|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.util.persistence.PersistenceManager
public class PersistenceManager
This class provides utility methods for saving resources through serialisation via static methods. It now supports both native and xml serialization.
| Nested 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. |
| Constructor Summary | |
|---|---|
PersistenceManager()
|
|
| Method Summary | |
|---|---|
protected static Class |
getMostSpecificPersistentType(Class type)
Finds the most specific persistent replacement type for a given class. |
static Serializable |
getPersistentRepresentation(Object target)
Recursively traverses the provided object and replaces it and all its contents with the appropriate persistent equivalent classes. |
static String |
getRelativePath(URL context,
URL target)
Calculates the relative path for a file: URL starting from a given context which is also a file: URL. |
static Object |
getTransientRepresentation(Object target)
|
static Object |
loadObjectFromFile(File file)
|
static Object |
loadObjectFromUrl(URL url)
|
static Class |
registerPersistentEquivalent(Class transientType,
Class persistentType)
Sets the persistent equivalent type to be used to (re)store a given type of transient objects. |
static Class |
registerPersitentEquivalent(Class transientType,
Class persistentType)
Deprecated. Use registerPersistentEquivalent(Class,Class) instead |
static void |
saveObjectToFile(Object obj,
File file)
|
static void |
saveObjectToFile(Object obj,
File file,
boolean usegatehome,
boolean warnaboutgatehome)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PersistenceManager()
| Method Detail |
|---|
public static Serializable getPersistentRepresentation(Object target)
throws PersistenceException
target - the object to be analysed and translated into a
persistent equivalent.
PersistenceException
public static Object getTransientRepresentation(Object target)
throws PersistenceException,
ResourceInstantiationException
PersistenceException
ResourceInstantiationExceptionprotected 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 String getRelativePath(URL context,
URL target)
context - the URL to be used as context.target - the URL for which the relative path is computed.
public static void saveObjectToFile(Object obj,
File file)
throws PersistenceException,
IOException
PersistenceException
IOException
public static void saveObjectToFile(Object obj,
File file,
boolean usegatehome,
boolean warnaboutgatehome)
throws PersistenceException,
IOException
PersistenceException
IOException
public static Object loadObjectFromFile(File file)
throws PersistenceException,
IOException,
ResourceInstantiationException
PersistenceException
IOException
ResourceInstantiationException
public static Object loadObjectFromUrl(URL url)
throws PersistenceException,
IOException,
ResourceInstantiationException
PersistenceException
IOException
ResourceInstantiationException
public static Class registerPersitentEquivalent(Class transientType,
Class persistentType)
throws PersistenceException
registerPersistentEquivalent(Class,Class) instead
PersistenceException
public static Class registerPersistentEquivalent(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.
PersistenceException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||