diff --git a/oaipmh-core/pom.xml b/oaipmh-core/pom.xml index 02f2b4736e61e70de13eb6d7f6235e9883bc91a4..3947887b0eeeac17339ee263d209b48a2cef2330 100644 --- a/oaipmh-core/pom.xml +++ b/oaipmh-core/pom.xml @@ -1,10 +1,11 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>oaipmh</artifactId> <groupId>info.textgrid.middleware</groupId> - <version>2.26.2-SNAPSHOT</version> + <version>2.27.0-SNAPSHOT</version> </parent> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh-core</artifactId> @@ -17,37 +18,47 @@ <artifactId>crud-common</artifactId> <version>${tgcrud.version}</version> </dependency> - <dependency> + <!--dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-security-cors</artifactId> <version>${cxf.version}</version> - </dependency> + </dependency--> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-client</artifactId> <version>${cxf.version}</version> </dependency> - <dependency> + <!--dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxrs</artifactId> <version>${cxf.version}</version> - </dependency> - <dependency> + </dependency--> + <!--dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxws</artifactId> + <version>${cxf.version}</version> + </dependency--> + <!--dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>${cxf.version}</version> + </dependency--> + <!--dependency> <groupId>javax.ws.rs</groupId> <artifactId>jsr311-api</artifactId> <version>1.0</version> - </dependency> + </dependency--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> - <dependency> + <!--dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.1</version> - </dependency> + </dependency--> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> @@ -80,6 +91,22 @@ <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> + <dependency> + <groupId>org.classicmayan.tools</groupId> + <artifactId>metsModsMapping</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <!--dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-core</artifactId> + <version>3.4.0</version> + </dependency--> + <!-- dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-arq</artifactId> + <version>3.6.0</version> + </dependency--> + </dependencies> <build> <pluginManagement> @@ -143,9 +170,33 @@ </executions> </plugin> <plugin> +<!-- We use this plugin to ensure that our usage of the +maven-jaxb2-plugin is JDK 8 compatible in absence of a fix +for https://java.net/jira/browse/MAVEN_JAXB2_PLUGIN-80. --> + <groupId>org.codehaus.mojo</groupId> + <artifactId>properties-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <executions> + <execution> + <id>set-additional-system-properties</id> + <goals> + <goal>set-system-properties</goal> + </goals> + </execution> + </executions> + <configuration> + <properties> + <property> + <name>javax.xml.accessExternalSchema</name> + <value>file,http</value> + </property> + </properties> + </configuration> +</plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> - <version>1.5</version> + <version>2.4</version> <executions> <execution> <id>oaipmhDCSchema-xjc</id> diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/DublinCoreFieldLoader.java b/oaipmh-core/src/main/java/info/textgrid/middleware/DublinCoreFieldLoader.java index a6f15360b2703a8f264e68149dd86d040a6f0242..50a9b56f4359e8930c8a4ed858c40603ecdbc2e6 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/DublinCoreFieldLoader.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/DublinCoreFieldLoader.java @@ -31,7 +31,7 @@ public class DublinCoreFieldLoader { public static String collectionTitle; private static org.apache.commons.logging.Log log = LogFactory - .getLog(RecordDeliverer.class); + .getLog(OAIPMHImpl.class); // ----DC-Contributor diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/ErrorHandler.java b/oaipmh-core/src/main/java/info/textgrid/middleware/ErrorHandler.java index 5197062957db4c2cd21d5f96f7238d6e46521efe..f3b28cd589085484db093994850cc8b6a857cfa1 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/ErrorHandler.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/ErrorHandler.java @@ -5,6 +5,7 @@ import info.textgrid.middleware.oaipmh.OAIPMHerrorcodeType; /** * Handling the errors for a incorrect request + * * @author Maximilian Brodhun * @version 1.1 * @since 29.01.2014 @@ -12,39 +13,46 @@ import info.textgrid.middleware.oaipmh.OAIPMHerrorcodeType; public class ErrorHandler { - private OAIPMHerrorType error = new OAIPMHerrorType(); - private OAIPMHerrorcodeType errorCode; - - /** - * The function gets an error description and set the responded error code for the OAIPMH error type - * @param errorDescription: String with the errorDescrption - * @return error returns the complete error as OAIPMHerrorType - */ - - public OAIPMHerrorType setError(String errorDescription){ - - if(errorDescription.equals("BadArgument")){ - errorCode = OAIPMHerrorcodeType.BAD_ARGUMENT; - }else if(errorDescription.equals("ResumptionTokenError")){ - errorCode = OAIPMHerrorcodeType.BAD_RESUMPTION_TOKEN; - }else if(errorDescription.equals("VerbError")){ - errorCode = OAIPMHerrorcodeType.BAD_VERB; - error.setValue("Illegal OAI-PMH verb"); - }else if(errorDescription.equals("FormatError")){ - errorCode = OAIPMHerrorcodeType.CANNOT_DISSEMINATE_FORMAT; - }else if(errorDescription.equals("IDError")){ - errorCode = OAIPMHerrorcodeType.ID_DOES_NOT_EXIST; - }else if(errorDescription.equals("MetadataFormatError")){ - error.setValue("There are no metadata formats available for the specified item."); - }else if(errorDescription.equals("RecordMatchError")){ - errorCode = OAIPMHerrorcodeType.NO_RECORDS_MATCH; - }else if(errorDescription.equals("SetHierarchyError")){ - errorCode = OAIPMHerrorcodeType.NO_SET_HIERARCHY; - } - - error.setCode(errorCode); - - return error; - } - + private OAIPMHerrorType error = new OAIPMHerrorType(); + private OAIPMHerrorcodeType errorCode; + + /** + * The function gets an error description and set the responded error code for the OAIPMH error + * type + * + * @param errorDescription: String with the errorDescrption + * @return error returns the complete error as OAIPMHerrorType + */ + public void setError(String errorDescription, String errorValue) { + + if (errorDescription.equals("BadArgument")) { + errorCode = OAIPMHerrorcodeType.BAD_ARGUMENT; + } else if (errorDescription.equals("ResumptionTokenError")) { + errorCode = OAIPMHerrorcodeType.BAD_RESUMPTION_TOKEN; + } else if (errorDescription.equals("VerbError")) { + errorCode = OAIPMHerrorcodeType.BAD_VERB; + error.setValue("Illegal OAI-PMH verb"); + } else if (errorDescription.equals("FormatError")) { + errorCode = OAIPMHerrorcodeType.CANNOT_DISSEMINATE_FORMAT; + } else if (errorDescription.equals("IDError")) { + errorCode = OAIPMHerrorcodeType.ID_DOES_NOT_EXIST; + } else if (errorDescription.equals("MetadataFormatError")) { + error.setValue("There are no metadata formats available for the specified item."); + } else if (errorDescription.equals("RecordMatchError")) { + errorCode = OAIPMHerrorcodeType.NO_RECORDS_MATCH; + } else if (errorDescription.equals("SetHierarchyError")) { + errorCode = OAIPMHerrorcodeType.NO_SET_HIERARCHY; + } + + error.setCode(errorCode); + error.setValue(errorValue); + } + + /** + * @return + */ + public OAIPMHerrorType getError() { + return error; + } + } diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererDC.java similarity index 86% rename from oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDeliverer.java rename to oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererDC.java index 3bc18591a944c6219acd2b35a8ddc2240865cb78..7b01c62769ed14439fb65af693b3c2d71877815a 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDeliverer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererDC.java @@ -8,7 +8,6 @@ import info.textgrid.middleware.oaipmh.RequestType; import info.textgrid.middleware.oaipmh.ResumptionTokenType; import info.textgrid.namespaces.middleware.tgcrud.common.TextGridMimetypes; -import java.math.BigInteger; import java.text.ParseException; import java.util.Hashtable; import java.util.Map; @@ -16,9 +15,7 @@ import java.util.Map; import javax.xml.datatype.DatatypeConfigurationException; import org.apache.commons.logging.LogFactory; -import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchScrollRequestBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; @@ -34,16 +31,13 @@ import org.elasticsearch.search.SearchHit; * @since 20.02.2014 */ -public class IdentifierListDeliverer { +public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract { - private static org.apache.commons.logging.Log log = LogFactory.getLog(IdentifierListDeliverer.class); + private static org.apache.commons.logging.Log log = LogFactory.getLog(IdentifierListDelivererDC.class); private String datestamp; private boolean idExist = true; private OAI_ESClient oaiEsClient; - private boolean textgrid; - private boolean dariah; - private String[] identifierListFields; //Fields for the elasticsearch request private String rangeField; // Field for the optional range query private String formatToFilter; // just necessary in textgrid case to just get the editions @@ -56,7 +50,8 @@ public class IdentifierListDeliverer { private static Map<String, Integer> cursorCollector = new Hashtable<String, Integer >(); private int searchResponseSize; - + + /** * In OAIPMH a ListIdentifiers request is answered by responding the * datestamp and the identifier of an object Both will be responded in a @@ -69,12 +64,8 @@ public class IdentifierListDeliverer { * @return the ListIdentifierElement with the responded header element */ - public IdentifierListDeliverer(OAI_ESClient oaiEsClient, boolean textgrid, boolean dariah) { - this.textgrid = textgrid; - this.dariah = dariah; - this.oaiEsClient = oaiEsClient; -// System.out.println("DARIAH boolean is set to: " + dariah); -// System.out.println("TEXTGRID boolean is set to: " + textgrid); + public IdentifierListDelivererDC(boolean textgrid, boolean dariah) { + super(textgrid, dariah); } @@ -110,13 +101,12 @@ public class IdentifierListDeliverer { * : end value to the range query * @return after calling the function "setListIdentifierHeader" the return * value is the whole ListIdentifiers element - * @throws ParseException */ // FIXME combine it with with getIdentifierListWithSet and check for empty set - public ListIdentifiersType processIdentifierList(String from, String to, String set, String resumptionToken) throws ParseException { + public ListIdentifiersType processIdentifierList(String from, String to, String set, String resumptionToken) { // System.out.println("JUHU"); ListIdentifiersType lit = new ListIdentifiersType(); QueryBuilder query = setOrNot(set, from, to); @@ -128,8 +118,10 @@ public class IdentifierListDeliverer { listListIdentiferValues = OAI_ESClient.getOaiESClient().prepareSearchScroll(resumptionToken).setScroll(new TimeValue(lifeTimeResToken)).execute().actionGet(); } else{ +// System.out.println("ELSE"); // System.out.println("JUHU3: " + searchResponseSize); // System.out.println(OAI_ESClient.getClusterName()); + listListIdentiferValues = OAI_ESClient .getOaiESClient().prepareSearch(OAI_ESClient.getEsIndex()) .setTypes(OAI_ESClient.getEsType()) @@ -140,7 +132,7 @@ public class IdentifierListDeliverer { .execute() .actionGet(); // System.out.println("DAMDAMDAM"); - + System.out.println(listListIdentiferValues.getHits().getTotalHits()); } // System.out.println("JUHU3.5"); listListIdentiferValues = hitHandling(listListIdentiferValues, lit, set, listListIdentiferValues.getScrollId()); @@ -152,6 +144,7 @@ public class IdentifierListDeliverer { public SearchResponse hitHandling(SearchResponse listFurtherValues, ListIdentifiersType lit, String set, String resumptionToken){ // System.out.println("JUHU4"); // System.out.println("FOR SET: " + set); + int i = 0; for (SearchHit hit : listFurtherValues.getHits().getHits()) { i++; @@ -206,8 +199,15 @@ public class IdentifierListDeliverer { public QueryBuilder setOrNot(String set, String from, String to){ - QueryBuilder rangeQuery = QueryBuilders.rangeQuery(rangeField).from(from).to(to); - QueryBuilder formatQuery = QueryBuilders.matchPhrasePrefixQuery("format", TextGridMimetypes.DARIAH_COLLECTION); + String filterFormat = ""; + if(textgrid==true) { + filterFormat = TextGridMimetypes.EDITION; + }else { + filterFormat = TextGridMimetypes.DARIAH_COLLECTION; + } + + QueryBuilder rangeQuery = QueryBuilders.rangeQuery(rangeField).from(from).to(to); + QueryBuilder formatQuery = QueryBuilders.matchPhrasePrefixQuery("format", filterFormat); QueryBuilder query; if(set!=null){ @@ -251,31 +251,6 @@ public class IdentifierListDeliverer { return lit; } - /** - * checking the request if all necessary values are set or not allowed - * values are not set - * - * @param request - * the initially request from the OAIPMG client - * @return a boolean indicating the correctness of the request - */ - - public boolean requestChecker(RequestType request) { - boolean requestCheck; - - if (request.getResumptionToken() != null && (request.getMetadataPrefix() != null) || request.getSet() != null ){ - requestCheck = false; - } - else { - if (request.getMetadataPrefix() == null || request.getIdentifier() != null) { - requestCheck = false; - } else { - requestCheck = true; - } - } - return requestCheck; - - } public void setFormatToFilter(String formatToFilter) { this.formatToFilter = formatToFilter; @@ -342,4 +317,14 @@ public class IdentifierListDeliverer { // System.out.println(this.searchResponseSize); } + + public OAI_ESClient getOaiEsClient() { + return oaiEsClient; + } + + + public void setOaiEsClient(OAI_ESClient oaiEsClient) { + this.oaiEsClient = oaiEsClient; + } + } diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDeliverer.java index 64ab0b4e756fd75c4c9834a4bba26742bf1da0eb..44eec995ebb303fc2fe3ade42bad571fdedc5fe4 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDeliverer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/MetadataFormatListDeliverer.java @@ -47,12 +47,17 @@ public class MetadataFormatListDeliverer { ListMetadataFormatsType lmft = new ListMetadataFormatsType(); MetadataFormatType mft = new MetadataFormatType(); + MetadataFormatType mftIdiomMets = new MetadataFormatType(); mft.setMetadataNamespace("http://www.openarchives.org/OAI/2.0/oai_dc/"); mft.setMetadataPrefix(TGConstants.METADATA_DC_PREFIX); mft.setSchema("http://www.openarchives.org/OAI/2.0/oai_dc.xsd"); lmft.getMetadataFormat().add(mft); + mftIdiomMets.setMetadataNamespace("http://www.loc.gov/METS/"); + mftIdiomMets.setMetadataPrefix(TGConstants.METADATA_IDIOM_PREFIX); + mftIdiomMets.setSchema("http://www.loc.gov/standards/mets/mets.xsd"); + lmft.getMetadataFormat().add(mftIdiomMets); return lmft; } 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 7f846898835b8cbfcfd1dca88998a9a2861fff43..80f1320eb9b6acde0e64d4b9b75375ec2d3b8956 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java @@ -25,20 +25,27 @@ import info.textgrid.middleware.oaipmh.VerbType; * </p> * * @author Maximilian Brodhun, SUB Göttingen - * @version 2018-05-16 + * @version 2019-03-07 * @since 2014-01-29 */ public class OAIPMHImpl implements OAIPMHProducer { private ErrorHandler error = new ErrorHandler(); private org.apache.commons.logging.Log log = LogFactory.getLog(OAIPMHImpl.class); - private OAI_ESClient oaiEsClient; private RepIdentification rep; - private RecordListDeliverer recordList; - private RecordDeliverer recDeliv; + + private RecordListDelivererDC recordListDC; + private RecordListDelivererIDIOM recordListIDIOM; + + private RecordDelivererDC recDelivDC; + private RecordDelivererIDIOM recDelivIDIOM; + + private IdentifierListDelivererDC identifierListDC; + private IdentifierListDelivererIDIOM identifierListIDIOM; + private MetadataFormatListDeliverer metadataFormatList; private SetDeliverer setList; - private IdentifierListDeliverer identifierList; + public boolean textgrid; public boolean dariah; @@ -53,16 +60,18 @@ public class OAIPMHImpl implements OAIPMHProducer { * @param setList * @param identifierList */ - public OAIPMHImpl(OAI_ESClient oaiEsClient, RepIdentification rep, RecordDeliverer recDeliv, - RecordListDeliverer recordList, MetadataFormatListDeliverer metadataFormatList, - SetDeliverer setList, IdentifierListDeliverer identifierList) { - this.oaiEsClient = oaiEsClient; + public OAIPMHImpl(RepIdentification rep, RecordDelivererDC recDelivDC,RecordDelivererIDIOM recDelivIDIOM, + RecordListDelivererDC recordListDC,RecordListDelivererIDIOM recordListIDIOM, MetadataFormatListDeliverer metadataFormatList, + SetDeliverer setList, IdentifierListDelivererDC identifierList, IdentifierListDelivererIDIOM identifierListIDIOM) { this.rep = rep; - this.recDeliv = recDeliv; - this.recordList = recordList; + this.recDelivDC = recDelivDC; + this.recDelivIDIOM = recDelivIDIOM; + this.recordListDC = recordListDC; + this.recordListIDIOM = recordListIDIOM; this.metadataFormatList = metadataFormatList; this.setList = setList; - this.identifierList = identifierList; + this.identifierListDC = identifierList; + this.identifierListIDIOM = identifierListIDIOM; } /* @@ -111,15 +120,15 @@ public class OAIPMHImpl implements OAIPMHProducer { JAXBElement<OAIPMHType> oaipmhRoot = obf.createOAIPMH(oai); IdentifyType tgRepIdentificationRequest = new IdentifyType(); - if (rep.requestChecker(request)) { + if (this.rep.requestChecker(request)) { - tgRepIdentificationRequest.setBaseURL(rep.getBaseUrl()); - tgRepIdentificationRequest.setDeletedRecord(rep.getDeletedRecordStatus()); - tgRepIdentificationRequest.setEarliestDatestamp(rep.getEarliestDatestamp()); - tgRepIdentificationRequest.setGranularity(rep.getGranularity()); - tgRepIdentificationRequest.setRepositoryName(rep.getRepositoryName()); - tgRepIdentificationRequest.setProtocolVersion(rep.getProtocolVersion()); - tgRepIdentificationRequest.getAdminEmail().add(rep.getAdminMaiAddresss()); + tgRepIdentificationRequest.setBaseURL(this.rep.getBaseUrl()); + tgRepIdentificationRequest.setDeletedRecord(this.rep.getDeletedRecordStatus()); + tgRepIdentificationRequest.setEarliestDatestamp(this.rep.getEarliestDatestamp()); + tgRepIdentificationRequest.setGranularity(this.rep.getGranularity()); + tgRepIdentificationRequest.setRepositoryName(this.rep.getRepositoryName()); + tgRepIdentificationRequest.setProtocolVersion(this.rep.getProtocolVersion()); + tgRepIdentificationRequest.getAdminEmail().add(this.rep.getAdminMaiAddresss()); oai.setIdentify(tgRepIdentificationRequest); } else { @@ -142,9 +151,9 @@ public class OAIPMHImpl implements OAIPMHProducer { errorValues.add("Set"); } - error.setError(TGConstants.OAI_BAD_ARGUMENT) - .setValue("The request includes illegal arguments: " + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); + this.error.setError(TGConstants.OAI_BAD_ARGUMENT, + "The request includes illegal arguments: " + errorValues); + oai.getError().add(this.error.getError()); } return oaipmhRoot; @@ -161,24 +170,33 @@ public class OAIPMHImpl implements OAIPMHProducer { */ public JAXBElement<OAIPMHType> getRecordRequest(ObjectFactory obf, OAIPMHType oai, RequestType request) { - - List<String> errorValues = new ArrayList<String>(); - // RecordDeliverer recDeliv = new RecordDeliverer(oaiEsClient, - // TGConstants.TGFields); JAXBElement<OAIPMHType> oaipmhRoot = obf.createOAIPMH(oai); - if (request.getMetadataPrefix() != null && !request.getMetadataPrefix().equals("oai_dc")) { - error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR) - .setValue("The value of the metadataPrefix: " + request.getMetadataPrefix() - + " is not supported by the item identified by the value of: " - + request.getIdentifier()); - oai.getError().add(error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR)); + /** + * Check request. In GetRecord: + * allowed parameters: identifier, metadataPrefix, verb + * forbidden: resumptionToken, from, till, set + * optional: no one + */ + + ErrorHandler requestErrors = RecordDelivererAbstract.requestChecker(request); + + if (requestErrors.getError().getCode() != null) { + oai.getError().add(requestErrors.getError()); } - else if (recDeliv.requestChecker(request)) { + // Get Record Request is done HERE! + else { - // recDeliv.getRecordById(request.getIdentifier()); + // Default is DC. + RecordDelivererInterface recDeliv = this.recDelivDC; + + // Take IDIOM if IDIOM prefix. + if (request.getMetadataPrefix().equals(TGConstants.METADATA_IDIOM_PREFIX)) { + recDeliv = this.recDelivIDIOM; + } + // Finally start the QUERY! GetRecordType getRecord = new GetRecordType(); getRecord = recDeliv.getRecordById(request.getIdentifier()); @@ -186,34 +204,11 @@ public class OAIPMHImpl implements OAIPMHProducer { // getRecord = recDeliv.getRecordById(request.getIdentifier()); oai.setGetRecord(getRecord); } else { - error.setError(TGConstants.OAI_NO_RECORD_MATCH).setValue("The value of the identifier: " + ErrorHandler idError = new ErrorHandler(); + idError.setError(TGConstants.OAI_NO_RECORD_MATCH, "The value of the identifier: " + request.getIdentifier() + " is unknown or illegal in this repository"); - oai.getError().add(error.setError(TGConstants.OAI_NO_RECORD_MATCH)); - } - } else { - - if (request.getFrom() != null) { - errorValues.add("from"); - } - if (request.getResumptionToken() != null) { - errorValues.add("resumptionToken"); - } - if (request.getSet() != null) { - errorValues.add("set"); - } - if (request.getUntil() != null) { - errorValues.add("until"); + oai.getError().add(idError.getError()); } - if (request.getMetadataPrefix() == null) { - errorValues.add("metadataPrefix"); - } - if (request.getIdentifier() == null) { - errorValues.add("identifier"); - } - error.setError(TGConstants.OAI_BAD_ARGUMENT) - .setValue("The request includes illegal arguments " + "or is missing required arguments: " - + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); } return oaipmhRoot; @@ -231,55 +226,34 @@ public class OAIPMHImpl implements OAIPMHProducer { */ public JAXBElement<OAIPMHType> listIdentifiersRequest(ObjectFactory obf, OAIPMHType oai, RequestType request) throws ParseException { - - List<String> errorValues = new ArrayList<String>(); - JAXBElement<OAIPMHType> oaipmhRoot = obf.createOAIPMH(oai); - - // if (identifierList.requestChecker(request)) { - - if (request.getResumptionToken() != null && request.getMetadataPrefix() != null) { - errorValues.add("MetadataPrefix"); - error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue( - "The request includes illegal arguments or missing requiered arguments:" + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); - } else if (request.getResumptionToken() != null && request.getSet() != null) { - errorValues.add("Set"); - error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue( - "The request includes illegal arguments or missing requiered arguments:" + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); - } else if (request.getResumptionToken() == null && request.getMetadataPrefix() == null) { - errorValues.add("MetadataPrefix"); - error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue( - "The request includes illegal arguments or missing requiered arguments:" + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); - } else if (request.getMetadataPrefix() != null - && !request.getMetadataPrefix().equals(TGConstants.METADATA_DC_PREFIX)) { - error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR) - .setValue("The value of the metadataPrefix: " + request.getMetadataPrefix() - + " is not supported by the item identified by the value of: " - + request.getIdentifier()); - oai.getError().add(error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR)); - } else { - // System.out.println("bla1000"); - if (request.getResumptionToken() != null - && RecordListDeliverer.cursorCollector.containsKey(request.getResumptionToken())) { - error.setError(TGConstants.OAI_BAD_RESUMPTION_TOKEN) - .setValue("The value of the resumptionToken argument is invalid or expired"); - oai.getError().add(error.setError(TGConstants.OAI_BAD_RESUMPTION_TOKEN)); - } else { - lit = identifierList.processIdentifierList(request.getFrom(), request.getUntil(), - request.getSet(), request.getResumptionToken()); - if (lit != null) { - // System.out.println("bla2000"); - 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)); - } - } - } - + + JAXBElement<OAIPMHType> oaipmhRoot = obf.createOAIPMH(oai); + ErrorHandler requestErrors = IdentifierListDelivererAbstract.requestChecker(request); + + if (requestErrors.getError().getCode() != null) { + oai.getError().add(requestErrors.getError()); + }else { + // Default is DC. + IdentifierListDelivererInterface listDeliv = this.identifierListDC; + + // Take IDIOM if IDIOM prefix. + if (request.getMetadataPrefix().equals(TGConstants.METADATA_IDIOM_PREFIX)) { + listDeliv = this.identifierListIDIOM; + } + ListIdentifiersType listIdentifiers = new ListIdentifiersType(); + listIdentifiers = listDeliv.processIdentifierList(request.getFrom(), request.getUntil(), + request.getSet(), request.getResumptionToken()); + + if(listIdentifiers!=null) { + oai.setListIdentifiers(listIdentifiers); + }else { + ErrorHandler idError = new ErrorHandler(); + idError.setError(TGConstants.OAI_NO_RECORD_MATCH, "The value of the identifier: " + + request.getIdentifier() + " is unknown or illegal in this repository"); + oai.getError().add(idError.getError()); + } + } + return oaipmhRoot; } @@ -317,21 +291,21 @@ public class OAIPMHImpl implements OAIPMHProducer { ListMetadataFormatsType listMF = new ListMetadataFormatsType(); JAXBElement<OAIPMHType> oaipmhRoot = obf.createOAIPMH(oai); - if (metadataFormatList.requestChecker(request)) { + if (this.metadataFormatList.requestChecker(request)) { if (id.isEmpty()) { - listMF = metadataFormatList.setMetadataFormatListWithoutId(); + listMF = this.metadataFormatList.setMetadataFormatListWithoutId(); } else { - listMF = metadataFormatList.setMetadataFormatList(request.getIdentifier()); + listMF = this.metadataFormatList.setMetadataFormatList(request.getIdentifier()); } if (listMF != null) { oai.setListMetadataFormats(listMF); } else { - error.setError(TGConstants.OAI_NO_RECORD_MATCH).setValue("The value of the identifier: " + this.error.setError(TGConstants.OAI_NO_RECORD_MATCH, "The value of the identifier: " + request.getIdentifier() + " is unknown or illegal in this repository"); - oai.getError().add(error.setError(TGConstants.OAI_NO_RECORD_MATCH)); + oai.getError().add(this.error.getError()); } } else { if (request.getFrom() != null) { @@ -350,9 +324,9 @@ public class OAIPMHImpl implements OAIPMHProducer { errorValues.add("until"); } - error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue("The request includes illegal " + this.error.setError(TGConstants.OAI_BAD_ARGUMENT, "The request includes illegal " + "arguments or is missing required arguments: " + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); + oai.getError().add(this.error.getError()); } return oaipmhRoot; @@ -365,50 +339,33 @@ public class OAIPMHImpl implements OAIPMHProducer { * @return */ public JAXBElement<OAIPMHType> listRecordsRequest(ObjectFactory obf, OAIPMHType oai, - RequestType request) { + RequestType request) { - // System.out.println("blablablabla"); - List<String> errorValues = new ArrayList<String>(); - ListRecordsType listRecords = new ListRecordsType(); - // RecordListDeliverer recordList = new - // RecordListDeliverer(oaiEsClient,// TGConstants.TGFields); JAXBElement<OAIPMHType> oaipmhRoot = obf.createOAIPMH(oai); - - if (request.getResumptionToken() != null && request.getMetadataPrefix() != null) { - errorValues.add("MetadataPrefix"); - error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue( - "The request includes illegal arguments or missing requiered arguments:" + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); - } else if (request.getResumptionToken() != null && request.getSet() != null) { - errorValues.add("Set"); - error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue( - "The request includes illegal arguments or missing requiered arguments:" + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); - } else if (request.getResumptionToken() == null && request.getMetadataPrefix() == null) { - errorValues.add("MetadataPrefix"); - error.setError(TGConstants.OAI_BAD_ARGUMENT).setValue( - "The request includes illegal arguments or missing requiered arguments:" + errorValues); - oai.getError().add(error.setError(TGConstants.OAI_BAD_ARGUMENT)); - } else if (request.getMetadataPrefix() != null - && !request.getMetadataPrefix().equals(TGConstants.METADATA_DC_PREFIX)) { - error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR) - .setValue("The value of the metadataPrefix: " + request.getMetadataPrefix() - + " is not supported by the item identified by the value of: " - + request.getIdentifier()); - oai.getError().add(error.setError(TGConstants.OAI_METADATA_FORMAT_ERROR)); - } else { - listRecords = recordList.getRecords(request.getFrom(), request.getUntil(), request.getSet(), - request.getResumptionToken()); - if (listRecords != null) { - oai.setListRecords(listRecords); - } 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)); - } + + ErrorHandler requestErrors = RecordListDelivererAbstract.requestChecker(request); + + if (requestErrors.getError().getCode() != null) { + oai.getError().add(requestErrors.getError()); + }else { + // Default is DC. + RecordListDelivererInterface recListDeliv = this.recordListDC; + + // Take IDIOM if IDIOM prefix. + if (request.getMetadataPrefix().equals(TGConstants.METADATA_IDIOM_PREFIX)) { + + recListDeliv = this.recordListIDIOM; + } + + ListRecordsType listRecords = new ListRecordsType(); + listRecords = recListDeliv.getRecords(request.getFrom(), request.getUntil(), request.getSet(), + request.getResumptionToken()); + + if (listRecords != null) { + oai.setListRecords(listRecords); + } } - - return oaipmhRoot; + return oaipmhRoot; } /** @@ -438,7 +395,8 @@ public class OAIPMHImpl implements OAIPMHProducer { } else if (verb != null && verb.equals("GetRecord")) { verbParam = VerbType.GET_RECORD; } else { - error.setError("VerbError"); + // FIXME + this.error.setError("VerbError", "!!!!!!!!!FIXME MAXI!!!!!!!!!!!!!"); } return verbParam; @@ -558,9 +516,9 @@ public class OAIPMHImpl implements OAIPMHProducer { .convertDateFormat(OAIPMHUtillities.getXMLGregorianCalendarNow().toString()); response.setResponseDate(convertedDateFormat); } catch (ParseException e) { - log.debug("can not parse date format"); + this.log.debug("can not parse date format"); } catch (DatatypeConfigurationException e) { - log.debug("Datatype configuration failed"); + this.log.debug("Datatype configuration failed"); } /* converting the request values */ @@ -574,10 +532,10 @@ public class OAIPMHImpl implements OAIPMHProducer { // request.setSet(set); request.setVerb(verbParam); - if (textgrid == true) { + if (this.textgrid == true) { request.setValue(TGConstants.TG_REP_BASEURL); } - if (dariah == true) { + if (this.dariah == true) { request.setValue(DARIAHConstants.DARIAH_REP_BASEURL); } @@ -601,7 +559,8 @@ public class OAIPMHImpl implements OAIPMHProducer { oaipmhRoot = listRecordsRequest(obf, response, request); } } else { - response.getError().add(error.setError("VerbError")); + this.error.setError("VerbError", "!!!!!!!!!FIXME MAXI!!!!!!!!!!!!!"); + response.getError().add(this.error.getError()); } response.setRequest(request); diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtillities.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtillities.java index fca94350d5f59e39cc09f4e1e4f9a460ad16c79e..628bb5d0b65e525105d1e352e74f59dc7245355e 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtillities.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHUtillities.java @@ -146,6 +146,7 @@ public class OAIPMHUtillities { // need to check hash map! // 2. Complete list size is > 100 and we have no token: we do need one! // 3. Complete list size is <= 100 (we do not need a token! do nothing!) + if (completeListSize > 100) { ResumptionTokenType resTokenForResponse = new ResumptionTokenType(); diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java deleted file mode 100644 index 5d934868e84a05b0b763fc2631dffce71bb81d5c..0000000000000000000000000000000000000000 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java +++ /dev/null @@ -1,498 +0,0 @@ -package info.textgrid.middleware; - -import java.text.ParseException; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.datatype.DatatypeConfigurationException; - -import org.apache.commons.logging.LogFactory; -import org.elasticsearch.action.get.GetRequestBuilder; -import org.elasticsearch.action.get.GetResponse; - -import info.textgrid.middleware.oaipmh.GetRecordType; -import info.textgrid.middleware.oaipmh.HeaderType; -import info.textgrid.middleware.oaipmh.OaiDcType; -import info.textgrid.middleware.oaipmh.ObjectFactory; -import info.textgrid.middleware.oaipmh.RecordType; -import info.textgrid.middleware.oaipmh.RequestType; - -/** - * Query ElasticSearch index for the values mapped to dublinCore for a specific - * object and collect them into lists - * - * @author Maximilian Brodhun SUB - * @version 1.1 - * @since 17.02.2014 - * - */ - -public class RecordDeliverer { - - private String[] fields; - private String[] workFields; - private boolean textgrid; - private boolean dariah; - - private String formatField; - private String formatToFilter; - private String dateOfObjectCreation; - private String relationToFurtherMetadataObject; - private String repositoryObjectURIPrefix; - private String identifierField; - - /* - * Lists for the Dublin Core elements. Lists are needed since each DC fields - * is possible to occur several times - */ - - private List<String> contributors = new ArrayList<String>(); - private List<String> coverages = new ArrayList<String>(); - private List<String> creators = new ArrayList<String>(); - private List<String> dates = new ArrayList<String>(); - private List<String> descriptions = new ArrayList<String>(); - private List<String> formats = new ArrayList<String>(); - private List<String> identifiers = new ArrayList<String>(); - private List<String> languages = new ArrayList<String>(); - private List<String> publishers = new ArrayList<String>(); - private List<String> relations = new ArrayList<String>(); - private List<String> rights = new ArrayList<String>(); - private List<String> sources = new ArrayList<String>(); - private List<String> subjects = new ArrayList<String>(); - private List<String> titles = new ArrayList<String>(); - private List<String> types = new ArrayList<String>(); - - private String[] contributorList; - private String[] coverageList; - private String[] creatorList; - private String[] dateList; - private String[] descriptionList; - private String[] formatList; - private String[] identifierList; - private String[] languageList; - private String[] publisherList; - private String[] relationList; - private String[] relationForWorkList; - private String[] rightList; - private String[] sourceList; - private String[] subjectList; - private String[] titleList; - private String[] typeList; - - private static org.apache.commons.logging.Log log = LogFactory - .getLog(RecordDeliverer.class); - - private OAI_ESClient oaiEsClient; - - /** - * @param oaiEsClient - * @param workFields - * @param textgrid - * @param dariah - */ - public RecordDeliverer(OAI_ESClient oaiEsClient, String[] workFields, - boolean textgrid, boolean dariah) { - this.oaiEsClient = oaiEsClient; - this.workFields = workFields; - this.textgrid = textgrid; - this.dariah = dariah; - } - - /** - * Query ElasticSearch index for the values mapped to dublinCore for a - * specific object - * - * @param id - * identifier within the EalsticSearch index - * @return Get the GetRecord response for the request - */ - public GetRecordType getRecordById(String id) { - - ObjectFactory of = new ObjectFactory(); - OaiDcType odt = new OaiDcType(); - GetRecordType grt = new GetRecordType(); - RecordType record = new RecordType(); - String changedId = id; - DublinCoreBuilder dbc = new DublinCoreBuilder(odt, of); - - if (id.startsWith(this.repositoryObjectURIPrefix)) { - changedId = changedId.replace(this.repositoryObjectURIPrefix, ""); -// System.out.println("CHANGEDID: " + changedId); - } - - GetRequestBuilder recordById = OAI_ESClient.getOaiESClient() - .prepareGet().setIndex(OAI_ESClient.getEsIndex()) - .setType(OAI_ESClient.getEsType()).setFields(this.fields) - .setId(changedId); - - GetResponse tgObject = recordById.execute().actionGet(); - - if (tgObject.isExists()) { - - String identifier; - - if (this.dariah == true) { - - putContentIntoDCFieldLists(tgObject); - // FIXME MAX!!!! DO CONFIGURE!!!! - -// System.out.println(identifierField); - identifier = tgObject.getField(this.identifierField).getValue().toString(); -// System.out.println("IDENTIFIER: " + identifier); - String dateOfCreation = "NO_DATE_SET!"; - - if (tgObject.getField(this.dateOfObjectCreation) != null) { - try { - dateOfCreation = OAIPMHUtillities.convertDateFormat(tgObject.getField(this.dateOfObjectCreation).getValue().toString()).toXMLFormat(); - } catch (ParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (DatatypeConfigurationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - setRecordHeader(dateOfCreation, identifier, record, dbc); - } - - if (this.textgrid == true && tgObject.getField(formatField).getValue().toString().equals(formatToFilter) ) { - - String workUri = tgObject.getField(this.relationToFurtherMetadataObject).getValue().toString(); - workUri = workUri.substring(this.repositoryObjectURIPrefix.length()); - putContentIntoDCFieldLists(tgObject, furtherDCElements(workUri)); - identifier = tgObject.getField(this.identifierField).getValue().toString(); - String dateOfCreation = tgObject.getField(this.dateOfObjectCreation).getValue().toString(); - setRecordHeader(dateOfCreation, identifier, record, dbc); - } - - setDCObject(odt, of, dbc); - record.setMetadata(dbc.getDC()); - grt.setRecord(record); - listClearer(); - - } else { - grt = null; - } - - return grt; - } - - /** - * @param dateOfCreation - * @param identifier - * @param record - * @param dbc - * @return - */ - public RecordType setRecordHeader(String dateOfCreation, String identifier, - RecordType record, DublinCoreBuilder dbc) { - - HeaderType recordHeader = new HeaderType(); -// System.out.println("IDENTIFIRE::: " + identifier); - recordHeader.setIdentifier(identifier); - recordHeader.setDatestamp(dateOfCreation); - record.setMetadata(dbc.getDC()); - record.setHeader(recordHeader); - - return record; - } - - /** - * @param id - * @return - */ - public GetResponse furtherDCElements(String id) { - - if (!id.endsWith(".0")) { - id = id.concat(".0"); - } - - GetRequestBuilder getWorkValues = OAI_ESClient.getOaiESClient() - .prepareGet().setIndex(OAI_ESClient.getEsIndex()) - .setType(OAI_ESClient.getEsType()).setId(id) - .setFields(this.workFields); - - GetResponse responseWorkValues = getWorkValues.execute().actionGet(); - - try { - if (responseWorkValues.getField(this.dateOfObjectCreation) != null) { - this.dates.add(OAIPMHUtillities.convertDateFormat(responseWorkValues.getField(this.dateOfObjectCreation).getValue().toString()).toXMLFormat()); - } - } catch (ParseException e) { - log.debug(e); - } catch (DatatypeConfigurationException e) { - log.debug(e); - } - - return responseWorkValues; - } - - /** - * @param responseWorkValues - * @param relatedWorkObject - */ - public void putContentIntoDCFieldLists(GetResponse responseWorkValues, GetResponse relatedWorkObject) { - this.contributors = DublinCoreFieldLoader.setContributor(responseWorkValues, this.contributorList); - this.formats = DublinCoreFieldLoader.setFormat(responseWorkValues,this.formatList); -// for(String bla : identifierList){ -// System.out.println("BLA: " + bla); -// } - this.identifiers = DublinCoreFieldLoader.setIdentifier(responseWorkValues, this.identifierList); - this.languages = DublinCoreFieldLoader.setLanguage(responseWorkValues,this.languageList); - this.publishers = DublinCoreFieldLoader.setPublisher(responseWorkValues, this.publisherList); - this.relations = DublinCoreFieldLoader.setRelationForWork(responseWorkValues, this.relationList); - this.rights = DublinCoreFieldLoader.setRights(responseWorkValues,this.rightList); - this.sources = DublinCoreFieldLoader.setSources(responseWorkValues,this.sourceList); - this.titles = DublinCoreFieldLoader.setTitle(responseWorkValues,this.titleList); - this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,this.coverageList); - this.creators = DublinCoreFieldLoader.setCreator(relatedWorkObject,this.creatorList); - this.dates = DublinCoreFieldLoader.setDate(relatedWorkObject,this.dateList); - this.descriptions = DublinCoreFieldLoader.setDescription(relatedWorkObject, this.descriptionList); - this.relations = DublinCoreFieldLoader.setRelationForWork(relatedWorkObject, this.relationForWorkList); - this.subjects = DublinCoreFieldLoader.setSubject(relatedWorkObject,this.subjectList); - this.types = DublinCoreFieldLoader.setType(relatedWorkObject,this.typeList); - - } - - /** - * @param responseWorkValues - */ - public void putContentIntoDCFieldLists(GetResponse responseWorkValues) { - this.contributors = DublinCoreFieldLoader.setContributor(responseWorkValues, this.contributorList); - this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,this.coverageList); - this.creators = DublinCoreFieldLoader.setCreator(responseWorkValues,this.creatorList); - this.dates = DublinCoreFieldLoader.setDate(responseWorkValues,this.dateList); - this.descriptions = DublinCoreFieldLoader.setDescription(responseWorkValues, this.descriptionList); - this.formats = DublinCoreFieldLoader.setFormat(responseWorkValues,this.formatList); - this.identifiers = DublinCoreFieldLoader.setIdentifier(responseWorkValues, this.identifierList); - this.languages = DublinCoreFieldLoader.setLanguage(responseWorkValues,this.languageList); - this.publishers = DublinCoreFieldLoader.setPublisher(responseWorkValues, this.publisherList); - this.relations = DublinCoreFieldLoader.setRelation(responseWorkValues,this.relationList); - this.rights = DublinCoreFieldLoader.setRights(responseWorkValues,this.rightList); - this.sources = DublinCoreFieldLoader.setSources(responseWorkValues,this.sourceList); - this.subjects = DublinCoreFieldLoader.setSubject(responseWorkValues,this.subjectList); - this.titles = DublinCoreFieldLoader.setTitle(responseWorkValues,this.titleList); - this.types = DublinCoreFieldLoader.setType(responseWorkValues,this.typeList); - } - - /** - * converting the textGrid elements into dublinCore elements - * - * @param odt - * container for the OAIPMH DublinCore element - * @param of - * jaxb object factory the DublinCore elements - */ - public void setDCObject(OaiDcType odt, ObjectFactory of, DublinCoreBuilder dbc) { - dbc.setContributor(this.contributors); - dbc.setCoverage(this.coverages); - dbc.setCreator(this.creators); - dbc.setDate(this.dates); - dbc.setDescription(this.descriptions); - dbc.setFormat(this.formats); - dbc.setIdentifier(this.identifiers); - for(String identifier : identifiers){ -// System.out.println("IDENTIFIEROPF: " + identifier); - } - dbc.setLanguage(this.languages); - dbc.setPublisher(this.publishers); - dbc.setRelation(this.relations); - dbc.setRights(this.rights); - dbc.setSource(this.sources); - dbc.setSubject(this.subjects); - for(String title : titles){ -// System.out.println("TITLEOPF: " + title); - } - dbc.setTitle(this.titles); - dbc.setType(this.types); - - } - - /** - * - */ - public void listClearer() { - this.contributors.clear(); - this.coverages.clear(); - this.creators.clear(); - this.dates.clear(); - this.descriptions.clear(); - this.formats.clear(); - this.identifiers.clear(); - this.languages.clear(); - this.publishers.clear(); - this.relations.clear(); - this.rights.clear(); - this.sources.clear(); - this.subjects.clear(); - this.titles.clear(); - this.types.clear(); - } - - public void setFormatToFilter(String formatToFilter) { - this.formatToFilter = formatToFilter; - } - - public void setFormatField(String formatField) { - this.formatField = formatField; - } - - public String getDateOfObjectCreation() { - return this.dateOfObjectCreation; - } - - public void setDateOfObjectCreation(String dateOfObjectCreation) { - this.dateOfObjectCreation = dateOfObjectCreation; - } - - public String getRelationToFurtherMetadataObject() { - return this.relationToFurtherMetadataObject; - } - - public void setRelationToFurtherMetadataObject( - String relationToFurtherMetadataObject) { - this.relationToFurtherMetadataObject = relationToFurtherMetadataObject; - } - - public String getRepositoryObjectURIPrefix() { - return this.repositoryObjectURIPrefix; - } - - public void setRepositoryObjectURIPrefix(String repositoryObjectURIPrefix) { - this.repositoryObjectURIPrefix = repositoryObjectURIPrefix; - } - - public String getIdentifierField() { - return this.identifierField; - } - - public void setIdentifierField(String identifierPrefix) { - this.identifierField = identifierPrefix; - } - - public void setFields(String[] fields) { - this.fields = fields; - } - - public String[] getFields() { - return this.fields; - - } - - public void setWorkFields(String[] workFields) { - this.workFields = workFields; - } - - public void setContributor(String[] contributorList) { - - this.contributorList = contributorList; - } - - public String[] getContributor() { - - return this.contributorList; - } - - public void setCoverage(String[] coveragesList) { - - this.coverageList = coveragesList; - } - - public void setCreator(String[] creatorsList) { - - this.creatorList = creatorsList; - } - - public void setDates(String[] datesList) { - - this.dateList = datesList; - } - - public void setDescriptions(String[] descriptionsList) { - - this.descriptionList = descriptionsList; - } - - public void setFormats(String[] formatsList) { - - this.formatList = formatsList; - } - - public void setIdentifiers(String[] identifiersList) { - - this.identifierList = identifiersList; - } - - public void setLanguages(String[] languagesList) { - - this.languageList = languagesList; - } - - public void setPublishers(String[] publishersList) { - - this.publisherList = publishersList; - } - - public void setRelations(String[] relationsList) { - - this.relationList = relationsList; - } - - public void setRelationsForWork(String[] relationsList) { - - this.relationForWorkList = relationsList; - } - - public void setRights(String[] rightsList) { - - this.rightList = rightsList; - } - - public void setSources(String[] sourcesList) { - - this.sourceList = sourcesList; - } - - public void setSubjects(String[] subjectsList) { - - this.subjectList = subjectsList; - } - - public void setTitles(String[] titlesList) { - - this.titleList = titlesList; - } - - public void setTypes(String[] typesList) { - - this.typeList = typesList; - } - - /** - * Checking if necessary values are set and not allowed values are not set - * - * @param request - * the request from the client - * @return requestCheck indicating if the request is correct or not - */ - public boolean requestChecker(RequestType request) { - - boolean requestCheck; - - if (request.getFrom() != null || request.getUntil() != null - || request.getResumptionToken() != null) { - - requestCheck = false; - } else if (request.getSet() != null || request.getIdentifier() == null - || request.getMetadataPrefix() == null) { - requestCheck = false; - } - - else { - requestCheck = true; - } - - return requestCheck; - } - -} diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererAbstract.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererAbstract.java new file mode 100644 index 0000000000000000000000000000000000000000..8ffcb85d7158ea9223c29e097fc88b547dbc575b --- /dev/null +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererAbstract.java @@ -0,0 +1,82 @@ +package info.textgrid.middleware; + +import java.util.ArrayList; +import java.util.List; +import info.textgrid.middleware.oaipmh.RequestType; + +/** + * FIXME + * + * @author Maximilian Brodhun, SUB Göttingen + * @author Stefan E. Funk, SUB Göttingen + * @version 2019-03-07 + * @since 2019-03-07 + */ + +public abstract class RecordDelivererAbstract implements RecordDelivererInterface { + + protected boolean textgrid; + protected boolean dariah; + + /** + * @param textgrid + * @param dariah + */ + public RecordDelivererAbstract(boolean textgrid, boolean dariah) { + this.textgrid = textgrid; + this.dariah = dariah; + } + + /* + * (non-Javadoc) + * + * @see info.textgrid.middleware.RecordDelivererInterface#requestChecker(info.textgrid.middleware. + * oaipmh.RequestType) + */ + public static ErrorHandler requestChecker(RequestType request) { + + ErrorHandler result = new ErrorHandler(); + + // Check if metadata prefix is existing and valid. + if (request.getMetadataPrefix() != null + && !request.getMetadataPrefix().equals(TGConstants.METADATA_DC_PREFIX) + && !request.getMetadataPrefix().equals(TGConstants.METADATA_IDIOM_PREFIX)) { + result.setError(TGConstants.OAI_METADATA_FORMAT_ERROR, + "The value of the metadataPrefix: " + request.getMetadataPrefix() + + " is not supported by the item identified by the value of: " + + request.getIdentifier()); + } + + // Check if other params are existing, they shouldn't! + else { + + List<String> errorValues = new ArrayList<String>(); + if (request.getFrom() != null) { + errorValues.add("from"); + } + if (request.getResumptionToken() != null) { + errorValues.add("resumptionToken"); + } + if (request.getSet() != null) { + errorValues.add("set"); + } + if (request.getUntil() != null) { + errorValues.add("until"); + } + if (request.getMetadataPrefix() == null) { + errorValues.add("metadataPrefix"); + } + if (request.getIdentifier() == null) { + errorValues.add("identifier"); + } + if(errorValues.size()>0) { + result.setError(TGConstants.OAI_BAD_ARGUMENT, "The request includes illegal arguments " + + "or is missing required arguments: " + errorValues); + } + + } + + return result; + } + +} diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererDC.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererDC.java new file mode 100644 index 0000000000000000000000000000000000000000..2c2290c310dd8bbbbf7efce27dbf1a91cde12cfe --- /dev/null +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererDC.java @@ -0,0 +1,473 @@ +package info.textgrid.middleware; + +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; +import javax.xml.datatype.DatatypeConfigurationException; +import org.apache.commons.logging.LogFactory; +import org.elasticsearch.action.get.GetRequestBuilder; +import org.elasticsearch.action.get.GetResponse; +import info.textgrid.middleware.oaipmh.GetRecordType; +import info.textgrid.middleware.oaipmh.HeaderType; +import info.textgrid.middleware.oaipmh.OaiDcType; +import info.textgrid.middleware.oaipmh.ObjectFactory; +import info.textgrid.middleware.oaipmh.RecordType; +import info.textgrid.middleware.oaipmh.RequestType; + +/** + * FIXME + * + * @author Maximilian Brodhun SUB + * @version 1.1 + * @since 17.02.2014 + */ + +public class RecordDelivererDC extends RecordDelivererAbstract { + + private String[] fields; + private String[] workFields; + + private String formatField; + private String formatToFilter; + private String dateOfObjectCreation; + private String relationToFurtherMetadataObject; + private String repositoryObjectURIPrefix; + private String identifierField; + + /* + * Lists for the Dublin Core elements. Lists are needed since each DC fields is possible to occur + * several times + */ + + private List<String> contributors = new ArrayList<String>(); + private List<String> coverages = new ArrayList<String>(); + private List<String> creators = new ArrayList<String>(); + private List<String> dates = new ArrayList<String>(); + private List<String> descriptions = new ArrayList<String>(); + private List<String> formats = new ArrayList<String>(); + private List<String> identifiers = new ArrayList<String>(); + private List<String> languages = new ArrayList<String>(); + private List<String> publishers = new ArrayList<String>(); + private List<String> relations = new ArrayList<String>(); + private List<String> rights = new ArrayList<String>(); + private List<String> sources = new ArrayList<String>(); + private List<String> subjects = new ArrayList<String>(); + private List<String> titles = new ArrayList<String>(); + private List<String> types = new ArrayList<String>(); + + private String[] contributorList; + private String[] coverageList; + private String[] creatorList; + private String[] dateList; + private String[] descriptionList; + private String[] formatList; + private String[] identifierList; + private String[] languageList; + private String[] publisherList; + private String[] relationList; + private String[] relationForWorkList; + private String[] rightList; + private String[] sourceList; + private String[] subjectList; + private String[] titleList; + private String[] typeList; + + private static org.apache.commons.logging.Log log = LogFactory.getLog(RecordDelivererDC.class); + + private OAI_ESClient oaiEsClient; + + /** + * @param textgrid + * @param dariah + */ + public RecordDelivererDC(boolean textgrid, boolean dariah) { + super(textgrid, dariah); + } + + /* + * (non-Javadoc) + * + * @see info.textgrid.middleware.RecordDelivererInterface#getRecordById(java.lang.String) + */ + public GetRecordType getRecordById(String id) { + ObjectFactory of = new ObjectFactory(); + OaiDcType odt = new OaiDcType(); + GetRecordType grt = new GetRecordType(); + RecordType record = new RecordType(); + String changedId = id; + DublinCoreBuilder dbc = new DublinCoreBuilder(odt, of); + + if (id.startsWith(this.repositoryObjectURIPrefix)) { + changedId = changedId.replace(this.repositoryObjectURIPrefix, ""); + } + + GetRequestBuilder recordById = OAI_ESClient.getOaiESClient() + .prepareGet().setIndex(OAI_ESClient.getEsIndex()) + .setType(OAI_ESClient.getEsType()).setFields(this.fields) + .setId(changedId); + + GetResponse tgObject = recordById.execute().actionGet(); + + if (tgObject.isExists()) { + + String identifier; + + if (this.dariah == true) { + + putContentIntoDCFieldLists(tgObject); + // FIXME MAX!!!! DO CONFIGURE!!!! + + // System.out.println(identifierField); + identifier = tgObject.getField(this.identifierField).getValue().toString(); + // System.out.println("IDENTIFIER: " + identifier); + String dateOfCreation = "NO_DATE_SET!"; + + if (tgObject.getField(this.dateOfObjectCreation) != null) { + try { + dateOfCreation = OAIPMHUtillities + .convertDateFormat( + tgObject.getField(this.dateOfObjectCreation).getValue().toString()) + .toXMLFormat(); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (DatatypeConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + setRecordHeader(dateOfCreation, identifier, record, dbc); + } + + if (this.textgrid == true + && tgObject.getField(formatField).getValue().toString().equals(formatToFilter)) { + + String workUri = + tgObject.getField(this.relationToFurtherMetadataObject).getValue().toString(); + workUri = workUri.substring(this.repositoryObjectURIPrefix.length()); + putContentIntoDCFieldLists(tgObject, furtherDCElements(workUri)); + identifier = tgObject.getField(this.identifierField).getValue().toString(); + String dateOfCreation = tgObject.getField(this.dateOfObjectCreation).getValue().toString(); + setRecordHeader(dateOfCreation, identifier, record, dbc); + } + + setDCObject(odt, of, dbc); + record.setMetadata(dbc.getDC()); + grt.setRecord(record); + listClearer(); + + } else { + grt = null; + } + + return grt; + } + + // ** + // PRIVATE METHODS + // ** + + /** + * @param dateOfCreation + * @param identifier + * @param record + * @param dbc + * @return + */ + private static RecordType setRecordHeader(String dateOfCreation, String identifier, + RecordType record, DublinCoreBuilder dbc) { + + HeaderType recordHeader = new HeaderType(); + + recordHeader.setIdentifier(identifier); + recordHeader.setDatestamp(dateOfCreation); + record.setMetadata(dbc.getDC()); + record.setHeader(recordHeader); + + return record; + } + + /** + * @param id + * @return + */ + private GetResponse furtherDCElements(String id) { + + if (!id.endsWith(".0")) { + id = id.concat(".0"); + } + + GetRequestBuilder getWorkValues = OAI_ESClient.getOaiESClient() + .prepareGet().setIndex(OAI_ESClient.getEsIndex()) + .setType(OAI_ESClient.getEsType()).setId(id) + .setFields(this.workFields); + + GetResponse responseWorkValues = getWorkValues.execute().actionGet(); + + try { + if (responseWorkValues.getField(this.dateOfObjectCreation) != null) { + this.dates.add(OAIPMHUtillities + .convertDateFormat( + responseWorkValues.getField(this.dateOfObjectCreation).getValue().toString()) + .toXMLFormat()); + } + } catch (ParseException e) { + log.debug(e); + } catch (DatatypeConfigurationException e) { + log.debug(e); + } + + return responseWorkValues; + } + + /** + * @param responseWorkValues + * @param relatedWorkObject + */ + private void putContentIntoDCFieldLists(GetResponse responseWorkValues, + GetResponse relatedWorkObject) { + this.contributors = + DublinCoreFieldLoader.setContributor(responseWorkValues, this.contributorList); + this.formats = DublinCoreFieldLoader.setFormat(responseWorkValues, this.formatList); + this.identifiers = DublinCoreFieldLoader.setIdentifier(responseWorkValues, this.identifierList); + this.languages = DublinCoreFieldLoader.setLanguage(responseWorkValues, this.languageList); + this.publishers = DublinCoreFieldLoader.setPublisher(responseWorkValues, this.publisherList); + this.relations = + DublinCoreFieldLoader.setRelationForWork(responseWorkValues, this.relationList); + this.rights = DublinCoreFieldLoader.setRights(responseWorkValues, this.rightList); + this.sources = DublinCoreFieldLoader.setSources(responseWorkValues, this.sourceList); + this.titles = DublinCoreFieldLoader.setTitle(responseWorkValues, this.titleList); + this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues, this.coverageList); + this.creators = DublinCoreFieldLoader.setCreator(relatedWorkObject, this.creatorList); + this.dates = DublinCoreFieldLoader.setDate(relatedWorkObject, this.dateList); + this.descriptions = + DublinCoreFieldLoader.setDescription(relatedWorkObject, this.descriptionList); + this.relations = + DublinCoreFieldLoader.setRelationForWork(relatedWorkObject, this.relationForWorkList); + this.subjects = DublinCoreFieldLoader.setSubject(relatedWorkObject, this.subjectList); + this.types = DublinCoreFieldLoader.setType(relatedWorkObject, this.typeList); + } + + /** + * @param responseWorkValues + */ + private void putContentIntoDCFieldLists(GetResponse responseWorkValues) { + this.contributors = + DublinCoreFieldLoader.setContributor(responseWorkValues, this.contributorList); + this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues, this.coverageList); + this.creators = DublinCoreFieldLoader.setCreator(responseWorkValues, this.creatorList); + this.dates = DublinCoreFieldLoader.setDate(responseWorkValues, this.dateList); + this.descriptions = + DublinCoreFieldLoader.setDescription(responseWorkValues, this.descriptionList); + this.formats = DublinCoreFieldLoader.setFormat(responseWorkValues, this.formatList); + this.identifiers = DublinCoreFieldLoader.setIdentifier(responseWorkValues, this.identifierList); + this.languages = DublinCoreFieldLoader.setLanguage(responseWorkValues, this.languageList); + this.publishers = DublinCoreFieldLoader.setPublisher(responseWorkValues, this.publisherList); + this.relations = DublinCoreFieldLoader.setRelation(responseWorkValues, this.relationList); + this.rights = DublinCoreFieldLoader.setRights(responseWorkValues, this.rightList); + this.sources = DublinCoreFieldLoader.setSources(responseWorkValues, this.sourceList); + this.subjects = DublinCoreFieldLoader.setSubject(responseWorkValues, this.subjectList); + this.titles = DublinCoreFieldLoader.setTitle(responseWorkValues, this.titleList); + this.types = DublinCoreFieldLoader.setType(responseWorkValues, this.typeList); + } + + /** + * converting the textGrid elements into dublinCore elements + * + * @param odt container for the OAIPMH DublinCore element + * @param of jaxb object factory the DublinCore elements + */ + private void setDCObject(OaiDcType odt, ObjectFactory of, DublinCoreBuilder dbc) { + dbc.setContributor(this.contributors); + dbc.setCoverage(this.coverages); + dbc.setCreator(this.creators); + dbc.setDate(this.dates); + dbc.setDescription(this.descriptions); + dbc.setFormat(this.formats); + dbc.setIdentifier(this.identifiers); + dbc.setLanguage(this.languages); + dbc.setPublisher(this.publishers); + dbc.setRelation(this.relations); + dbc.setRights(this.rights); + dbc.setSource(this.sources); + dbc.setSubject(this.subjects); + dbc.setTitle(this.titles); + dbc.setType(this.types); + } + + /** + * + */ + private void listClearer() { + this.contributors.clear(); + this.coverages.clear(); + this.creators.clear(); + this.dates.clear(); + this.descriptions.clear(); + this.formats.clear(); + this.identifiers.clear(); + this.languages.clear(); + this.publishers.clear(); + this.relations.clear(); + this.rights.clear(); + this.sources.clear(); + this.subjects.clear(); + this.titles.clear(); + this.types.clear(); + } + + // ** + // GETTERS AND SETTERS + // ** + + /** + * @param formatToFilter + */ + public void setFormatToFilter(String formatToFilter) { + this.formatToFilter = formatToFilter; + } + + /** + * @param formatField + */ + public void setFormatField(String formatField) { + this.formatField = formatField; + } + + public String getDateOfObjectCreation() { + return this.dateOfObjectCreation; + } + + public void setDateOfObjectCreation(String dateOfObjectCreation) { + this.dateOfObjectCreation = dateOfObjectCreation; + } + + public String getRelationToFurtherMetadataObject() { + return this.relationToFurtherMetadataObject; + } + + public void setRelationToFurtherMetadataObject( + String relationToFurtherMetadataObject) { + this.relationToFurtherMetadataObject = relationToFurtherMetadataObject; + } + + public String getRepositoryObjectURIPrefix() { + return this.repositoryObjectURIPrefix; + } + + public void setRepositoryObjectURIPrefix(String repositoryObjectURIPrefix) { + this.repositoryObjectURIPrefix = repositoryObjectURIPrefix; + } + + public String getIdentifierField() { + return this.identifierField; + } + + public void setIdentifierField(String identifierPrefix) { + this.identifierField = identifierPrefix; + } + + public void setContributor(String[] contributorList) { + this.contributorList = contributorList; + } + + public String[] getContributor() { + return this.contributorList; + } + + public void setCoverage(String[] coveragesList) { + this.coverageList = coveragesList; + } + + public void setCreator(String[] creatorsList) { + this.creatorList = creatorsList; + } + + public void setDates(String[] datesList) { + this.dateList = datesList; + } + + public void setDescriptions(String[] descriptionsList) { + this.descriptionList = descriptionsList; + } + + public void setFormats(String[] formatsList) { + this.formatList = formatsList; + } + + public void setIdentifiers(String[] identifiersList) { + this.identifierList = identifiersList; + } + + public void setLanguages(String[] languagesList) { + this.languageList = languagesList; + } + + public void setPublishers(String[] publishersList) { + this.publisherList = publishersList; + } + + public void setRelations(String[] relationsList) { + this.relationList = relationsList; + } + + public void setRelationsForWork(String[] relationsList) { + this.relationForWorkList = relationsList; + } + + public void setRights(String[] rightsList) { + this.rightList = rightsList; + } + + public void setSources(String[] sourcesList) { + this.sourceList = sourcesList; + } + + public void setSubjects(String[] subjectsList) { + this.subjectList = subjectsList; + } + + public void setTitles(String[] titlesList) { + this.titleList = titlesList; + } + + public void setTypes(String[] typesList) { + this.typeList = typesList; + } + + /** + * @return + */ + public OAI_ESClient getOaiEsClient() { + return this.oaiEsClient; + } + + /** + * @param oaiEsClient + */ + public void setOaiEsClient(OAI_ESClient oaiEsClient) { + this.oaiEsClient = oaiEsClient; + } + + /** + * @return + */ + public String[] getWorkFields() { + return this.workFields; + } + + public void setWorkFields(String[] workFields) { + this.workFields = workFields; + } + + public void setFields(String[] fields) { + this.fields = fields; + } + + public String[] getFields() { + return this.fields; + } + + + +} diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java new file mode 100644 index 0000000000000000000000000000000000000000..6af7ce1f9774c25bbcaed1ee3de930675dcdfd7e --- /dev/null +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java @@ -0,0 +1,158 @@ +package info.textgrid.middleware; + +import java.io.StringReader; +import java.text.ParseException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; +import org.xml.sax.InputSource; + +import org.apache.commons.logging.LogFactory; +import org.classicmayan.tools.ClassicMayanMetsMods; +import org.elasticsearch.action.get.GetRequestBuilder; +import org.elasticsearch.action.get.GetResponse; + +import info.textgrid.middleware.oaipmh.GetRecordType; +import info.textgrid.middleware.oaipmh.HeaderType; +import info.textgrid.middleware.oaipmh.MetadataType; +import info.textgrid.middleware.oaipmh.RecordType; + +/** + * + * @author Maximilian Brodhun, SUB Göttingen + * @since 2019-03-08 + * @version 2019-03-12 + * + */ + +public class RecordDelivererIDIOM extends RecordDelivererAbstract { + + private String dateOfObjectCreation; + private String dateOfLastOblectModification; + + static MetadataType metadataMets = new MetadataType(); + RecordType record = new RecordType(); + ClassicMayanMetsMods metsmods; + + private static org.apache.commons.logging.Log log = LogFactory.getLog(RecordDelivererIDIOM.class); + + /** + * @param textgrid + * @param dariah + */ + public RecordDelivererIDIOM(boolean textgrid, boolean dariah) { + super(textgrid, dariah); + } + + /* + * (non-Javadoc) + * + * @see info.textgrid.middleware.RecordDelivererInterface#getRecordById(java.lang.String) + */ + + /** + * ElasticSearch request in non-public index to get the datestamps for + * the object creation and last modification date in TextGrid-Repo + * + * @param idInDatabase + */ + + public void setDatestamps(String idInDatabase) { + + GetRequestBuilder recordById = OAI_ESClient.getOaiESClient() + .prepareGet() + .setIndex("textgrid-nonpublic") + .setType(OAI_ESClient.getEsType()) + .setFields(TGConstants.CREATED, TGConstants.MODIFIED_FIELD) + .setId(idInDatabase.replace("textgrid:", "") + ".0"); + + GetResponse objectInDatabase = recordById.execute().actionGet(); + + dateOfObjectCreation = objectInDatabase.getField(TGConstants.CREATED).getValue().toString(); + dateOfLastOblectModification = objectInDatabase.getField(TGConstants.MODIFIED_FIELD).getValue().toString(); + } + + /** + * building the record XML object for the OAI-PMH response + */ + + public GetRecordType getRecordById(String id) { + + GetRecordType grt = new GetRecordType(); + + setDatestamps(id); + String textgridBaseURI_FromID; + if(!id.startsWith("textgrid:")) { + textgridBaseURI_FromID = "textgrid:" + id.replace(".0", ""); + }else { + textgridBaseURI_FromID = id; + } + + metsmods = new ClassicMayanMetsMods( + textgridBaseURI_FromID, + dateOfObjectCreation, + dateOfLastOblectModification); + record.setMetadata(idiomMets()); + try { + if(!id.startsWith("textgrid:")) { + setRecordHeader(dateOfObjectCreation, "textgrid:" + id); + }else { + setRecordHeader(dateOfObjectCreation, id); + } + } catch (ParseException e) { + e.printStackTrace(); + //log.error(e.printStackTrace()); + } + + grt.setRecord(record); + + return grt; + } + + // ** + // PRIVATE METHODS + // ** + + /** + * Getting the Mets/Mods object for the ClassicMayan artefact + * and put them into metadata element of the OAI-PMH response + * @return metadata XML-Elment + */ + + private MetadataType idiomMets(){ + + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder; + + try + { + builder = factory.newDocumentBuilder(); + Document doc = builder.parse( new InputSource( new StringReader( metsmods.getMets() ) ) ); + metadataMets.setAny(doc.getDocumentElement()); + } catch (Exception e) { + e.printStackTrace(); + } + + return metadataMets; + } + + + + /** + * @param dateOfCreation + * @param identifier + * @return + * @throws ParseException + */ + private void setRecordHeader(String dateOfCreation, String identifier) throws ParseException { + + HeaderType recordHeader = new HeaderType(); + recordHeader.setIdentifier(identifier); + recordHeader.setDatestamp(OAIPMHUtillities.datestampAsString(dateOfCreation)); + record.setHeader(recordHeader); + //return recordHeader; + } + +} diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererInterface.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..8e0ee0a8d193f5c368413e6b562d666e8bbefa9c --- /dev/null +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererInterface.java @@ -0,0 +1,26 @@ +package info.textgrid.middleware; + +import info.textgrid.middleware.oaipmh.GetRecordType; + +/** + * FIXME + * + * @author Maximilian Brodhun, SUB Göttingen + * @author Stefan E. Funk, SUB Göttingen + * @version 2019-03-07 + * @since 2019-03-07 + */ + +public interface RecordDelivererInterface { + + /** + * <p> + * Query database (whatever) for specific dataset. + * </p> + * + * @param id identifier within database + * @return Get the GetRecord response for the request + */ + GetRecordType getRecordById(String id); + +} diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java similarity index 94% rename from oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java rename to oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java index fbbb6aee85177cb8b418b46bccfb3d92c3b61a44..cff9212f9d30a06c849120af1489f04c5a2d4607 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererDC.java @@ -29,23 +29,21 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType; /** * FIXME Care about all repeatable fields as done in TITLE! */ -public class RecordListDeliverer { +public class RecordListDelivererDC extends RecordListDelivererAbstract{ // ** // STATICS // ** - private static org.apache.commons.logging.Log log = LogFactory.getLog(RecordDeliverer.class); + private static org.apache.commons.logging.Log log = LogFactory.getLog(OAIPMHImpl.class); // ** // CLASS VARIABLES // ** - // private OAI_ESClient oaiEsClient; + private OAI_ESClient oaiEsClient; private String[] fields; private String[] workFields; - private boolean textgrid; - private boolean dariah; private String formatField; private String formatToFilter; private String dateOfObjectCreation; @@ -105,13 +103,8 @@ public class RecordListDeliverer { * @param textgrid * @param dariah */ - public RecordListDeliverer(String[] fields, String[] workFields, boolean textgrid, - boolean dariah) { - // this.oaiEsClient = oaiEsClient; - this.fields = fields; - this.workFields = workFields; - this.textgrid = textgrid; - this.dariah = dariah; + public RecordListDelivererDC(boolean textgrid, boolean dariah) { + super(textgrid, dariah); } /** @@ -169,9 +162,15 @@ public class RecordListDeliverer { } if (resumptionToken == null) { - scrollResp = OAI_ESClient.getOaiESClient().prepareSearch(OAI_ESClient.getEsIndex()) - .setScroll(new TimeValue(lifeTimeResToken)).setTypes(OAI_ESClient.getEsType()) - .addFields(this.fields).setQuery(recordFilter).setSize(searchResponseSize).execute() + + scrollResp = OAI_ESClient.getOaiESClient() + .prepareSearch(OAI_ESClient.getEsIndex()) + .setScroll(new TimeValue(lifeTimeResToken)) + .setTypes(OAI_ESClient.getEsType()) + .addFields(this.fields) + .setQuery(recordFilter) + .setSize(searchResponseSize) + .execute() .actionGet(); } else { scrollResp = OAI_ESClient.getOaiESClient().prepareSearchScroll(resumptionToken) @@ -179,15 +178,14 @@ public class RecordListDeliverer { } scrollID = scrollResp.getScrollId(); - long completeListSize = scrollResp.getHits().totalHits(); - // System.out.println("LISTSIZE: " + completeListSize); + long completeListSize = scrollResp.getHits().totalHits(); if (completeListSize > 0) { setFoundItems(true); - + int i = 0; - + for (SearchHit hit : scrollResp.getHits().getHits()) { i++; @@ -205,14 +203,16 @@ public class RecordListDeliverer { log.debug(e1); } modifiedValue = hit.getFields().get(this.modifiedField).getValue().toString(); + // TextGrid search! String workUri = ""; + if (this.textgrid == true && hit.getFields().get(formatField).values().get(0).toString() .equals(formatToFilter)) { if (hit.getFields().get(this.relationToFurtherMetadataObject) != null) { workUri = hit.getFields().get(this.relationToFurtherMetadataObject).values().get(0) .toString().substring(this.repositoryObjectURIPrefix.length()); - + if (!workUri.endsWith(".0")) { workUri = workUri.concat(".0"); } @@ -220,8 +220,9 @@ public class RecordListDeliverer { putContentIntoDCFieldLists(hit, furtherDCElements(workUri, OAI_ESClient.getOaiESClient())); + buildRecord(recordList, set, - hit.getFields().get(this.identifierField).getValue().toString()); + hit.getFields().get(this.identifierField).getValue().toString()); listClearer(); } @@ -361,9 +362,6 @@ public class RecordListDeliverer { QueryBuilder matchQuery = QueryBuilders.matchPhraseQuery(queryField, valueField); QueryBuilder boolQuery = QueryBuilders.boolQuery().must(rangeQuery).must(matchQuery); query = boolQuery; - -// System.out.println(query); - } else { query = rangeQuery; } @@ -651,24 +649,6 @@ public class RecordListDeliverer { this.typeList = typesList; } - /** - * @param request - * @return - */ - public boolean requestChecker(RequestType request) { - - boolean requestCheck; - - if (request.getIdentifier() != null || request.getMetadataPrefix() == null) { - - requestCheck = false; - } else { - requestCheck = true; - } - - return requestCheck; - } - /** * @return */ @@ -707,6 +687,10 @@ public class RecordListDeliverer { this.searchResponseSize = Integer.parseInt(searchResponseSize); } + public boolean getTextGrid() { + return textgrid; + } + // public String getCollectionTitle() { // return collectionTitle; // } @@ -714,5 +698,39 @@ public class RecordListDeliverer { // public void setCollectionTitle(GetResponse responseWorkValues) { // this.collectionTitle = responseWorkValues.getField("metadata.dc:title").getValue().toString(); // } + /** + * @return + */ + public String[] getWorkFields() { + return this.workFields; + } + + /** + * @param workFields + */ + public void setWorkFields(String[] workFields) { + this.workFields = workFields; + } + + public void setFields(String[] fields) { + this.fields = fields; + } + + public String[] getFields() { + return this.fields; + } + + /** + * @return + */ + public OAI_ESClient getOaiEsClient() { + return this.oaiEsClient; + } + /** + * @param oaiEsClient + */ + public void setOaiEsClient(OAI_ESClient oaiEsClient) { + this.oaiEsClient = oaiEsClient; + } } diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java index d9549991a32c59049bb91f18da8b8dc7feb492c0..94752cd75868478429d2515d92dea0cecd97c0d4 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java @@ -3,7 +3,7 @@ package info.textgrid.middleware; import info.textgrid.middleware.oaipmh.ListSetsType; import info.textgrid.middleware.oaipmh.SetType; import info.textgrid.namespaces.middleware.tgcrud.common.TextGridMimetypes; -import info.textgrid.utils.sesameclient.SesameClient; + import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.Hashtable; @@ -27,7 +27,6 @@ public class SetDeliverer { private static Map<String, String> setSet = new Hashtable<String, String>(); private OAI_ESClient oaiEsClient; - private SesameClient sparqlClient; private Set<String> identifier = new LinkedHashSet<String>(); private String formatField; private String formatToFilter; @@ -255,17 +254,5 @@ public class SetDeliverer { this.dariah = dariah; } - /** - * @return - */ - public SesameClient getSparqlClient() { - return this.sparqlClient; - } - /** - * @param sparqlClient - */ - public void setSparqlClient(SesameClient sparqlClient) { - this.sparqlClient = sparqlClient; - } } diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java index 307aba47fe2b2ec214b95ca6279b1f63796352f8..053d8eb20dac154284c5cca4d70424d9c8bc1f04 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java @@ -1,21 +1,18 @@ package info.textgrid.middleware; import java.text.ParseException; - -import info.textgrid.middleware.oaipmh.DeletedRecordType; -import info.textgrid.middleware.oaipmh.GranularityType; -import info.textgrid.middleware.oaipmh.OAIPMHType; -import info.textgrid.namespaces.middleware.tgcrud.common.TextGridMimetypes; -import info.textgrid.utils.sesameclient.SesameClient; - import javax.xml.bind.JAXB; import javax.xml.bind.JAXBElement; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.XMLGregorianCalendar; - import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; +import info.textgrid.middleware.oaipmh.DeletedRecordType; +import info.textgrid.middleware.oaipmh.GranularityType; +import info.textgrid.middleware.oaipmh.OAIPMHType; +import info.textgrid.namespaces.middleware.tgcrud.common.TextGridMimetypes; +import info.textgrid.utils.sesameclient.SesameClient; /** * @@ -23,503 +20,580 @@ import org.junit.Test; public class OaiPmhTest { - public static OAI_ESClient oaiEsClient; - private static SesameClient sc; - DeletedRecordType bla = DeletedRecordType.NO; - GranularityType bla2 = GranularityType.YYYY_MM_DD_THH_MM_SS_Z; - private RepIdentification rep = new RepIdentification( - "TextGrid-Repository", "www.textgridrep.de", this.bla, - "2011-06-11T02:32:40Z", this.bla2, "2.0", - "textgrid-support@gwdg.de"); - - // private RecordDeliverer record = new RecordDeliverer( - // oaiEsClient, - // TGConstants.TGWorkFields, - // true, false); - //private RecordDeliverer record = new RecordDeliverer(oaiEsClient, DARIAHConstants.DARIAHFields, false, true); - - private RecordDeliverer record = new RecordDeliverer(oaiEsClient, TGConstants.TGFields, true, false); - - //private RecordListDeliverer recordList = new RecordListDeliverer(TGConstants.TGFields, TGConstants.TGWorkFields, true, false); - - private RecordListDeliverer recordList = new RecordListDeliverer(DARIAHConstants.DARIAHFields, DARIAHConstants.DARIAHFields, false, true); - - - // TGConstants.TGWorkFields, true, false); - private MetadataFormatListDeliverer metadataFormatList = new MetadataFormatListDeliverer(oaiEsClient); - private SetDeliverer setListDARIAH = new SetDeliverer(oaiEsClient, false, true); - private SetDeliverer setListTextGrid = new SetDeliverer(oaiEsClient, true, false); - //private IdentifierListDeliverer identifierList = new IdentifierListDeliverer(oaiEsClient, false, true); - private IdentifierListDeliverer identifierList = new IdentifierListDeliverer(oaiEsClient, true, false); - private OAIPMHImpl request = new OAIPMHImpl(oaiEsClient, this.rep, this.record, this.recordList, this.metadataFormatList, this.setListDARIAH, this.identifierList); - - /** - * @throws Exception - */ - @BeforeClass - public static void setUp() throws Exception { - - //sc = new SesameClient("http://localhost:9091/openrdf-workbench/repositories/textgrid-public"); - oaiEsClient = new OAI_ESClient("localhost", "9302", "tg-esx2-instance"); - //oaiEsClient = new OAI_ESClient("localhost", "9302", "dariah-repository-prototype"); - OAI_ESClient.setEsIndex("textgrid-public"); - OAI_ESClient.setEsType("metadata"); - //oaiEsClient.setEsIndex("dariahreptest"); - //oaiEsClient.setEsType("oai"); - } - - /** - * @throws DatatypeConfigurationException - */ - @Test - @Ignore - public void testDateNow() throws DatatypeConfigurationException { - System.out.println("---------------Now Version-----------------"); - XMLGregorianCalendar nowTest = OAIPMHUtillities - .getXMLGregorianCalendarNow(); - System.out.println(nowTest); - System.out.println("-------------------------------------------"); - } - - /** - * @throws ParseException - * @throws DatatypeConfigurationException - */ - @Test - @Ignore - public void testDateGregorianType() throws ParseException, - DatatypeConfigurationException { - String dateformatbefore = "2012-02-06T20:48:39.614+01:00"; - - System.out.println("---------XML Gregorian Version---------------"); - System.out.println("Original date: " + dateformatbefore); - XMLGregorianCalendar testDate = OAIPMHUtillities - .convertDateFormat(dateformatbefore); - System.out.println("Date after conversion: " + testDate); - System.out.println("---------------------------------------------"); - } - - /** - * @throws ParseException - * @throws DatatypeConfigurationException - */ - @Test - @Ignore - public void testDateStringType() throws ParseException, - DatatypeConfigurationException { - String dateformatbefore = "2012-02-06T20:48:39.614+01:00"; - - System.out.println("------------String Version-------------------"); - System.out.println("Original date: " + dateformatbefore); - String testDate = OAIPMHUtillities.datestampAsString(dateformatbefore); - System.out.println("Date after conversion: " + testDate); - System.out.println("---------------------------------------------"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testGetRequestIdentify() throws ParseException { - - System.out - .println("Test for the verb \"Identify\" with succesfull response"); - JAXBElement<OAIPMHType> r = this.request.getRequest("Identify", "", "", - "", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testGetRequestIdentifyVerbError() throws ParseException { - JAXBElement<OAIPMHType> t = this.request.getRequest("Identify", "", - "a", "", "", "", ""); - JAXB.marshal(t, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testGetRequestIdentifyArgumentError() throws ParseException { - System.out - .println("Test for the verb \"Identify\" with error response"); - JAXBElement<OAIPMHType> z = this.request.getRequest("Identify", "a", - "", "", "", "a", ""); - JAXB.marshal(z, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testGetRequestGetRecordError() throws ParseException { - - System.out - .println("Test for the verb \"GetRecord\" with succesfull response"); - JAXBElement<OAIPMHType> t = this.request.getRequest("GetRecord", - "textgrid:vqn0.0", "oai_dc", "", "", "", ""); - JAXB.marshal(t, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testGetRequestGetRecordError2() throws ParseException { - - this.record.setContributor(TGConstants.CONTRIBUTOR_LIST); - this.record.setCoverage(TGConstants.COVERAGE_LIST); - this.record.setCreator(TGConstants.CREATOR_LIST); - this.record.setDates(TGConstants.DATE_LIST); - this.record.setDescriptions(TGConstants.DESCRIPTION_LIST); - this.record.setFormats(TGConstants.FORMAT_LIST); - this.record.setIdentifiers(TGConstants.IDENTIFIER_LIST); - this.record.setLanguages(TGConstants.LANGUAGE_LIST); - this.record.setPublishers(TGConstants.PUBLISHER_LIST); - this.record.setRelations(TGConstants.RELATIONS_LIST); - this.record.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); - this.record.setRights(TGConstants.RIGHTS_LIST); - this.record.setSources(TGConstants.SOURCE_LIST); - this.record.setSubjects(TGConstants.SUBJECT_LIST); - this.record.setTitles(TGConstants.TITLE_LIST); - this.record.setTypes(TGConstants.TYPE_LIST); - this.record.setFields(TGConstants.TGFields); - this.record.setFormatField(TGConstants.FORMAT); - this.record.setFormatToFilter(TextGridMimetypes.EDITION); - this.record.setDateOfObjectCreation(TGConstants.CREATED); - this.record.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); - this.record.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); - this.record.setIdentifierField("textgridUri"); - - System.out.println("Test for the verb \"GetRecord\" with succesfull response"); - JAXBElement<OAIPMHType> p = this.request.getRequest("GetRecord","wr71.0", "oai_dc", "", "", "", ""); - JAXB.marshal(p, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testGetRequestGetRecordDariah() throws ParseException { - - this.record.setContributor(DARIAHConstants.CONTRIBUTOR_LIST); - this.record.setCoverage(DARIAHConstants.COVERAGE_LIST); - this.record.setCreator(DARIAHConstants.CREATOR_LIST); - this.record.setDates(DARIAHConstants.DATE_LIST); - this.record.setDescriptions(DARIAHConstants.DESCRIPTION_LIST); - this.record.setFormats(DARIAHConstants.FORMAT_LIST); - this.record.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); - this.record.setLanguages(DARIAHConstants.LANGUAGE_LIST); - this.record.setPublishers(DARIAHConstants.PUBLISHER_LIST); - this.record.setRelations(DARIAHConstants.RELATIONS_LIST); - this.record.setRights(DARIAHConstants.RIGHTS_LIST); - this.record.setSources(DARIAHConstants.SOURCE_LIST); - this.record.setSubjects(DARIAHConstants.SUBJECT_LIST); - this.record.setTitles(DARIAHConstants.TITLE_LIST); - this.record.setTypes(DARIAHConstants.TYPE_LIST); - this.record.setFields(DARIAHConstants.DARIAHFields); - this.record.setFormatField(DARIAHConstants.FORMAT); - this.record.setFormatToFilter("metadata"); - this.record.setDateOfObjectCreation(DARIAHConstants.MODIFIED_FIELD); - this.record.setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); - this.record.setIdentifierField("administrativeMetadata.dcterms:identifier"); - - System.out.println("Test for the verb \"GetRecord\" with succesfull response"); - JAXBElement<OAIPMHType> p = this.request.getRequest("GetRecord","hdl:21.T11991/0000-0003-5667-9", "oai_dc", "", "", "", ""); - JAXB.marshal(p, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testGetRequestGetRecordError3() throws ParseException { - System.out - .println("Test for the verb \"GetRecord\" with succesfull response"); - JAXBElement<OAIPMHType> p = this.request.getRequest("GetRecord", "", - "", "", "", "", ""); - JAXB.marshal(p, System.out); - System.out.println("-----------------------------------\n"); - - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListIdentifierSets() throws ParseException { - this.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); - this.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); - this.identifierList.setFormatField(TGConstants.FORMAT); - this.identifierList.setFormatToFilter(TextGridMimetypes.EDITION); - this.identifierList.setDateOfObjectCreation(TGConstants.CREATED); - this.identifierList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); - this.identifierList.setIdentifierField("textgridUri"); - - System.out.println("Test for the verb \"ListIdentifiers\" with succesfull response"); - JAXBElement<OAIPMHType> p = this.request.getRequest("ListIdentifiers","", "oai_dc", "project:TGPR-26236625-1acc-b921-a5fa-53567c3eeb80", "", "", ""); - JAXB.marshal(p, System.out); - System.out.println("-----------------------------------\n"); - - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListRecordSets() throws ParseException { - this.recordList.setContributor(TGConstants.CONTRIBUTOR_LIST); - this.recordList.setCoverage(TGConstants.COVERAGE_LIST); - this.recordList.setCreators(TGConstants.CREATOR_LIST); - this.recordList.setDates(TGConstants.DATE_LIST); - this.recordList.setDescriptions(TGConstants.DESCRIPTION_LIST); - this.recordList.setFormats(TGConstants.FORMAT_LIST); - this.recordList.setIdentifiers(TGConstants.IDENTIFIER_LIST); - this.recordList.setLanguages(TGConstants.LANGUAGE_LIST); - this.recordList.setPublishers(TGConstants.PUBLISHER_LIST); - this.recordList.setRelations(TGConstants.RELATIONS_LIST); - this.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); - this.recordList.setRights(TGConstants.RIGHTS_LIST); - this.recordList.setSources(TGConstants.SOURCE_LIST); - this.recordList.setSubjects(TGConstants.SUBJECT_LIST); - this.recordList.setTitles(TGConstants.TITLE_LIST); - this.recordList.setTypes(TGConstants.TYPE_LIST); - this.recordList.setFormatField(TGConstants.FORMAT); - this.recordList.setFormatToFilter(TextGridMimetypes.EDITION); - this.recordList.setDateOfObjectCreation(TGConstants.CREATED); - this.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); - this.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); - this.recordList.setFieldForRange(TGConstants.CREATED); - this.recordList.setModifiedField(TGConstants.MODIFIED_FIELD); - - System.out.println("Test for the verb \"ListRecord\" with sets with succesfull response"); - JAXBElement<OAIPMHType> p = this.request.getRequest("ListRecords", "","oai_dc", "", "", "", ""); - JAXB.marshal(p, System.out); - System.out.println("-----------------------------------\n"); - - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListRecords() throws ParseException { - - JAXBElement<OAIPMHType> r = this.request.getRequest("ListRecords", "","oai_dc", "", "2011-02-06T20:48:39", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListRecords2() throws ParseException { - - System.out.println("TG"); - - this.recordList.setContributor(TGConstants.CONTRIBUTOR_LIST); - this.recordList.setCoverage(TGConstants.COVERAGE_LIST); - this.recordList.setCreators(TGConstants.CREATOR_LIST); - this.recordList.setDates(TGConstants.DATE_LIST); - this.recordList.setDescriptions(TGConstants.DESCRIPTION_LIST); - this.recordList.setFormats(TGConstants.FORMAT_LIST); - this.recordList.setIdentifiers(TGConstants.IDENTIFIER_LIST); - this.recordList.setLanguages(TGConstants.LANGUAGE_LIST); - this.recordList.setPublishers(TGConstants.PUBLISHER_LIST); - this.recordList.setRelations(TGConstants.RELATIONS_LIST); - this.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); - this.recordList.setRights(TGConstants.RIGHTS_LIST); - this.recordList.setSources(TGConstants.SOURCE_LIST); - this.recordList.setSubjects(TGConstants.SUBJECT_LIST); - this.recordList.setTitles(TGConstants.TITLE_LIST); - this.recordList.setTypes(TGConstants.TYPE_LIST); - this.recordList.setFormatField(TGConstants.FORMAT); - this.recordList.setFormatToFilter(TextGridMimetypes.EDITION); - this.recordList.setDateOfObjectCreation(TGConstants.CREATED); - this.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); - this.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); - this.recordList.setFieldForRange(TGConstants.CREATED); - this.recordList.setModifiedField(TGConstants.CREATED); - this.recordList.setIdentifierField("textgridUri"); - this.recordList.setSearchResponseSize("100"); - - JAXBElement<OAIPMHType> r = this.request.getRequest("ListRecords", "","oai_dc", "", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListRecordsDariah() throws ParseException { - - //System.out.println("BUJA"); - - this.recordList.setContributor(DARIAHConstants.CONTRIBUTOR_LIST); - this.recordList.setCoverage(DARIAHConstants.COVERAGE_LIST); - this.recordList.setCreators(DARIAHConstants.CREATOR_LIST); - this.recordList.setDates(DARIAHConstants.DATE_LIST); - this.recordList.setDescriptions(DARIAHConstants.DESCRIPTION_LIST); - this.recordList.setFormats(DARIAHConstants.FORMAT_LIST); - this.recordList.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); - this.recordList.setLanguages(DARIAHConstants.LANGUAGE_LIST); - this.recordList.setPublishers(DARIAHConstants.PUBLISHER_LIST); - this.recordList.setRelations(DARIAHConstants.RELATIONS_LIST); - this.recordList.setRights(DARIAHConstants.RIGHTS_LIST); - this.recordList.setSources(DARIAHConstants.SOURCE_LIST); - this.recordList.setSubjects(DARIAHConstants.SUBJECT_LIST); - this.recordList.setTitles(DARIAHConstants.TITLE_LIST); - this.recordList.setTypes(DARIAHConstants.TYPE_LIST); - this.recordList.setFormatField(DARIAHConstants.FORMAT); - this.recordList.setDateOfObjectCreation(DARIAHConstants.CREATED); - this.recordList.setFieldForRange(DARIAHConstants.MODIFIED_FIELD); - this.recordList.setDateOfObjectCreation(DARIAHConstants.RANGE_FIELD); - this.recordList.setIdentifierField(DARIAHConstants.IDENTIFIER); - this.recordList.setFormatToFilter(TextGridMimetypes.DARIAH_COLLECTION); - this.recordList.setModifiedField(DARIAHConstants.MODIFIED_FIELD); - this.recordList.setRelationToFurtherMetadataObject("descriptiveMetadata.dc:relation"); - this.recordList.setSearchResponseSize("100"); - - JAXBElement<OAIPMHType> r = this.request.getRequest("ListRecords", "","oai_dc", "21.T11991/0000-0003-718E-E", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListMetadataFormats() throws ParseException { - JAXBElement<OAIPMHType> r = this.request.getRequest( - "ListMetadataFormats", "7t.0", "", "", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListMetadataFormatsWithoutID() throws ParseException { - JAXBElement<OAIPMHType> r = this.request.getRequest( - "ListMetadataFormats", "", "", "", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListSets() throws ParseException { - System.out.println("bla"); - this.setListTextGrid.setFormatField("format"); - this.setListTextGrid.setFormatToFilter(TextGridMimetypes.DARIAH_COLLECTION); - this.setListTextGrid.setIdentifierField("textgridUri"); - this.setListTextGrid.setRepositoryObjectURIPrefix("textgrid:"); - JAXBElement<OAIPMHType> r = this.request.getRequest("ListSets", "", "", "", "", "", ""); - - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListSetsDARIAH() throws ParseException { - System.out.println("TEST DARIAH"); - - this.setListDARIAH.setFormatField(DARIAHConstants.FORMAT); - this.setListDARIAH.setFormatToFilter(DARIAHConstants.COLLECTION_MIMETYPE); - this.setListDARIAH.setIdentifierField(DARIAHConstants.IDENTIFIER); - this.setListDARIAH.setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); - this.setListDARIAH.setIdentifierField("administrativeMetadata.dcterms:identifier"); - this.setListDARIAH.setSpecField("descriptiveMetadata.dc:title"); - this.setListDARIAH.setSpecFieldPrefix(DARIAHConstants.COLLECTIONREGISTRY_PREFIX); - JAXBElement<OAIPMHType> r = this.request.getRequest("ListSets", "", "", "", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - /** - * @throws ParseException - */ - @Test - @Ignore - public void testListIdentifiers() throws ParseException { - this.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); - this.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); - this.identifierList.setFormatField(TGConstants.FORMAT); - this.identifierList.setFormatToFilter(TextGridMimetypes.EDITION); - this.identifierList.setDateOfObjectCreation(TGConstants.CREATED); - this.identifierList.setIdentifierField("textgridUri"); - this.identifierList.setRepositoryObjectURIPrefix("textgrid:"); - this.identifierList.setSearchResponseSize("100"); - JAXBElement<OAIPMHType> r = this.request.getRequest("ListIdentifiers", "", "oai_dc", "project:TGPR-f2242b43-bc28-712e-59ca-54801b1bbf52", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - @Test - @Ignore - public void testListIdentifiersDARIAH() throws ParseException { - this.identifierList.setFieldForRange(DARIAHConstants.RANGE_FIELD); - this.identifierList.setIdentifierListFields(DARIAHConstants.IDENTIFIER_LIST_FIELDS); - this.identifierList.setFormatField(DARIAHConstants.FORMAT); - // this.identifierList.setFormatToFilter(TextGridMimetypes.EDITION); - this.identifierList.setDateOfObjectCreation("administrativeMetadata.dcterms:modified"); - this.identifierList.setRepositoryObjectURIPrefix("hdl:"); - this.identifierList.setIdentifierField("administrativeMetadata.dcterms:identifier"); - this.identifierList.setSearchResponseSize("100"); - //System.out.println("BLABLUBB"); - JAXBElement<OAIPMHType> r = this.request.getRequest("ListIdentifiers","", "oai_dc", "", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } - - - @Test - @Ignore - public void testEmptyRequest() throws ParseException { - this.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); - this.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); - this.identifierList.setFormatField(TGConstants.FORMAT); - this.identifierList.setFormatToFilter(TextGridMimetypes.EDITION); - this.identifierList.setDateOfObjectCreation(TGConstants.CREATED); - this.identifierList.setIdentifierField("textgridUri"); - this.identifierList.setRepositoryObjectURIPrefix("textgrid:"); - this.identifierList.setSearchResponseSize("100"); - JAXBElement<OAIPMHType> r = this.request.getRequest("", "", "", "", "", "", ""); - JAXB.marshal(r, System.out); - System.out.println("-----------------------------------\n"); - } + public static OAI_ESClient oaiEsClient; + private static SesameClient sc; + DeletedRecordType bla = DeletedRecordType.NO; + GranularityType bla2 = GranularityType.YYYY_MM_DD_THH_MM_SS_Z; + private RepIdentification rep = new RepIdentification("TextGrid-Repository", "www.textgridrep.de", + this.bla, "2011-06-11T02:32:40Z", this.bla2, "2.0", "textgrid-support@gwdg.de"); + + // private RecordDeliverer record = new RecordDeliverer( + // oaiEsClient, + // TGConstants.TGWorkFields, + // true, false); + // private RecordDeliverer record = new RecordDeliverer(oaiEsClient, DARIAHConstants.DARIAHFields, + // false, true); + + private static RecordDelivererDC record; + private static RecordDelivererIDIOM recordIDIOM; + // private RecordListDeliverer recordList = new RecordListDeliverer(TGConstants.TGFields, + // TGConstants.TGWorkFields, true, false); + + private static RecordListDelivererDC recordList; + private static RecordListDelivererIDIOM recordListIDIOM; + + private static IdentifierListDelivererDC identifierList; + private static IdentifierListDelivererIDIOM identifierListIDIOM = new IdentifierListDelivererIDIOM(true, false); + // TGConstants.TGWorkFields, true, false); + private MetadataFormatListDeliverer metadataFormatList = new MetadataFormatListDeliverer(oaiEsClient); + private SetDeliverer setListDARIAH = new SetDeliverer(oaiEsClient, false, true); + private SetDeliverer setListTextGrid = new SetDeliverer(oaiEsClient, true, false); + // private IdentifierListDeliverer identifierList = new IdentifierListDeliverer(oaiEsClient, + // false, true); + + private OAIPMHImpl request = new OAIPMHImpl(this.rep, OaiPmhTest.record, OaiPmhTest.recordIDIOM, OaiPmhTest.recordList, + OaiPmhTest.recordListIDIOM, this.metadataFormatList, this.setListDARIAH, OaiPmhTest.identifierList, OaiPmhTest.identifierListIDIOM); + + /** + * @throws Exception + */ + @BeforeClass + public static void setUp() throws Exception { + + // sc = new + // SesameClient("http://localhost:9091/openrdf-workbench/repositories/textgrid-public"); + oaiEsClient = new OAI_ESClient("localhost", "9302", "tg-esx2-instance"); + // oaiEsClient = new OAI_ESClient("localhost", "9302", "dariah-repository-prototype"); + OAI_ESClient.setEsIndex("textgrid-public"); + OAI_ESClient.setEsType("metadata"); + // oaiEsClient.setEsIndex("dariahreptest"); + // oaiEsClient.setEsType("oai"); + + // Set OSI client for record. + record = new RecordDelivererDC(true, false); + record.setOaiEsClient(oaiEsClient); + record.setWorkFields(TGConstants.TGWorkFields); + + recordIDIOM = new RecordDelivererIDIOM(true, false); + + + recordList = new RecordListDelivererDC(true, false); + recordList.setFields(TGConstants.TGFields); + recordList.setWorkFields(TGConstants.TGWorkFields); + recordList.setOaiEsClient(oaiEsClient); + recordList.setSearchResponseSize("10"); + + recordListIDIOM = new RecordListDelivererIDIOM(true, false); + recordListIDIOM.setOaiEsClient(oaiEsClient); + + identifierList = new IdentifierListDelivererDC(true, false); + identifierList.setOaiEsClient(oaiEsClient); + identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); + } + + /** + * @throws DatatypeConfigurationException + */ + @Test + @Ignore + public void testDateNow() throws DatatypeConfigurationException { + System.out.println("---------------Now Version-----------------"); + XMLGregorianCalendar nowTest = OAIPMHUtillities + .getXMLGregorianCalendarNow(); + System.out.println(nowTest); + System.out.println("-------------------------------------------"); + } + + /** + * @throws ParseException + * @throws DatatypeConfigurationException + */ + @Test + @Ignore + public void testDateGregorianType() throws ParseException, + DatatypeConfigurationException { + String dateformatbefore = "2012-02-06T20:48:39.614+01:00"; + + System.out.println("---------XML Gregorian Version---------------"); + System.out.println("Original date: " + dateformatbefore); + XMLGregorianCalendar testDate = OAIPMHUtillities + .convertDateFormat(dateformatbefore); + System.out.println("Date after conversion: " + testDate); + System.out.println("---------------------------------------------"); + } + + /** + * @throws ParseException + * @throws DatatypeConfigurationException + */ + @Test + @Ignore + public void testDateStringType() throws ParseException, + DatatypeConfigurationException { + String dateformatbefore = "2012-02-06T20:48:39.614+01:00"; + + System.out.println("------------String Version-------------------"); + System.out.println("Original date: " + dateformatbefore); + String testDate = OAIPMHUtillities.datestampAsString(dateformatbefore); + System.out.println("Date after conversion: " + testDate); + System.out.println("---------------------------------------------"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testGetRequestIdentify() throws ParseException { + + System.out + .println("Test for the verb \"Identify\" with succesfull response"); + JAXBElement<OAIPMHType> r = this.request.getRequest("Identify", "", "", + "", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testGetRequestIdentifyVerbError() throws ParseException { + JAXBElement<OAIPMHType> t = this.request.getRequest("Identify", "", + "a", "", "", "", ""); + JAXB.marshal(t, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testGetRequestIdentifyArgumentError() throws ParseException { + System.out + .println("Test for the verb \"Identify\" with error response"); + JAXBElement<OAIPMHType> z = this.request.getRequest("Identify", "a", + "", "", "", "a", ""); + JAXB.marshal(z, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testGetRequestGetRecordError() throws ParseException { + + System.out + .println("Test for the verb \"GetRecord\" with succesfull response"); + JAXBElement<OAIPMHType> t = this.request.getRequest("GetRecord", + "textgrid:vqn0.0", "oai_dc", "", "", "", ""); + JAXB.marshal(t, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testGetRequestGetRecordError2() throws ParseException { + + record.setContributor(TGConstants.CONTRIBUTOR_LIST); + record.setCoverage(TGConstants.COVERAGE_LIST); + record.setCreator(TGConstants.CREATOR_LIST); + record.setDates(TGConstants.DATE_LIST); + record.setDescriptions(TGConstants.DESCRIPTION_LIST); + record.setFormats(TGConstants.FORMAT_LIST); + record.setIdentifiers(TGConstants.IDENTIFIER_LIST); + record.setLanguages(TGConstants.LANGUAGE_LIST); + record.setPublishers(TGConstants.PUBLISHER_LIST); + record.setRelations(TGConstants.RELATIONS_LIST); + record.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); + record.setRights(TGConstants.RIGHTS_LIST); + record.setSources(TGConstants.SOURCE_LIST); + record.setSubjects(TGConstants.SUBJECT_LIST); + record.setTitles(TGConstants.TITLE_LIST); + record.setTypes(TGConstants.TYPE_LIST); + record.setFields(TGConstants.TGFields); + record.setFormatField(TGConstants.FORMAT); + record.setFormatToFilter(TextGridMimetypes.EDITION); + record.setDateOfObjectCreation(TGConstants.CREATED); + record.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); + record.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + record.setIdentifierField("textgridUri"); + + System.out.println("Test for the verb \"GetRecord\" with succesfull response"); + JAXBElement<OAIPMHType> p = + this.request.getRequest("GetRecord", "vqn0.0", "oai_dc", "", "", "", ""); + JAXB.marshal(p, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testGetRequestGetRecordIDIOM() throws ParseException { + + System.out.println("Test for the verb \"GetRecord\" with succesfull response"); + JAXBElement<OAIPMHType> p = + this.request.getRequest("ListRecords", "", TGConstants.METADATA_IDIOM_PREFIX, "project:TGPR-0e926f53-1aba-d415-ecf6-539edcd8a318", "", "", ""); + JAXB.marshal(p, System.out); + System.out.println("-----------------------------------\n"); + } + + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testGetRequestGetRecordDariah() throws ParseException { + + record.setContributor(DARIAHConstants.CONTRIBUTOR_LIST); + record.setCoverage(DARIAHConstants.COVERAGE_LIST); + record.setCreator(DARIAHConstants.CREATOR_LIST); + record.setDates(DARIAHConstants.DATE_LIST); + record.setDescriptions(DARIAHConstants.DESCRIPTION_LIST); + record.setFormats(DARIAHConstants.FORMAT_LIST); + record.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); + record.setLanguages(DARIAHConstants.LANGUAGE_LIST); + record.setPublishers(DARIAHConstants.PUBLISHER_LIST); + record.setRelations(DARIAHConstants.RELATIONS_LIST); + record.setRights(DARIAHConstants.RIGHTS_LIST); + record.setSources(DARIAHConstants.SOURCE_LIST); + record.setSubjects(DARIAHConstants.SUBJECT_LIST); + record.setTitles(DARIAHConstants.TITLE_LIST); + record.setTypes(DARIAHConstants.TYPE_LIST); + record.setFields(DARIAHConstants.DARIAHFields); + record.setFormatField(DARIAHConstants.FORMAT); + record.setFormatToFilter("metadata"); + record.setDateOfObjectCreation(DARIAHConstants.MODIFIED_FIELD); + record.setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); + record.setIdentifierField("administrativeMetadata.dcterms:identifier"); + + System.out.println("Test for the verb \"GetRecord\" with succesfull response"); + JAXBElement<OAIPMHType> p = this.request.getRequest("GetRecord", + "hdl:21.T11991/0000-0003-5667-9", "oai_dc", "", "", "", ""); + JAXB.marshal(p, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testGetRequestGetRecordError3() throws ParseException { + System.out + .println("Test for the verb \"GetRecord\" with succesfull response"); + JAXBElement<OAIPMHType> p = this.request.getRequest("GetRecord", "", + "", "", "", "", ""); + JAXB.marshal(p, System.out); + System.out.println("-----------------------------------\n"); + + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListIdentifierSets() throws ParseException { + OaiPmhTest.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); + OaiPmhTest.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); + OaiPmhTest.identifierList.setFormatField(TGConstants.FORMAT); + OaiPmhTest.identifierList.setFormatToFilter(TextGridMimetypes.EDITION); + OaiPmhTest.identifierList.setDateOfObjectCreation(TGConstants.CREATED); + OaiPmhTest.identifierList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTest.identifierList.setIdentifierField("textgridUri"); + OaiPmhTest.identifierList.setSearchResponseSize("100"); + System.out.println("Test for the verb \"ListIdentifiers\" with succesfull response"); + JAXBElement<OAIPMHType> p = this.request.getRequest("ListIdentifiers", "", "oai_dc", + "project:TGPR-26236625-1acc-b921-a5fa-53567c3eeb80", "", "", ""); + JAXB.marshal(p, System.out); + System.out.println("-----------------------------------\n"); + //project:TGPR-26236625-1acc-b921-a5fa-53567c3eeb80 + + } + + @Test + @Ignore + public void testListIdentifierIDIOM() throws ParseException { + + System.out.println("Test for the verb \"ListIdentifiers\" with succesfull response"); + JAXBElement<OAIPMHType> p = this.request.getRequest("ListIdentifiers", "", TGConstants.METADATA_IDIOM_PREFIX, + "", "", "", ""); + JAXB.marshal(p, System.out); + System.out.println("-----------------------------------\n"); + + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListRecordSets() throws ParseException { + OaiPmhTest.recordList.setContributor(TGConstants.CONTRIBUTOR_LIST); + OaiPmhTest.recordList.setCoverage(TGConstants.COVERAGE_LIST); + OaiPmhTest.recordList.setCreators(TGConstants.CREATOR_LIST); + OaiPmhTest.recordList.setDates(TGConstants.DATE_LIST); + OaiPmhTest.recordList.setDescriptions(TGConstants.DESCRIPTION_LIST); + OaiPmhTest.recordList.setFormats(TGConstants.FORMAT_LIST); + OaiPmhTest.recordList.setIdentifiers(TGConstants.IDENTIFIER_LIST); + OaiPmhTest.recordList.setLanguages(TGConstants.LANGUAGE_LIST); + OaiPmhTest.recordList.setPublishers(TGConstants.PUBLISHER_LIST); + OaiPmhTest.recordList.setRelations(TGConstants.RELATIONS_LIST); + OaiPmhTest.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); + OaiPmhTest.recordList.setRights(TGConstants.RIGHTS_LIST); + OaiPmhTest.recordList.setSources(TGConstants.SOURCE_LIST); + OaiPmhTest.recordList.setSubjects(TGConstants.SUBJECT_LIST); + OaiPmhTest.recordList.setTitles(TGConstants.TITLE_LIST); + OaiPmhTest.recordList.setTypes(TGConstants.TYPE_LIST); + OaiPmhTest.recordList.setFormatField(TGConstants.FORMAT); + OaiPmhTest.recordList.setFormatToFilter(TextGridMimetypes.EDITION); + OaiPmhTest.recordList.setDateOfObjectCreation(TGConstants.CREATED); + OaiPmhTest.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); + OaiPmhTest.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + OaiPmhTest.recordList.setFieldForRange(TGConstants.CREATED); + OaiPmhTest.recordList.setModifiedField(TGConstants.MODIFIED_FIELD); + OaiPmhTest.recordList.setIdentifierField("textgridUri"); + + System.out.println("Test for the verb \"ListRecords\" with sets with succesfull response"); + JAXBElement<OAIPMHType> p = + this.request.getRequest("ListRecords", "", "oai_dc", "", "", "", ""); + JAXB.marshal(p, System.out); + System.out.println("-----------------------------------\n"); + + } + + @Test + @Ignore + public void testListRecordSetsForIDIOM() throws ParseException { + + System.out.println("Test for the verb \"ListRecords\" for IDIOM with succesfull response"); + JAXBElement<OAIPMHType> p = + this.request.getRequest("ListRecords", "", TGConstants.METADATA_IDIOM_PREFIX, "", "", "", ""); + JAXB.marshal(p, System.out); + System.out.println("-----------------------------------\n"); + + } + + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListRecords() throws ParseException { + + JAXBElement<OAIPMHType> r = + this.request.getRequest("ListRecords", "", "oai_dc", "", "2011-02-06T20:48:39", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListRecords2() throws ParseException { + + System.out.println("TG"); + + this.recordList.setContributor(TGConstants.CONTRIBUTOR_LIST); + this.recordList.setCoverage(TGConstants.COVERAGE_LIST); + this.recordList.setCreators(TGConstants.CREATOR_LIST); + this.recordList.setDates(TGConstants.DATE_LIST); + this.recordList.setDescriptions(TGConstants.DESCRIPTION_LIST); + this.recordList.setFormats(TGConstants.FORMAT_LIST); + this.recordList.setIdentifiers(TGConstants.IDENTIFIER_LIST); + this.recordList.setLanguages(TGConstants.LANGUAGE_LIST); + this.recordList.setPublishers(TGConstants.PUBLISHER_LIST); + this.recordList.setRelations(TGConstants.RELATIONS_LIST); + this.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); + this.recordList.setRights(TGConstants.RIGHTS_LIST); + this.recordList.setSources(TGConstants.SOURCE_LIST); + this.recordList.setSubjects(TGConstants.SUBJECT_LIST); + this.recordList.setTitles(TGConstants.TITLE_LIST); + this.recordList.setTypes(TGConstants.TYPE_LIST); + this.recordList.setFormatField(TGConstants.FORMAT); + this.recordList.setFormatToFilter(TextGridMimetypes.EDITION); + this.recordList.setDateOfObjectCreation(TGConstants.CREATED); + this.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); + this.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + this.recordList.setFieldForRange(TGConstants.CREATED); + this.recordList.setModifiedField(TGConstants.CREATED); + this.recordList.setIdentifierField("textgridUri"); + this.recordList.setSearchResponseSize("100"); + + JAXBElement<OAIPMHType> r = + this.request.getRequest("ListRecords", "", "oai_dc", "", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListRecordsDariah() throws ParseException { + + // System.out.println("BUJA"); + + this.recordList.setContributor(DARIAHConstants.CONTRIBUTOR_LIST); + this.recordList.setCoverage(DARIAHConstants.COVERAGE_LIST); + this.recordList.setCreators(DARIAHConstants.CREATOR_LIST); + this.recordList.setDates(DARIAHConstants.DATE_LIST); + this.recordList.setDescriptions(DARIAHConstants.DESCRIPTION_LIST); + this.recordList.setFormats(DARIAHConstants.FORMAT_LIST); + this.recordList.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); + this.recordList.setLanguages(DARIAHConstants.LANGUAGE_LIST); + this.recordList.setPublishers(DARIAHConstants.PUBLISHER_LIST); + this.recordList.setRelations(DARIAHConstants.RELATIONS_LIST); + this.recordList.setRights(DARIAHConstants.RIGHTS_LIST); + this.recordList.setSources(DARIAHConstants.SOURCE_LIST); + this.recordList.setSubjects(DARIAHConstants.SUBJECT_LIST); + this.recordList.setTitles(DARIAHConstants.TITLE_LIST); + this.recordList.setTypes(DARIAHConstants.TYPE_LIST); + this.recordList.setFormatField(DARIAHConstants.FORMAT); + this.recordList.setDateOfObjectCreation(DARIAHConstants.CREATED); + this.recordList.setFieldForRange(DARIAHConstants.MODIFIED_FIELD); + this.recordList.setDateOfObjectCreation(DARIAHConstants.RANGE_FIELD); + this.recordList.setIdentifierField(DARIAHConstants.IDENTIFIER); + this.recordList.setFormatToFilter(TextGridMimetypes.DARIAH_COLLECTION); + this.recordList.setModifiedField(DARIAHConstants.MODIFIED_FIELD); + this.recordList.setRelationToFurtherMetadataObject("descriptiveMetadata.dc:relation"); + this.recordList.setSearchResponseSize("100"); + + JAXBElement<OAIPMHType> r = this.request.getRequest("ListRecords", "", "oai_dc", + "21.T11991/0000-0003-718E-E", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListMetadataFormats() throws ParseException { + JAXBElement<OAIPMHType> r = this.request.getRequest( + "ListMetadataFormats", "7t.0", "", "", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListMetadataFormatsWithoutID() throws ParseException { + JAXBElement<OAIPMHType> r = this.request.getRequest( + "ListMetadataFormats", "", "", "", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListSets() throws ParseException { + System.out.println("bla"); + this.setListTextGrid.setFormatField("format"); + this.setListTextGrid.setFormatToFilter(TextGridMimetypes.DARIAH_COLLECTION); + this.setListTextGrid.setIdentifierField("textgridUri"); + this.setListTextGrid.setRepositoryObjectURIPrefix("textgrid:"); + JAXBElement<OAIPMHType> r = this.request.getRequest("ListSets", "", "", "", "", "", ""); + + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListSetsDARIAH() throws ParseException { + System.out.println("TEST DARIAH"); + + this.setListDARIAH.setFormatField(DARIAHConstants.FORMAT); + this.setListDARIAH.setFormatToFilter(DARIAHConstants.COLLECTION_MIMETYPE); + this.setListDARIAH.setIdentifierField(DARIAHConstants.IDENTIFIER); + this.setListDARIAH.setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); + this.setListDARIAH.setIdentifierField("administrativeMetadata.dcterms:identifier"); + this.setListDARIAH.setSpecField("descriptiveMetadata.dc:title"); + this.setListDARIAH.setSpecFieldPrefix(DARIAHConstants.COLLECTIONREGISTRY_PREFIX); + JAXBElement<OAIPMHType> r = this.request.getRequest("ListSets", "", "", "", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + /** + * @throws ParseException + */ + @Test + @Ignore + public void testListIdentifiers() throws ParseException { + this.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); + this.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); + this.identifierList.setFormatField(TGConstants.FORMAT); + this.identifierList.setFormatToFilter(TextGridMimetypes.EDITION); + this.identifierList.setDateOfObjectCreation(TGConstants.CREATED); + this.identifierList.setIdentifierField("textgridUri"); + this.identifierList.setRepositoryObjectURIPrefix("textgrid:"); + this.identifierList.setSearchResponseSize("100"); + JAXBElement<OAIPMHType> r = this.request.getRequest("ListIdentifiers", "", "oai_dc", + "project:TGPR-f2242b43-bc28-712e-59ca-54801b1bbf52", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + @Test + @Ignore + public void testListIdentifiersDARIAH() throws ParseException { + this.identifierList.setFieldForRange(DARIAHConstants.RANGE_FIELD); + this.identifierList.setIdentifierListFields(DARIAHConstants.IDENTIFIER_LIST_FIELDS); + this.identifierList.setFormatField(DARIAHConstants.FORMAT); + // this.identifierList.setFormatToFilter(TextGridMimetypes.EDITION); + this.identifierList.setDateOfObjectCreation("administrativeMetadata.dcterms:modified"); + this.identifierList.setRepositoryObjectURIPrefix("hdl:"); + this.identifierList.setIdentifierField("administrativeMetadata.dcterms:identifier"); + this.identifierList.setSearchResponseSize("100"); + // System.out.println("BLABLUBB"); + JAXBElement<OAIPMHType> r = + this.request.getRequest("ListIdentifiers", "", "oai_dc", "", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } + + + @Test + @Ignore + public void testEmptyRequest() throws ParseException { + this.identifierList.setFieldForRange(TGConstants.RANGE_FIELD); + this.identifierList.setIdentifierListFields(TGConstants.IDENTIFIER_LIST_FIELDS); + this.identifierList.setFormatField(TGConstants.FORMAT); + this.identifierList.setFormatToFilter(TextGridMimetypes.EDITION); + this.identifierList.setDateOfObjectCreation(TGConstants.CREATED); + this.identifierList.setIdentifierField("textgridUri"); + this.identifierList.setRepositoryObjectURIPrefix("textgrid:"); + this.identifierList.setSearchResponseSize("100"); + JAXBElement<OAIPMHType> r = this.request.getRequest("", "", "", "", "", "", ""); + JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } } diff --git a/oaipmh-webapp/pom.xml b/oaipmh-webapp/pom.xml index 6c306ceeb070ba0b0ce991cbfe109a24178fbca4..6b175152a2a1a0ce047640bb5ce2cd007b913c3f 100644 --- a/oaipmh-webapp/pom.xml +++ b/oaipmh-webapp/pom.xml @@ -1,10 +1,11 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>oaipmh</artifactId> <groupId>info.textgrid.middleware</groupId> - <version>2.26.2-SNAPSHOT</version> + <version>2.27.0-SNAPSHOT</version> </parent> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh-webapp</artifactId> diff --git a/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml b/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml index c5f849dd288e2dd43289e6ef49ec75567e6e9f25..22b95fcc400979e327cbcc16b29ecf3fcad808e1 100644 --- a/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml +++ b/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml @@ -20,8 +20,7 @@ <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> - <bean id="propertyPlaceholderConfigurer" - class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>file:/etc/dhrep/oaipmh/oaipmh.properties</value> @@ -31,48 +30,40 @@ <property name="ignoreUnresolvablePlaceholders" value="true" /> </bean> - <bean id="ElasticSearchClient" - class="info.textgrid.middleware.OAI_ESClient"> - <constructor-arg index="0" - value="${elasticSearch.url}" /> - <constructor-arg index="1" - value="${elasticSearch.port}" /> - <constructor-arg index="2" - value="${elasticSearch.clusterName}" /> + <bean id="ElasticSearchClient" class="info.textgrid.middleware.OAI_ESClient"> + <constructor-arg index="0" value="${elasticSearch.url}" /> + <constructor-arg index="1" value="${elasticSearch.port}" /> + <constructor-arg index="2" value="${elasticSearch.clusterName}" /> <property name="esIndex" value="${elasticSearch.index}" /> <property name="esType" value="${elasticSearch.type}" /> </bean> <!--bean id="drc" class="info.textgrid.middleware.oaipmh.${DeletedRecordInfo}" --> - <bean id="RepIdentification" - class="info.textgrid.middleware.RepIdentification"> + <bean id="RepIdentification" class="info.textgrid.middleware.RepIdentification"> <constructor-arg index="0" value="${RepositoryName}" /> <constructor-arg index="1" value="${BaseUrl}" /> - <constructor-arg index="2" - value="${DeletedRecordInfo}" /> - <constructor-arg index="3" - value="${EarliestDateStamp}" /> + <constructor-arg index="2" value="${DeletedRecordInfo}" /> + <constructor-arg index="3" value="${EarliestDateStamp}" /> <constructor-arg index="4" value="${Granularity}" /> <constructor-arg index="5" value="${ProtocolVersion}" /> <constructor-arg index="6" value="${AdminMail}" /> </bean> - <bean id="RecordList" - class="info.textgrid.middleware.RecordListDeliverer"> + <bean id="RecordListDC" class="info.textgrid.middleware.RecordListDelivererDC"> <!--constructor-arg index="0" ref="ElasticSearchClient" / --> - <constructor-arg index="0" value="${fields}" /> - <constructor-arg index="1" value="${workFields}" /> - <constructor-arg index="2" value="${textgrid}" /> - <constructor-arg index="3" value="${dariah}" /> + <!-- <constructor-arg index="0" value="${fields}" />--> + <!-- <constructor-arg index="1" value="${workFields}" /> --> + <constructor-arg index="0" value="${textgrid}" /> + <constructor-arg index="1" value="${dariah}" /> + <property name="fields" value="${fields}" /> + <property name="workFields" value="${workFields}" /> + <!-- <property name="oaiEsClient" value="${formatToFilter}" /> --> <property name="formatField" value="${formatField}" /> <property name="formatToFilter" value="${formatToFilter}" /> - <property name="dateOfObjectCreation" - value="${dateOfObjectCreation}" /> - <property name="relationToFurtherMetadataObject" - value="${relationToFurtherMetadataObject}" /> - <property name="repositoryObjectURIPrefix" - value="${repositoryObjectURIPrefix}" /> + <property name="dateOfObjectCreation" value="${dateOfObjectCreation}" /> + <property name="relationToFurtherMetadataObject" value="${relationToFurtherMetadataObject}" /> + <property name="repositoryObjectURIPrefix" value="${repositoryObjectURIPrefix}" /> <property name="FieldForRange" value="${rangeField}" /> <property name="contributor" value="${contributorList}" /> <property name="coverage" value="${coverageList}" /> @@ -84,8 +75,7 @@ <property name="languages" value="${languageList}" /> <property name="publishers" value="${publisherList}" /> <property name="relations" value="${relationList}" /> - <property name="relationsForWork" - value="${relationsForWorkList}" /> + <property name="relationsForWork" value="${relationsForWorkList}" /> <property name="rights" value="${rightsList}" /> <property name="sources" value="${sourceList}" /> <property name="subjects" value="${subjectList}" /> @@ -93,25 +83,29 @@ <property name="types" value="${typeList}" /> <property name="modifiedField" value="${modifiedField}" /> <property name="identifierField" value="${identifierField}" /> - <property name="searchResponseSize" - value="${searchResponseSize}" /> + <property name="searchResponseSize" value="${searchResponseSize}" /> </bean> - <bean id="Record" class="info.textgrid.middleware.RecordDeliverer"> - <constructor-arg index="0" ref="ElasticSearchClient" /> - <constructor-arg index="1" value="${workFields}" /> - <constructor-arg index="2" value="${textgrid}" /> - <constructor-arg index="3" value="${dariah}" /> + <bean id="RecordListIDIOM" class="info.textgrid.middleware.RecordListDelivererIDIOM"> + <constructor-arg index="0" value="${textgrid}" /> + <constructor-arg index="1" value="${dariah}" /> + <!-- <property name="oaiEsClient" value="${formatToFilter}" /> --> + </bean> + + <bean id="RecordDC" class="info.textgrid.middleware.RecordDelivererDC"> + <!-- <constructor-arg index="0" ref="ElasticSearchClient" /> --> + <!-- <constructor-arg index="1" value="${workFields}" /> --> + <constructor-arg index="0" value="${textgrid}" /> + <constructor-arg index="1" value="${dariah}" /> <property name="formatField" value="${formatField}" /> <property name="formatToFilter" value="${formatToFilter}" /> - <property name="dateOfObjectCreation" - value="${dateOfObjectCreation}" /> - <property name="relationToFurtherMetadataObject" - value="${relationToFurtherMetadataObject}" /> - <property name="repositoryObjectURIPrefix" - value="${repositoryObjectURIPrefix}" /> + <!-- <property name="oaiEsClient" value="${formatToFilter}" /> --> + <property name="dateOfObjectCreation" value="${dateOfObjectCreation}" /> + <property name="relationToFurtherMetadataObject" value="${relationToFurtherMetadataObject}" /> + <property name="repositoryObjectURIPrefix" value="${repositoryObjectURIPrefix}" /> <property name="identifierField" value="${identifierField}" /> <property name="fields" value="${fields}" /> + <property name="workFields" value="${workFields}" /> <property name="contributor" value="${contributorList}" /> <property name="coverage" value="${coverageList}" /> <property name="creator" value="${creatorList}" /> @@ -122,20 +116,24 @@ <property name="languages" value="${languageList}" /> <property name="publishers" value="${publisherList}" /> <property name="relations" value="${relationList}" /> - <property name="relationsForWork" - value="${relationsForWorkList}" /> + <property name="relationsForWork" value="${relationsForWorkList}" /> <property name="rights" value="${rightsList}" /> <property name="sources" value="${sourceList}" /> <property name="subjects" value="${subjectList}" /> <property name="titles" value="${titleList}" /> <property name="types" value="${typeList}" /> </bean> + + <bean id="RecordDC" class="info.textgrid.middleware.RecordDelivererIDIOM"> + <constructor-arg index="0" value="${textgrid}" /> + <constructor-arg index="1" value="${dariah}" /> + <!-- <property name="oaiEsClient" value="${formatToFilter}" /> --> + </bean> - <bean id="ListIdentifier" - class="info.textgrid.middleware.IdentifierListDeliverer"> - <constructor-arg index="0" ref="ElasticSearchClient" /> - <constructor-arg index="1" value="${textgrid}" /> - <constructor-arg index="2" value="${dariah}" /> + <bean id="ListIdentifierDC" class="info.textgrid.middleware.IdentifierListDelivererDC"> + <!-- <constructor-arg index="0" ref="ElasticSearchClient" /> --> + <constructor-arg index="0" value="${textgrid}" /> + <constructor-arg index="1" value="${dariah}" /> <property name="formatField" value="${formatField}" /> <property name="formatToFilter" value="${formatToFilter}" /> <property name="dateOfObjectCreation" @@ -149,50 +147,54 @@ <property name="searchResponseSize" value="${searchResponseSize}" /> </bean> + + <bean id="ListIdentifierIDIOM" class="info.textgrid.middleware.IdentifierListDelivererIDIOM"> + <!-- <constructor-arg index="0" ref="ElasticSearchClient" /> --> + <constructor-arg index="0" value="${textgrid}" /> + <constructor-arg index="1" value="${dariah}" /> + </bean> - <bean id="SetDeliverer" - class="info.textgrid.middleware.SetDeliverer"> + <bean id="SetDeliverer" class="info.textgrid.middleware.SetDeliverer"> <constructor-arg ref="ElasticSearchClient" /> <constructor-arg index="1" value="${textgrid}" /> <constructor-arg index="2" value="${dariah}" /> <property name="formatField" value="${formatField}" /> <property name="formatToFilter" value="${formatToFilter}" /> <property name="identifierField" value="${identifierField}" /> - <property name="repositoryObjectURIPrefix" - value="${repositoryObjectURIPrefix}" /> + <property name="repositoryObjectURIPrefix" value="${repositoryObjectURIPrefix}" /> <property name="specField" value="${specField}" /> <property name="specFieldPrefix" value="${specFieldPrefix}" /> </bean> - <bean id="MetadataFormatList" - class="info.textgrid.middleware.MetadataFormatListDeliverer"> + <bean id="MetadataFormatList" class="info.textgrid.middleware.MetadataFormatListDeliverer"> <constructor-arg ref="ElasticSearchClient" /> </bean> <!-- REST Interface --> <bean id="rest" class="info.textgrid.middleware.Rest" /> - <bean id="cors-filter" - class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"> + <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"> <property name="allowOrigins"> <util:list /> </property> </bean> <bean id="oai" class="info.textgrid.middleware.OAIPMHImpl"> - <constructor-arg ref="ElasticSearchClient" /> <constructor-arg ref="RepIdentification" /> - <constructor-arg ref="Record" /> - <constructor-arg ref="RecordList" /> + <constructor-arg ref="RecordAbstract" /> + <constructor-arg ref="RecordDC" /> + <constructor-arg ref="RecordIDIOM" /> + <constructor-arg ref="RecordListDC" /> + <constructor-arg ref="RecordListIDIOM" /> <constructor-arg ref="MetadataFormatList" /> <constructor-arg ref="SetDeliverer" /> - <constructor-arg ref="ListIdentifier" /> + <constructor-arg ref="ListIdentifierDC" /> + <constructor-arg ref="ListIdentifierIDIOM" /> <property name="textGrid" value="${textgrid}" /> <property name="dariah" value="${dariah}" /> </bean> - <jaxrs:server id="root" address="/root" - publishedEndpointUrl="${RS_ENDPOINT}"> + <jaxrs:server id="root" address="/root" publishedEndpointUrl="${RS_ENDPOINT}"> <jaxrs:serviceBeans> <ref bean="rest" /> </jaxrs:serviceBeans> @@ -201,8 +203,7 @@ </jaxrs:providers> </jaxrs:server> - <jaxrs:server id="queryEndpoint" address="/oai" - publishedEndpointUrl="${RS_ENDPOINT}"> + <jaxrs:server id="queryEndpoint" address="/oai" publishedEndpointUrl="${RS_ENDPOINT}"> <jaxrs:serviceBeans> <ref bean="oai" /> </jaxrs:serviceBeans> diff --git a/pom.xml b/pom.xml index d70dc63fae05f9d2b755923a8696909b67f5bd7d..04fdb964860d3b934ca2d9b19db49dfc76de59d1 100644 --- a/pom.xml +++ b/pom.xml @@ -4,12 +4,12 @@ <modelVersion>4.0.0</modelVersion> <groupId>info.textgrid.middleware</groupId> <artifactId>oaipmh</artifactId> - <version>2.26.2-SNAPSHOT</version> + <version>2.27.0-SNAPSHOT</version> <packaging>pom</packaging> <name>DARIAHDE :: OAI-PMH DataProvider</name> <properties> <tgcrud.version>7.24.0-DH</tgcrud.version> - <tghttpclients.version>3.0.0</tghttpclients.version> + <tghttpclients.version>3.3.1-SNAPSHOT</tghttpclients.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <cxf.version>3.2.3</cxf.version> <spring.version>4.0.2.RELEASE</spring.version>