gov.nih.nci.cagrid.introduce.servicetools
Interface PersistenceHelper

All Known Implementing Classes:
XmlPersistenceHelper

public interface PersistenceHelper


Method Summary
 java.util.List list()
           
 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 removeAll()
           
 void store(ReflectionResource resource)
          Store the resource into an XML document (current implementation).
 

Method Detail

list

java.util.List list()
                    throws java.lang.Exception
Throws:
java.lang.Exception

load

void load(java.lang.Object key,
          ReflectionResource resource)
          throws org.globus.wsrf.ResourceException
Loads and initialize the resource.

Parameters:
key - the key of the potentially new resource
resource - 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().
Throws:
org.globus.wsrf.ResourceException
See Also:
PersistentResource

load

java.lang.Object load(java.lang.Class clazz,
                      java.lang.Object key)
                      throws org.globus.wsrf.ResourceException
Loads and returns the object of the given key from the persistent storage.

Parameters:
key - key of object to load.
Returns:
loaded Object instance.
Throws:
org.globus.wsrf.ResourceException - If the object cannot be loaded from file.

store

void store(ReflectionResource resource)
           throws org.globus.wsrf.ResourceException
Store the resource into an XML document (current implementation). The name of the file is governed by getKeyAsFile(). 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?)

Parameters:
resource - the resource to store the state of.
Throws:
org.globus.wsrf.ResourceException - if the resource could not be stored
See Also:
getKeyAsFile(), PersistentResource

remove

void remove(ReflectionResource resource)
            throws org.globus.wsrf.ResourceException
Removes the resource from persistent storage.

Parameters:
resource - the resource to remove from storage.
Throws:
org.globus.wsrf.ResourceException - if the resource could not be removed.
See Also:
RemoveCallback

removeAll

void removeAll()
               throws java.lang.Exception
Throws:
java.lang.Exception