Skip to content

Commit

Permalink
Restoring a fork of the lyncode XOAI 4.1.0 from which the libraries u…
Browse files Browse the repository at this point in the history
…sed by Dataverse were built.
  • Loading branch information
landreev committed Feb 7, 2022
1 parent c387d36 commit 8d24fcd
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<groupId>com.lyncode</groupId>
<artifactId>xoai</artifactId>
<version>4.1.0</version>
<version>4.1.0-header-patch</version>

<name>XOAI : OAI-PMH Java Toolkit</name>
<url>http://www.lyncode.com</url>
Expand Down
4 changes: 2 additions & 2 deletions xoai-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>xoai</artifactId>
<groupId>com.lyncode</groupId>
<version>4.1.0</version>
<version>4.1.0-header-patch</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -73,4 +73,4 @@
</dependencies>


</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ public void write(XmlWriter writer) throws XmlWriteException {
}
}

/* Not to be confused with the similarly-named constructor, this
method exposes the "private final Record record" to other parts
of the OAI framework: */
public Record getRecord() {
return record;
}

@Override
public Type getType() {
return Type.GetRecord;
Expand Down
4 changes: 2 additions & 2 deletions xoai-data-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>xoai</artifactId>
<groupId>com.lyncode</groupId>
<version>4.1.0</version>
<version>4.1.0-header-patch</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -50,4 +50,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public GetRecord handle(OAICompiledRequest parameters) throws OAIException, Hand
if (item.isDeleted())
header.withStatus(Header.Status.DELETED);

/* Include the raw metadata: */
record.withMetadata(item.getMetadata());
/* Bypass/disable the XOAI metadata transform functionality:
if (!item.isDeleted()) {
Metadata metadata = null;
try {
Expand Down Expand Up @@ -87,7 +90,7 @@ public GetRecord handle(OAICompiledRequest parameters) throws OAIException, Hand
for (About about : item.getAbout())
record.withAbout(about);
}
}
}*/
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ else if (parameters.hasFrom() && parameters.hasUntil())
listItemIdentifiersResult = itemRepositoryHelper.getItemIdentifiers(getContext(), offset, length,
parameters.getMetadataPrefix());
} else {
if (!getRepository().getSetRepository().exists(parameters.getSet()) && !getContext().hasSet(parameters.getSet()))
throw new NoMatchesException();
/*if (!getRepository().getSetRepository().exists(parameters.getSet()) && !getContext().hasSet(parameters.getSet()))
throw new NoMatchesException();*/

if (parameters.hasFrom() && !parameters.hasUntil())
listItemIdentifiersResult = itemRepositoryHelper.getItemIdentifiers(getContext(), offset, length,
Expand Down
4 changes: 2 additions & 2 deletions xoai-service-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>xoai</artifactId>
<groupId>com.lyncode</groupId>
<version>4.1.0</version>
<version>4.1.0-header-patch</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -63,4 +63,4 @@
</dependency>
</dependencies>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.lyncode.xoai.serviceprovider.lazy.Source;
import com.lyncode.xoai.serviceprovider.model.Context;
import com.lyncode.xoai.serviceprovider.parsers.ListSetsParser;
import java.io.IOException;

public class ListSetsHandler implements Source<Set> {
private Context context;
Expand Down Expand Up @@ -82,6 +83,24 @@ public List<Set> nextIteration() {
resumptionToken = text;
} else ended = true;
} else ended = true;
/* This appears to be a bug in 4.1.0: the handler should be
* closing the stream here, similarly to the ListIdentifierHandle,
* etc. Without closing it, if there is a resumption token and
* we need to make another call - you will get an exception
* "Invalid use of BasicClientConnManager: connection still allocated.
* Make sure to release the connection before allocating another one."
* Also note, that I ignore the IOException if one is thrown on an
* attempt to close the stream (unlike ListIdentifierHandler - which
* then proceeds to throw an InvalidOAIResponse). If there is
* something seriously bad with the connection, to the point that it
* prevents us from making the next call, it will surely result in
* an exception then. -- L.A. May 2016.
*/
try {
stream.close();
} catch (IOException ioex) {
// ignore!
}
return sets;
} catch (XmlReaderException e) {
throw new InvalidOAIResponse(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ public Header parse (XmlReader reader) throws XmlReaderException {
header.withIdentifier(reader.getText());
reader.next(elementName(localPart(equalTo("datestamp")))).next(text());
header.withDatestamp(reader.get(dateParser()));
/* The 4.0-4.1 implementation was buggy, in that it made the
* setspec tag mandatory. Commenting out the next 2 lines fixes it:
reader.next(setSpecElement()).next(text());
header.withSetSpec(reader.getText());
*/

while (reader.next(endOfHeader(), setSpecElement()).current(setSpecElement()))
header.withSetSpec(reader.next(text()).getText());
return header;
Expand Down

0 comments on commit 8d24fcd

Please sign in to comment.