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:
-
sweeperDelay - configures how often the resource sweeper runs in msec.
By default the resource sweeper runs every minute. For example:
<parameter>
<name>sweeperDelay</name>
<value>60000</value>
</parameter>
-
resourceClass - configures the name of the resource class. For example:
<parameter>
<name>resourceClass</name>
<value>org.globus.wsrf.samples.counter.PersistentCounter</value>
</parameter>
-
resourceKeyType - configures the key type class. By default
java.lang.String is used. For example:
<parameter>
<name>resourceKeyType</name>
<value>java.lang.Integer</value>
</parameter>
-
resourceKeyName - configures the key name. For example:
<parameter>
<name>resourceKeyName</name>
<value>{http://counter.com}CounterKey</value>
</parameter>
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();.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
resources
protected Map resources
keyTypeName
protected QName keyTypeName
resourceClass
protected Class resourceClass
keyTypeClass
protected Class keyTypeClass
lockManager
protected LockManager lockManager
PersistentResourceHome
public PersistentResourceHome()
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 keyInvalidResourceKeyException - 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 keyInvalidResourceKeyException - 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.