public abstract class DOTranslationUtility extends Object implements Constants
Constants.FedoraHome| Modifier and Type | Field and Description |
|---|---|
static int |
AS_IS
Deserialize or Serialize as is.
|
static int |
DESERIALIZE_INSTANCE
DESERIALIZE_INSTANCE: Deserialize XML into a java object appropriate for
in-memory usage.
|
static Pattern |
s_getItemPattern |
static int |
SERIALIZE_EXPORT_ARCHIVE
SERIALIZE_EXPORT_ARCHIVE: Serialize digital object to XML in a manner
appropriate for creating a stand alone archive of objects from a
repository that will NOT be available after objects have been exported.
|
static int |
SERIALIZE_EXPORT_MIGRATE
SERIALIZE_EXPORT_MIGRATE: Serialize digital object to XML in a manner
appropriate for migrating or moving objects from one repository to
another.
|
static int |
SERIALIZE_EXPORT_PUBLIC
SERIALIZE_EXPORT_PUBLIC: Serialize digital object to XML appropriate for
"public" external use.
|
static int |
SERIALIZE_STORAGE_INTERNAL
SERIALIZE_STORAGE_INTERNAL: Serialize java object to XML appropriate for
persistent storage in the repository, ensuring that any URLs that are
relative to the local repository are stored with the Fedora local URL
syntax.
|
ACCESS, ACTION, API, ATOM_APIM1_0, ATOM_ZIP1_1, ATOM1_1, AUDIT, AUDIT1_0, BATCH_MODIFY, BATCH_MODIFY1_1, BE_SECURITY, BE_SECURITY1_0, BINDING_SPEC, DATASTREAM, DC, DISSEMINATOR, DS_COMPOSITE_MODEL, DS_COMPOSITE_MODEL1_0, DS_INPUT_SPEC1_0, DS_INPUT_SPEC1_1, ENVIRONMENT, FCFG, FEDORA, FEDORA_APP_CONTEXT_NAME, FEDORA_DEFAULT_APP_CONTEXT, FEDORA_HOME, FEDORA_REPOSITORY_PID, FOXML, FOXML1_0, FOXML1_0_LEGACY, FOXML1_1, HTTP_REQUEST, MANAGEMENT, METHOD_MAP, METS, METS_EXT, METS_EXT1_0, METS_EXT1_0_LEGACY, METS_EXT1_1, MODEL, MULGARA, OAI_DC, OAI_DC2_0, OAI_FRIENDS, OAI_FRIENDS2_0, OAI_IDENTIFIER, OAI_IDENTIFIER2_0, OAI_PMH, OAI_PMH2_0, OAI_PROV, OAI_PROV2_0, OBJ_DATASTREAMS1_0, OBJ_HISTORY1_0, OBJ_ITEMS1_0, OBJ_METHODS1_0, OBJ_PROFILE1_0, OBJ_VALIDATION1_0, OBJECT, OLD_XLINK, PID_LIST1_0, RDF, RDF_XSD, RECOVERY, RELS_EXT, RELS_EXT1_0, RELS_INT1_0, REPO_DESC1_0, RESOURCE, SDEF, SDEF_METHOD_MAP1_0, SDEP, SDEP_METHOD_MAP1_0, SDEP_METHOD_MAP1_1, SERVICE_PROFILE, SOAP, SOAP_ENC, SUBJECT, TYPES, VIEW, WSDL, WSDL_HTTP, WSDL_MIME, XACML_POLICY, XACML_POLICY1_0, XACML1, XACML1_ACTION, XACML1_POLICY, XACML1_RESOURCE, XACML1_SUBJECT, XACML2_POLICY_SCHEMA, XLINK, XML_XSD, XMLNS, XSI| Constructor and Description |
|---|
DOTranslationUtility() |
| Modifier and Type | Method and Description |
|---|---|
protected static void |
appendAuditTrail(DigitalObject obj,
PrintWriter writer) |
protected static void |
appendXMLStream(InputStream in,
PrintWriter writer,
String encoding)
Appends XML to a PrintWriter.
|
protected static List<AuditRecord> |
getAuditRecords(InputStream auditTrail)
Parse an audit:auditTrail and return a list of AuditRecords.
|
protected static List<AuditRecord> |
getAuditRecords(Reader auditTrail) |
protected static List<AuditRecord> |
getAuditRecords(XMLEventReader reader) |
protected static String |
getAuditTrail(DigitalObject obj) |
static String |
getStateAttribute(DigitalObject obj)
Reads the state attribute from a DigitalObject.
|
static RDFName |
getTypeAttribute(DigitalObject obj) |
static String |
makeAbsoluteURLs(String input)
Make URLs that are relative to the local Fedora repository ABSOLUTE URLs.
|
static String |
makeFedoraLocalURLs(String input)
Detect all forms of URLs that point to the local Fedora repository and
make sure they are encoded in the special Fedora local URL syntax
(http://local.fedora.server/...").
|
static void |
normalizeDatastreams(DigitalObject obj,
int transContext,
String characterEncoding) |
static Datastream |
normalizeDSLocationURLs(String PID,
Datastream origDS,
int transContext) |
static String |
normalizeInlineXML(String xml,
int transContext)
Utility method to normalize a chunk of inline XML depending on the
translation context.
|
protected static String |
oneString(String[] idList) |
static String |
readStateAttribute(String rawValue)
Parse and read the object state value from raw text.
|
static Datastream |
setDatastreamDefaults(Datastream ds)
Check for null values in attributes and set them to empty string so
'null' does not appear in XML attribute values.
|
static Disseminator |
setDisseminatorDefaults(Disseminator diss)
Deprecated.
|
protected static void |
validateAudit(AuditRecord audit)
The audit record is created by the system, so programmatic validation
here is o.k.
|
public static final int DESERIALIZE_INSTANCE
public static final int SERIALIZE_EXPORT_PUBLIC
public static final int SERIALIZE_EXPORT_MIGRATE
public static final int SERIALIZE_STORAGE_INTERNAL
public static final int SERIALIZE_EXPORT_ARCHIVE
public static final int AS_IS
public static Pattern s_getItemPattern
public static String makeAbsoluteURLs(String input)
m_xmlContent - public static String makeFedoraLocalURLs(String input)
input - public static Datastream normalizeDSLocationURLs(String PID, Datastream origDS, int transContext)
public static String normalizeInlineXML(String xml, int transContext)
xml - a chunk of XML that's contents of an inline XML datastreamtransContext - Integer value indicating the serialization or deserialization
context. Valid values are defined as constants in
org.fcrepo.server.storage.translation.DOTranslationUtility:
0=DOTranslationUtility.DESERIALIZE_INSTANCE
1=DOTranslationUtility.SERIALIZE_EXPORT_PUBLIC
2=DOTranslationUtility.SERIALIZE_EXPORT_MIGRATE
3=DOTranslationUtility.SERIALIZE_STORAGE_INTERNAL
4=DOTranslationUtility.SERIALIZE_EXPORT_ARCHIVEpublic static Datastream setDatastreamDefaults(Datastream ds) throws ObjectIntegrityException
ds - The Datastream object to work on.ObjectIntegrityExceptionprotected static void appendXMLStream(InputStream in, PrintWriter writer, String encoding) throws ObjectIntegrityException, UnsupportedEncodingException, StreamIOException
in - InputStreaming containing serialized XML.writer - PrintWriter to write XML content to.encoding - Character set encoding.ObjectIntegrityExceptionUnsupportedEncodingExceptionStreamIOExceptionpublic static void normalizeDatastreams(DigitalObject obj, int transContext, String characterEncoding) throws UnsupportedEncodingException
UnsupportedEncodingException@Deprecated public static Disseminator setDisseminatorDefaults(Disseminator diss) throws ObjectIntegrityException
ObjectIntegrityExceptionpublic static String getStateAttribute(DigitalObject obj) throws ObjectIntegrityException
Null or empty strings are interpteted as "Active".
obj - Object that potentially contains object state data.ObjectIntegrityException - thrown when the state cannot be parsed.public static String readStateAttribute(String rawValue) throws ParseException
Reads a text representation of object state, and returns a "state code" abbreviation corresponding to that state. Null or empty values are interpreted as "Active".
XXX: It might clearer to nix state codes altogether and just use the full valuerawValue - Raw string to parse. May be nullParseException - thrown when state value cannot be determinedpublic static RDFName getTypeAttribute(DigitalObject obj) throws ObjectIntegrityException
ObjectIntegrityExceptionprotected static void validateAudit(AuditRecord audit) throws ObjectIntegrityException
audit - ObjectIntegrityExceptionprotected static String getAuditTrail(DigitalObject obj) throws ObjectIntegrityException
ObjectIntegrityExceptionprotected static void appendAuditTrail(DigitalObject obj, PrintWriter writer) throws ObjectIntegrityException
ObjectIntegrityExceptionprotected static List<AuditRecord> getAuditRecords(XMLEventReader reader) throws XMLStreamException
XMLStreamExceptionprotected static List<AuditRecord> getAuditRecords(InputStream auditTrail) throws XMLStreamException
auditTrail - XMLStreamExceptionprotected static List<AuditRecord> getAuditRecords(Reader auditTrail) throws XMLStreamException
XMLStreamExceptionCopyright © 2013 DuraSpace. All Rights Reserved.