Backend
extends AbstractBackend
in package
Uses
SecretTrait
EDS API Backend
Tags
Table of Contents
- $authManager : Manager
- VuFind Authentication manager
- $backendType : string
- Backend type
- $cache : StorageInterface
- Object cache (for storing authentication tokens)
- $client : Connector
- Client user to make the actually requests to the EdsApi
- $collectionFactory : RecordCollectionFactoryInterface
- Record collection factory.
- $defaultProfile : string
- Default profile for EBSCO EDS API account (taken from initial config and never changed)
- $identifier : string
- Backend identifier.
- $ipAuth : bool
- Whether or not to use IP Authentication for communication with the EDS API
- $isGuest : bool
- Is the current user a guest?
- $orgId : string
- Organization EDS API requests are being made for
- $password : string
- Password for EBSCO EDS API account if using UID Authentication
- $profile : string
- Profile for EBSCO EDS API account (may be overridden)
- $queryBuilder : QueryBuilder
- Query builder
- $session : Container
- Session container
- $userName : string
- User name for EBSCO EDS API account if using UID Authentication
- __construct() : mixed
- Constructor.
- autocomplete() : array<string|int, mixed>
- Get popular terms using the autocomplete API.
- createSession() : string
- Obtain the session to use with the EDS API from cache if it exists. If not, then generate a new one.
- getIdentifier() : string
- Return backend identifier.
- getInfo() : array<string|int, mixed>
- Obtain data from the INFO method
- getQueryBuilder() : QueryBuilder
- Return query builder.
- getRecordCollectionFactory() : RecordCollectionFactoryInterface
- Return the record collection factory.
- getSessionToken() : string
- Obtain the session token from the Session container. If it doesn't exist, generate a new one.
- retrieve() : RecordCollectionInterface
- Retrieve a single document.
- search() : RecordCollectionInterface
- Perform a search and return record collection.
- setAuthManager() : void
- Set the VuFind Authentication Manager
- setBackendType() : void
- Set the EBSCO backend type. Backend/EDS is used for both EDS and EPF.
- setIdentifier() : void
- Set the backend identifier.
- setQueryBuilder() : void
- Set the query builder.
- setRecordCollectionFactory() : void
- Set the record collection factory.
- createEBSCOSession() : string
- Generate a new session token and store it in the Session container.
- createRecordCollection() : RecordCollectionInterface
- Create record collection.
- debug() : void
- Log a debug message.
- getAuthenticationToken() : string
- Obtain the authentication to use with the EDS API from cache if it exists. If not, then generate a new one.
- getAutocompleteData() : array<string|int, mixed>
- Obtain the autocomplete authentication to use with the EDS API from cache if it exists. If not, then generate a new set.
- getSecretFromConfig() : string|null
- Load a secret value from the specified configuration and key.
- injectSourceIdentifier() : RecordCollectionInterface
- Inject source identifier in record collection and all contained records.
- isGuest() : string
- Is the current user a guest? If so, return 'y' else 'n'.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
- paramBagToEBSCOSearchModel() : SearchRequestModel
- Convert a ParamBag to a EdsApi Search request object.
Properties
$authManager
VuFind Authentication manager
protected
Manager
$authManager
= null
$backendType
Backend type
protected
string
$backendType
= null
$cache
Object cache (for storing authentication tokens)
protected
StorageInterface
$cache
$client
Client user to make the actually requests to the EdsApi
protected
Connector
$client
$collectionFactory
Record collection factory.
protected
RecordCollectionFactoryInterface
$collectionFactory
= null
$defaultProfile
Default profile for EBSCO EDS API account (taken from initial config and never changed)
protected
string
$defaultProfile
$identifier
Backend identifier.
protected
string
$identifier
= null
$ipAuth
Whether or not to use IP Authentication for communication with the EDS API
protected
bool
$ipAuth
$isGuest
Is the current user a guest?
protected
bool
$isGuest
$orgId
Organization EDS API requests are being made for
protected
string
$orgId
$password
Password for EBSCO EDS API account if using UID Authentication
protected
string
$password
$profile
Profile for EBSCO EDS API account (may be overridden)
protected
string
$profile
$queryBuilder
Query builder
protected
QueryBuilder
$queryBuilder
$session
Session container
protected
Container
$session
$userName
User name for EBSCO EDS API account if using UID Authentication
protected
string
$userName
Methods
__construct()
Constructor.
public
__construct(Connector $client, RecordCollectionFactoryInterface $factory, StorageInterface $cache, Container $session[, Config $config = null ][, bool $isGuest = true ]) : mixed
Parameters
- $client : Connector
-
EdsApi client to use
- $factory : RecordCollectionFactoryInterface
-
Record collection factory
- $cache : StorageInterface
-
Object cache
- $session : Container
-
Session container
- $config : Config = null
-
Object representing EDS.ini
- $isGuest : bool = true
-
Is the current user a guest?
Return values
mixed —autocomplete()
Get popular terms using the autocomplete API.
public
autocomplete(string $query[, string $domain = 'rawqueries' ]) : array<string|int, mixed>
Parameters
- $query : string
-
Simple query string
- $domain : string = 'rawqueries'
-
Autocomplete type (e.g. 'rawqueries' or 'holdings')
Return values
array<string|int, mixed> —of terms
createSession()
Obtain the session to use with the EDS API from cache if it exists. If not, then generate a new one.
public
createSession(bool $isGuest[, string $profile = '' ]) : string
Parameters
- $isGuest : bool
-
Whether or not this session will be a guest session
- $profile : string = ''
-
Authentication to use for generating a new session if necessary
Return values
string —getIdentifier()
Return backend identifier.
public
getIdentifier() : string
Return values
string —getInfo()
Obtain data from the INFO method
public
getInfo([string $sessionToken = null ]) : array<string|int, mixed>
Parameters
- $sessionToken : string = null
-
Session token (optional)
Return values
array<string|int, mixed> —getQueryBuilder()
Return query builder.
public
getQueryBuilder() : QueryBuilder
Lazy loads an empty QueryBuilder if none was set.
Return values
QueryBuilder —getRecordCollectionFactory()
Return the record collection factory.
public
getRecordCollectionFactory() : RecordCollectionFactoryInterface
Lazy loads a generic collection factory.
Return values
RecordCollectionFactoryInterface —getSessionToken()
Obtain the session token from the Session container. If it doesn't exist, generate a new one.
public
getSessionToken([bool $isInvalid = false ]) : string
Parameters
- $isInvalid : bool = false
-
If a session token is invalid, generate a new one regardless of what is in the session container
Return values
string —retrieve()
Retrieve a single document.
public
retrieve(string $id[, ParamBag $params = null ]) : RecordCollectionInterface
Parameters
- $id : string
-
Document identifier
- $params : ParamBag = null
-
Search backend parameters
Return values
RecordCollectionInterface —search()
Perform a search and return record collection.
public
search(AbstractQuery $query, int $offset, int $limit[, ParamBag $params = null ]) : RecordCollectionInterface
Parameters
- $query : AbstractQuery
-
Search query
- $offset : int
-
Search offset
- $limit : int
-
Search limit
- $params : ParamBag = null
-
Search backend parameters
Return values
RecordCollectionInterface —setAuthManager()
Set the VuFind Authentication Manager
public
setAuthManager(Manager $authManager) : void
Parameters
- $authManager : Manager
-
Authentication Manager
Return values
void —setBackendType()
Set the EBSCO backend type. Backend/EDS is used for both EDS and EPF.
public
setBackendType(string $backendType) : void
Parameters
- $backendType : string
-
'EDS' or 'EPF'
Return values
void —setIdentifier()
Set the backend identifier.
public
setIdentifier(string $identifier) : void
Parameters
- $identifier : string
-
Backend identifier
Return values
void —setQueryBuilder()
Set the query builder.
public
setQueryBuilder(QueryBuilder $queryBuilder) : void
Parameters
- $queryBuilder : QueryBuilder
-
Query builder
Return values
void —setRecordCollectionFactory()
Set the record collection factory.
public
setRecordCollectionFactory(RecordCollectionFactoryInterface $factory) : void
Parameters
- $factory : RecordCollectionFactoryInterface
-
Factory
Return values
void —createEBSCOSession()
Generate a new session token and store it in the Session container.
protected
createEBSCOSession() : string
Return values
string —createRecordCollection()
Create record collection.
protected
createRecordCollection(array<string|int, mixed> $records) : RecordCollectionInterface
Parameters
- $records : array<string|int, mixed>
-
Records to process
Return values
RecordCollectionInterface —debug()
Log a debug message.
protected
debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —getAuthenticationToken()
Obtain the authentication to use with the EDS API from cache if it exists. If not, then generate a new one.
protected
getAuthenticationToken([bool $isInvalid = false ]) : string
Parameters
- $isInvalid : bool = false
-
whether or not the the current token is invalid
Return values
string —getAutocompleteData()
Obtain the autocomplete authentication to use with the EDS API from cache if it exists. If not, then generate a new set.
protected
getAutocompleteData([bool $isInvalid = false ]) : array<string|int, mixed>
Parameters
- $isInvalid : bool = false
-
whether or not the the current autocomplete data is invalid and should be regenerated
Return values
array<string|int, mixed> —autocomplete data
getSecretFromConfig()
Load a secret value from the specified configuration and key.
protected
getSecretFromConfig(Config|array<string|int, mixed>|null $config, string $key) : string|null
Will look for a _file-suffixed version of the key first, and load the data from a separate file if configured to do so.
Parameters
- $config : Config|array<string|int, mixed>|null
-
The config to read from
- $key : string
-
The key to retrieve
Return values
string|null —injectSourceIdentifier()
Inject source identifier in record collection and all contained records.
protected
injectSourceIdentifier(RecordCollectionInterface $response) : RecordCollectionInterface
Parameters
- $response : RecordCollectionInterface
-
Response
Return values
RecordCollectionInterface —isGuest()
Is the current user a guest? If so, return 'y' else 'n'.
protected
isGuest() : string
Return values
string —log()
Send a message to the logger.
protected
log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
- $level : string
-
Log level
- $message : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = false
-
Prepend class name to message?
Return values
void —logError()
Log an error message.
protected
logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —logWarning()
Log a warning message.
protected
logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —paramBagToEBSCOSearchModel()
Convert a ParamBag to a EdsApi Search request object.
protected
paramBagToEBSCOSearchModel(ParamBag $params) : SearchRequestModel
Parameters
- $params : ParamBag
-
ParamBag to convert