org.globus.wsrf.impl
Class PersistentResourceHome

java.lang.Object
  |
  +--org.globus.wsrf.impl.PersistentResourceHome
All Implemented Interfaces:
Initializable, ResourceHome

public abstract class PersistentResourceHome
extends Object
implements ResourceHome, Initializable

An implementation of the ResourceHome interface. This implementation was designed to work with resources that implement the PersistentResource interface. If the resource class implements the PersistentResource interface SoftReferences will be used to recycle resource objects. The resource class implementation is responsible for saving its state to disk. This implementation will not call PersistentResource.store(). The resource implementation must have a default constructor.

Configuration options:


Note: Must be deployed with org.globus.wsrf.tools.jndi.BeanFactory in JNDI or user must first call initialize() method. Also when overriding the initialize() method make sure to call super.initialize();.


Field Summary
protected  Class keyTypeClass
           
protected  QName keyTypeName
           
protected  LockManager lockManager
           
protected  Class resourceClass
           
protected  Map resources
           
 
Constructor Summary
PersistentResourceHome()
           
 
Method Summary
protected  void add(ResourceKey key, Object resource)
           
protected  Object createNewInstance()
           
protected  Object createNewInstanceAndLoad(ResourceKey key)
           
 Object find(ResourceKey key)
          Retrives a resource.
 Class getKeyTypeClass()
          The resource key type.
 QName getKeyTypeName()
          The name of the resource key.
 String getResourceClass()
           
 long getSweeperDelay()
           
 void initialize()
           
 void remove(ResourceKey key)
          Removes a resource.
 void setResourceClass(String clazz)
           
 void setResourceKeyName(String keyName)
           
 void setResourceKeyType(String clazz)
           
 void setSweeperDelay(long delay)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

protected Map resources

keyTypeName

protected QName keyTypeName

resourceClass

protected Class resourceClass

keyTypeClass

protected Class keyTypeClass

lockManager

protected LockManager lockManager
Constructor Detail

PersistentResourceHome

public PersistentResourceHome()
Method Detail

setResourceClass

public void setResourceClass(String clazz)
                      throws ClassNotFoundException

getResourceClass

public String getResourceClass()

setResourceKeyType

public void setResourceKeyType(String clazz)
                        throws ClassNotFoundException

getKeyTypeClass

public Class getKeyTypeClass()
Description copied from interface: ResourceHome
The resource key type. The ResourceKey used or passed to this ResourceHome must have match this type (corresponds to ResourceKey.getValue()).
Specified by:
getKeyTypeClass in interface ResourceHome
Following copied from interface: org.globus.wsrf.ResourceHome
Returns:
the type of the key.

setResourceKeyName

public void setResourceKeyName(String keyName)

getKeyTypeName

public QName getKeyTypeName()
Description copied from interface: ResourceHome
The name of the resource key. The ResourceKey used or passed to this ResourceHome must have match this name (corresponds to ResourceKey.getName()).
Specified by:
getKeyTypeName in interface ResourceHome
Following copied from interface: org.globus.wsrf.ResourceHome
Returns:
the name of the key.

setSweeperDelay

public void setSweeperDelay(long delay)

getSweeperDelay

public long getSweeperDelay()

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable

createNewInstance

protected Object createNewInstance()
                            throws ResourceException

createNewInstanceAndLoad

protected Object createNewInstanceAndLoad(ResourceKey key)
                                   throws ResourceException

find

public Object find(ResourceKey key)
            throws ResourceException
Description copied from interface: ResourceHome
Retrives a resource. Note: This function must not return null. It must return the resource object or throw an exception if there is no resource with the specified key.
Specified by:
find in interface ResourceHome
Following copied from interface: org.globus.wsrf.ResourceHome
Returns:
non-null resource object.
Throws:
NoSuchResourceException - if no resource exists with the given key
InvalidResourceKeyException - if the resource key is invalid.
ResourceException - if any other error occurs.

remove

public void remove(ResourceKey key)
            throws ResourceException
Description copied from interface: ResourceHome
Removes a resource. If the resource implements the RemoveCallback interface, the implementation must invoke this the remove operation on the resource.
Specified by:
remove in interface ResourceHome
Following copied from interface: org.globus.wsrf.ResourceHome
Throws:
NoSuchResourceException - if no resource exists with the given key
InvalidResourceKeyException - if the resource key is invalid.
RemoveNotSupportedException - if remove operation is not supported.
ResourceException - if any other error occurs.

add

protected void add(ResourceKey key,
                   Object resource)


Copyright © 1999-2003 University of Chicago and The University of Southern California. All rights reserved.