diff --git a/oaipmh-core/TODO b/oaipmh-core/TODO index d1ecf10958cbc3a02b3919b74469ff71c3135846..de1cca5aeb01db34711af1fd3c8c6463605d2a26 100644 --- a/oaipmh-core/TODO +++ b/oaipmh-core/TODO @@ -1,12 +1,18 @@ 1. change identifier from 123.0 to textgrid:123.0 in all/the getRecord requests, -must be equal to the identifiers we get with the getIdentifiers() method +must be equal to the identifiers we get with the getIdentifiers() method + +DONE 2. implement sets (for the prootype :) +DONE (ListSets still has to be implemented, but it is possible to query for sets in ListIndentifiers and ListRecords) + 3. implement resumtion tokens (later) 4. remove "yo" in class RecordDeliverer :-) + +DONE :D diff --git a/oaipmh-core/pom.xml b/oaipmh-core/pom.xml index ee1cb57729545ecf1dc14a83fbdd6cc68a8e618a..03b903e5a00c38ab430c5babe8ef2dad330c1ee2 100644 --- a/oaipmh-core/pom.xml +++ b/oaipmh-core/pom.xml @@ -20,9 +20,19 @@ </dependency> <dependency> <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http-hc</artifactId> + <artifactId>cxf-rt-transports-http</artifactId> <version>${cxf.version}</version> </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-security-cors</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + <version>${cxf.version}</version> + </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxrs</artifactId> @@ -146,6 +156,53 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.3</version> + <executions> + <execution> + <id>do-get</id> + <phase>initialize</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + <!-- download wsdl task --> + <get usetimestamp="true" src="${tgauth.wsdl}" dest="tgextra.wsdl"/> + <!--get usetimestamp="true" src="https://develop.sub.uni-goettingen.de/repos/textgrid/trunk/middleware/tgauth/info.textgrid.middleware.tgauth.rbac/rbacSoap/wsdl-productive/tgextra.wsdl" dest="tgextra.wsdl"/--> + </tasks> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-codegen-plugin</artifactId> + <version>${cxf.version}</version> + <executions> + <execution> + <id>generate-sources</id> + <phase>generate-sources</phase> + <configuration> + <wsdlOptions> + <wsdlOption> + <wsdl>tgextra.wsdl</wsdl> + <extraargs> + <extraarg>-fe</extraarg> + <extraarg>jaxws21</extraarg> + </extraargs> + </wsdlOption> + </wsdlOptions> + </configuration> + <goals> + <goal>wsdl2java</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> </build> </project> 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 a52daa2b5651e8b2786dd0fbe31057b8d5d444ae..c5d94a8c88cd4f51ec9b3600737a8517969cb48c 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java @@ -5,11 +5,13 @@ import info.textgrid.middleware.oaipmh.IdentifyType; import info.textgrid.middleware.oaipmh.ListIdentifiersType; import info.textgrid.middleware.oaipmh.ListMetadataFormatsType; import info.textgrid.middleware.oaipmh.ListRecordsType; +import info.textgrid.middleware.oaipmh.ListSetsType; import info.textgrid.middleware.oaipmh.OAIPMHType; import info.textgrid.middleware.oaipmh.ObjectFactory; import info.textgrid.middleware.oaipmh.RequestType; import info.textgrid.middleware.oaipmh.VerbType; +import java.io.IOException; import java.text.ParseException; import java.util.ArrayList; import java.util.List; @@ -287,13 +289,20 @@ public class OAIPMHImpl implements OAIPMHProducer{ /** * checks the ListSets request of correctness and response including errors in case of an incorrect request + * @throws IOException */ public JAXBElement<OAIPMHType> listSetsRequest(ObjectFactory obf, OAIPMHType oai, RequestType request){ + ListSetsType setList = new ListSetsType(); + SetDeliverer sets = new SetDeliverer(oaiEsClient); JAXBElement<OAIPMHType> oaipmhRoot = obf.createOAIPMH(oai); - error.setError(TGConstants.OAI_NO_SET_HIERARCHY).setValue("The repository does not support sets"); - oai.getError().add(error.setError(TGConstants.OAI_NO_SET_HIERARCHY)); + setList = sets.setListBuilder(); + + oai.setListSets(setList); + + /*error.setError(TGConstants.OAI_NO_SET_HIERARCHY).setValue("The repository does not support sets"); + oai.getError().add(error.setError(TGConstants.OAI_NO_SET_HIERARCHY));*/ return oaipmhRoot; } diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OaiPmhClient.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OaiPmhClient.java index c32090aabb8ed8cc8f34ffda93ccd5992e72ff86..c0bb1ee52ead6c9bfef91bb6defde5c4e56de97b 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/OaiPmhClient.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OaiPmhClient.java @@ -4,9 +4,11 @@ import java.text.ParseException; import javax.xml.bind.JAXBElement; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; + import info.textgrid.middleware.oaipmh.OAIPMHType; -import org.apache.cxf.jaxrs.client.JAXRSClientFactory; + public class OaiPmhClient { diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java index 8ad5acc9f86e5e87ef57132123c23649156969cd..10ffb44e0dc92e267a261ed03739ae03137420f7 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java @@ -512,7 +512,7 @@ public class RecordListDeliverer { // Only if we have a search response AND a hit field map... if (hit != null && hits != null) { - + if (hit.getFields().get(FORMAT).values().get(0).toString() .equals(TextGridMimetypes.EDITION)) { 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 ba84ba4f6abcf078f332259bff6293362a09c6b4..a6359a515ae7f2129d69e2e0234f526388a200e7 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java @@ -27,25 +27,22 @@ public class OaiPmhTest { } - /* - * @Test - * - * @Ignore public void testListRecords() throws ParseException{ - * - * JAXBElement<OAIPMHType> r = testRequest.getRequest("ListRecords", "", - * "oai_dc", "", "2011-02-06T20:48:39", "", ""); JAXB.marshal(r, - * System.out); System.out.println("-----------------------------------\n"); - * } - * - * - * @Test - * - * @Ignore public void testListMetadataFormats() throws ParseException{ - * - * JAXBElement<OAIPMHType> r = testRequest.getRequest("ListMetadataFormats", - * "wr67.0", "", "", "", "", ""); JAXB.marshal(r, System.out); - * System.out.println("-----------------------------------\n"); } - */ + + @Test + @Ignore + public void testListRecords() throws ParseException{ + JAXBElement<OAIPMHType> r = testRequest.getRequest("ListRecords", "", + "oai_dc", "", "2011-02-06T20:48:39", "", ""); JAXB.marshal(r, + System.out); System.out.println("-----------------------------------\n"); + } + + @Test + @Ignore + public void testListMetadataFormats() throws ParseException{ + JAXBElement<OAIPMHType> r = testRequest.getRequest("ListMetadataFormats", + "wr67.0", "", "", "", "", ""); JAXB.marshal(r, System.out); + System.out.println("-----------------------------------\n"); + } @Test //@Ignore @@ -93,7 +90,6 @@ public class OaiPmhTest { JAXB.marshal(r, System.out); System.out.println("-----------------------------------\n"); } - @Test @Ignore @@ -175,7 +171,7 @@ public class OaiPmhTest { @Test @Ignore public void testListIdentifierSets() throws ParseException { - System.out.println("Test for the verb \"GetRecord\" with succesfull response"); + System.out.println("Test for the verb \"ListIdentifiers\" with succesfull response"); JAXBElement<OAIPMHType> p = testRequest.getRequest("ListIdentifiers", "", "oai_dc", "project.value:St. Matthias Test 07", "", "", ""); JAXB.marshal(p, System.out); diff --git a/pom.xml b/pom.xml index 4b075a336b75a927358aafe80d1b1d47a869e896..3fd1e03f210ce3486b79bfabd692079084f17d71 100644 --- a/pom.xml +++ b/pom.xml @@ -7,9 +7,10 @@ <packaging>pom</packaging> <name>TextGrid :: TG-OAI-PMH :: Parent</name> <properties> + <tgauth.wsdl>https://textgridlab.org/1.0/tgauth/rbacSoap/wsdl/tgextra.wsdl</tgauth.wsdl> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <sonar.host.url>https://ci.bibforge.org/sonar</sonar.host.url> - <cxf.version>2.7.13</cxf.version> + <cxf.version>3.0.3</cxf.version> <tgcrud.version>5.5.9-SNAPSHOT</tgcrud.version> <spring.version>4.0.2.RELEASE</spring.version> <textgrid.httpclients.version>1.3.0-SNAPSHOT</textgrid.httpclients.version>