Oai
in package
Implements controller for the OAI-PMH service: - checks OAI-PMH requests correctness, - handles OAI-PMH `identify` and `ListMetadataFormats` commands - delegates OAI-PMH `GetRecord`, `ListIdentifiers` and `ListRecords` commands to a chosen class implementing the `acdhOeaw\arche\oaipmh\search\SearchInterface` - delegates OAI-PMH `ListSets` command to a chosen class extending the `acdhOeaw\arche\oaipmh\set\SetInterface` class.
- generates OAI-PMH compliant output from results of above mentioned actions
- catches errors and generates OAI-PMH compliant error responses
Tags
Table of Contents
Properties
- $cache : Cache
- Cache object
- $config : object
- Configuration options
- $dateRegExp : string
- OAI-PMH date format regexp
- $deleted : DeletedInterface
- Object handling deleted resources information
- $info : RepositoryInfo
- Repository info object used to serve OAI-PMH `Identify` requests
- $log : Log
- $metadataFormats : array<string|int, MetadataFormat>
- List of metadata descriptors
- $pdo : PDO
- Repository database connection object
- $reqId : string
- $respBegin : string
- OAI-PMH response beginning template
- $respEnd : string
- OAI-PMH response ending template
- $response : DOMDocument
- XML object used to serialize OAI-PMH response parts
- $search : SearchInterface
- $sets : SetInterface
- Object handling sets
Methods
- __construct() : mixed
- Initialized the OAI-PMH server object.
- handleRequest() : void
- Handles OAI-PMH request.
- oaiIdentify() : void
- Implements the Identify OAI-PMH verb
- oaiListMetadataFormats() : void
- Implements the ListMetadataFormats OAI-PMH verb
- oaiListRecordRaw() : void
- Returns a single metadata record without any OAI structures
- oaiListRecords() : void
- Implements the ListIdentifiers, ListRecords and GetRecord OAI-PMH verbs
- oaiListSets() : void
- Implements the ListSets OAI-PMH verb.
- checkRequestParam() : void
- Validates request parameters.
- createElement() : DOMNode
- Returns a PHP reresentation of an XML node.
- createHeader() : DOMElement
- Creates a resource's <header> element as defined by OAI-PMH standard.
- getParam() : string|null
Properties
$cache
Cache object
private
Cache
$cache
$config
Configuration options
private
object
$config
$dateRegExp
OAI-PMH date format regexp
private
static string
$dateRegExp
= '|^[0-9]{4}-[0-1][0-9]-[0-3][0-9](T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]Z)?$|'
$deleted
Object handling deleted resources information
private
DeletedInterface
$deleted
$info
Repository info object used to serve OAI-PMH `Identify` requests
private
RepositoryInfo
$info
$log
private
Log
$log
$metadataFormats
List of metadata descriptors
private
array<string|int, MetadataFormat>
$metadataFormats
= []
$pdo
Repository database connection object
private
PDO
$pdo
$reqId
private
string
$reqId
$respBegin
OAI-PMH response beginning template
private
static string
$respBegin
= <<<TMPL
<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>%s</responseDate>
<request %s>%s</request>
TMPL
$respEnd
OAI-PMH response ending template
private
static string
$respEnd
= <<<TMPL
</OAI-PMH>
TMPL
$response
XML object used to serialize OAI-PMH response parts
private
DOMDocument
$response
$search
private
SearchInterface
$search
$sets
Object handling sets
private
SetInterface
$sets
Methods
__construct()
Initialized the OAI-PMH server object.
public
__construct(object $config) : mixed
Parameters
- $config : object
handleRequest()
Handles OAI-PMH request.
public
handleRequest() : void
oaiIdentify()
Implements the Identify OAI-PMH verb
public
oaiIdentify() : void
oaiListMetadataFormats()
Implements the ListMetadataFormats OAI-PMH verb
public
oaiListMetadataFormats() : void
Tags
oaiListRecordRaw()
Returns a single metadata record without any OAI structures
public
oaiListRecordRaw([string $id = '' ]) : void
Parameters
- $id : string = ''
oaiListRecords()
Implements the ListIdentifiers, ListRecords and GetRecord OAI-PMH verbs
public
oaiListRecords(string $verb[, string $id = '' ]) : void
Parameters
- $verb : string
- $id : string = ''
Tags
oaiListSets()
Implements the ListSets OAI-PMH verb.
public
oaiListSets() : void
Fetches set description using a chosen (config:oaiSetClass) class and formats its output as an OAI-PMH XML.
checkRequestParam()
Validates request parameters.
private
checkRequestParam(array<string|int, string> $allowed) : void
Parameters
- $allowed : array<string|int, string>
-
allowed parameter names list
Tags
createElement()
Returns a PHP reresentation of an XML node.
private
createElement(string $element[, string $value = '' ][, array<string, string> $attributes = [] ]) : DOMNode
Parameters
- $element : string
- $value : string = ''
- $attributes : array<string, string> = []
Return values
DOMNodecreateHeader()
Creates a resource's <header> element as defined by OAI-PMH standard.
private
createHeader(HeaderData $res) : DOMElement
Parameters
- $res : HeaderData
Return values
DOMElementgetParam()
private
getParam(string $name) : string|null
Parameters
- $name : string