Excerpt |
---|
This guide |
...
will help you setup the OAI-PMH provider for Fedora 4 |
...
on Tomcat 7 |
...
. For further details, please refer to the project's documentation on GitHub. |
Setting up Tomcat7
Install Tomcat. On . Use the appropriate package manager (e.g. yum, portage) to install Tomcat (on Xubuntu, for example, setting up Tomcat is accomplished by a simple command: "
Code Block |
---|
sudo apt-get install tomcat7 |
Alternatively, tomcat7". On other systems, use the appropriate package manager (e.g. yum, portage) to install Tomcat (or visit the Apache Tomcat project documentation for more installation options). After installing and deploying Tomcat. Once Tomcat is installed and running, you should be able to see the Tomcat welcome screen when you visit http://localhost:8080.
Setting up Fedora Repository
Use either the pre-packaged WAR file (.war) from webapp-plus project or build Fedora from source to get a WAR file. Copy the WAR to the Tomcat root directory <CATALINA_HOME>/webapps. Start/restart Tomcat, and http://localhost:8080/<fcrepo>/rest should display the Fedora repository front page.(
Info |
---|
<fcrepo> is the name of the .war file minus the .war extension and the exact file name can vary on build/release number. |
...
Install the fcrepo-oaiprovider library dependencies
...
Obtain and build the fcrepo-oaiprovider source code:
Code Block language text git clone https://github.com/fcrepo4-labs/fcrepo4-oaiprovider.git cd fcrepo4-oaiprovider mvn package
Move the generated JAR to Tomcat's lib folder:
Code Block language text cp target/fcrepo4-oaiprovider-4.0.0-beta-0405-SNAPSHOT.jar <CATALINA_HOME>/webapps/<fcrepo>/WEB-INF/lib
Copy the oai.xml file to the fcrepo config directory:
Code Block cp fcrepo4-oaiprovider/src/main/resources/spring/oai.xml /<CATALINA_HOME>/webapps/<fcrepo>/WEB-INF/classes/spring/
Add the import to fcrepo's Edit the fcrepo master.xml file :
- Editin <CATALINA_HOME>/webapps/<fcrepo>/WEB-INF/
classesclass/spring/master.xml
- Add '<importto paste the following <import> declaration after other <import> declarations:
' after the other <import> declarationsCode Block language text <import resource="classpath:/spring/oai.xml"/>
You may have to add the following namespace element to
Make sure the OAI namespace is defined as a Compact Node Definition Type. Add: <oai = 'http://www.openarchives.org/OAI/2.0/'> tofcrepo-kernel-impl/src/main/resources/fedora-node-types.cnd in the
main core and rebuild the project, but you may have to find another way to add it. See Herefcrepo4 project and rebuild it, or reference your .cnd file in repository.json, if necessary.
Code Block language text <oai = 'http://www.openarchives.org/OAI/2.0/'>
- Restart Tomcat. Go to http://localhost:8080/<fcrepo>/rest/oai?verb=Identify. If everything is in order, you should see an XML file outlining the default configuration for the OAI-PMH provider.
Common errors are either the OAI-PMH provider generating either 4xx HTTP error codes or producing the default values (see mentioned below). The 4xx HTTP Error codes are a manifestation that the namespace having not been defined status codes indicate an undefined namespace (Step 5 above), so make sure the OAI compact node definition has been added correctly to the fedora-node-types. cnd file. If default values appear instead of the properties you definedpopulated, this means the properties are not available or defined incorrectly.
Configuring the OAI-PMH provider
The OAI - Provider relies on four properties being present in the main repository for the IDENTIFY verb. The properties and the corresponding default values are:
Property | Default |
---|---|
oai:repositoryName | "Fedora 4" |
oai:description | "An example repository description" |
oai:version | <build version> |
oai: |
...
adminAddress | "admin@example.com" |
These properties have to populated manually for now (with the exception of oai:version, which is populated automatically to reflect the build version), using the following SPARQL/Update queries of the pattern:
INSERT {<> oai:repositoryName "exciting repository name here"}
...
INSERT {<> oai:adminEmail "your.email@here.org"}
If one or more of the properties are missing, the OAI provider uses the built-in values:
Property | Default |
---|---|
oai:repositoryName | "Fedora 4" |
oai:description | "An example repository description" |
oai:version | <build version> |
oai:adminAddress | "admin@example.com" |
...
As an example:
Code Block | ||
---|---|---|
| ||
echo "insert data {<> oai:repositoryName coolrepo } " | curl -X PATCH --upload-file - http://localhost:8080/fcrepo/rest |