|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.globus.wsrf.impl.ResourceHomeImpl
An implementation of the ResourceHome interface.
This implementation was designed to work with resources that implement
the PersistenceCallback interface as well as
memory resident resources. If the resource class implements the
PersistenceCallback 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
PersistenceCallback.store(). The
resource implementation must have a default constructor.
Configuration options:
<parameter>
<name>sweeperDelay</name>
<value>60000</value>
</parameter>
<parameter>
<name>resourceClass</name>
<value>org.globus.wsrf.samples.counter.PersistentCounter</value>
</parameter>
java.lang.String is used. For example:
<parameter>
<name>resourceKeyType</name>
<value>java.lang.Integer</value>
</parameter>
<parameter>
<name>resourceKeyName</name>
<value>{http://counter.com}CounterKey</value>
</parameter>
org.globus.wsrf.jndi.BeanFactory in JNDI
or user must first call initialize() method.
Also when overriding the initialize() method make
sure to call super.initialize();.
ResourceHome implementation performs per key
synchronization.
| Nested Class Summary | |
private static class |
ResourceHomeImpl.Sweeper
This ResourceSweeper implementation just returns the resources currently stored in the map. |
| Field Summary | |
protected Cache |
cache
|
protected java.lang.String |
cacheLocation
|
private static org.globus.util.I18n |
i18n
|
private boolean |
initialized
|
protected java.lang.Class |
keyTypeClass
|
protected javax.xml.namespace.QName |
keyTypeName
|
protected LockManager |
lockManager
|
private static org.apache.commons.logging.Log |
logger
|
protected java.lang.Class |
resourceClass
|
protected java.lang.reflect.Constructor |
resourceConstructor
|
protected boolean |
resourceIsPersistent
|
protected java.util.Map |
resources
|
private ResourceHomeImpl.Sweeper |
sweeper
|
private long |
sweeperDelay
|
| Constructor Summary | |
ResourceHomeImpl()
|
|
| Method Summary | |
protected void |
add(ResourceKey key,
Resource resource)
|
private void |
addResource(ResourceKey key,
Resource resource)
|
protected Resource |
createNewInstance()
|
protected Resource |
createNewInstanceAndLoad(ResourceKey key)
|
void |
destroy()
|
Resource |
find(ResourceKey key)
Retrives a resource. |
private Resource |
get(ResourceKey key)
|
java.lang.String |
getCacheLocation()
|
java.lang.Class |
getKeyTypeClass()
The resource key type. |
javax.xml.namespace.QName |
getKeyTypeName()
The name of the resource key. |
java.lang.String |
getResourceClass()
|
long |
getSweeperDelay()
|
void |
initialize()
|
private void |
initResourceConstructor()
|
void |
remove(ResourceKey key)
Removes a resource. |
void |
setCacheLocation(java.lang.String jndiLocation)
|
void |
setResourceClass(java.lang.String clazz)
|
void |
setResourceKeyName(java.lang.String keyName)
|
void |
setResourceKeyType(java.lang.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 |
private static org.apache.commons.logging.Log logger
private static org.globus.util.I18n i18n
protected java.util.Map resources
protected javax.xml.namespace.QName keyTypeName
protected java.lang.Class resourceClass
protected java.lang.Class keyTypeClass
protected boolean resourceIsPersistent
protected java.lang.reflect.Constructor resourceConstructor
protected LockManager lockManager
protected java.lang.String cacheLocation
protected Cache cache
private long sweeperDelay
private ResourceHomeImpl.Sweeper sweeper
private boolean initialized
| Constructor Detail |
public ResourceHomeImpl()
| Method Detail |
public void setResourceClass(java.lang.String clazz)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic java.lang.String getResourceClass()
public void setResourceKeyType(java.lang.String clazz)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic java.lang.Class getKeyTypeClass()
ResourceHomeResourceKey used or
passed to this ResourceHome must have match this type
(corresponds to ResourceKey.getValue()).
getKeyTypeClass in interface ResourceHomepublic void setResourceKeyName(java.lang.String keyName)
public javax.xml.namespace.QName getKeyTypeName()
ResourceHomeResourceKey used or
passed to this ResourceHome must have match this name
(corresponds to ResourceKey.getName()).
getKeyTypeName in interface ResourceHomepublic void setSweeperDelay(long delay)
public long getSweeperDelay()
public void setCacheLocation(java.lang.String jndiLocation)
public java.lang.String getCacheLocation()
public void initialize()
throws java.lang.Exception
initialize in interface Initializablejava.lang.Exception
private void initResourceConstructor()
throws java.lang.Exception
java.lang.Exception
protected Resource createNewInstance()
throws ResourceException
ResourceException
protected Resource createNewInstanceAndLoad(ResourceKey key)
throws ResourceException
ResourceException
public Resource find(ResourceKey key)
throws ResourceException
ResourceHome
find in interface ResourceHomeResourceException - if any other error occurs.
private Resource get(ResourceKey key)
throws ResourceException
ResourceException
public void remove(ResourceKey key)
throws ResourceException
RemoveCallback
interface the RemoveCallback.remove()
operation will be called. The RemoveCallback.remove() operation is called under a reentrant lock.
Therefore, a RemoveCallback.remove()
implementation might perform ResourceHome.find() on itself from the same thread but will deadlock
if done from another thread.
remove in interface ResourceHomeNoSuchResourceException - 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.
protected void add(ResourceKey key,
Resource resource)
private void addResource(ResourceKey key,
Resource resource)
public void destroy()
destroy in interface Destroyable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||