Skip to content
Snippets Groups Projects
Commit 93c6053b authored by Stefan E. Funk's avatar Stefan E. Funk
Browse files

Added version method

Increased service version
parent e46d8135
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
......@@ -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;
}
}
......@@ -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();
}
......@@ -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>
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment