Skip to content
Snippets Groups Projects
Commit e8ba8bdb authored by mbrodhu's avatar mbrodhu
Browse files

enable recordList

parent 250d615d
No related branches found
No related tags found
No related merge requests found
...@@ -12,8 +12,9 @@ ...@@ -12,8 +12,9 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<name>DARIAHDE :: OAI-PMH DataProvider :: Core</name> <name>DARIAHDE :: OAI-PMH DataProvider :: Core</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<dependencies>
<dependency> <dependencies>
<dependency>
<groupId>info.textgrid.middleware</groupId> <groupId>info.textgrid.middleware</groupId>
<artifactId>crud-common</artifactId> <artifactId>crud-common</artifactId>
<version>${tgcrud.version}</version> <version>${tgcrud.version}</version>
...@@ -84,7 +85,7 @@ ...@@ -84,7 +85,7 @@
<dependency> <dependency>
<groupId>org.classicmayan.tools</groupId> <groupId>org.classicmayan.tools</groupId>
<artifactId>metsModsMapping</artifactId> <artifactId>metsModsMapping</artifactId>
<version>1.1.9</version> <version>1.1.11</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.shadowhunt.maven.plugins</groupId> <groupId>de.shadowhunt.maven.plugins</groupId>
......
...@@ -418,11 +418,11 @@ public class OAIPMHImpl implements OAIPMHProducer { ...@@ -418,11 +418,11 @@ public class OAIPMHImpl implements OAIPMHProducer {
&& RecordListDelivererDC.cursorCollector.containsKey(request.getResumptionToken()); && RecordListDelivererDC.cursorCollector.containsKey(request.getResumptionToken());
boolean restokIDIOMExisting = RecordListDelivererIDIOM.cursorCollector != null boolean restokIDIOMExisting = RecordListDelivererIDIOM.cursorCollector != null
&& RecordListDelivererIDIOM.cursorCollector.containsKey(request.getResumptionToken()); && RecordListDelivererIDIOM.cursorCollector.containsKey(request.getResumptionToken());
System.out.println("OAIIMPL: " + request.getResumptionToken());
if (restokDCExisting) { if (restokDCExisting) {
recListDeliv = this.recordListDC; recListDeliv = this.recordListDC;
} else if (restokIDIOMExisting) { } else if (restokIDIOMExisting) {
System.out.println("DUMDIDUM");
recListDeliv = this.recordListIDIOM; recListDeliv = this.recordListIDIOM;
} }
} }
......
...@@ -14,6 +14,7 @@ import info.textgrid.middleware.oaipmh.GetRecordType; ...@@ -14,6 +14,7 @@ import info.textgrid.middleware.oaipmh.GetRecordType;
import info.textgrid.middleware.oaipmh.HeaderType; import info.textgrid.middleware.oaipmh.HeaderType;
import info.textgrid.middleware.oaipmh.MetadataType; import info.textgrid.middleware.oaipmh.MetadataType;
import info.textgrid.middleware.oaipmh.RecordType; import info.textgrid.middleware.oaipmh.RecordType;
import info.textgrid.middleware.oaipmh.StatusType;
/** /**
* *
...@@ -162,6 +163,8 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract { ...@@ -162,6 +163,8 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
recordHeader.setIdentifier(identifier); recordHeader.setIdentifier(identifier);
recordHeader.setDatestamp(OAIPMHUtilities.datestampAsString(dateOfCreation)); recordHeader.setDatestamp(OAIPMHUtilities.datestampAsString(dateOfCreation));
this.record.setHeader(recordHeader); this.record.setHeader(recordHeader);
//recordHeader.setStatus(StatusType.DELETED);
// return recordHeader; // return recordHeader;
} }
......
...@@ -61,48 +61,6 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract { ...@@ -61,48 +61,6 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
* @see info.textgrid.middleware.RecordListDelivererInterface#getRecords(java.lang.String, * @see info.textgrid.middleware.RecordListDelivererInterface#getRecords(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String) * java.lang.String, java.lang.String, java.lang.String)
*/ */
/* @Override
public ListRecordsType getRecords(final String from, final String to, final String set,
final String resumptionToken) {
String resTokenValue = resumptionToken;
log.info("Started List Records with booleans for DARIAH: " + this.dariah + " and TextGrid: "
+ this.textgrid);
ListRecordsType recordList = new ListRecordsType();
List<String> artefactURIs;
Queries queries = new Queries();
if (resumptionToken == null) {
artefactURIs = queries.getArtefactList(0);
// Create resumption token for every request only (we do need the same token for resuming
// because we are using a hash map for counting the calls).
resTokenValue = UUID.randomUUID().toString();
} else {
// Use given resumption token here.
artefactURIs = queries.getArtefactList(cursorCollector.get(resumptionToken));
}
long listSize = Queries.getAmountOfArtefacts();
int i = 0;
for (String artefactURI : artefactURIs) {
RecordDelivererIDIOM idiomRecord = new RecordDelivererIDIOM(true, false);
recordList.getRecord().add(idiomRecord.getRecordById(artefactURI).getRecord());
i++;
}
// Check the need for a resumption token!
ResumptionTokenType resTokenForResponse = OAIPMHUtilities.getResumptionToken(listSize,
resumptionToken, cursorCollector, resTokenValue, 30, i);
if (resTokenForResponse != null) {
recordList.setResumptionToken(resTokenForResponse);
}
return recordList;
}*/
@Override @Override
public ListRecordsType getRecords(final String from, final String to, final String set, public ListRecordsType getRecords(final String from, final String to, final String set,
...@@ -113,9 +71,9 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract { ...@@ -113,9 +71,9 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
QueryBuilder recordFilterForClassicMayan; QueryBuilder recordFilterForClassicMayan;
QueryBuilder rangeQuery; QueryBuilder rangeQuery;
Queries queries = new Queries(); Queries queries = new Queries();
List<String> artefactURIs = queries.getArtefactList();; //List<String> artefactURIs = queries.getArtefactList();
rangeQuery = QueryBuilders.rangeQuery("created").from(from).to(to); rangeQuery = QueryBuilders.rangeQuery("lastModified").from(from).to(to);
recordFilterForClassicMayan = QueryBuilders.boolQuery().must(rangeQuery) recordFilterForClassicMayan = QueryBuilders.boolQuery().must(rangeQuery)
.must(QueryBuilders.matchPhraseQuery("project.id", "TGPR-0e926f53-1aba-d415-ecf6-539edcd8a318")) .must(QueryBuilders.matchPhraseQuery("project.id", "TGPR-0e926f53-1aba-d415-ecf6-539edcd8a318"))
.must(QueryBuilders.matchPhraseQuery("format", "text/tg.inputform+rdf+xml")) .must(QueryBuilders.matchPhraseQuery("format", "text/tg.inputform+rdf+xml"))
...@@ -127,7 +85,7 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract { ...@@ -127,7 +85,7 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
scrollResp = OAI_ESClient.getOaiESClient() scrollResp = OAI_ESClient.getOaiESClient()
.prepareSearch("textgrid-nonpublic") .prepareSearch("textgrid-nonpublic")
.setScroll(new TimeValue(60000)) .setScroll(TimeValue.timeValueHours(24L))
.setTypes(OAI_ESClient.getEsType()) .setTypes(OAI_ESClient.getEsType())
.addFields("lastModified", "textgridUri", "project.id") .addFields("lastModified", "textgridUri", "project.id")
.setQuery(recordFilterForClassicMayan) .setQuery(recordFilterForClassicMayan)
...@@ -135,9 +93,8 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract { ...@@ -135,9 +93,8 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
.execute() .execute()
.actionGet(); .actionGet();
}else { }else {
System.out.println("resumptionToken for res: " + resumptionToken);
scrollResp = OAI_ESClient.getOaiESClient().prepareSearchScroll(resumptionToken) scrollResp = OAI_ESClient.getOaiESClient().prepareSearchScroll(resumptionToken)
.setScroll(new TimeValue(60000)).execute().actionGet(); .setScroll(TimeValue.timeValueHours(24L)).execute().actionGet();
} }
String scrollID = scrollResp.getScrollId(); String scrollID = scrollResp.getScrollId();
...@@ -150,16 +107,16 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract { ...@@ -150,16 +107,16 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
int i = 0; int i = 0;
//System.out.println("inside "); //System.out.println("inside ");
for (SearchHit hit : scrollResp.getHits().getHits()) { for (SearchHit hit : scrollResp.getHits().getHits()) {
i++; i++;
String textgridURI = hit.getFields().get("textgridUri").getValue().toString().replace(".0", ""); String textgridURI = hit.getFields().get("textgridUri").getValue().toString().replace(".0", "");
if(artefactURIs.contains(textgridURI)) { System.out.println("Processing: " + textgridURI);
RecordDelivererIDIOM idiomRecord = new RecordDelivererIDIOM(true, false); RecordDelivererIDIOM idiomRecord = new RecordDelivererIDIOM(true, false);
recordList.getRecord().add(idiomRecord.getRecordById(textgridURI).getRecord()); recordList.getRecord().add(idiomRecord.getRecordById(textgridURI).getRecord());
}
} }
// Check the need for a resumption token! // Check the need for a resumption token!
System.out.println("resumptionToken: " + resumptionToken);
ResumptionTokenType resTokenForResponse = OAIPMHUtilities.getResumptionToken( ResumptionTokenType resTokenForResponse = OAIPMHUtilities.getResumptionToken(
completeListSize, resumptionToken, cursorCollector, scrollID, 30, i); completeListSize, resumptionToken, cursorCollector, scrollID, 30, i);
if (resTokenForResponse != null) { if (resTokenForResponse != null) {
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
<artifactId>oaipmh-core</artifactId> <artifactId>oaipmh-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>oaipmh</finalName> <finalName>oaipmh</finalName>
......
...@@ -22,12 +22,13 @@ ...@@ -22,12 +22,13 @@
<maven-antrun-plugin.version>1.3</maven-antrun-plugin.version> <maven-antrun-plugin.version>1.3</maven-antrun-plugin.version>
<jaxb2-maven-plugin.version>2.5.0</jaxb2-maven-plugin.version> <jaxb2-maven-plugin.version>2.5.0</jaxb2-maven-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version> <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-compiler-plugin.version>3.0</maven-compiler-plugin.version> <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<jetty-maven-plugin.version>9.4.12.v20180830</jetty-maven-plugin.version> <jetty-maven-plugin.version>9.4.12.v20180830</jetty-maven-plugin.version>
<maven-eclipse-plugin.version>2.9</maven-eclipse-plugin.version> <maven-eclipse-plugin.version>2.9</maven-eclipse-plugin.version>
<properties-maven-plugin.version>1.0-alpha-2</properties-maven-plugin.version> <properties-maven-plugin.version>1.0-alpha-2</properties-maven-plugin.version>
</properties> </properties>
<url>https://projects.gwdg.de/projects/oai-pmh</url> <url>https://projects.gwdg.de/projects/oai-pmh</url>
<scm> <scm>
<connection>scm:git@git.projects.gwdg.de:oai-pmh.git</connection> <connection>scm:git@git.projects.gwdg.de:oai-pmh.git</connection>
<developerConnection>scm:git@git.projects.gwdg.de:oai-pmh.git</developerConnection> <developerConnection>scm:git@git.projects.gwdg.de:oai-pmh.git</developerConnection>
...@@ -78,6 +79,28 @@ ...@@ -78,6 +79,28 @@
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version> <version>${maven-deploy-plugin.version}</version>
</plugin> </plugin>
<!--plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>chronos-jmeter-maven-plugin</artifactId>
<version>1.1.0</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.15</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin-->
</plugins> </plugins>
</build> </build>
<modules> <modules>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment