This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
islandora_oai.api.php
149 lines (145 loc) · 6.78 KB
/
islandora_oai.api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
/**
* @file
* Hooks provided by Islandora OAI.
*/
/**
* Get module supplied XSL files for transforming content to output for OAI.
*
* @return array
* Returns an associative array where the key is the URI to the file on the
* file system and the value is the name of the file.
*/
function hook_islandora_oai_get_xsl_files() {
}
/**
* Identify the availability of a custom request handler for OAI requests.
*
* @return array
* An associative array containing:
* -label: A string describing the handler.
* -description: A string describing the request handler.
* -configuration (optional): A relative menu path to custom configuration for
* the handler.
* -requests: An array containing modifiable requests and function to call.
* Each of the requests is considered optional and will always default back
* to the generic implementation if not implemented in a custom handler.
* Each request takes a parameters array as defined below. Available requests
* to override:
* -ListIdentifiers: The ListIdentifiers OAI request, params array contains:
* -set: String of the PID of the set being searched for, FALSE if no set
* argument.
* -from: String of the from time starting point, FALSE if no argument.
* -until: String of the until ending point, FALSE if no until argument.
* -token: Object representing a token.
* Expected to return an array of arrays containing:
* -total_records: An integer with the number of total results for the
* request.
* -records: An array of arrays containing at least:
* -pid: A string representing the PID of the result.
* -date: A string date timestamp used to identify the lastModified date
* of the record.
* More fields may be present to be used by custom handlers defined below
* but the former two fields are required for every implementation.
* -ListRecords: The ListRecords OAI request, params array contains:
* -set: String of the PID of the set being searched for, FALSE if no set
* argument.
* -from: String of the from time starting point, FALSE if no argument.
* -until: String of the until ending point, FALSE if no until argument.
* -token: Object representing a token.
* Expected to return an array of arrays containing at least:
* -total_records: An integer with the number of total results for the
* request.
* -records: An array of arrays containing at least:
* -pid: A string representing the PID of the result.
* -date: A string date timestamp used to identify the lastModified date
* of the record.
* -ListSets: The ListSets OAI request, params array contains:
* -token: A resumption token object specifying information about a
* previous request, or a new empty one.
* -max_records: An integer of the maximum number of records to return per
* request.
* Expected to return an array containing:
* -total_records: An integer with the number of total results for the
* request.
* -records: An array of arrays containing:
* -pid: A string representing the PID of the set.
* -label: A string containing the label of the set.
* -description (optional): An XML string detailing the set.
* -GetRecord: The GetRecord OAI request, params array contains:
* -pid: A string representing the PID of the record being requested.
* Expected to return FALSE if the record does not exist, otherwise an array
* containing at least:
* -pid: A string representing the PID of the result.
* -date: A string date timestamp used to identify the lastModified date
* of the record.
* More fields may be present to be used by custom handlers defined below
* but the former two fields are required for every implementation.
* -response_xml: Used to construct the individual XML response for a record,
* params array contains:
* -metadata_prefix: String describing the metadata prefix of the request
* being executed.
* -pid: A string representing the PID of the record being requested.
* Expected to return a string containing the XML to be rendered, or NULL
* if an error is encountered.
* -set_membership: Used to construct the setSpec portion of record
* responses, params array contains:
* -pid: A string representing the PID of the result.
* -date: A string date timestamp used to identify the lastModified date
* of the record.
* More fields may be present to be used by custom handlers defined above
* but the former two fields are required for every implementation.
* Expected to return an array containing a list of PIDs of the sets that
* the record belongs to.
*/
function hook_islandora_oai_identify_request_handler() {
return array(
'my_cool_oai_handler' => array(
'label' => t('My Cool OAI Handler'),
'description' => t('Provides a standard OAI implementation for Islandora.'),
'configuration' => 'admin/islandora/tools/my-cool-oai/handler',
'requests' => array(
'ListIdentifiers' => array(
'file' => drupal_get_path('module', 'my_cool_oai_handler') . '/includes/handler.inc',
'function' => 'my_cool_oai_handler_retrieve_records_or_identifiers',
),
'ListRecords' => array(
'file' => drupal_get_path('module', 'my_cool_oai_handler') . '/includes/handler.inc',
'function' => 'my_cool_oai_handler_retrieve_records_or_identifiers',
),
'ListSets' => array(
'file' => drupal_get_path('module', 'my_cool_oai_handler') . '/includes/handler.inc',
'function' => 'my_cool_oai_handler_retrieve_sets',
),
'GetRecord' => array(
'file' => drupal_get_path('module', 'my_cool_oai_handler') . '/includes/handler.inc',
'function' => 'my_cool_oai_handler_retrieve_record',
),
'response_xml' => array(
'file' => drupal_get_path('module', 'my_cool_oai_handler') . '/includes/handler.inc',
'function' => 'my_cool_oai_handler_object_response_xml',
),
'set_membership' => array(
'file' => drupal_get_path('module', 'my_cool_oai_handler') . '/includes/handler.inc',
'function' => 'my_cool_oai_handler_get_membership',
),
),
),
);
}
/**
* Get module supplied XSLT params for self transform.
*
* * @param AbstractObject $object
* The object being called for the OAI request
*
* @param string $metadata_prefix
* The handler metadata prefix for the request.
*
* @return array
* Returns an associative array of arrays. The key of each array is the
* namespace for the parameters, where the array contains the params to be
* passed to the XSLT transform.
*/
function hook_islandora_oai_self_transform_params($object, $metadata_prefix) {
}