OAI Class Reference
[Oai]

Class to process and respond to OAI requests. More...

Inheritance diagram for OAI:

JournalOAI

List of all members.

Public Member Functions

 checkParams ($required=array(), $optional=array())
 error ($code, $message)
 execute ()
 extractDateParams ($params, &$from, &$until)
formatMetadata ($format, $record)
 getParam ($name)
 getParams ()
 GetRecord ()
 identifierExists ($identifier)
identifiers ($metadataPrefix, $from, $until, $set, $offset, $limit, &$total)
 Identify ()
 ListIdentifiers ()
 ListMetadataFormats ()
 ListRecords ()
 ListSets ()
metadataFormats ($namesOnly=false, $identifier=null)
 OAI (&$config)
 paramExists ($name)
 parseStr ($string, &$array)
 prepInput (&$data)
 prepOutput (&$data)
record ($identifier)
records ($metadataPrefix, $from, $until, $set, $offset, $limit, &$total)
repositoryInfo ()
 response ($response, $printParams=true)
resumptionToken ($tokenId)
saveResumptionToken ($offset, $params)
 setParams (&$params)
sets ($offset, &$total)
 UTCDate ($timestamp=0, $includeTime=true)
 UTCtoTimestamp ($date, $checkGranularity=true)
 validIdentifier ($identifier)


Detailed Description

Class to process and respond to OAI requests.

See also:
OAIDAO

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


Member Function Documentation

OAI.checkParams ( required = array(),
optional = array() 
)

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

Parameters:
$required array required parameters for the current request
$optional array optional parameters for the current request
Returns:
boolean

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

References error(), getParam(), Request.isPathInfoEnabled(), and paramExists().

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

OAI.error ( code,
message 
)

Display OAI error response.

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

References response().

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

OAI.execute (  ) 

Execute the requested OAI protocol request and output the response.

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

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

OAI.extractDateParams ( params,
&$  from,
&$  until 
)

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

Parameters:
$params array request parameters
$from int from timestamp (output parameter)
$until int until timestamp (output parameter)
Returns:
boolean

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

References error(), and UTCtoTimestamp().

Referenced by ListIdentifiers(), and ListRecords().

& OAI.formatMetadata ( format,
record 
)

Returns formatted metadata response in specified format.

Parameters:
$format string
$metadata OAIMetadata
Returns:
string

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

References metadataFormats().

Referenced by GetRecord(), and ListRecords().

OAI.getParam ( name  ) 

Returns the value of the specified parameter.

Parameters:
$name string
Returns:
string

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

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

OAI.getParams (  ) 

Returns an associative array of all request parameters.

Returns:
array

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

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

OAI.GetRecord (  ) 

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

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

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

Referenced by execute().

OAI.identifierExists ( identifier  ) 

Check if identifier exists.

Parameters:
$identifier string
Returns:
boolean

Reimplemented in JournalOAI.

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

Referenced by ListMetadataFormats().

& 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 164 of file OAI.inc.php.

Referenced by ListIdentifiers().

OAI.Identify (  ) 

Handle OAI Identify request. Retrieves information about a repository.

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

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

Referenced by execute().

OAI.ListIdentifiers (  ) 

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

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

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

Referenced by execute().

OAI.ListMetadataFormats (  ) 

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

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

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

Referenced by execute().

OAI.ListRecords (  ) 

Handle OAI ListRecords request. Retrieves records from the repository.

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

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

Referenced by execute().

OAI.ListSets (  ) 

Handle OAI ListSets request. Retrieves sets from a repository.

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

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

Referenced by execute().

& OAI.metadataFormats ( namesOnly = false,
identifier = null 
)

Return array of supported metadata formats.

Parameters:
$namesOnly boolean return array of format prefix names only
$identifier string return formats for specific identifier
Returns:
array

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

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

OAI.OAI ( &$  config  ) 

Constructor. Initializes object and parses user input.

Parameters:
$config OAIConfig repository configuration

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

References parseStr(), and prepInput().

OAI.paramExists ( name  ) 

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

Parameters:
$name string
Returns:
boolean

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

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

OAI.parseStr ( string,
&$  array 
)

Parses string $string into an associate array $array. Acts like parse_str($string, $array) except duplicate variable names in $string are converted to an array.

Parameters:
$duplicate string input data string
$array array of parsed parameters

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

Referenced by OAI().

OAI.prepInput ( &$  data  ) 

Clean input variables.

Parameters:
$data mixed request parameter(s)
Returns:
mixed cleaned request parameter(s)

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

Referenced by OAI().

OAI.prepOutput ( &$  data  ) 

Prepare variables for output. Data is assumed to be UTF-8 encoded (FIXME?)

Parameters:
$data mixed output parameter(s)
Returns:
mixed cleaned output parameter(s)

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

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

& OAI.record ( identifier  ) 

Return OAI record for specified identifier.

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

Reimplemented in JournalOAI.

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

Referenced by GetRecord().

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

Return set of OAI records.

Parameters:
$metadataPrefix string specified metadata prefix
$from int minimum timestamp
$until int maximum timestamp
$set string specified set
$offset int current record offset
$limit int maximum number of records to return
$total int output parameter, set to total number of records
Returns:
array OAIRecord

Reimplemented in JournalOAI.

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

Referenced by ListRecords().

& OAI.repositoryInfo (  ) 

Return information about the repository.

Returns:
OAIRepository

Reimplemented in JournalOAI.

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

Referenced by Identify().

OAI.response ( response,
printParams = true 
)

Output OAI response.

Parameters:
$response string text of response message.
$printParams boolean display request parameters

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

References prepOutput(), and UTCDate().

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

& OAI.resumptionToken ( tokenId  ) 

Retrieve a resumption token.

Parameters:
$tokenId string
Returns:
OAIResumptionToken (or false, if token invalid)

Reimplemented in JournalOAI.

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

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

& OAI.saveResumptionToken ( offset,
params 
)

Save a resumption token.

Parameters:
$offset int current offset
$params array request parameters
Returns:
OAIResumptionToken the saved token

Reimplemented in JournalOAI.

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

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

OAI.setParams ( &$  params  ) 

Set the request parameters.

Parameters:
$params array

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

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

& OAI.sets ( offset,
&$  total 
)

Return set of OAI sets.

Parameters:
$offset int current set offset
$total int output parameter, set to total number of sets

Reimplemented in JournalOAI.

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

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

OAI.UTCDate ( timestamp = 0,
includeTime = true 
)

Return a UTC-formatted datestamp from the specified UNIX timestamp.

Parameters:
$timestamp int *nix timestamp (if not used, the current time is used)
$includeTime boolean include both the time and date
Returns:
string UTC datestamp

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

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

OAI.UTCtoTimestamp ( date,
checkGranularity = true 
)

Returns a UNIX timestamp from a UTC-formatted datestamp. Returns the string "invalid" if datestamp is invalid, or "invalid_granularity" if unsupported granularity.

Parameters:
$date string UTC datestamp
$checkGranularity boolean verify that granularity is correct
Returns:
int timestamp

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

Referenced by extractDateParams().

OAI.validIdentifier ( identifier  ) 

Check if identifier is in the valid format.

Parameters:
$identifier string
Returns:
boolean

Reimplemented in JournalOAI.

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

Referenced by GetRecord().


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

Generated on Mon Jul 14 10:55:44 2008 for Open Journal Systems by  doxygen 1.5.6