|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nih.nci.cagrid.introduce.servicetools.FilePersistenceHelper
gov.nih.nci.cagrid.introduce.servicetools.XmlPersistenceHelper
public class XmlPersistenceHelper
This helper is used to persist a ReflectionResource by serializing the resource implementation JavaBean used
in constructing the ReflectionResource. The result of storing the resource is
an XML file that corresponds exactly to the XML Schema Resource document
defined for this resource. Future versions will offer alternative modes of
persistence.
Usage:
Use this helper on the model of
PersistentReflectionResource
ReflectionResource,
PersistentReflectionResource,
ResourceHomeImpl,
PersistentResource,
RemoveCallback| Field Summary |
|---|
| Fields inherited from class gov.nih.nci.cagrid.introduce.servicetools.FilePersistenceHelper |
|---|
beanClass, fileSuffix, storageDir |
| Constructor Summary | |
|---|---|
XmlPersistenceHelper(java.lang.Class beanClass,
ServiceConfiguration configuration)
|
|
| Method Summary | |
|---|---|
static void |
copyFile(java.io.File in,
java.io.File out)
|
java.lang.Object |
load(java.lang.Class clazz,
java.lang.Object key)
Loads and returns the object of the given key from the persistent storage. |
void |
load(java.lang.Object key,
ReflectionResource resource)
Loads and initialize the resource. |
void |
remove(ReflectionResource resource)
Removes the resource from persistent storage. |
void |
store(java.lang.Object key,
java.lang.Object object,
javax.xml.namespace.QName topElementQName)
Stores the object of the given key to persistent storage. |
void |
store(ReflectionResource resource)
Store the resource into an XML document (current implementation). |
| Methods inherited from class gov.nih.nci.cagrid.introduce.servicetools.FilePersistenceHelper |
|---|
createStorageDirectory, getBeanClass, getDefaultStorageDirectory, getFileSuffix, getKeyAsFile, getStorageDirectory, list, remove, removeAll, setStorageDirectory, setStorageDirectory |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface gov.nih.nci.cagrid.introduce.servicetools.PersistenceHelper |
|---|
list, removeAll |
| Constructor Detail |
|---|
public XmlPersistenceHelper(java.lang.Class beanClass,
ServiceConfiguration configuration)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public void load(java.lang.Object key,
ReflectionResource resource)
throws org.globus.wsrf.ResourceException
PersistenceHelper
load in interface PersistenceHelperkey - the key of the potentially new resourceresource - the new resource to load.
Its key and implementation bean are null.
They will be set by a call from this method to
resource.initialize().
org.globus.wsrf.ResourceExceptionPersistentResource
public void store(ReflectionResource resource)
throws org.globus.wsrf.ResourceException
PersistenceHelpergetKeyAsFile().
This stores the state of the implementation JavaBean. If some resource
properties have been implemented with something else (for instance
getters and setters from another object) they will not be
persisted with the current state. This is not a problem if their state
is immutable after initial creation, as their values will be set by
initialize,
ReflectionResource.initialize()} which is called by
this method.
(TODO: persist based on each RP?)
store in interface PersistenceHelperresource - the resource to store the state of.
org.globus.wsrf.ResourceException - if the resource could not be storedgetKeyAsFile(),
PersistentResource
public void remove(ReflectionResource resource)
throws org.globus.wsrf.ResourceException
PersistenceHelper
remove in interface PersistenceHelperresource - the resource to remove from storage.
org.globus.wsrf.ResourceException - if the resource could not be removed.RemoveCallback
public java.lang.Object load(java.lang.Class clazz,
java.lang.Object key)
throws org.globus.wsrf.ResourceException
load in interface PersistenceHelperkey - key of object to load.
org.globus.wsrf.ResourceException - If the object cannot be loaded from file.
public void store(java.lang.Object key,
java.lang.Object object,
javax.xml.namespace.QName topElementQName)
throws org.globus.wsrf.ResourceException
key - key of object.object - object to persist.topElementQName - the top element name of the XML object.
org.globus.wsrf.ResourceException - If the object cannot be saved to a file.
public static void copyFile(java.io.File in,
java.io.File out)
throws java.io.IOException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||