diff --git a/oaipmh-core/pom.xml b/oaipmh-core/pom.xml index 82804127e77910267c3ff61f3bc7816d5b890775..4035c0e6f78d091f561b0baf218943bc57a3169b 100644 --- a/oaipmh-core/pom.xml +++ b/oaipmh-core/pom.xml @@ -4,11 +4,11 @@ <parent> <artifactId>oaipmh</artifactId> <groupId>info.textgrid.middleware</groupId> - <version>2.1.8-SNAPSHOT</version> + <version>2.1.9-SNAPSHOT</version> </parent> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh-core</artifactId> - <version>2.1.8-SNAPSHOT</version> + <version>2.1.9-SNAPSHOT</version> <packaging>jar</packaging> <name>DARIAHDE :: OAI-PMH DataProvider :: Core</name> <url>http://maven.apache.org</url> @@ -106,6 +106,56 @@ </plugins> </pluginManagement> <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>${maven-antrun-plugin.version}</version> + <executions> + <execution> + <id>do-get-sources</id> + <phase>generate-sources</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + <tstamp> + <format property="BUILDDATE" pattern="yyyyMMddHHmm" /> + </tstamp> + <echo + file="./src/main/java/info/textgrid/middleware/OaipmhServiceVersion.java"> + package + info.textgrid.middleware; + public + final + class + OaipmhServiceVersion { + private + OaipmhServiceVersion() { + // + } + public + static + final + String + VERSION + = + "${project.version}"; + public static + final + String + BUILDDATE = + "${BUILDDATE}"; + public static final String + BUILDNAME + = + "${project.artifactId}"; + }</echo> + </tasks> + </configuration> + </execution> + </executions> + </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java index a64755eb6b43f85e954fcbf20c72aa83fb069cef..e96ad92be7769e7ccee63eeade3ca2793522dfd8 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java @@ -21,6 +21,7 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import javax.xml.bind.JAXBElement; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.XMLGregorianCalendar; @@ -68,6 +69,15 @@ public class OAIPMHImpl implements OAIPMHProducer { this.identifierList = identifierList; } + @GET + @Produces(MediaType.TEXT_PLAIN) + @Path("/version") + public String getVersion() { + return OaipmhServiceVersion.BUILDNAME + "-" + + OaipmhServiceVersion.VERSION + "." + + OaipmhServiceVersion.BUILDDATE; + } + /** * Getting The request values as QueryParam from a REST request and proceeds * appropriate to them @@ -116,11 +126,11 @@ public class OAIPMHImpl implements OAIPMHProducer { setSetRequestValue(set, request); setVerbRequestValue(verb, verbParam, request); - if(textgrid==true){ + if (textgrid == true) { request.setValue(TGConstants.TG_REP_BASEURL); } - if(dariah==true){ - request.setValue(DARIAHConstants.DARIAH_REP_BASEURL); + if (dariah == true) { + request.setValue(DARIAHConstants.DARIAH_REP_BASEURL); } if (verbParam != null) { @@ -318,29 +328,28 @@ public class OAIPMHImpl implements OAIPMHProducer { } else { try { - //if (request.getSet() == null) { - identifierList.processIdentifierList(request.getFrom(), - request.getUntil(), request.getSet()); - if (identifierList.processIdentifierList( - request.getFrom(), request.getUntil(), request.getSet()) != null) { - lit = identifierList.processIdentifierList( - request.getFrom(), request.getUntil(), request.getSet()); - oai.setListIdentifiers(lit); - } else { - error.setError(TGConstants.OAI_NO_RECORD_MATCH) - .setValue( - "The combination of the values " - + request.getFrom() - + " and " - + request.getUntil() - + " results in an empty list"); - oai.getError() - .add(error - .setError(TGConstants.OAI_NO_RECORD_MATCH)); - } - - - //} + // if (request.getSet() == null) { + identifierList.processIdentifierList(request.getFrom(), + request.getUntil(), request.getSet()); + if (identifierList.processIdentifierList(request.getFrom(), + request.getUntil(), request.getSet()) != null) { + lit = identifierList.processIdentifierList( + request.getFrom(), request.getUntil(), + request.getSet()); + oai.setListIdentifiers(lit); + } else { + error.setError(TGConstants.OAI_NO_RECORD_MATCH) + .setValue( + "The combination of the values " + + request.getFrom() + " and " + + request.getUntil() + + " results in an empty list"); + oai.getError() + .add(error + .setError(TGConstants.OAI_NO_RECORD_MATCH)); + } + + // } } catch (Exception e) { // TODO Auto-generated catch block @@ -464,7 +473,8 @@ public class OAIPMHImpl implements OAIPMHProducer { oai.getError().add( error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR)); } else { - listRecords = recordList.getRecordsWithSet(request.getFrom(),request.getUntil(), request.getSet()); + listRecords = recordList.getRecordsWithSet(request.getFrom(), + request.getUntil(), request.getSet()); if (recordList.isFoundItems()) { // if(listRecords!=null){ oai.setListRecords(listRecords); @@ -625,7 +635,6 @@ public class OAIPMHImpl implements OAIPMHProducer { if (!verb.isEmpty()) { request.setVerb(verbParam); } - } public RequestType setRequestType(String verb) { @@ -634,14 +643,13 @@ public class OAIPMHImpl implements OAIPMHProducer { return request; } - - public void setTextGrid(boolean textgrid){ - this.textgrid=textgrid; - + + public void setTextGrid(boolean textgrid) { + this.textgrid = textgrid; } - - public void setDariah(boolean dariah){ - this.dariah=dariah; - + + public void setDariah(boolean dariah) { + this.dariah = dariah; } + } diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHProducer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHProducer.java index da223e789a0c1ee2ccb9758fdc831074a206b25e..77d94b1a348b627e4150767b82ae64195b44adaa 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHProducer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHProducer.java @@ -7,6 +7,7 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.DefaultValue; +import javax.ws.rs.core.MediaType; import javax.xml.bind.JAXBElement; /** @@ -47,8 +48,16 @@ public interface OAIPMHProducer { @QueryParam("set") @DefaultValue("") String set, @QueryParam("from") @DefaultValue("") String from, @QueryParam("until") @DefaultValue("") String until, - @QueryParam("resumptionToken") @DefaultValue("") String resumptionToken - + @QueryParam("resumptionToken") @DefaultValue("") String resumptionToken ); + /** + * @return + */ + + @GET + @Produces(MediaType.TEXT_PLAIN) + @Path("/version") + public String getVersion(); + } diff --git a/oaipmh-webapp/pom.xml b/oaipmh-webapp/pom.xml index a150dbc711e7deb0e512055a23fb965318e7ae79..8c263aa9a4d6caa5bcb12639d457b77ddc3d1dcf 100644 --- a/oaipmh-webapp/pom.xml +++ b/oaipmh-webapp/pom.xml @@ -4,12 +4,12 @@ <parent> <artifactId>oaipmh</artifactId> <groupId>info.textgrid.middleware</groupId> - <version>2.1.8-SNAPSHOT</version> + <version>2.1.9-SNAPSHOT</version> </parent> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh-webapp</artifactId> <packaging>war</packaging> - <version>2.1.8-SNAPSHOT</version> + <version>2.1.9-SNAPSHOT</version> <name>DARIAHDE :: OAI-PMH DataProvider :: Webapp</name> <url>http://maven.apache.org</url> <profiles> diff --git a/pom.xml b/pom.xml index ff26f80a2894fd68e3334546e970abbaba703642..1f2455ef1fc642bee087795df8a4b82bb8f8bf5c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh</artifactId> - <version>2.1.8-SNAPSHOT</version> + <version>2.1.9-SNAPSHOT</version> <packaging>pom</packaging> <name>DARIAHDE :: OAI-PMH DataProvider</name> <properties> @@ -19,6 +19,7 @@ <slf4j.version>1.7.5</slf4j.version> <junit.version>4.11</junit.version> <jdk.version>1.7</jdk.version> + <maven-antrun-plugin.version>1.3</maven-antrun-plugin.version> </properties> <url>https://projects.gwdg.de/projects/oai-pmh</url> <scm>