Added some basic Javadocs to all classes in se.kb.oai.ore.* and se.kb.oai.ore.impl.*.
git-svn-id: https://oai4j-client.svn.sourceforge.net/svnroot/oai4j-client/trunk@11 201c9376-5148-0410-b534-98494c770f31
This commit is contained in:
parent
b8fd52d15a
commit
fe13c7bc4d
|
@ -16,6 +16,12 @@
|
||||||
|
|
||||||
package se.kb.oai;
|
package se.kb.oai;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A general exception that OAI4J throws. Often used to wrap lower-level
|
||||||
|
* exceptions.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class OAIException extends Exception {
|
public class OAIException extends Exception {
|
||||||
|
|
||||||
private static final long serialVersionUID = 5926653436917245659L;
|
private static final long serialVersionUID = 5926653436917245659L;
|
||||||
|
|
|
@ -22,6 +22,13 @@ import java.util.List;
|
||||||
|
|
||||||
import org.dom4j.QName;
|
import org.dom4j.QName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base class for those classes that make up an aggregation, i.e.
|
||||||
|
* <code>Aggregation</code> and <code>AggregatedResource</code>. It can be used to
|
||||||
|
* get and set <code>Types</code> and <code>Metadata</code>.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public abstract class AggregateBase {
|
public abstract class AggregateBase {
|
||||||
|
|
||||||
protected URI id;
|
protected URI id;
|
||||||
|
|
|
@ -22,6 +22,13 @@ import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An aggregated resource is a resource, that together with other resources,
|
||||||
|
* create an {@link Aggregation}. This class has the actual content of a
|
||||||
|
* resource and also metadata about it.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class AggregatedResource extends AggregateBase {
|
public class AggregatedResource extends AggregateBase {
|
||||||
|
|
||||||
public AggregatedResource(String id) throws URISyntaxException {
|
public AggregatedResource(String id) throws URISyntaxException {
|
||||||
|
|
|
@ -21,6 +21,14 @@ import java.net.URISyntaxException;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An aggregation is a set of related resources (see {@link AggregatedResource}), grouped
|
||||||
|
* together such that the set can be treated as a single resource. This class is used to
|
||||||
|
* manage the individual resources and also holds information for the aggregation as
|
||||||
|
* a whole.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class Aggregation extends AggregateBase {
|
public class Aggregation extends AggregateBase {
|
||||||
|
|
||||||
private List<AggregatedResource> resources;
|
private List<AggregatedResource> resources;
|
||||||
|
|
|
@ -20,6 +20,13 @@ import static se.kb.oai.ore.OREConstants.*;
|
||||||
|
|
||||||
import org.dom4j.QName;
|
import org.dom4j.QName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that represents metadata that can be set for an <code>Aggregation</code>
|
||||||
|
* or an <code>AggreagatedResource</code>. Only metadata from the Dublin Core elements
|
||||||
|
* (DC) namespace or the Dublin Core terms (DCTERMS) namespace can be created.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class Metadata {
|
public class Metadata {
|
||||||
|
|
||||||
public enum Namespace { DC, DCTERMS }
|
public enum Namespace { DC, DCTERMS }
|
||||||
|
|
|
@ -18,6 +18,11 @@ package se.kb.oai.ore;
|
||||||
|
|
||||||
import org.dom4j.Namespace;
|
import org.dom4j.Namespace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constants regarding OAI-ORE.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class OREConstants {
|
public class OREConstants {
|
||||||
|
|
||||||
public static final String ATOM_NS_PREFIX = "atom";
|
public static final String ATOM_NS_PREFIX = "atom";
|
||||||
|
|
|
@ -20,6 +20,14 @@ import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A resource map is a description of an {@link Aggregation} according to the OAI-ORE data model.
|
||||||
|
* <code>ResourceMaps</code> can be serialized to a machine readable format, see {@link ResourceMapSerializer}.
|
||||||
|
* This class will consist of the <code>Aggregation</code> it describes and some metadata concerning the
|
||||||
|
* resource map itself.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class ResourceMap {
|
public class ResourceMap {
|
||||||
|
|
||||||
private URI id;
|
private URI id;
|
||||||
|
|
|
@ -24,6 +24,20 @@ import org.dom4j.Element;
|
||||||
|
|
||||||
import se.kb.oai.OAIException;
|
import se.kb.oai.OAIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A <code>ResourceMapFactory</code> will be used to create a {@link ResourceMap}.
|
||||||
|
* It can either be a totally new <code>ResourceMap</code> or one that is parsed
|
||||||
|
* from an existing serialization of a <code>ResourceMap</code>. Different
|
||||||
|
* implementations of this interface will handle different serialization formats.
|
||||||
|
* <p>
|
||||||
|
* At the moment the Open Archive Initiative describes two possible formats:
|
||||||
|
* <ul>
|
||||||
|
* <li> Atom - <a href="http://www.openarchives.org/ore/0.2/atom-implementation">http://www.openarchives.org/ore/0.2/atom-implementation</a>
|
||||||
|
* <li> RDF/XML - <a href="http://www.openarchives.org/ore/0.2/rdfsyntax">http://www.openarchives.org/ore/0.2/rdfsyntax</a>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public interface ResourceMapFactory {
|
public interface ResourceMapFactory {
|
||||||
|
|
||||||
public ResourceMap newResourceMap(String uri) throws URISyntaxException;
|
public ResourceMap newResourceMap(String uri) throws URISyntaxException;
|
||||||
|
|
|
@ -21,6 +21,19 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A <code>ResourceMapSerializer</code> is used to serialize the content of a
|
||||||
|
* {@link ResourceMap} to a machine readable format (for example XML). Different
|
||||||
|
* implementations of this interface will handle serialization to different formats.
|
||||||
|
* <p>
|
||||||
|
* At the moment the Open Archive Initiative describes two possible serialization formats:
|
||||||
|
* <ul>
|
||||||
|
* <li> Atom - <a href="http://www.openarchives.org/ore/0.2/atom-implementation">http://www.openarchives.org/ore/0.2/atom-implementation</a>
|
||||||
|
* <li> RDF/XML - <a href="http://www.openarchives.org/ore/0.2/rdfsyntax">http://www.openarchives.org/ore/0.2/rdfsyntax</a>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public interface ResourceMapSerializer {
|
public interface ResourceMapSerializer {
|
||||||
|
|
||||||
public void serializeToFile(File file, ResourceMap map) throws IOException;
|
public void serializeToFile(File file, ResourceMap map) throws IOException;
|
||||||
|
|
|
@ -16,6 +16,12 @@
|
||||||
|
|
||||||
package se.kb.oai.ore;
|
package se.kb.oai.ore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that are used for typing <code>Aggreagations</code> and
|
||||||
|
* <code>AggreagatedResources</code>.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class Type {
|
public class Type {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
|
@ -22,6 +22,11 @@ import org.dom4j.QName;
|
||||||
|
|
||||||
import se.kb.oai.ore.OREConstants;
|
import se.kb.oai.ore.OREConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constants concerning Atom feeds.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class AtomConstants extends OREConstants {
|
public class AtomConstants extends OREConstants {
|
||||||
|
|
||||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
|
|
|
@ -40,6 +40,13 @@ import static se.kb.oai.ore.OREConstants.RDF_NS_PREFIX;
|
||||||
import static se.kb.oai.ore.OREConstants.RDF_NS_URI;
|
import static se.kb.oai.ore.OREConstants.RDF_NS_URI;
|
||||||
import static se.kb.oai.ore.impl.AtomConstants.*;
|
import static se.kb.oai.ore.impl.AtomConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>AtomFactory</code> class implements the {@link se.kb.oai.ore.ResourceMapFactory}
|
||||||
|
* interface to provide the functionality to parse Atom feeds and turn them into
|
||||||
|
* <code>ResourceMap</code> objects.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class AtomFactory extends FactoryBase {
|
public class AtomFactory extends FactoryBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,6 +29,13 @@ import se.kb.oai.ore.Type;
|
||||||
|
|
||||||
import static se.kb.oai.ore.impl.AtomConstants.*;
|
import static se.kb.oai.ore.impl.AtomConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>AtomSerializer</code> class implements the {@link se.kb.oai.ore.ResourceMapSerializer}
|
||||||
|
* interface to provide the functionality of serializing <code>ResourceMap</code> objects into
|
||||||
|
* Atom feeds.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public class AtomSerializer extends SerializerBase {
|
public class AtomSerializer extends SerializerBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,6 +28,11 @@ import se.kb.oai.OAIException;
|
||||||
import se.kb.oai.ore.ResourceMap;
|
import se.kb.oai.ore.ResourceMap;
|
||||||
import se.kb.oai.ore.ResourceMapFactory;
|
import se.kb.oai.ore.ResourceMapFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base class for the different <code>ResourceMapFactory</code> implementations.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public abstract class FactoryBase implements ResourceMapFactory {
|
public abstract class FactoryBase implements ResourceMapFactory {
|
||||||
|
|
||||||
public ResourceMap newResourceMap(String uri) throws URISyntaxException {
|
public ResourceMap newResourceMap(String uri) throws URISyntaxException {
|
||||||
|
|
|
@ -26,6 +26,11 @@ import se.kb.oai.ore.ResourceMap;
|
||||||
import se.kb.oai.ore.ResourceMapSerializer;
|
import se.kb.oai.ore.ResourceMapSerializer;
|
||||||
import se.kb.xml.XMLUtils;
|
import se.kb.xml.XMLUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base class for the different <code>ResourceMapSerializer</code> implementations.
|
||||||
|
*
|
||||||
|
* @author Oskar Grenholm, National Library of Sweden
|
||||||
|
*/
|
||||||
public abstract class SerializerBase implements ResourceMapSerializer {
|
public abstract class SerializerBase implements ResourceMapSerializer {
|
||||||
|
|
||||||
public void serializeToFile(File file, ResourceMap map) throws IOException {
|
public void serializeToFile(File file, ResourceMap map) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue