|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gate.util.persistence.PersistenceManager
This class provides utility methods for saving resources through serialisation via static methods.
Inner Class Summary | |
static class |
PersistenceManager.ClassComparator
|
static class |
PersistenceManager.NotComparableException
Thrown by a comparator when the values provided for comparison are not comparable. |
protected static class |
PersistenceManager.ObjectHolder
A reference to an object; it uses the identity hashcode and the equals defined by object identity. |
static class |
PersistenceManager.SlashDevSlashNull
This class is used as a marker for types that should NOT be serialised when saving the state of a gate object. |
static class |
PersistenceManager.URLHolder
URLs get upset when serialised and deserialised so we need to convert them to strings for storage |
Field Summary | |
private static PersistenceManager.ClassComparator |
classComparator
|
private static Map |
existingPersitentReplacements
Stores the persistent replacements created during a transaction in order to avoid creating two different persistent copies for the same object. |
private static Map |
existingTransientValues
Stores the transient values obtained from persistent replacements during a transaction in order to avoid creating two different transient copies for the same persistent replacement. |
private static Map |
persistentReplacementTypes
A dictionary mapping from java type (Class) to the type (Class) that can be used to store persistent data for the input type. |
Constructor Summary | |
PersistenceManager()
|
Method Summary | |
(package private) static void |
|
protected static Class |
getMostSpecificPersistentType(Class type)
Finds the most specific persistent replacement type for a given class. |
(package private) static Serializable |
getPersistentRepresentation(Object target)
Recursively traverses the provided object and replaces it and all its contents with the appropiate persistent equivalent classes. |
(package private) static Object |
getTransientRepresentation(Object target)
|
static Object |
loadObjectFromFile(File file)
|
static Class |
registerPersitentEquivalent(Class transientType,
Class persistentType)
Sets the persistent equivalent type to be used to (re)store a given type of transient objects. |
static void |
saveObjectToFile(Object obj,
File file)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
Field Detail |
private static Map persistentReplacementTypes
private static Map existingPersitentReplacements
PersistenceManager.ObjectHolder
s that contain the transient values
being converted to persistent equivalents.private static Map existingTransientValues
PersistenceManager.ObjectHolder
s that hold persistent equivalents.
The values are the transient values created by the persisten equivalents.private static PersistenceManager.ClassComparator classComparator
Constructor Detail |
public PersistenceManager()
Method Detail |
static Serializable getPersistentRepresentation(Object target) throws PersistenceException
the
- object to be analised and translated into a persistent
equivalent.static Object getTransientRepresentation(Object target) throws PersistenceException, ResourceInstantiationException
protected static Class getMostSpecificPersistentType(Class type)
Resource
and
for LanguageResource
than such a request for a
Document
will yield the registered type for
LanguageResource
.public static void saveObjectToFile(Object obj, File file) throws PersistenceException, IOException
public static Object loadObjectFromFile(File file) throws PersistenceException, IOException, ResourceInstantiationException
public static Class registerPersitentEquivalent(Class transientType, Class persistentType) throws PersistenceException
transientType
- the type that will be replaced during serialisation
operationspersistentType
- the type used to replace objects of transient type
when serialising; this type needs to extend Persistence
.static void()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |