public final class OAIUtils
extends java.lang.Object
Constructor and Description |
---|
OAIUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
decode(java.lang.String msg)
Decode an identifier or resumption token.
|
static java.lang.String |
encode(java.lang.String msg)
Encode an identifier or resumption token.
|
static java.util.Date |
getDateFromDatestamp(java.lang.String datestamp)
Converts an ISO8601 UTC datestamp String of the form yyyy-MM-ddTHH:mm:ssZ or the short form yyyy-MM-dd to a Java
Date.
|
static java.util.Date |
getDateFromDatestamp(java.lang.String datestamp,
long increment)
Converts an ISO8601 UTC datastamp String of the form yyyy-MM-ddTHH:mm:ssZ or the short form yyyy-MM-dd to a Java
Date.
|
static java.lang.String |
getDatestampFromDate(java.util.Date date)
Gets an ISO8601 UTC datestamp string of the form yyyy-MM-ddTHH:mm:ssZ from a Date.
|
static java.lang.String |
getHarvestedDirBaseURLPath(java.lang.String basePath,
java.lang.String baseURL)
Creates an appropriate directory path where harvested file(s) are saved similar to wget paths based on
the URI.
|
static java.lang.String |
getHarvestedDirPath(java.lang.String basePath,
java.lang.String setname,
java.lang.String prefix,
java.lang.String baseURL)
Creates an appropriate directory path where harvested file(s) are saved based on the baseURL, format and
set.
|
static long |
getLongFromDatestamp(java.lang.String datestamp)
Converts an ISO8601 UTC datastamp String of the form yyyy-MM-ddTHH:mm:ssZ to a long.
|
static long |
getLongFromDatestamp(java.lang.String datestamp,
long increment)
Converts an ISO8601 UTC datastamp String of the form yyyy-MM-ddTHH:mm:ssZ to a long.
|
public static final java.lang.String getDatestampFromDate(java.util.Date date)
date
- The DategetDateFromDatestamp(java.lang.String)
public static final java.util.Date getDateFromDatestamp(java.lang.String datestamp) throws java.text.ParseException
datestamp
- A datestamp in UTC format.java.text.ParseException
- If unable to interpret the datestamp.public static final java.util.Date getDateFromDatestamp(java.lang.String datestamp, long increment) throws java.text.ParseException
datestamp
- A datestamp in UTC format.increment
- Number of seconds to increment the date, positive or negative, or 0 to leave
unchanged.java.text.ParseException
- If unable to interpret the datestamp.public static final long getLongFromDatestamp(java.lang.String datestamp) throws java.text.ParseException
datestamp
- A datestamp in UTC format.java.text.ParseException
- If unable to interpret the datestamp.public static final long getLongFromDatestamp(java.lang.String datestamp, long increment) throws java.text.ParseException
datestamp
- A datestamp in UTC format.increment
- Number of seconds to increment the date, positive or negative, or 0 to leave
unchanged.java.text.ParseException
- If unable to interpret the datestamp.public static java.lang.String getHarvestedDirBaseURLPath(java.lang.String basePath, java.lang.String baseURL)
basePath
- The base output directory.baseURL
- The baseURL of the OAI data provider.public static java.lang.String getHarvestedDirPath(java.lang.String basePath, java.lang.String setname, java.lang.String prefix, java.lang.String baseURL)
basePath
- The base output directory.setname
- The OAI setSpec harvested, or null if none.prefix
- The metadataPrefix (format) harvested.baseURL
- The baseURL of the OAI data provider.public static java.lang.String encode(java.lang.String msg) throws java.lang.Exception
See section 3.1.1.3 in http://www.openarchives.org/OAI/2.0/openarchivesprotocol.htm
msg
- A String to encode.java.lang.Exception
- If errorpublic static java.lang.String decode(java.lang.String msg) throws java.lang.Exception
See section 3.1.1.3 in http://www.openarchives.org/OAI/2.0/openarchivesprotocol.htm
msg
- Message to decodejava.lang.Exception
- If unable to decode.