Created a project web site, using Maven, that has some basic info and examples.

git-svn-id: https://oai4j-client.svn.sourceforge.net/svnroot/oai4j-client/trunk@10 201c9376-5148-0410-b534-98494c770f31
This commit is contained in:
bobcat_zed 2008-03-18 11:56:57 +00:00
parent 1f9012dea4
commit b8fd52d15a
5 changed files with 198 additions and 1 deletions

View File

@ -20,7 +20,7 @@ public abstract class ListBase<T> extends ResponseBase {
/**
* Constructor.
*
* @param the response
* @param document the response
*
* @throws ErrorResponseException
*/

View File

@ -0,0 +1,29 @@
-----
OAI4J: a client library for PMH and ORE
-----
Oskar Grenholm
-----
2008-03-18
-----
Releases
All releases can be found at the
{{{http://sourceforge.net/project/showfiles.php?group_id=221177}Sourceforge Downloads page}}.
Source Code
The source code can be retrieved via Subversion from Sourceforge by following
{{{http://sourceforge.net/svn/?group_id=221177}these instructions}}.\
\
It can then be built by using the {{{http://maven.apache.org/}Maven}} tool.
To create the jar file just type:
+-----+
mvn package
+-----+
in the downloaded directory that has the pom.xml file. This will create
an oai4j-VERSION.jar in the target/ directory.

131
src/site/apt/examples.apt Normal file
View File

@ -0,0 +1,131 @@
-----
OAI4J: a client library for PMH and ORE
-----
Oskar Grenholm
-----
2008-03-18
-----
Dependencies
OAI4J has two dependencies on other Java libraries:
* dom4j-1.6.1.jar - {{http://www.dom4j.org}}
* jaxen-1.1.1.jar - {{http://jaxen.codehaus.org/}}
[]
Both of these needs to be present on the classpath to successfully run OAI4J.
Examples
To create an OaiPmhServer object and use it to retrieve a Record:
+-----+
String baseurl = "http://magasin.kb.se:8080/oaiprovider/";
OaiPmhServer server = new OaiPmhServer(baseurl);
Record record = server.getRecord("oai:kb:1", "oai_dc");
+-----+
To get the metadata from the Record:
+-----+
Element metadata = record.getMetadata();
// You can now use the org.dom4j.Element to handle the metadata as you see fit.
// OR you can get the metadata as a String instead.
String metadataString = record.getMetadataAsString();
+-----+
To list ALL identifiers in the repository that has "oai_dc" metadata:
+-----+
IdentifiersList list = server.listIdentifiers("oai_dc");
while (more) {
for (Header header : list.asList()) {
System.out.println(header.getIdentifier());
}
if (list.getResumptionToken() != null)
list = oai.listIdentifiers(list.getResumptionToken());
else
more = false;
}
+-----+
To create an AtomFactory and use it to create a new ResourceMap:
+-----+
// AtomFactory implements ResourceMapFactory
AtomFactory factory = new AtomFactory();
ResourceMap map = factory.newResourceMap("http://test.kb.se/rem/");
+-----+
To populate the ResourceMap with metadata:
+-----+
map.setCreator("OAI4J Library");
map.setModified(new Date());
map.setRights("http://creativecommons.org/licenses/by-nc-sa/2.5/");
+-----+
To populate the ResourceMap's Aggregation with an AggregatedResource:
+-----+
Aggregation aggregation = map.getAggregation();
AggregatedResource resource = new AggregatedResource("http://test.kb.se/docs/article.pdf");
// Add what kind of resource it is.
resource.addType(new Type("http://purl.org/dc/dcmitype/Text"));
// Add the author of the article.
resource.addMetadata(new Metadata(Namespace.DC, "creator", "Philip J. Fry"));
// Add the AggregatedResource to the Aggregation.
aggregation.addResource(resource);
+-----+
To create an AtomSerializer and use it to serialize the ResourceMap to a file:
+-----+
// AtomSerializer implements ResourceMapSerializer
AtomSerializer serializer = new AtomSerializer();
serializer.serializeToFile(new File("atom.xml"), map);
+-----+
To use an AtomFactory to parse an existing Atom feed and then modify it slightly:
+-----+
ResourceMap map = factory.getResourceMap("http://test.kb.se/atom.xml");
// Add one more AggregatedResource to the Aggregation.
map.getAggregation.addResource(aResource);
// Set the modified date to now.
map.setModified(new Date());
+-----+

14
src/site/apt/index.apt Normal file
View File

@ -0,0 +1,14 @@
-----
OAI4J: a client library for PMH and ORE
-----
Oskar Grenholm
-----
2008-03-18
-----
OAI4J: a client library for PMH and ORE
OAI4J is an open-source client library for OAI-PMH and OAI-ORE created by the National Library of Sweden.
The library is object-oriented in it's design and written in Java. It can be used to harvest metadata from
OAI-PMH compliant repositories.It can also be used to create new OAI-ORE Resource Maps from scratch, to
parse existing ones and to serialize them to xml.

23
src/site/site.xml Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<bannerLeft>
<name>Sourceforge</name>
<src>http://sflogo.sourceforge.net/sflogo.php?group_id=221177&amp;type=2</src>
<href >http://sourceforge.net</href>
</bannerLeft>
<body>
<links>
<item name="OAI-PMH" href="http://www.openarchives.org/OAI/openarchivesprotocol.html"/>
<item name="OAI-ORE" href="http://www.openarchives.org/ore/0.2/"/>
<item name="National Library of Sweden" href="http://www.kb.se/"/>
</links>
<menu name="Documentation">
<item name="Start Page" href="index.html"/>
<item name="Getting Started" href="examples.html"/>
<item name="Javadocs" href="apidocs/index.html"/>
<item name="Downloads" href="downloads.html"/>
</menu>
<!--<menu ref="reports"/>-->
</body>
</project>