Open Journal Systems  3.3.0
OAI Class Reference
Inheritance diagram for OAI:
JournalOAI

Public Member Functions

 __construct ($config)
 
 checkParams ($required=array(), $optional=array())
 
 error ($code, $message)
 
 execute ()
 
 extractDateParams ($params, &$from, &$until)
 
 formatMetadata ($format, $record)
 
 getNonPathInfoParams ()
 
 getParam ($name)
 
 getParams ()
 
 GetRecord ()
 
 identifierExists ($identifier)
 
 identifiers ($metadataPrefix, $from, $until, $set, $offset, $limit, &$total)
 
 Identify ()
 
 ListIdentifiers ()
 
 ListMetadataFormats ()
 
 ListRecords ()
 
 ListSets ()
 
 metadataFormats ($namesOnly=false, $identifier=null)
 
 paramExists ($name)
 
 record ($identifier)
 
 records ($metadataPrefix, $from, $until, $set, $offset, $limit, &$total)
 
 repositoryInfo ()
 
 response ($response, $printParams=true)
 
 resumptionToken ($tokenId)
 
 saveResumptionToken ($offset, $params)
 
 setParams ($params)
 
 sets ($offset, $limit, &$total)
 
 validIdentifier ($identifier)
 

Data Fields

 $config
 
 $params
 
 $protocolVersion = '2.0'
 

Detailed Description

Class to process and respond to OAI requests.

Utility functions used by OAI related classes.

See also
OAIDAO

Definition at line 27 of file OAI.inc.php.

Constructor & Destructor Documentation

◆ __construct()

OAI::__construct (   $config)

Constructor. Initializes object and parses user input.

Parameters
$configOAIConfig repository configuration

Reimplemented in JournalOAI.

Definition at line 52 of file OAI.inc.php.

References $config, $GLOBALS, OAIUtils\parseStr(), and OAIUtils\prepInput().

Member Function Documentation

◆ checkParams()

OAI::checkParams (   $required = array(),
  $optional = array() 
)

Check request parameters. Outputs error response if an invalid parameter is found.

Parameters
$requiredarray required parameters for the current request
$optionalarray optional parameters for the current request
Returns
boolean

Definition at line 749 of file OAI.inc.php.

References error(), PKPApplication\get(), getNonPathInfoParams(), getParam(), and paramExists().

Referenced by GetRecord(), Identify(), ListIdentifiers(), ListMetadataFormats(), ListRecords(), and ListSets().

◆ error()

OAI::error (   $code,
  $message 
)

Display OAI error response.

Definition at line 659 of file OAI.inc.php.

References response().

Referenced by checkParams(), execute(), extractDateParams(), GetRecord(), ListIdentifiers(), ListMetadataFormats(), ListRecords(), and ListSets().

◆ execute()

OAI::execute ( )

Execute the requested OAI protocol request and output the response.

Definition at line 79 of file OAI.inc.php.

References error(), getParam(), GetRecord(), Identify(), ListIdentifiers(), ListMetadataFormats(), ListRecords(), and ListSets().

◆ extractDateParams()

OAI::extractDateParams (   $params,
$from,
$until 
)

Checks if from and until parameters have been passed. If passed, validate and convert to UNIX timestamps.

Parameters
$paramsarray request parameters
$fromint from timestamp (output parameter)
$untilint until timestamp (output parameter)
Returns
boolean

Definition at line 809 of file OAI.inc.php.

References $params, error(), and OAIUtils\UTCtoTimestamp().

Referenced by ListIdentifiers(), and ListRecords().

◆ formatMetadata()

OAI::formatMetadata (   $format,
  $record 
)

Returns formatted metadata response in specified format.

Parameters
$formatstring
$metadataOAIMetadata
Returns
string

Definition at line 795 of file OAI.inc.php.

References metadataFormats().

Referenced by GetRecord(), and ListRecords().

◆ getNonPathInfoParams()

OAI::getNonPathInfoParams ( )

Return a list of ignorable GET parameters.

Returns
array

Reimplemented in JournalOAI.

Definition at line 738 of file OAI.inc.php.

Referenced by checkParams().

◆ getParam()

OAI::getParam (   $name)

Returns the value of the specified parameter.

Parameters
$namestring
Returns
string

Definition at line 705 of file OAI.inc.php.

Referenced by checkParams(), execute(), GetRecord(), ListIdentifiers(), ListMetadataFormats(), ListRecords(), and ListSets().

◆ getParams()

OAI::getParams ( )

Returns an associative array of all request parameters.

Returns
array

Definition at line 713 of file OAI.inc.php.

References $params.

Referenced by ListIdentifiers(), ListRecords(), and ListSets().

◆ GetRecord()

OAI::GetRecord ( )

Handle OAI GetRecord request. Retrieves an individual record from the repository.

Definition at line 212 of file OAI.inc.php.

References checkParams(), error(), formatMetadata(), getParam(), metadataFormats(), record(), response(), and validIdentifier().

Referenced by execute().

◆ identifierExists()

OAI::identifierExists (   $identifier)

Check if identifier exists.

Parameters
$identifierstring
Returns
boolean

Reimplemented in JournalOAI.

Definition at line 131 of file OAI.inc.php.

Referenced by ListMetadataFormats().

◆ identifiers()

OAI::identifiers (   $metadataPrefix,
  $from,
  $until,
  $set,
  $offset,
  $limit,
$total 
)

Return set of OAI identifiers.

See also
getRecords
Returns
array OAIIdentifier

Reimplemented in JournalOAI.

Definition at line 162 of file OAI.inc.php.

Referenced by ListIdentifiers().

◆ Identify()

OAI::Identify ( )

Handle OAI Identify request. Retrieves information about a repository.

Definition at line 267 of file OAI.inc.php.

References checkParams(), OAIUtils\prepOutput(), repositoryInfo(), response(), and OAIUtils\UTCDate().

Referenced by execute().

◆ ListIdentifiers()

OAI::ListIdentifiers ( )

Handle OAI ListIdentifiers request. Retrieves headers of records from the repository.

Definition at line 324 of file OAI.inc.php.

References checkParams(), error(), extractDateParams(), getParam(), getParams(), identifiers(), metadataFormats(), paramExists(), OAIUtils\prepOutput(), response(), resumptionToken(), saveResumptionToken(), setParams(), and OAIUtils\UTCDate().

Referenced by execute().

◆ ListMetadataFormats()

OAI::ListMetadataFormats ( )

Handle OAI ListMetadataFormats request. Retrieves metadata formats supported by the repository.

Definition at line 419 of file OAI.inc.php.

References checkParams(), error(), getParam(), identifierExists(), metadataFormats(), paramExists(), and response().

Referenced by execute().

◆ ListRecords()

OAI::ListRecords ( )

Handle OAI ListRecords request. Retrieves records from the repository.

Definition at line 465 of file OAI.inc.php.

References checkParams(), error(), extractDateParams(), formatMetadata(), getParam(), getParams(), metadataFormats(), paramExists(), OAIUtils\prepOutput(), records(), response(), resumptionToken(), saveResumptionToken(), setParams(), and OAIUtils\UTCDate().

Referenced by execute().

◆ ListSets()

OAI::ListSets ( )

Handle OAI ListSets request. Retrieves sets from a repository.

Definition at line 569 of file OAI.inc.php.

References checkParams(), error(), getParam(), getParams(), paramExists(), OAIUtils\prepOutput(), response(), resumptionToken(), saveResumptionToken(), setParams(), sets(), and OAIUtils\UTCDate().

Referenced by execute().

◆ metadataFormats()

OAI::metadataFormats (   $namesOnly = false,
  $identifier = null 
)

Return array of supported metadata formats.

Parameters
$namesOnlyboolean return array of format prefix names only
$identifierstring return formats for specific identifier
Returns
array

Definition at line 197 of file OAI.inc.php.

References HookRegistry\call().

Referenced by formatMetadata(), GetRecord(), ListIdentifiers(), ListMetadataFormats(), and ListRecords().

◆ paramExists()

OAI::paramExists (   $name)

Returns true if the requested parameter is set, false if it is not set.

Parameters
$namestring
Returns
boolean

Definition at line 730 of file OAI.inc.php.

Referenced by checkParams(), ListIdentifiers(), ListMetadataFormats(), ListRecords(), and ListSets().

◆ record()

OAI::record (   $identifier)
abstract

Return OAI record for specified identifier.

Parameters
$identifierstring
Returns
OAIRecord (or false, if identifier is invalid)

Reimplemented in JournalOAI.

Referenced by GetRecord().

◆ records()

OAI::records (   $metadataPrefix,
  $from,
  $until,
  $set,
  $offset,
  $limit,
$total 
)

Return set of OAI records.

Parameters
$metadataPrefixstring specified metadata prefix
$fromint minimum timestamp
$untilint maximum timestamp
$setstring specified set
$offsetint current record offset
$limitint maximum number of records to return
$totalint output parameter, set to total number of records
Returns
array OAIRecord

Reimplemented in JournalOAI.

Definition at line 153 of file OAI.inc.php.

Referenced by ListRecords().

◆ repositoryInfo()

OAI::repositoryInfo ( )
abstract

Return information about the repository.

Returns
OAIRepository

Reimplemented in JournalOAI.

Referenced by Identify().

◆ response()

OAI::response (   $response,
  $printParams = true 
)

Output OAI response.

Parameters
$responsestring text of response message.
$printParamsboolean display request parameters

Definition at line 675 of file OAI.inc.php.

References PKPApplication\get(), OAIUtils\prepOutput(), and OAIUtils\UTCDate().

Referenced by error(), GetRecord(), Identify(), ListIdentifiers(), ListMetadataFormats(), ListRecords(), and ListSets().

◆ resumptionToken()

OAI::resumptionToken (   $tokenId)
abstract

Retrieve a resumption token.

Parameters
$tokenIdstring
Returns
OAIResumptionToken|false

Reimplemented in JournalOAI.

Referenced by ListIdentifiers(), ListRecords(), and ListSets().

◆ saveResumptionToken()

OAI::saveResumptionToken (   $offset,
  $params 
)
abstract

Save a resumption token.

Parameters
$offsetint current offset
$paramsarray request parameters
Returns
OAIResumptionToken the saved token

Reimplemented in JournalOAI.

Referenced by ListIdentifiers(), ListRecords(), and ListSets().

◆ setParams()

OAI::setParams (   $params)

Set the request parameters.

Parameters
$paramsarray

Definition at line 721 of file OAI.inc.php.

References $params.

Referenced by ListIdentifiers(), ListRecords(), and ListSets().

◆ sets()

OAI::sets (   $offset,
  $limit,
$total 
)

Return set of OAI sets.

Parameters
$offsetint current set offset
$limitint Maximum number of sets to return
$totalint output parameter, set to total number of sets

Reimplemented in JournalOAI.

Definition at line 172 of file OAI.inc.php.

Referenced by ListSets(), and OAIDAO\setOAIData().

◆ validIdentifier()

OAI::validIdentifier (   $identifier)

Check if identifier is in the valid format.

Parameters
$identifierstring
Returns
boolean

Reimplemented in JournalOAI.

Definition at line 122 of file OAI.inc.php.

Referenced by GetRecord().

Field Documentation

◆ $config

OAIConfig OAI::$config

configuration parameters

Definition at line 32 of file OAI.inc.php.

Referenced by JournalOAI\__construct(), and __construct().

◆ $params

array OAI::$params

list of request parameters

Definition at line 38 of file OAI.inc.php.

Referenced by extractDateParams(), getParams(), JournalOAI\saveResumptionToken(), and setParams().

◆ $protocolVersion

string OAI::$protocolVersion = '2.0'

version of the OAI protocol supported by this class

Definition at line 44 of file OAI.inc.php.


The documentation for this class was generated from the following file: