uk.org.ogsadai.service.wsrf.resource
Class DataServiceResourceWrapperHome

java.lang.Object
  |
  +--uk.org.ogsadai.service.wsrf.resource.DataServiceResourceWrapperHome
All Implemented Interfaces:
org.globus.wsrf.jndi.Initializable, org.globus.wsrf.ResourceHome

public class DataServiceResourceWrapperHome
extends java.lang.Object
implements org.globus.wsrf.ResourceHome, org.globus.wsrf.jndi.Initializable

A org.globus.wsrf.ResourceHome for uk.org.ogsadai.service.wsrf.resource.DataServiceResourceWrappers.

The key type class is specified in a JNDI configuration file.

The key type name is specified in uk.org.ogsadai.service.wsrf.WSRFConstants#DATA_SERVICE_RESOURCE_KEY.

Author:
The OGSA-DAI Team.
See Also:
ResourceHome, Initializable, DataServiceResource, DataServiceResourceWrapper

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement.
private static DAILogger LOG
          Logger object for logging in this class
private  java.lang.Class mKeyTypeClass
          Class used for resource keys
private  java.util.Map mResources
          Current DataServiceResourceWrappers indexed by keys of type mKeyTypeClass
 
Constructor Summary
DataServiceResourceWrapperHome()
           
 
Method Summary
 void add(org.globus.wsrf.ResourceKey key, java.lang.Object resource)
          Add a wrapped data service resource with the given key to the "home".
 boolean contains(org.globus.wsrf.ResourceKey key)
          Returns whether or a resource already exists with the specified key.
 org.globus.wsrf.ResourceKey create(java.lang.Object id, DataResourceAccessor dataResourceAccessor, ActivitiesConfig activitiesConfig, SessionComponentFactory sessionComponentFactory, SecurityContextProvider securityContextProvider, ConcurrencySettings concurrency, AccessAuthorizer authority)
          Create a new DataServiceResource, wrapped in a DataServiceResourceWrapper, add it to the "home" and return its org.globus.wsrf.ResourceKey.
 org.globus.wsrf.Resource find(org.globus.wsrf.ResourceKey key)
           
 java.lang.Object[] getKeys()
          Return an array of the current keys.
 java.lang.Class getKeyTypeClass()
           
 javax.xml.namespace.QName getKeyTypeName()
           
 void initialize()
           
 void remove(org.globus.wsrf.ResourceKey key)
           
 void setResourceKeyType(java.lang.String clazz)
          Set the class used for resource keys.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement.

See Also:
Constant Field Values

LOG

private static DAILogger LOG
Logger object for logging in this class


mKeyTypeClass

private java.lang.Class mKeyTypeClass
Class used for resource keys


mResources

private java.util.Map mResources
Current DataServiceResourceWrappers indexed by keys of type mKeyTypeClass

Constructor Detail

DataServiceResourceWrapperHome

public DataServiceResourceWrapperHome()
Method Detail

create

public org.globus.wsrf.ResourceKey create(java.lang.Object id,
                                          DataResourceAccessor dataResourceAccessor,
                                          ActivitiesConfig activitiesConfig,
                                          SessionComponentFactory sessionComponentFactory,
                                          SecurityContextProvider securityContextProvider,
                                          ConcurrencySettings concurrency,
                                          AccessAuthorizer authority)
                                   throws ResourceCreationException,
                                          ResourceKeyInvalidException
Create a new DataServiceResource, wrapped in a DataServiceResourceWrapper, add it to the "home" and return its org.globus.wsrf.ResourceKey.

Any existing resource with the same ID is overwritten.

Parameters:
id - ID of the data service resource - used to construct the ResourceKey
dataResourceAccessor - The data resource accessor that gives access to any underlying data resource.
activitiesConfig - Configuration details regarding the activity that can be used with the resource.
sessionComponentFactory - A factory to create the session components required by a data service resource.
securityContextProvider - Object that will provide security information for use when accessing resource property values.
concurrency - Default concurrency settings for the resource.
authority - Authorizes access to activities supported by this data service resource.
Returns:
key of the new resource
Throws:
ResourceCreationException - if the data service resource cannot be created for some reason.
ResourceKeyInvalidException - if the resource key ID is null.
See Also:
DataServiceResource, DataServiceResourceWrapper

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.globus.wsrf.jndi.Initializable
java.lang.Exception

getKeyTypeClass

public java.lang.Class getKeyTypeClass()
Specified by:
getKeyTypeClass in interface org.globus.wsrf.ResourceHome

getKeyTypeName

public javax.xml.namespace.QName getKeyTypeName()
Specified by:
getKeyTypeName in interface org.globus.wsrf.ResourceHome

setResourceKeyType

public void setResourceKeyType(java.lang.String clazz)
                        throws java.lang.ClassNotFoundException
Set the class used for resource keys.

Parameters:
clazz - Resource key class.
Throws:
java.lang.ClassNotFoundException - if the class does not exist on the CLASSPATH.

find

public org.globus.wsrf.Resource find(org.globus.wsrf.ResourceKey key)
                              throws org.globus.wsrf.ResourceException,
                                     org.globus.wsrf.NoSuchResourceException,
                                     org.globus.wsrf.InvalidResourceKeyException
Specified by:
find in interface org.globus.wsrf.ResourceHome
org.globus.wsrf.ResourceException
org.globus.wsrf.NoSuchResourceException
org.globus.wsrf.InvalidResourceKeyException

remove

public void remove(org.globus.wsrf.ResourceKey key)
            throws org.globus.wsrf.ResourceException,
                   org.globus.wsrf.NoSuchResourceException,
                   org.globus.wsrf.InvalidResourceKeyException,
                   org.globus.wsrf.RemoveNotSupportedException
Specified by:
remove in interface org.globus.wsrf.ResourceHome
org.globus.wsrf.ResourceException
org.globus.wsrf.NoSuchResourceException
org.globus.wsrf.InvalidResourceKeyException
org.globus.wsrf.RemoveNotSupportedException

add

public void add(org.globus.wsrf.ResourceKey key,
                java.lang.Object resource)
         throws org.globus.wsrf.InvalidResourceKeyException,
                java.lang.IllegalArgumentException
Add a wrapped data service resource with the given key to the "home". If the given resource is not of type DataServiceResourceWrapper then it is not added.

Any existing resource with the same ID is overwritte.

Parameters:
key - Resource key.
resource - A DataServiceResourceWrapper.
Throws:
org.globus.wsrf.InvalidResourceKeyException - if key is null.
java.lang.IllegalArgumentException - if resource is null or not of type DataServiceResourceWrapper

getKeys

public java.lang.Object[] getKeys()
Return an array of the current keys.

Returns:
array of current keys.

contains

public boolean contains(org.globus.wsrf.ResourceKey key)
Returns whether or a resource already exists with the specified key.

Parameters:
key - Resource key.
Returns:
true if the resource exists, false if it does not.