|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfedora.server.storage.translation.DOTranslationUtility
public abstract class DOTranslationUtility
Utility methods for usage by digital object serializers and deserializers. This class provides methods for detecting various forms of relative repository URLs, which are URLs that point to the hostname and port of the local repository. Methods will detect these kinds of URLS in datastream location fields and in special cases of inline XML. Methods are available to convert these URLS back and forth from relative URL syntax, to Fedora's internal local URL syntax, and to absolute URL sytnax. This utility class defines different "translation contexts" and the format of these relative URLs will be set appropriately to the context. Currently defined translation contexts are: 0=Deserialize XML into java object appropriate for in-memory usage 1=Serialize java object to XML appropriate for "public" export (absolute URLs) 2=Serialize java object to XML appropriate for move/migrate to another repository 3=Serialize java object to XML appropriate for internal storage
The public "normalize*" methods in this class should be called to make the right decisions about what conversions should occur for what contexts. Other utility methods set default values for datastreams and disseminators.
| Field Summary | |
|---|---|
static int |
DESERIALIZE_INSTANCE
DESERIALIZE_INSTANCE: Deserialize XML into a java object appropriate for in-memory usage. |
static java.util.regex.Pattern |
s_fedoraLocalPattern
|
static java.util.regex.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. |
| Constructor Summary | |
|---|---|
DOTranslationUtility()
|
|
| Method Summary | |
|---|---|
static void |
appendXMLStream(java.io.InputStream in,
java.lang.StringBuffer buf,
java.lang.String encoding)
Appends XML to a StringBuffer. |
static Datastream |
normalizeDSLocationURLs(java.lang.String PID,
Datastream origDS,
int transContext)
|
static java.lang.String |
normalizeInlineXML(java.lang.String xml,
int transContext)
Utility method to normalize a chunk of inline XML depending on the translation context. |
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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 java.util.regex.Pattern s_fedoraLocalPattern
public static java.util.regex.Pattern s_getItemPattern
| Constructor Detail |
|---|
public DOTranslationUtility()
| Method Detail |
|---|
public static Datastream normalizeDSLocationURLs(java.lang.String PID,
Datastream origDS,
int transContext)
public static java.lang.String normalizeInlineXML(java.lang.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 fedora.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_ARCHIVE
public static Datastream setDatastreamDefaults(Datastream ds)
throws ObjectIntegrityException
ds - The Datastream object to work on.
ObjectIntegrityException
public static Disseminator setDisseminatorDefaults(Disseminator diss)
throws ObjectIntegrityException
ObjectIntegrityException
public static void appendXMLStream(java.io.InputStream in,
java.lang.StringBuffer buf,
java.lang.String encoding)
throws ObjectIntegrityException,
java.io.UnsupportedEncodingException,
StreamIOException
in - InputStreaming containing serialized XML.buf - StringBuffer to write XML content to.encoding - Character set encoding.
ObjectIntegrityException
java.io.UnsupportedEncodingException
StreamIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||