diff --git a/dspace-oai/dspace-oai-api/pom.xml b/dspace-oai/dspace-oai-api/pom.xml
index 189e003853..bc91007d01 100644
--- a/dspace-oai/dspace-oai-api/pom.xml
+++ b/dspace-oai/dspace-oai-api/pom.xml
@@ -1,40 +1,57 @@
-
- 4.0.0
- org.dspace
- dspace-oai-api
- jar
- DSpace OAI :: API and Implementation
- Libraries to support DSpace OAI Service Provider Webapplication
+
+
+ 4.0.0
+
+ dspace-oai
+ org.dspace
+ 3.0-SNAPSHOT
+
+ dspace-oai-api
+ DSpace OAI 2.0 :: API and Implementation
+
+ UTF-8
+
+ XOAI API
-
-
- org.dspace
- dspace-oai
- 3.0-SNAPSHOT
- ..
-
-
-
-
- org.dspace
- dspace-api
-
-
- org.dspace
- dspace-api-lang
-
-
- org.dspace
- oaicat
-
-
- javax.servlet
- servlet-api
- provided
-
-
+
+
+ com.lyncode
+ xoai
+ 2.2.0
+
+
+ org.dspace
+ dspace-api
+
+
+ org.apache.solr
+ solr-solrj
+ 3.3.0
+
+
+ javax.servlet
+ servlet-api
+ 2.3
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.5.6
+
+
+ org.slf4j
+ slf4j-api
+ 1.5.6
+
+
+
+
+ DSpace @ Lyncode
+ dspace@lyncode.com
+ Lyncode
+ http://www.lyncode.com
+
+
diff --git a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/didl/UUID.java b/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/didl/UUID.java
deleted file mode 100644
index 4decb1a801..0000000000
--- a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/didl/UUID.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * The contents of this file are subject to the license and copyright
- * detailed in the LICENSE and NOTICE files at the root of the source
- * tree and available online at
- *
- * http://www.dspace.org/license/
- */
-package org.dspace.app.didl;
-
-import java.io.Serializable;
-/**
- * This class implements UUID version 4. The values for the various fields are
- * crypto random values set by the factory class UUIDFactory
- *
- * Development of this code was part of the aDORe repository project by the
- * Research Library of the Los Alamos National Laboratory.
- *
- * This code is based on the implementation of UUID version 4 (the one that
- * uses random/pseudo-random numbers by Ashraf Amrou of the Old Dominion University
- * (Aug 14, 2003)
- **/
-public final class UUID implements Serializable
-{
- private long hi;
- private long lo;
-
- /**
- * Construct a Version 4 UUID object from another UUID object
- *
- * @param uuid
- * the UUID to use as a base for the new UUID
- **/
- public UUID(UUID uuid)
- {
- this.hi = uuid.hi;
- this.lo = uuid.lo;
- }
-
- /**
- * Construct a Version 4 UUID object form the two given long values.
- * These values are (pseudo)random numbers (best if crypto quality)
- *
- * @param _hi
- * first long value
- *
- * @param _lo
- * second long value
- *
- **/
- public UUID(long _hi, long _lo)
- {
- this.hi = _hi;
- this.lo = _lo;
- // IETF variant (10)b
- lo &= 0x3FFFFFFFFFFFFFFFL; lo |= 0x8000000000000000L;
- // set multicast bit (so that it there is no chance it will clash
- // with other UUIDs generated based on real IEEE 802 addresses)
- lo |= 0x0000800000000000L;
- // version 4 (100)b: the one based on random/pseudo-random numbers
- hi &= 0xFFFFFFFFFFFF0FFFL; hi |= 0x0000000000004000L;
- }
-
- /**
- * Compare UUID objects
- *
- * @param obj
- * the object to compare this UUID against
- *
- * @return true or false
- **/
- public boolean equals(Object obj)
- {
- if(this == obj) // comparing to myself
- {
- return true;
- }
- if(obj instanceof UUID)
- {
- UUID uuid = (UUID)obj;
- return (hi == uuid.hi && lo == uuid.lo);
- }
- return false;
- }
-
- /**
- * Generate a hash for the UUID
- *
- * @return hash code for the UUID
- *
- **/
- public int hashCode()
- {
- return Long.valueOf(hi ^ lo).hashCode();
- }
-
-
- /**
- * Obtain a string representation of the UUID object
- *
- * @return the string representation of this UUID
- *
- **/
- public String toString()
- {
- return (/**"urn:uuid:" + **/
- hexDigits(hi >> 32, 4) // time_low: 4 hexOctet (8 hex digits)
- + "-" +
- hexDigits(hi >> 16, 2) // time_mid: 2 hexOctet (4 hex digits)
- + "-" +
- hexDigits(hi, 2) // time_high_and_version: 2 hexOctet (4 hex digits)
- + "-" +
- hexDigits(lo >> 48, 2) // clock_seq_and_reserved: 1 hexOctet (2 hex digits) & clock_seq_low: 1 hexOctet (2 hex digits)
- + "-" +
- hexDigits(lo, 6)); // node: 6 hexOctet (12 hex digits)
- }
-
- /**
- * Obtain the Hex value of a given number of least significant octets
- * from a long value as a String
- *
- * @param lVal
- * the long value to retrieve octets from
- *
- * @param nHexOctets
- * number of hex octets to return
- *
- * @return hex value of least significant octets as a string
- *
- **/
- private static String hexDigits(long lVal, int nHexOctets) {
- long tmp = 1L << (nHexOctets * 2 * 4); // e.g., if nHexOctets is 2, tmp = (1 0000 0000 0000 0000)b & tmp - 1 = (1111 1111 1111 1111)b
- long result = lVal & (tmp - 1); // get ride of the uneeded most significant bits
- result = tmp | result; // make sure the digit at position (nDigits + 1) equals 1 (to preserve leading zeroes)
- return Long.toHexString(result).substring(1); // getride ot the digit at position nDigits + 1
- }
-}
\ No newline at end of file
diff --git a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/didl/UUIDFactory.java b/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/didl/UUIDFactory.java
deleted file mode 100644
index 237aa3a515..0000000000
--- a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/didl/UUIDFactory.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * The contents of this file are subject to the license and copyright
- * detailed in the LICENSE and NOTICE files at the root of the source
- * tree and available online at
- *
- * http://www.dspace.org/license/
- */
-package org.dspace.app.didl;
-
-import java.security.SecureRandom;
-import java.util.Random;
-/**
- * Factory class for generating UUID version 4. All what this class does is
- * creating UUID version 4 objects using crypto-quality random numbers.
- *
- * Development of this code was part of the aDORe repository project by the
- * Research Library of the Los Alamos National Laboratory.
- *
- * This code is based on the implementation of UUID version 4 (the one that
- * uses random/pseudo-random numbers by Ashraf Amrou of the Old Dominion University
- * (Aug 14, 2003)
- *
- **/
-public final class UUIDFactory
-{
- /** Random number generator */
- private Random rand = null;
-
- /** an instance */
- private static UUIDFactory generator = new UUIDFactory();
-
- /** private constructor (Singleton class) */
- private UUIDFactory()
- {
- // crypto-quality random number generator
- rand = new SecureRandom();
- }
-
- /**
- *
- * Customers of this class call this method to generete new UUID objects
- *
- * @return a new UUID object
- *
- **/
- public static synchronized UUID generateUUID()
- {
- return new UUID(generator.rand.nextLong(),generator.rand.nextLong());
- }
-}
\ No newline at end of file
diff --git a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DIDLCrosswalk.java b/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DIDLCrosswalk.java
deleted file mode 100644
index 33946f4829..0000000000
--- a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DIDLCrosswalk.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
- * The contents of this file are subject to the license and copyright
- * detailed in the LICENSE and NOTICE files at the root of the source
- * tree and available online at
- *
- * http://www.dspace.org/license/
- */
-package org.dspace.app.oai;
-
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.Properties;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
-import org.dspace.app.didl.UUIDFactory;
-import org.dspace.content.Bitstream;
-import org.dspace.content.Bundle;
-import org.dspace.content.Item;
-import org.dspace.core.ConfigurationManager;
-import org.dspace.core.Context;
-import org.dspace.search.HarvestedItemInfo;
-import org.dspace.storage.bitstore.BitstreamStorageManager;
-
-import ORG.oclc.oai.server.crosswalk.Crosswalk;
-import ORG.oclc.oai.server.verb.CannotDisseminateFormatException;
-import ORG.oclc.oai.server.verb.ServerVerb;
-
-/**
- * DSpace Item DIDL crosswalk.
- *
- * Development of this code was part of the aDORe repository project
- * by the Research Library of the Los Alamos National Laboratory.
- *
- * @author Henry Jerez
- * @author Los Alamos National Laboratory
- */
-
-public class DIDLCrosswalk extends Crosswalk
-{
- private static final Logger log = Logger.getLogger(DIDLCrosswalk.class);
-
- /** default value if no oai.didl.maxresponse property is defined */
- public static final int MAXRESPONSE_INLINE_BITSTREAM = 0;
-
- /** another crosswalk that will be used to generate the metadata section */
- private Crosswalk metadataCrosswalk;
-
- public DIDLCrosswalk(Properties properties)
- {
- super("urn:mpeg:mpeg21:2002:02-DIDL-NS http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-21_schema_files/did/didl.xsd ");
-
- // FIXME this should be injected from the configuration...
- // but it is better than duplicate the OAIDCCrosswalk code!
- metadataCrosswalk = new OAIDCCrosswalk(properties);
- }
-
-
- public boolean isAvailableFor(Object nativeItem)
- {
- // We have DC for everything
- return true;
- }
-
-
- public String createMetadata(Object nativeItem)
- throws CannotDisseminateFormatException
- {
- Item item = ((HarvestedItemInfo) nativeItem).item;
-
- StringBuffer metadata = new StringBuffer();
- String itemhandle=item.getHandle();
- String strMaxSize = ConfigurationManager.getProperty("oai", "didl.maxresponse");
- int maxsize = MAXRESPONSE_INLINE_BITSTREAM;
- if (strMaxSize != null)
- {
- maxsize = Integer.parseInt(strMaxSize);
- }
-
- String currdate=ServerVerb.createResponseDate(new Date());
-
- metadata.append("")
- .append ("")
- .append ("")
- .append (currdate)
- .append ("" )
- .append("");
- metadata.append("")
- .append("")
- .append("").append("urn:hdl:").append(itemhandle)
- .append("")
- .append("")
- .append("");
- metadata.append("")
- .append("");
-
- // delegate the metadata section to another crosswalk
- metadata.append(metadataCrosswalk.createMetadata(nativeItem));
-
- metadata
- .append("")
- .append("");
-
- /**putfirst item here**/
-
-
- //**CYCLE HERE!!!!**//
-
- try
- {
- Bundle[] bundles= item.getBundles("ORIGINAL");
-
- if (bundles.length != 0)
- {
- /**cycle bundles**/
- for (int i = 0; i < bundles.length; i++)
- {
- int flag=0;
- Bitstream[] bitstreams = bundles[i].getBitstreams();
-
- /**cycle bitstreams**/
- for (int k = 0; k < bitstreams.length ; k++)
- {
- // Skip internal types
- if (!bitstreams[k].getFormat().isInternal())
- {
- if (flag==0)
- {
- flag=1;
- }
-
- metadata.append("");
-
- if (bitstreams[k].getSize()> maxsize)
- {
- metadata.append("");
- metadata.append("");
- }
- else
- {
- try
- {
- metadata.append("");
-
- /*
- * Assume that size of in-line bitstreams will always be
- * smaller than MAXINT bytes
- */
- int intSize = (int) bitstreams[k].getSize();
-
- byte[] buffer = new byte[intSize];
-
- Context contextl= new Context();
- InputStream is = BitstreamStorageManager.retrieve(contextl,bitstreams[k].getID());
- BufferedInputStream bis = new BufferedInputStream(is);
- try
- {
- bis.read(buffer);
- }
- finally
- {
- if (bis != null)
- {
- try
- {
- bis.close();
- }
- catch (IOException ioe)
- {
- }
- }
-
- if (is != null)
- {
- try
- {
- is.close();
- }
- catch (IOException ioe)
- {
- }
- }
- }
-
- contextl.complete();
-
- String encoding = new String(Base64.encodeBase64(buffer), "ASCII");
- metadata.append(encoding);
- }
- catch (Exception ex)
- {
- log.error("Error creating resource didl", ex);
-
- metadata.append("");
- }
-
- metadata.append("");
- }
- metadata.append("");
- }
- /*end bitstream cycle*/
- }
- /*end bundle cycle*/
- }
- }
- }
- catch (SQLException sqle)
- {
- System.err.println("Caught exception:"+sqle.getCause());
- log.error("Database error", sqle);
- }
-
- //**END CYCLE HERE **//
-
- metadata.append("")
- .append("");
-
- return metadata.toString();
- }
-}
diff --git a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DSpaceOAICatalog.java b/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DSpaceOAICatalog.java
deleted file mode 100644
index b6d39bb4bd..0000000000
--- a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DSpaceOAICatalog.java
+++ /dev/null
@@ -1,933 +0,0 @@
-/**
- * The contents of this file are subject to the license and copyright
- * detailed in the LICENSE and NOTICE files at the root of the source
- * tree and available online at
- *
- * http://www.dspace.org/license/
- */
-package org.dspace.app.oai;
-
-import java.sql.SQLException;
-import java.text.ParseException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.apache.log4j.Logger;
-import org.dspace.authorize.AuthorizeManager;
-import org.dspace.content.Collection;
-import org.dspace.content.Community;
-import org.dspace.content.DSpaceObject;
-import org.dspace.core.ConfigurationManager;
-import org.dspace.core.Constants;
-import org.dspace.core.Context;
-import org.dspace.core.LogManager;
-import org.dspace.core.Utils;
-import org.dspace.handle.HandleManager;
-import org.dspace.search.Harvest;
-import org.dspace.search.HarvestedItemInfo;
-import org.dspace.eperson.Group;
-
-import ORG.oclc.oai.server.catalog.AbstractCatalog;
-import ORG.oclc.oai.server.verb.BadArgumentException;
-import ORG.oclc.oai.server.verb.BadResumptionTokenException;
-import ORG.oclc.oai.server.verb.CannotDisseminateFormatException;
-import ORG.oclc.oai.server.verb.IdDoesNotExistException;
-import ORG.oclc.oai.server.verb.NoItemsMatchException;
-import ORG.oclc.oai.server.verb.NoMetadataFormatsException;
-import ORG.oclc.oai.server.verb.NoSetHierarchyException;
-import ORG.oclc.oai.server.verb.OAIInternalServerError;
-
-/**
- * This class extends OAICat's AbstractCatalog base class to allow
- * harvesting of the metadata in DSpace via OAI-PMH 2.0.
- *
- * FIXME: Some CNRI Handle-specific stuff in here. Anyone wanting to use
- * something else will need to update this code, too. Sorry about that.
- *
- * @author Robert Tansley
- * @version $Revision$
- */
-public class DSpaceOAICatalog extends AbstractCatalog
-{
- /** log4j logger */
- private static Logger log = Logger.getLogger(DSpaceOAICatalog.class);
-
- /** Prefix that all our OAI identifiers have */
- public static final String OAI_ID_PREFIX = "oai:" + ConfigurationManager.getProperty("dspace.hostname") + ":";
-
- /** Maximum number of records returned by one request */
- private final int MAX_RECORDS = ConfigurationManager.getIntProperty("oai","response.max-records", 100);
-
- public DSpaceOAICatalog(Properties properties)
- {
- // Don't need to do anything
- }
-
- /**
- * Retrieve a list of schemaLocation values associated with the specified
- * identifier.
- *
- * @param identifier
- * the OAI identifier
- * @return a Vector containing schemaLocation Strings
- * @exception OAIInternalServerError
- * signals an http status code 500 problem
- * @exception IdDoesNotExistException
- * the specified identifier can't be found
- * @exception NoMetadataFormatsException
- * the specified identifier was found but the item is flagged
- * as deleted and thus no schemaLocations (i.e.
- * metadataFormats) can be produced.
- */
- public Vector getSchemaLocations(String identifier)
- throws OAIInternalServerError, IdDoesNotExistException,
- NoMetadataFormatsException
- {
- log.info(LogManager.getHeader(null, "oai_request",
- "verb=getSchemaLocations,identifier="
- + ((identifier == null) ? "null" : identifier)));
-
- HarvestedItemInfo itemInfo = null;
- Context context = null;
-
- // Get the item from the DB
- try
- {
- context = new Context();
-
- // All valid identifiers have the "oai:hostname:" prefix
- if (identifier != null && identifier.startsWith(OAI_ID_PREFIX))
- {
- itemInfo = Harvest.getSingle(context, identifier
- .substring(OAI_ID_PREFIX.length()), // Strip prefix to
- // get raw handle
- false);
- }
- }
- catch (SQLException se)
- {
- // Log the error
- log.warn(LogManager.getHeader(context, "database_error", ""), se);
-
- // Stack trace loss as OAI Exception does not support cause
- throw new OAIInternalServerError(se.toString());
- }
- finally
- {
- if (context != null)
- {
- context.abort();
- }
- }
-
- if (itemInfo == null)
- {
- throw new IdDoesNotExistException(identifier);
- }
- else
- {
- if (itemInfo.withdrawn)
- {
- throw new NoMetadataFormatsException();
- }
- else
- {
- return getRecordFactory().getSchemaLocations(itemInfo);
- }
- }
- }
-
- /**
- * Retrieve a list of identifiers that satisfy the specified criteria
- *
- * @param from
- * beginning date using the proper granularity
- * @param until
- * ending date using the proper granularity
- * @param set
- * the set name or null if no such limit is requested
- * @param metadataPrefix
- * the OAI metadataPrefix or null if no such limit is requested
- * @return a Map object containing entries for "headers" and "identifiers"
- * Iterators (both containing Strings) as well as an optional
- * "resumptionMap" Map. It may seem strange for the map to include
- * both "headers" and "identifiers" since the identifiers can be
- * obtained from the headers. This may be true, but
- * AbstractCatalog.listRecords() can operate quicker if it doesn't
- * need to parse identifiers from the XML headers itself. Better
- * still, do like I do below and override
- * AbstractCatalog.listRecords(). AbstractCatalog.listRecords() is
- * relatively inefficient because given the list of identifiers, it
- * must call getRecord() individually for each as it constructs its
- * response. It's much more efficient to construct the entire
- * response in one fell swoop by overriding listRecords() as I've
- * done here.
- * @exception OAIInternalServerError
- * signals an http status code 500 problem
- * @exception NoSetHierarchyException
- * the repository doesn't support sets.
- * @exception CannotDisseminateFormatException
- * the metadata format specified is not supported by your
- * repository.
- */
- public Map listIdentifiers(String from, String until, String set,
- String metadataPrefix) throws OAIInternalServerError,
- NoSetHierarchyException, NoItemsMatchException,
- CannotDisseminateFormatException, BadArgumentException
- {
- log
- .info(LogManager.getHeader(null, "oai_request",
- "verb=listIdentifiers,from="
- + ((from == null) ? "null" : from)
- + ",until="
- + ((until == null) ? "null" : until)
- + ",set="
- + ((set == null) ? "null" : set)
- + ",metadataPrefix="
- + ((metadataPrefix == null) ? "null"
- : metadataPrefix)));
-
- // We can produce oai_dc and simple DC for all items, so just return IDs
- Context context = null;
-
- // Lists to put results in
- List headers = new LinkedList();
- List identifiers = new LinkedList();
-
- try
- {
- context = new Context();
-
- // Get the relevant OAIItemInfo objects to make headers
- DSpaceObject scope = resolveSet(context, set);
- boolean includeAll = ConfigurationManager.getBooleanProperty("oai", "harvest.includerestricted.oai", true);
- // Warning: In large repositories, setting harvest.includerestricted.oai to false may cause
- // performance problems as all items will need to have their authorization permissions checked,
- // but because we haven't implemented resumption tokens in ListIdentifiers, ALL items will
- // need checking whenever a ListIdentifiers request is made.
- List itemInfos = Harvest.harvest(context, scope, from, until, 0, 0, // Everything
- // for
- // now
- !includeAll, true, true, includeAll);
-
- // No Item objects, but we need to know collections they're in and
- // withdrawn items
- if (itemInfos.size() == 0)
- {
- log.info(LogManager.getHeader(null, "oai_error",
- "no_items_match"));
- throw new NoItemsMatchException();
- }
-
- // Build up lists of headers and identifiers
- Iterator i = itemInfos.iterator();
-
- while (i.hasNext())
- {
- HarvestedItemInfo itemInfo = i.next();
-
- String[] header = getRecordFactory().createHeader(itemInfo);
-
- headers.add(header[0]);
- identifiers.add(header[1]);
- }
- }
- catch (SQLException se)
- {
- // Log the error
- log.warn(LogManager.getHeader(context, "database_error", ""), se);
-
- // Stack trace loss as OAI Exception does not support cause
- throw new OAIInternalServerError(se.toString());
- }
- catch (ParseException pe)
- {
- // Stack trace loss as OAI Exception does not support cause
- throw new OAIInternalServerError(pe.toString());
- }
- finally
- {
- if (context != null)
- {
- context.abort();
- }
- }
-
- // Put results in form needed to return
- Map> results = new HashMap>();
- results.put("headers", headers.iterator());
- results.put("identifiers", identifiers.iterator());
-
- return results;
- }
-
- /**
- * Retrieve the next set of identifiers associated with the resumptionToken
- *
- * @param resumptionToken
- * implementation-dependent format taken from the previous
- * listIdentifiers() Map result.
- * @return a Map object containing entries for "headers" and "identifiers"
- * Iterators (both containing Strings) as well as an optional
- * "resumptionMap" Map.
- * @exception BadResumptionTokenException
- * the value of the resumptionToken is invalid or expired.
- * @exception OAIInternalServerError
- * signals an http status code 500 problem
- */
- public Map listIdentifiers(String resumptionToken)
- throws BadResumptionTokenException, OAIInternalServerError
- {
- // Resumption tokens not yet supported
- throw new BadResumptionTokenException();
- }
-
- /**
- * Retrieve the specified metadata for the specified identifier
- *
- * @param identifier
- * the OAI identifier
- * @param metadataPrefix
- * the OAI metadataPrefix
- * @return the portion of the XML response.
- * @exception OAIInternalServerError
- * signals an http status code 500 problem
- * @exception CannotDisseminateFormatException
- * the metadataPrefix is not supported by the item.
- * @exception IdDoesNotExistException
- * the identifier wasn't found
- */
- public String getRecord(String identifier, String metadataPrefix)
- throws OAIInternalServerError, CannotDisseminateFormatException,
- IdDoesNotExistException
- {
- log
- .info(LogManager.getHeader(null, "oai_request",
- "verb=getRecord,identifier="
- + ((identifier == null) ? "null" : identifier)
- + ",metadataPrefix="
- + ((metadataPrefix == null) ? "null"
- : metadataPrefix)));
-
- Context context = null;
- String record = null;
- HarvestedItemInfo itemInfo = null;
-
- // First get the item from the DB
- try
- {
- // Valid IDs start with oai:hostname:
- if (identifier != null && identifier.startsWith(OAI_ID_PREFIX))
- {
- context = new Context();
-
- /*
- * Try and get the item. the .substring() is to strip the
- * oai:(hostname): prefix to get the raw handle
- */
- itemInfo = Harvest.getSingle(context, identifier
- .substring(OAI_ID_PREFIX.length()), true);
- }
-
- if (itemInfo == null)
- {
- log.info(LogManager.getHeader(null, "oai_error",
- "id_does_not_exist"));
- throw new IdDoesNotExistException(identifier);
- }
-
- boolean includeAll = ConfigurationManager.getBooleanProperty("oai", "harvest.includerestricted.oai", true);
-
- if (!includeAll)
- {
- Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, itemInfo.item, Constants.READ);
- boolean authorized = false;
- for (int i = 0; i < authorizedGroups.length; i++)
- {
- if ((authorizedGroups[i].getID() == 0) && (!authorized))
- {
- authorized = true;
- }
- }
-
- if (!authorized)
- {
- log.info(LogManager.getHeader(null, "oai_error",
- "id_not_accessible"));
- throw new IdDoesNotExistException(identifier);
- }
- }
-
- String schemaURL = getCrosswalks().getSchemaURL(metadataPrefix);
-
- if (schemaURL == null)
- {
- log.info(LogManager.getHeader(null, "oai_error",
- "cannot_disseminate_format"));
- throw new CannotDisseminateFormatException(metadataPrefix);
- }
-
- record = getRecordFactory().create(itemInfo, schemaURL,
- metadataPrefix);
- }
- catch (SQLException se)
- {
- // Log the error
- log.warn(LogManager.getHeader(context, "database_error", ""), se);
-
- // Stack trace loss as OAI Exception does not support cause
- throw new OAIInternalServerError(se.toString());
- }
- finally
- {
- if (context != null)
- {
- context.abort();
- }
- }
-
- return record;
- }
-
- /**
- * Retrieve a list of records that satisfy the specified criteria. Note,
- * though, that unlike the other OAI verb type methods implemented here,
- * both of the listRecords methods are already implemented in
- * AbstractCatalog rather than abstracted. This is because it is possible to
- * implement ListRecords as a combination of ListIdentifiers and GetRecord
- * combinations. Nevertheless, I suggest that you override both the
- * AbstractCatalog.listRecords methods here since it will probably improve
- * the performance if you create the response in one fell swoop rather than
- * construct it one GetRecord at a time.
- *
- * @param from
- * beginning date using the proper granularity
- * @param until
- * ending date using the proper granularity
- * @param set
- * the set name or null if no such limit is requested
- * @param metadataPrefix
- * the OAI metadataPrefix or null if no such limit is requested
- * @return a Map object containing entries for a "records" Iterator object
- * (containing XML Strings) and an optional
- * "resumptionMap" Map.
- * @exception OAIInternalServerError
- * signals an http status code 500 problem
- * @exception NoSetHierarchyException
- * The repository doesn't support sets.
- * @exception CannotDisseminateFormatException
- * the metadataPrefix isn't supported by the item.
- */
- public Map listRecords(String from, String until, String set,
- String metadataPrefix) throws OAIInternalServerError,
- NoSetHierarchyException, CannotDisseminateFormatException,
- NoItemsMatchException, BadArgumentException
- {
- log
- .info(LogManager.getHeader(null, "oai_request",
- "verb=listRecords,from="
- + ((from == null) ? "null" : from)
- + ",until="
- + ((until == null) ? "null" : until)
- + ",set="
- + ((set == null) ? "null" : set)
- + ",metadataPrefix="
- + ((metadataPrefix == null) ? "null"
- : metadataPrefix)));
-
- Map m = doRecordHarvest(from, until, set, metadataPrefix, 0);
-
- // Null means bad metadata prefix
- if (m == null)
- {
- log.info(LogManager.getHeader(null, "oai_error",
- "cannot_disseminate_format"));
- throw new CannotDisseminateFormatException(metadataPrefix);
- }
-
- // If there were zero results, return the appropriate error
- Iterator i = (Iterator) m.get("records");
-
- if ((i == null) || !i.hasNext())
- {
- log.info(LogManager.getHeader(null, "oai_error", "no_items_match"));
- throw new NoItemsMatchException();
- }
-
- return m;
- }
-
- /**
- * Retrieve the next set of records associated with the resumptionToken
- *
- * @param resumptionToken
- * implementation-dependent format taken from the previous
- * listRecords() Map result.
- * @return a Map object containing entries for "headers" and "identifiers"
- * Iterators (both containing Strings) as well as an optional
- * "resumptionMap" Map.
- * @exception OAIInternalServerError
- * signals an http status code 500 problem
- * @exception BadResumptionTokenException
- * the value of the resumptionToken argument is invalid or
- * expired.
- */
- public Map listRecords(String resumptionToken)
- throws BadResumptionTokenException, OAIInternalServerError
- {
- log.info(LogManager.getHeader(null, "oai_request",
- "verb=listRecords,resumptionToken=" + resumptionToken));
-
- /*
- * FIXME: This may return zero records if the previous harvest returned
- * a number of records that's an exact multiple of MAX_RECORDS. I hope
- * that's OK.
- */
- Object[] params = decodeResumptionToken(resumptionToken);
- Integer offset = (Integer) params[4];
-
- Map m = null;
-
- /*
- * We catch BadArgumentExceptions here, because doRecordHarvest() throws
- * BadArgumentExcpetions when the set spec is bad. set spec bad == bad
- * resumption token.
- */
- try
- {
- m = doRecordHarvest((String) params[0], (String) params[1],
- (String) params[2], (String) params[3], offset.intValue());
- }
- catch (BadArgumentException bae)
- {
- m = null;
- }
-
- // null result means a problem -> bad resumption token
- if (m == null)
- {
- log.info(LogManager.getHeader(null, "oai_error",
- "bad_resumption_token"));
- throw new BadResumptionTokenException();
- }
-
- return m;
- }
-
- /**
- * Method to do the actual harvest of records
- *
- * @param from
- * OAI 'from' parameter
- * @param until
- * OAI 'until' parameter
- * @param set
- * OAI 'set' parameter
- * @param metadataPrefix
- * OAI 'metadataPrefix' parameter
- * @param offset
- * where to start this harvest
- *
- * @return the Map for listRecords to return, or null if the metadataPrefix
- * is invalid
- */
- private Map doRecordHarvest(String from, String until, String set,
- String metadataPrefix, int offset) throws OAIInternalServerError,
- BadArgumentException
- {
- Context context = null;
- String schemaURL = getCrosswalks().getSchemaURL(metadataPrefix);
- Map results = new HashMap();
-
- if (schemaURL == null)
- {
- return null;
- }
-
- // List to put results in
- List records = new LinkedList();
-
- try
- {
- context = new Context();
-
- // Get the relevant HarvestedItemInfo objects to make headers
- DSpaceObject scope = resolveSet(context, set);
- boolean includeAll = ConfigurationManager.getBooleanProperty("oai", "harvest.includerestricted.oai", true);
- List itemInfos = Harvest.harvest(context, scope, from, until,
- offset, MAX_RECORDS, // Limit amount returned from one
- // request
- true, true, true, includeAll); // Need items, containers + withdrawals
-
- // Build list of XML records from item info objects
- int ignore = 0;
- for (HarvestedItemInfo itemInfo : itemInfos)
- {
- try
- {
- String recordXML = getRecordFactory().create(itemInfo, schemaURL, metadataPrefix);
- records.add(recordXML);
- }
- catch (CannotDisseminateFormatException cdfe)
- {
- /*
- * FIXME: I've a feeling a
- * "CannotDisseminateFormatException" should be discarded
- * here - it's OK if some records in the requested date
- * range don't have the requested metadata format available.
- * I'll just log it for now.
- */
- ignore++;
- if (log.isDebugEnabled())
- {
- log.debug(LogManager.getHeader(context, "oai_warning",
- "Couldn't disseminate " + metadataPrefix
- + " for " + itemInfo.handle));
- }
- }
- }
-
- // Put results in form needed to return
- results.put("records", records.iterator());
-
- log.info(LogManager.getHeader(context, "oai_harvest", "results=" + records.size() + ", ignore=" + ignore));
-
- // If we have MAX_RECORDS records, we need to provide a resumption
- // token
- if ((records.size() + ignore) >= MAX_RECORDS)
- {
- String resumptionToken = makeResumptionToken(from, until, set,
- metadataPrefix, offset + MAX_RECORDS);
-
- if (log.isDebugEnabled())
- {
- log.debug(LogManager
- .getHeader(context, "made_resumption_token",
- "token=" + resumptionToken));
- }
-
- results.put("resumptionMap", getResumptionMap(resumptionToken));
-
- //results.put("resumptionToken", resumptionToken);
- }
- }
- catch (SQLException se)
- {
- // Log the error
- log.warn(LogManager.getHeader(context, "database_error", ""), se);
-
- // Stack trace loss as OAI Exception does not support cause
- throw new OAIInternalServerError(se.toString());
- }
- catch (ParseException pe)
- {
- // Stack trace loss as OAI Exception does not support cause
- throw new OAIInternalServerError(pe.toString());
- }
- finally
- {
- if (context != null)
- {
- context.abort();
- }
- }
-
- return results;
- }
-
- /**
- * Retrieve a list of sets that satisfy the specified criteria
- *
- * @return a Map object containing "sets" Iterator object (contains
- * XML Strings) as well as an optional resumptionMap Map.
- * @exception NoSetHierarchyException
- * signals an http status code 400 problem
- * @exception OAIInternalServerError
- * signals an http status code 500 problem
- */
- public Map listSets() throws NoSetHierarchyException,
- OAIInternalServerError
- {
- log.info(LogManager.getHeader(null, "oai_request", "verb=listSets"));
-
- Context context = null;
-
- // List to put results in
- List sets = new LinkedList();
-
- try
- {
- context = new Context();
-
- Collection[] allCols = Collection.findAll(context);
- StringBuffer spec = null;
- for (int i = 0; i < allCols.length; i++)
- {
- spec = new StringBuffer("hdl_");
- spec.append(allCols[i].getHandle().replace('/', '_'));
- spec.append("");
- String collName = allCols[i].getMetadata("name");
- if(collName != null)
- {
- spec.append("");
- spec.append(Utils.addEntities(collName));
- spec.append("");
- }
- else
- {
- spec.append("");
- // Warn that there is an error of a null set name
- log.info(LogManager.getHeader(null, "oai_error",
- "null_set_name_for_set_id_" + allCols[i].getHandle()));
- }
- spec.append("");
- sets.add(spec.toString());
- }
-
- Community[] allComs = Community.findAll(context);
- for (int i = 0; i < allComs.length; i++)
- {
- spec = new StringBuffer("hdl_");
- spec.append(allComs[i].getHandle().replace('/', '_'));
- spec.append("");
- String commName = allComs[i].getMetadata("name");
- if(commName != null)
- {
- spec.append("");
- spec.append(Utils.addEntities(commName));
- spec.append("");
- }
- else
- {
- spec.append("");
- // Warn that there is an error of a null set name
- log.info(LogManager.getHeader(null, "oai_error",
- "null_set_name_for_set_id_" + allComs[i].getHandle()));
- }
- spec.append("");
- sets.add(spec.toString());
- }
- }
- catch (SQLException se)
- {
- // Log the error
- log.warn(LogManager.getHeader(context, "database_error", ""), se);
-
- // Stack trace loss as OAI Exception does not support cause
- throw new OAIInternalServerError(se.toString());
- }
- finally
- {
- if (context != null)
- {
- context.abort();
- }
- }
-
- // Put results in form needed to return
- Map> results = new HashMap>();
- results.put("sets", sets.iterator());
-
- return results;
- }
-
- /**
- * Retrieve the next set of sets associated with the resumptionToken
- *
- * @param resumptionToken
- * implementation-dependent format taken from the previous
- * listSets() Map result.
- * @return a Map object containing "sets" Iterator object (contains
- * XML Strings) as well as an optional resumptionMap Map.
- * @exception BadResumptionTokenException
- * the value of the resumptionToken is invalid or expired.
- * @exception OAIInternalServerError
- * signals an http status code 500 problem
- */
- public Map listSets(String resumptionToken)
- throws BadResumptionTokenException, OAIInternalServerError
- {
- // Resumption tokens not yet supported
- throw new BadResumptionTokenException();
- }
-
- /**
- * close the repository
- */
- public void close()
- {
- }
-
- // ******************************************
- // Internal DSpace utility methods below here
- // ******************************************
-
- /**
- * Get the community or collection signified by a set spec
- *
- * @param context
- * DSpace context object
- * @param set
- * OAI set spec
- * @return the corresponding community or collection, or null if no set
- * provided
- */
- private DSpaceObject resolveSet(Context context, String set)
- throws SQLException, BadArgumentException
- {
- if (set == null)
- {
- return null;
- }
-
- DSpaceObject o = null;
-
- /*
- * set specs are in form hdl_123.456_789 corresponding to
- * hdl:123.456/789
- */
- if (set.startsWith("hdl_"))
- {
- // Looks OK so far... turn second _ into /
- String handle = set.substring(4).replace('_', '/');
- o = HandleManager.resolveToObject(context, handle);
- }
-
- // If it corresponds to a collection or a community, that's the set we
- // want
- if ((o != null) &&
- ((o instanceof Collection) || (o instanceof Community)))
- {
- return o;
- }
-
- // Handle is either non-existent, or corresponds to a non-collection
- // Either way, a bad set spec, ergo a bad argument
- throw new BadArgumentException();
- }
-
- /**
- * Create a resumption token. The relevant parameters for the harvest are
- * put in a
- *
- * @param from
- * OAI 'from' parameter
- * @param until
- * OAI 'until' parameter
- * @param set
- * OAI 'set' parameter
- * @param prefix
- * OAI 'metadataPrefix' parameter
- * @param offset
- * where to start the next harvest
- *
- * @return the appropriate resumption token
- */
- private String makeResumptionToken(String from, String until, String set,
- String prefix, int offset)
- {
- StringBuffer token = new StringBuffer();
-
- if (from != null)
- {
- token.append(from);
- }
-
- token.append("/");
-
- if (until != null)
- {
- token.append(until);
- }
-
- token.append("/");
-
- if (set != null)
- {
- token.append(set);
- }
-
- token.append("/");
-
- if (prefix != null)
- {
- token.append(prefix);
- }
-
- token.append("/");
- token.append(String.valueOf(offset));
-
- return (token.toString());
- }
-
- /**
- * Get the information out of a resumption token
- *
- * @param token
- * the resumption token
- * @return a 5-long array of Objects; 4 Strings (from, until, set, prefix)
- * and an Integer (the offset)
- */
- private Object[] decodeResumptionToken(String token)
- throws BadResumptionTokenException
- {
- Object[] obj = new Object[5];
- StringTokenizer st = new StringTokenizer(token, "/", true);
-
- try
- {
- // Extract from, until, set, prefix
- for (int i = 0; i < 4; i++)
- {
- if (!st.hasMoreTokens())
- {
- throw new BadResumptionTokenException();
- }
-
- String s = st.nextToken();
-
- // If this value is a delimiter /, we have no value for this
- // part of the resumption token.
- if (s.equals("/"))
- {
- obj[i] = null;
- }
- else
- {
- obj[i] = s;
-
- // Skip the delimiter
- st.nextToken();
- }
-
- log.debug("is: " + (String) obj[i]);
- }
-
- if (!st.hasMoreTokens())
- {
- throw new BadResumptionTokenException();
- }
-
- obj[4] = Integer.valueOf(st.nextToken());
- }
- catch (NumberFormatException nfe)
- {
- // Stack trace loss as OAI Exception does not support cause
- throw new BadResumptionTokenException();
- }
- catch (NoSuchElementException nsee)
- {
- // Stack trace loss as OAI Exception does not support cause
- throw new BadResumptionTokenException();
- }
-
- return obj;
- }
-}
diff --git a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DSpaceRecordFactory.java b/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DSpaceRecordFactory.java
deleted file mode 100644
index b78facf93c..0000000000
--- a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/DSpaceRecordFactory.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * The contents of this file are subject to the license and copyright
- * detailed in the LICENSE and NOTICE files at the root of the source
- * tree and available online at
- *
- * http://www.dspace.org/license/
- */
-package org.dspace.app.oai;
-
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-import org.dspace.content.DCDate;
-import org.dspace.search.HarvestedItemInfo;
-
-import ORG.oclc.oai.server.catalog.RecordFactory;
-import ORG.oclc.oai.server.verb.CannotDisseminateFormatException;
-
-/**
- * Implementation of the OAICat RecordFactory base class for DSpace items.
- *
- * @author Robert Tansley
- * @version $Revision$
- */
-public class DSpaceRecordFactory extends RecordFactory
-{
- public DSpaceRecordFactory(Properties properties)
- {
- // We don't use the OAICat properties; pass on up
- super(properties);
- }
-
- public String fromOAIIdentifier(String identifier)
- {
- // Our local identifier is actually the same as the OAI one (the Handle)
- return identifier;
- }
-
- public String quickCreate(Object nativeItem, String schemaURL,
- String metadataPrefix) throws IllegalArgumentException,
- CannotDisseminateFormatException
- {
- // Not supported
- return null;
- }
-
- public String getOAIIdentifier(Object nativeItem)
- {
- String h = DSpaceOAICatalog.OAI_ID_PREFIX
- + ((HarvestedItemInfo) nativeItem).handle;
-
- return h;
- }
-
- public String getDatestamp(Object nativeItem)
- {
- Date d = ((HarvestedItemInfo) nativeItem).datestamp;
-
- // Return as ISO8601
- return new DCDate(d).toString();
- }
-
- public Iterator getSetSpecs(Object nativeItem)
- {
- HarvestedItemInfo hii = (HarvestedItemInfo) nativeItem;
- Iterator i = hii.collectionHandles.iterator();
- List setSpecs = new LinkedList();
-
- // Convert the DB Handle string 123.456/789 to the OAI-friendly
- // hdl_123.456/789
- while (i.hasNext())
- {
- String handle = "hdl_" + i.next();
- setSpecs.add(handle.replace('/', '_'));
- }
-
- return setSpecs.iterator();
- }
-
- public boolean isDeleted(Object nativeItem)
- {
- HarvestedItemInfo hii = (HarvestedItemInfo) nativeItem;
-
- return hii.withdrawn;
- }
-
- public Iterator getAbouts(Object nativeItem)
- {
- // Nothing in the about section for now
- return new LinkedList().iterator();
- }
-}
diff --git a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/LoadDSpaceOAIConfig.java b/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/LoadDSpaceOAIConfig.java
deleted file mode 100644
index f2044925f8..0000000000
--- a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/LoadDSpaceOAIConfig.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * The contents of this file are subject to the license and copyright
- * detailed in the LICENSE and NOTICE files at the root of the source
- * tree and available online at
- *
- * http://www.dspace.org/license/
- */
-package org.dspace.app.oai;
-
-import javax.servlet.http.HttpServlet;
-
-import org.dspace.core.ConfigurationManager;
-
-/**
- * Simple servlet to load in DSpace and log4j configurations. Should always be
- * started up before other servlets (use )
- *
- * This class holds code to be removed in the next version of the DSpace XMLUI,
- * it is now managed by a Shared Context Listener inthe dspace-api project.
- *
- * It is deprecated, rather than removed to maintain backward compatibility for
- * local DSpace 1.5.x customized overlays.
- *
- * TODO: Remove in trunk
- *
- * @deprecated Use Servlet Context Listener provided in dspace-api (remove in >
- * 1.5.x)
- *
- * @author Robert Tansley
- * @version $Revision$
- */
-public class LoadDSpaceOAIConfig extends HttpServlet
-{
- public void init()
- {
- if(!ConfigurationManager.isConfigured())
- {
- // Get config parameter
- String config = getServletContext().getInitParameter("dspace-config");
-
- // Load in DSpace config
- ConfigurationManager.loadConfig(config);
- }
- }
-}
diff --git a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/METSCrosswalk.java b/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/METSCrosswalk.java
deleted file mode 100644
index aa1fae6984..0000000000
--- a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/METSCrosswalk.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * The contents of this file are subject to the license and copyright
- * detailed in the LICENSE and NOTICE files at the root of the source
- * tree and available online at
- *
- * http://www.dspace.org/license/
- */
-package org.dspace.app.oai;
-
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-
-import ORG.oclc.oai.server.crosswalk.Crosswalk;
-import ORG.oclc.oai.server.verb.CannotDisseminateFormatException;
-import org.dspace.content.crosswalk.DisseminationCrosswalk;
-import org.dspace.core.PluginManager;
-import org.dspace.search.HarvestedItemInfo;
-
-import org.jdom.Element;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
-
-/**
- * OAICat crosswalk to allow METS to be harvested.
- *
- * No security or privacy measures in place.
- *
- * @author Li XiaoYu (Rita)
- * @author Robert Tansley
- * @author Tim Donohue (rewrite to use METS DisseminationCrosswalk)
- */
-public class METSCrosswalk extends Crosswalk
-{
- private static final Logger log = Logger.getLogger(METSCrosswalk.class);
-
- // JDOM xml output writer - indented format for readability.
- private static XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
-
- public METSCrosswalk(Properties properties)
- {
- super(
- "http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/mets.xsd");
- }
-
- @Override
- public boolean isAvailableFor(Object nativeItem)
- {
- // We have METS for everything
- return true;
- }
-
- @Override
- public String createMetadata(Object nativeItem)
- throws CannotDisseminateFormatException
- {
- HarvestedItemInfo hii = (HarvestedItemInfo) nativeItem;
-
- try
- {
- //Get a reference to our DSpace METS DisseminationCrosswalk
- // (likely this is org.dspace.content.crosswalk.METSDisseminationCrosswalk)
- DisseminationCrosswalk xwalk = (DisseminationCrosswalk)PluginManager.
- getNamedPlugin(DisseminationCrosswalk.class, "METS");
-
- //if no crosswalk found, thrown an error
- if(xwalk==null)
- throw new CannotDisseminateFormatException("DSpace cannot disseminate METS format, as no DisseminationCrosswalk is configured which supports 'METS'");
-
- if(xwalk.canDisseminate(hii.item))
- {
- //disseminate the object to METS
- Element rootElement = xwalk.disseminateElement(hii.item);
-
- //Return XML results as a formatted String
- return outputter.outputString(rootElement);
- }
- else
- return null; // cannot disseminate this type of object
- }
- catch (Exception e)
- {
- log.error("OAI-PMH METSCrosswalk error", e);
- return null;
- }
-
- }
-}
diff --git a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/OAIDCCrosswalk.java b/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/OAIDCCrosswalk.java
deleted file mode 100644
index e44b41b849..0000000000
--- a/dspace-oai/dspace-oai-api/src/main/java/org/dspace/app/oai/OAIDCCrosswalk.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/**
- * The contents of this file are subject to the license and copyright
- * detailed in the LICENSE and NOTICE files at the root of the source
- * tree and available online at
- *
- * http://www.dspace.org/license/
- */
-package org.dspace.app.oai;
-
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.sql.SQLException;
-
-import org.dspace.app.util.MetadataExposure;
-import org.dspace.content.DCValue;
-import org.dspace.content.Item;
-import org.dspace.content.crosswalk.IConverter;
-import org.dspace.search.HarvestedItemInfo;
-import org.dspace.core.ConfigurationManager;
-import org.dspace.core.PluginManager;
-import org.dspace.core.LogManager;
-import org.apache.log4j.Logger;
-
-import ORG.oclc.oai.server.crosswalk.Crosswalk;
-import ORG.oclc.oai.server.verb.CannotDisseminateFormatException;
-
-/**
- * OAI_DC Crosswalk implementation based on oaidc.properties file. All metadata
- * included in the oaidc.properties file will be mapped on a valid oai_dc
- * element, invalid oai_dc element will be not used. It is possible specify for
- * any metadata a converter {@link org.dspace.content.crosswalk.IConverter}
- * to manipulate the metadata value before that it will be dissemite in OAI_DC.
- *
- * @author Robert Tansley
- * @author Andrea Bollini
- * @version $Revision$
- */
-public class OAIDCCrosswalk extends Crosswalk
-{
- // Pattern containing all the characters we want to filter out / replace
- // converting a String to xml
- private static final Pattern invalidXmlPattern = Pattern
- .compile("([^\\t\\n\\r\\u0020-\\ud7ff\\ue000-\\ufffd\\u10000-\\u10ffff]+|[&<>])");
-
- // Patter to extract the converter name if any
- private static final Pattern converterPattern = Pattern.compile(".*\\((.*)\\)");
-
- private static final String[] oaidcElement = new String[] { "title",
- "creator", "subject", "description", "publisher", "contributor",
- "date", "type", "format", "identifier", "source", "language",
- "relation", "coverage", "rights" };
-
- /** Location of config file */
- private static final String configFilePath = ConfigurationManager
- .getProperty("dspace.dir")
- + File.separator
- + "config"
- + File.separator
- + "crosswalks"
- + File.separator + "oaidc.properties";
-
- /** log4j logger */
- private static Logger log = Logger.getLogger(OAIDCCrosswalk.class);
-
- private static final Map> config = new HashMap>();
-
- static
- {
- // Read in configuration
- Properties crosswalkProps = new Properties();
- FileInputStream fis = null;
- try
- {
- fis = new FileInputStream(configFilePath);
- crosswalkProps.load(fis);
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException(
- "Wrong configuration for OAI_DC", e);
- }
- finally
- {
- if (fis != null)
- {
- try
- {
- fis.close();
- }
- catch (IOException ioe)
- {
- log.error(ioe);
- }
- }
- }
-
- Set
diff --git a/dspace/solr/oai/conf/admin-extra.html b/dspace/solr/oai/conf/admin-extra.html
new file mode 100644
index 0000000000..aa739da862
--- /dev/null
+++ b/dspace/solr/oai/conf/admin-extra.html
@@ -0,0 +1,31 @@
+
+
+
diff --git a/dspace/solr/oai/conf/elevate.xml b/dspace/solr/oai/conf/elevate.xml
new file mode 100644
index 0000000000..7630ebe20f
--- /dev/null
+++ b/dspace/solr/oai/conf/elevate.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dspace/solr/oai/conf/protwords.txt b/dspace/solr/oai/conf/protwords.txt
new file mode 100644
index 0000000000..1dfc0abecb
--- /dev/null
+++ b/dspace/solr/oai/conf/protwords.txt
@@ -0,0 +1,21 @@
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#-----------------------------------------------------------------------
+# Use a protected word file to protect against the stemmer reducing two
+# unrelated words to the same base word.
+
+# Some non-words that normally won't be encountered,
+# just to test that they won't be stemmed.
+dontstems
+zwhacky
+
diff --git a/dspace/solr/oai/conf/schema.xml b/dspace/solr/oai/conf/schema.xml
new file mode 100644
index 0000000000..67780813e3
--- /dev/null
+++ b/dspace/solr/oai/conf/schema.xml
@@ -0,0 +1,185 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ item.handle
+ item.handle
+
+
diff --git a/dspace/solr/oai/conf/solrconfig.xml b/dspace/solr/oai/conf/solrconfig.xml
new file mode 100644
index 0000000000..2ccd3410cc
--- /dev/null
+++ b/dspace/solr/oai/conf/solrconfig.xml
@@ -0,0 +1,1037 @@
+
+
+
+
+
+ ${solr.abortOnConfigurationError:true}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+ 10
+
+
+
+
+ 32
+
+ 10000
+ 1000
+ 10000
+
+
+
+
+
+
+
+
+
+
+
+
+ native
+
+
+
+
+
+
+ false
+ 32
+ 10
+
+
+
+
+
+
+
+ false
+
+
+ true
+
+
+
+
+
+
+
+ 1
+
+ 0
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+ 10000
+ 10000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1024
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+ 20
+
+
+ 200
+
+
+
+
+
+
+
+
+
+
+
+
+ solr rocks010
+ static firstSearcher warming query from solrconfig.xml
+
+
+
+
+ false
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ explicit
+
+
+
+
+
+
+
+
+
+
+
+
+ dismax
+ explicit
+ 0.01
+
+ text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
+
+
+ text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9
+
+
+ popularity^0.5 recip(price,1,1000,1000)^0.3
+
+
+ id,name,price,score
+
+
+ 2<-1 5<-2 6<90%
+
+ 100
+ *:*
+
+ text features name
+
+ 0
+
+ name
+ regex
+
+
+
+
+
+
+ dismax
+ explicit
+ text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0
+ 2<-1 5<-2 6<90%
+
+ incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2
+
+
+
+ inStock:true
+
+
+
+ cat
+ manu_exact
+ price:[* TO 500]
+ price:[500 TO *]
+
+
+
+
+
+
+
+
+
+ textSpell
+
+
+ default
+ name
+ ./spellchecker
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+ false
+
+ 1
+
+
+ spellcheck
+
+
+
+
+
+
+
+ true
+
+
+ tvComponent
+
+
+
+
+
+
+
+
+ default
+
+ org.carrot2.clustering.lingo.LingoClusteringAlgorithm
+
+ 20
+
+
+ stc
+ org.carrot2.clustering.stc.STCClusteringAlgorithm
+
+
+
+
+ true
+ default
+ true
+
+ name
+ id
+
+ features
+
+ true
+
+
+
+ false
+
+
+ clusteringComponent
+
+
+
+
+
+
+
+ text
+ true
+ ignored_
+
+
+ true
+ links
+ ignored_
+
+
+
+
+
+
+
+
+
+ true
+
+
+ termsComponent
+
+
+
+
+
+
+
+ string
+ elevate.xml
+
+
+
+
+
+ explicit
+
+
+ elevator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ standard
+ solrpingquery
+ all
+
+
+
+
+
+
+ explicit
+ true
+
+
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+ 70
+
+ 0.5
+
+ [-\w ,/\n\"']{20,200}
+
+
+
+
+
+
+ ]]>
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+
+
+
+
+
+
+ solr
+
+
+
+
+
diff --git a/dspace/solr/oai/conf/spellings.txt b/dspace/solr/oai/conf/spellings.txt
new file mode 100644
index 0000000000..162a044d56
--- /dev/null
+++ b/dspace/solr/oai/conf/spellings.txt
@@ -0,0 +1,2 @@
+pizza
+history
diff --git a/dspace/solr/oai/conf/stopwords.txt b/dspace/solr/oai/conf/stopwords.txt
new file mode 100644
index 0000000000..8433c832d2
--- /dev/null
+++ b/dspace/solr/oai/conf/stopwords.txt
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#-----------------------------------------------------------------------
+# a couple of test stopwords to test that the words are really being
+# configured from this file:
+stopworda
+stopwordb
+
+#Standard english stop words taken from Lucene's StopAnalyzer
+an
+and
+are
+as
+at
+be
+but
+by
+for
+if
+in
+into
+is
+it
+no
+not
+of
+on
+or
+s
+such
+t
+that
+the
+their
+then
+there
+these
+they
+this
+to
+was
+will
+with
+
diff --git a/dspace/solr/oai/conf/synonyms.txt b/dspace/solr/oai/conf/synonyms.txt
new file mode 100644
index 0000000000..b0e31cb7ec
--- /dev/null
+++ b/dspace/solr/oai/conf/synonyms.txt
@@ -0,0 +1,31 @@
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#-----------------------------------------------------------------------
+#some test synonym mappings unlikely to appear in real input text
+aaa => aaaa
+bbb => bbbb1 bbbb2
+ccc => cccc1,cccc2
+a\=>a => b\=>b
+a\,a => b\,b
+fooaaa,baraaa,bazaaa
+
+# Some synonym groups specific to this example
+GB,gib,gigabyte,gigabytes
+MB,mib,megabyte,megabytes
+Television, Televisions, TV, TVs
+#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
+#after us won't split it into two words.
+
+# Synonym mappings can be used for spelling correction too
+pixima => pixma
+
diff --git a/dspace/solr/oai/conf/xslt/DRI.xsl b/dspace/solr/oai/conf/xslt/DRI.xsl
new file mode 100644
index 0000000000..f68043c843
--- /dev/null
+++ b/dspace/solr/oai/conf/xslt/DRI.xsl
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /metadata/handle/
+
+ /mets.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dspace/solr/oai/conf/xslt/example.xsl b/dspace/solr/oai/conf/xslt/example.xsl
new file mode 100644
index 0000000000..6832a1d4cb
--- /dev/null
+++ b/dspace/solr/oai/conf/xslt/example.xsl
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This has been formatted by the sample "example.xsl" transform -
+ use your own XSLT to get a nicer page
+