Old Release

This documentation covers an old version of Fedora. Looking for another version? See all documentation.

Support for the oai-provider module has fallen out of support since the release of Fedora 4.4.0.
If you are interested in using and helping maintain this module, we would be delighted to hear from you on the fedora-tech@googlegroups.com mailing list!

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. 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:

sudo apt-get install tomcat7

Alternatively, visit the Apache Tomcat project documentation for more installation options. Once Tomcat is installed and running, you should see the Tomcat welcome screen when you visit http://localhost:8080.

Setting up Fedora Repository

Use either the pre-packaged WAR file 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.

<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

The OAI-PMH provider in fcrepo4-oaiprovider relies on JAXB, so download the following JAR files from:

 http://central.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar
 http://central.maven.org/maven2/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar

and move them to <CATALINA_HOME>/webapps/<fcrepo>/WEB-INF/lib

Building fcrepo-oaiprovider

  1.  Obtain and build the fcrepo-oaiprovider source code:

        git clone https://github.com/fcrepo4-labs/fcrepo4-oaiprovider.git
        cd fcrepo4-oaiprovider
        mvn package
  2.  Move the generated JAR to Tomcat's lib folder:

        cp target/fcrepo4-oaiprovider-4.0.0-beta-05-SNAPSHOT.jar <CATALINA_HOME>/webapps/<fcrepo>/WEB-INF/lib
  3.  Copy the oai.xml file to the fcrepo config directory:

        cp fcrepo4-oaiprovider/src/main/resources/spring/oai.xml /<CATALINA_HOME>/webapps/<fcrepo>/WEB-INF/classes/spring/
  4. Edit the fcrepo master.xml file in <CATALINA_HOME>/webapps/<fcrepo>/WEB-INF/class/spring/master.xml to paste the following <import> declaration after other <import> declarations:

    <import resource="classpath:/spring/oai.xml"/>
  5. You may have to add the following namespace element to fcrepo-kernel-impl/src/main/resources/fedora-node-types.cnd in the fcrepo4 project and rebuild it, or reference your .cnd file in repository.json, if necessary. 

    <oai = 'http://www.openarchives.org/OAI/2.0/'>
  6. 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 the OAI-PMH provider generating either 4xx HTTP error codes or producing default values mentioned below. The 4xx HTTP status codes indicate an undefined namespace (Step 5 above). If default values appear instead of the properties you populated, 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:

PropertyDefault
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 SPARQL/Update queries of the pattern:

INSERT {<> oai:repositoryName "exciting repository name here"}
INSERT {<> oai:description "exciting description here"}
INSERT {<> oai:adminEmail "your.email@here.org"}

As an example:

echo "insert data {<> oai:repositoryName coolrepo } " | curl -X PATCH --upload-file - http://localhost:8080/fcrepo/rest