These instructions assume that you have a Hippo project based on the Hippo project archetype, i.e. a Maven multiproject consisting of submodules like cms, site and repository-data.
You should know on how to use the HST RESTful JAX-RS Component Support
You should know how the OAI-PMH protocol works; see the Protocol for Metadata Harvesting specification
In the main pom.xml of the project, in the repositories section, add this repository if it is not configured there yet.
<repository> <id>hippo-forge</id> <name>Bloomreach Forge maven 2 repository.</name> <url>https://maven.onehippo.com/maven2-forge/</url> </repository>
Add to the pom.xml of your cms module:
<dependency> <groupId>org.bloomreach.forge.oai-pmh-provider</groupId> <artifactId>oai-pmh-provider-repository</artifactId> <version>[version]</version> </dependency>
org.onehippo.forge
.
Add to the pom.xml of your site module:
<dependency> <groupId>org.bloomreach.forge.oai-pmh-provider</groupId> <artifactId>oai-pmh-provider-hst</artifactId> <version>[version]</version> </dependency>
org.onehippo.forge
.
Add to the web.xml of your site module:
<context-param> <param-name>hst-beans-annotated-classes</param-name> <param-value>....., classpath*:org/onehippo/forge/oaipmh/provider/api/**/*.class, </param-value> </context-param>
first implement the org.onehippo.forge.oaipmh.provider.api.OAIBean
There are 3 types of annotations you should use in your content beans:
Either in the CND (example):
<'oaipmh.demo'='http://www.onehippo.org/oaipmh.demo/nt/1.0'> <'hippo'='http://www.onehippo.org/jcr/hippo/nt/2.0'> <'hippostd'='http://www.onehippo.org/jcr/hippostd/nt/2.0'> <'hippostdpubwf'='http://www.onehippo.org/jcr/hippostdpubwf/nt/1.0'> <'oai'='http://www.hippoecm.org/hst/nt/oai/1.0'> [oaipmh.demo:basedocument] > hippo:document, hippostd:publishableSummary, hippostdpubwf:document orderable [oaipmh.demo:contentdocument] > oaipmh.demo:basedocument, hippostd:relaxed [oaipmh.demo:newsdocument] > oaipmh.demo:basedocument, hippostd:relaxed, oai:document
Or in your prototype (best practice):
/hipposysedit:prototype: jcr:primaryType: oaipmhdemo:contentdocument jcr:mixinTypes: ['mix:referenceable', 'oai:document']
Depending on your project, you might need to create a script which will add the mixin on all existing documents
add oai-pmh.xml to META-INF.hst-assembly.overrides package of your site project. Example:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <import resource="classpath:/org/onehippo/forge/oaipmh/provider/resource/oai-pmh.xml"/> <bean id="beanPackage" class="java.lang.String"> <constructor-arg value="org.onehippo.demo"/> </bean> <bean id="customRestOAIPMHResourceProviders" class="org.springframework.beans.factory.config.ListFactoryBean"> <property name="sourceList"> <list> <bean class="org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider"> <constructor-arg> <bean class="org.onehippo.demo.rest.OAIPMHResource"> <property name="beansPackage" value="org.onehippo.beans"/> <!--milliseconds setting since versions 3.1.0 and 4.1.0 --> <property name="useMilliSecondsDatePrecision" value="false"/> </bean> </constructor-arg> </bean> </list> </property> </bean> </beans>
Since versions 3.1.1 and 4.1.1 you can configure using either second or millisecond precision on (publication)date (oai:pubdate) and resumption token properties.
Second-precision is used by default. To enable the use of millisecond-precision:
In oai-pmh.xml in the META-INF.hst-assembly.overrides package of your site project, set:
<property name="useMilliSecondsDatePrecision" value="true"/>
In the console, configure the oaipmh derivative configuration to use the OAIPMHDateFunctionMillis Class:
definitions: config: /hippo:configuration/hippo:derivatives/oaipmh: hipposys:classname: org.onehippo.forge.oaipmh.repository.deriveddata.OAIPMHDateFunctionMillis
Documents that are touched by the derivative function will now have millisecond precision properties set. Existing documents will need to be updated using a groovy script.
Configure your HST mount to display the correct mount on the URL, e.g. http://localhost:8080/site/pmh
Automatically the oai-pmh project will set PMH mount on the hst:root mount
Try out the identify verb e.g. http://localhost:8080/site/pmh/oai?verb=Identify
You can configure metadata from the Identify by looking at the mount for the identify.path property which points to an Identify document.
Important for EDUREP!!
You should have the knowledge about the used xml formats and which elements and attributes are mandatory for edurep NLLOM
https://wiki.surfnet.nl/display/nllom/Home
All elements and attributes are already provided in the oai-pmh project under the following package: package
Plus we also provide a helper class which should get you going: NLLOM in combination with newsdocument:
Be aware you probably need to check your own metadata configuration for mandatory elements and properties