uk.org.ogsadai.service.wsrf.dataservice.impl
Class DataServiceImpl

java.lang.Object
  |
  +--uk.org.ogsadai.service.wsrf.dataservice.impl.DataServiceImpl
All Implemented Interfaces:
DataServiceResourceFactory, SecurityContextProvider
Direct Known Subclasses:
ConfigurableDataServiceImpl

public class DataServiceImpl
extends java.lang.Object
implements SecurityContextProvider, DataServiceResourceFactory

This class provides an OGSA-DAI data service which exposes 0 or more data service resources and supports access to resource properties, resource operations and data transport operations.

Each service maintains a collection of 0 or more DataServiceResource objects wrapped in DataServiceResourceWrappers which are maintained in a DataServiceResourceWrapperHome

Deployment descriptor information is expected to be:

Author:
The OGSA-DAI Project Team
See Also:
DataServiceResource, DataServicePortType, DataServiceResourceWrapper, DataServiceResourceWrapperHome

Field Summary
private static java.lang.String AUTHORIZATION_CONFIG
          Configuration file for resource authorization
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static java.lang.String DAI_CONFIG_DIR
          Deployment descriptor parameter - path to OGSA-DAI configuration files directory
private static java.lang.String DAI_SCHEMA_DIR
          Deployment descriptor parameter - path to OGSA-DAI XML Schema directory
private static DAILogger LOG
          Logger object for logging in this class
private  AccessAuthorizer mAuthority
          Authorizes access to resources
private static java.lang.String MAX_QUEUE_LENGTH
          Deployment descriptor parameter - maximum number of Perform requests that can be queued by each resource
private static java.lang.String MAX_REQUESTS
          Deployment descriptor parameter - maximum number of Perform requests that can be submitted to each resource
private  ConcurrencySettings mConcurrencySettings
          Concurrency settings for resources
private  java.lang.String mConfigDir
          Path to OGSA-DAI configuration files directory
private  org.globus.wsrf.ResourceContext mResourceContext
          Resource context - we need to store this as we cannot get hold if if unless we are on the request thread which we will not be if we come via an activity.
protected  DataServiceResourceFactoryUtil mResourceFactoryUtil
          Data service resource factory utility object used to assist in the dynamic creation of new data service resources.
protected  DataServiceResourceWrapperHome mResourceHome
          Resource home - contains all data service resources.
protected  java.lang.String mResourcesFile
          Name of data service resources file
protected  java.lang.String mURL
          Local service URL
private  java.lang.String mVersion
          OGSA-DAI service version
private static java.lang.String REQUEST_TIMEOUT
          Deployment descriptor parameter - timeout for all Perform requests submitted to each resource
protected static java.lang.String RESOURCE_ATTR
          Data service resources file root element attribute name
protected static java.lang.String RESOURCE_ELT
          Data service resources file root element name
private static java.lang.String RESOURCES_FILE
          Deployment descriptor parameter - name of data service resources file holding names of resources exposed by the service
private static java.lang.String VERSION
          Deployment descriptor parameter - OGSA-DAI version used to implement service
 
Constructor Summary
DataServiceImpl()
          Create a new data service.
 
Method Summary
private  void addAuthzComplexFault(ComplexFaultType complex, DAIAuthorizationException exception)
          Adds information about an authorization exception to a ComplexFaultType which is to be inserted into a RequestFaultType.
private  void addComplexFault(ComplexFaultType complex, java.lang.Throwable exception)
          Adds information about an exception to a ComplexFaultType which is to be inserted into a RequestFaultType.
private  void authorizeResource(DataServiceResource resource, SecurityContext context)
          Authorizes a resource for access within the given security context.
private  void configureConcurrencySettings(org.apache.axis.MessageContext context)
          Extract the concurrency settings from the deployment descriptor.
 java.lang.String createResource(java.lang.String namePrefix, DataResourceAccessor dataResourceAccessor, ActivitiesConfig activitiesConfig, SessionComponentFactory sessionComponentFactory)
          Cteates a data service resource using the given details.
 void createResource(java.lang.String resourceName, java.lang.String dataResourceClassName)
          Creates a new data service resource.
protected  org.globus.wsrf.ResourceKey createResourceFromComponentFactory(java.lang.Object id, DSRComponentFactory componentFactory)
          Creates a data service resource using a data service resource component factory to generate the required components of the resource.
protected  org.globus.wsrf.ResourceKey createResourceFromComponents(java.lang.Object id, DataResourceAccessor dataResourceAccessor, ActivitiesConfig activitiesConfig, SessionComponentFactory sessionComponentFactory)
          Creates a data service resource that is made up of the given components.
protected  org.globus.wsrf.ResourceKey createResourceFromConfigDirectory(java.lang.Object id)
          Creates a data service resource using configuration details from the resource's configuration directory.
 GetResponse getBlock(GetBlock parameters)
          Get part of a batch of data from a stream known to an active session of a specific data service resource.
protected  DataServiceResource getDataServiceResource()
          From the current message and request context get the DataServiceResource specified by the client.
 GetResponse getFully(GetFully parameters)
          Get all the possible data from stream known to an active session of a specific data service resource.
 GetResponse getNBlocks(GetNBlocks parameters)
          Get part of a batch of data from a stream known to an active session of a specific data service resource.
 java.lang.String getNewResourceName()
          Returns a new resource name that is guaranteed to be unique within the host service.
 java.lang.String getNewResourceName(java.lang.String prefix)
          Returns a new resource name that is guaranteed to be unique within the host service.
 java.io.File getResourceConfigDirectory(java.lang.String resourceName)
          Returns the configuration files directory for the named resource.
protected  DataServiceResourceWrapperHome getResourceHome()
          Obtain the service's resource home object.
 SecurityContext getSecurityContext()
          Return a security context.
 GetVersionResponse getVersion(GetVersion parameters)
          Return the OGSA-DAI version.
private  void initialise()
          Extracts from the message context and the service deployment descriptor information on the service URL, version, configuration files directory, schemae directory and data service resource configuration file.
 ListResourcesResponse listResources(ListResources parameters)
          Return a list of the IDs of the data service resources currently known to this service.
private  void loadAuthorization(java.lang.String configFile)
          Constructs a new authorization file.
private  org.w3c.dom.Document perform(DataServiceResource resource, org.w3c.dom.Document performDoc, AttachmentManager attMgr)
          Submit an OGSA-DAI perform document to a data service resource.
 PerformResponse perform(Perform performDocument)
          Submit an OGSA-DAI perform document to a data service resource.
 PutResponse putBlock(PutBlock parameters)
          Put part of a successive batch of data into a stream known to an active session of a specific data service resource.
 PutResponse putFully(PutFully parameters)
          Put some data into a stream known to an active session of a specific data service resource.
 void registerResourceWithMDS(org.globus.wsrf.ResourceKey resourceKey)
          Registers the specified resourced with the local MDS server.
protected  void removeResource(java.lang.Object id)
          Remove a data service resource with the given ID
 void removeResource(java.lang.String resourceName, boolean removeConfiguration)
          Withdraw a data service resource from a service.
 TerminateResponse terminate(Terminate terminate)
          Terminate the current request running on the resource.
protected  void throwAuthorisationFault(DAIAuthorizationException exception)
          Throw a AuthorisationFaultType back to the client.
protected  void throwInternalFault(java.lang.Throwable exception, boolean isFatal)
          Throw an InternalFaultType - raised in response to a server-side problem - back to the client.
protected  void throwRequestFault(DAIException e)
          Throw information about a uk.org.ogsadai.exception.DAIException back to the client in a RequestFaultType.
protected  void throwResourceUnknownFault(java.lang.String resourceID)
          Throw a ResourceUnknownFaultType back to the client.
 
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


mResourceHome

protected DataServiceResourceWrapperHome mResourceHome
Resource home - contains all data service resources.


RESOURCES_FILE

private static final java.lang.String RESOURCES_FILE
Deployment descriptor parameter - name of data service resources file holding names of resources exposed by the service

See Also:
Constant Field Values

mResourcesFile

protected java.lang.String mResourcesFile
Name of data service resources file


DAI_CONFIG_DIR

private static final java.lang.String DAI_CONFIG_DIR
Deployment descriptor parameter - path to OGSA-DAI configuration files directory

See Also:
Constant Field Values

mConfigDir

private java.lang.String mConfigDir
Path to OGSA-DAI configuration files directory


DAI_SCHEMA_DIR

private static final java.lang.String DAI_SCHEMA_DIR
Deployment descriptor parameter - path to OGSA-DAI XML Schema directory

See Also:
Constant Field Values

VERSION

private static final java.lang.String VERSION
Deployment descriptor parameter - OGSA-DAI version used to implement service

See Also:
Constant Field Values

REQUEST_TIMEOUT

private static final java.lang.String REQUEST_TIMEOUT
Deployment descriptor parameter - timeout for all Perform requests submitted to each resource

See Also:
Constant Field Values

MAX_REQUESTS

private static final java.lang.String MAX_REQUESTS
Deployment descriptor parameter - maximum number of Perform requests that can be submitted to each resource

See Also:
Constant Field Values

MAX_QUEUE_LENGTH

private static final java.lang.String MAX_QUEUE_LENGTH
Deployment descriptor parameter - maximum number of Perform requests that can be queued by each resource

See Also:
Constant Field Values

AUTHORIZATION_CONFIG

private static final java.lang.String AUTHORIZATION_CONFIG
Configuration file for resource authorization

See Also:
Constant Field Values

mConcurrencySettings

private ConcurrencySettings mConcurrencySettings
Concurrency settings for resources


RESOURCE_ELT

protected static final java.lang.String RESOURCE_ELT
Data service resources file root element name

See Also:
Constant Field Values

RESOURCE_ATTR

protected static final java.lang.String RESOURCE_ATTR
Data service resources file root element attribute name

See Also:
Constant Field Values

mVersion

private java.lang.String mVersion
OGSA-DAI service version


mURL

protected java.lang.String mURL
Local service URL


mAuthority

private AccessAuthorizer mAuthority
Authorizes access to resources


mResourceContext

private org.globus.wsrf.ResourceContext mResourceContext
Resource context - we need to store this as we cannot get hold if if unless we are on the request thread which we will not be if we come via an activity.


mResourceFactoryUtil

protected DataServiceResourceFactoryUtil mResourceFactoryUtil
Data service resource factory utility object used to assist in the dynamic creation of new data service resources.

Constructor Detail

DataServiceImpl

public DataServiceImpl()
                throws InternalFaultType
Create a new data service.

The service will initialise itself using information within its deployment descriptor if it has not already done so.

Throws:
InternalFaultType - if some internal problem occurs that is not under the client's control.
Method Detail

initialise

private void initialise()
                 throws MissingDeploymentParamException,
                        MessageContextException,
                        ResourceFileException,
                        IllegalConcurrencySettingException,
                        DeploymentParamParseException,
                        ResourceFactoryUtilCreateException,
                        AuthorizationInitialisationException
Extracts from the message context and the service deployment descriptor information on the service URL, version, configuration files directory, schemae directory and data service resource configuration file.

Sets up the initial set of data service resources to be exposed.

Throws:
MissingDeploymentParamException - if the OGSA-DAI configuration files directories are not specified in the deployment descriptor.
DeploymentParamParseException - if any concurrency setting is not parsable into a number.
IllegalConcurrencySettingException - if any concurrency setting is illegal.
ResourceFactoryUtilCreateException - if there is a problem encountered when creating a data service resource factory utility object.
ResourceFileException - if there is a problem encountered when loading the data service resources file.
MessageContextException - if the current MessageContext cannot be determined.
AuthorizationInitialisationException - if there is a problem encountered when creating the authorization

configureConcurrencySettings

private void configureConcurrencySettings(org.apache.axis.MessageContext context)
                                   throws DeploymentParamParseException,
                                          IllegalConcurrencySettingException
Extract the concurrency settings from the deployment descriptor.

Parameters:
context - Current message context.
Throws:
DeploymentParamParseException - if any concurrency setting is not parsable into a number.
IllegalConcurrencySettingException - if any concurrency setting is illegal.

perform

public PerformResponse perform(Perform performDocument)
                        throws java.rmi.RemoteException,
                               ResourceBusyFaultType,
                               ResourceUnknownFaultType,
                               InternalFaultType,
                               RequestFaultType,
                               AuthorisationFaultType
Submit an OGSA-DAI perform document to a data service resource.

Parameters:
performDocument - OGSA-DAI perform document wrapped in service-layer bean.
Returns:
OGSA-DAI response document wrapped in service-layer bean.
Throws:
java.rmi.RemoteException - never.
AuthorisationFaultType - if the client is not authorised to submit a request to this resource or to execute some action within their request.
InternalFaultType - if some internal problem occurs that is not under the client's control.
RequestFaultType - if the request does not validate against the perform document schema, contains an unsupported activity, contains an unconnected activity stream, contains an activity the user is not allowed to authorise or contains an incorrectly-specified activity.
ResourceBusyFaultType - if the resource is processing a request and so cannot service this request.
ResourceUnknownFaultType - if the resource is unknown to this service.
See Also:
DataServicePortType.perform(uk.org.ogsadai.service.perform.types.Perform)

perform

private org.w3c.dom.Document perform(DataServiceResource resource,
                                     org.w3c.dom.Document performDoc,
                                     AttachmentManager attMgr)
                              throws java.rmi.RemoteException,
                                     ResourceBusyFaultType,
                                     ResourceUnknownFaultType,
                                     InternalFaultType,
                                     RequestFaultType,
                                     AuthorisationFaultType
Submit an OGSA-DAI perform document to a data service resource.

Parameters:
resource - Data service resource to execute perform document.
performDoc - OGSA-DAI perform document.
attMgr - SOAP attachments manager.
Returns:
OGSA-DAI response document.
Throws:
java.rmi.RemoteException - never.
AuthorisationFaultType - if the client is not authorised to submit a request to this resource or to execute some action within their request.
InternalFaultType - if some internal problem occurs that is not under the client's control.
RequestFaultType - if the request does not validate against the perform document schema, contains an unsupported activity, contains an unconnected activity stream, contains an activity the user is not allowed to authorise or contains an incorrectly-specified activity.
ResourceBusyFaultType - if the resource is processing a request and so cannot service this request.
ResourceUnknownFaultType - if the resource is unknown to this service.

terminate

public TerminateResponse terminate(Terminate terminate)
                            throws java.rmi.RemoteException,
                                   ResourceBusyFaultType,
                                   ResourceUnknownFaultType,
                                   InternalFaultType,
                                   AuthorisationFaultType
Terminate the current request running on the resource.

This operation currently does nothing

Parameters:
terminate - Empty bean.
Returns:
empty bean.
Throws:
java.rmi.RemoteException - never.
AuthorisationFaultType - if the client is not authorised to submit a request to this resource or to execute some action within their request.
InternalFaultType - if some internal problem occurs that is not under the client's control.
ResourceBusyFaultType - if the resource is processing a request and so cannot service this request.
ResourceUnknownFaultType - if the resource is unknown to this service.
See Also:
DataServicePortType.terminate(uk.org.ogsadai.service.perform.types.Terminate)

getSecurityContext

public SecurityContext getSecurityContext()
Return a security context.

Provides a default with no security information if none can be extracted from the Globus Toolkit infrastructure.

Specified by:
getSecurityContext in interface SecurityContextProvider
Returns:
context.
See Also:
SecurityContextProvider.getSecurityContext()

listResources

public ListResourcesResponse listResources(ListResources parameters)
                                    throws java.rmi.RemoteException,
                                           InternalFaultType
Return a list of the IDs of the data service resources currently known to this service.

Parameters:
parameters - ignored.
Returns:
list of valid data service resource IDs in a bean.
Throws:
java.rmi.RemoteException - never.
InternalFaultType - if some internal problem occurs that is not under the client's control.
See Also:
DataServicePortType.listResources(uk.org.ogsadai.service.types.ListResources)

getVersion

public GetVersionResponse getVersion(GetVersion parameters)
                              throws java.rmi.RemoteException,
                                     InternalFaultType
Return the OGSA-DAI version.

Parameters:
parameters - ignored.
Returns:
OGSA-DAI version in a bean.
Throws:
java.rmi.RemoteException - never.
InternalFaultType - never.
See Also:
DataServicePortType.getVersion(uk.org.ogsadai.service.types.GetVersion)

putFully

public PutResponse putFully(PutFully parameters)
                     throws java.rmi.RemoteException,
                            ResourceBusyFaultType,
                            ResourceUnknownFaultType,
                            InternalFaultType,
                            RequestFaultType,
                            AuthorisationFaultType
Put some data into a stream known to an active session of a specific data service resource.

Parameters:
parameters - Session ID and stream ID conjoined by ":" and the data wrapped in a bean.
Returns:
empty bean.
Throws:
java.rmi.RemoteException - never.
AuthorisationFaultType - if the client is not authorised to access the resource or stream.
InternalFaultType - if some internal problem occurs that is not under the client's control.
RequestFaultType - if the session or stream is unknown to the resource.
ResourceBusyFaultType - if the resource is processing a request and so cannot service this request.
ResourceUnknownFaultType - if the resource is unknown to this service.
See Also:
DataServicePortType.putFully(uk.org.ogsadai.service.transport.types.PutFully)

putBlock

public PutResponse putBlock(PutBlock parameters)
                     throws java.rmi.RemoteException,
                            ResourceBusyFaultType,
                            ResourceUnknownFaultType,
                            InternalFaultType,
                            RequestFaultType,
                            AuthorisationFaultType
Put part of a successive batch of data into a stream known to an active session of a specific data service resource.

Parameters:
parameters - Session ID and stream ID conjoined by ":" and the data wrapped in a bean.
Returns:
empty bean.
Throws:
java.rmi.RemoteException - never.
AuthorisationFaultType - if the client is not authorised to access the resource or stream.
InternalFaultType - if some internal problem occurs that is not under the client's control.
RequestFaultType - if the session or stream is unknown to the resource.
ResourceBusyFaultType - if the resource is processing a request and so cannot service this request.
ResourceUnknownFaultType - if the resource is unknown to this service.
See Also:
DataServicePortType.putBlock(uk.org.ogsadai.service.transport.types.PutBlock)

getFully

public GetResponse getFully(GetFully parameters)
                     throws java.rmi.RemoteException,
                            ResourceBusyFaultType,
                            ResourceUnknownFaultType,
                            InternalFaultType,
                            RequestFaultType,
                            AuthorisationFaultType
Get all the possible data from stream known to an active session of a specific data service resource.

Parameters:
parameters - Session ID and stream ID conjoined by ":" in a bean.
Returns:
data in a bean.
Throws:
java.rmi.RemoteException - never.
AuthorisationFaultType - if the client is not authorised to access the resource or stream.
InternalFaultType - if some internal problem occurs that is not under the client's control.
RequestFaultType - if the session or stream is unknown to the resource.
ResourceBusyFaultType - if the resource is processing a request and so cannot service this request.
ResourceUnknownFaultType - if the resource is unknown to this service.
See Also:
DataServicePortType.getFully(uk.org.ogsadai.service.transport.types.GetFully)

getBlock

public GetResponse getBlock(GetBlock parameters)
                     throws java.rmi.RemoteException,
                            ResourceBusyFaultType,
                            ResourceUnknownFaultType,
                            InternalFaultType,
                            RequestFaultType,
                            AuthorisationFaultType
Get part of a batch of data from a stream known to an active session of a specific data service resource.

Parameters:
parameters - Session ID and stream ID conjoined by ":" in a bean.
Returns:
data in a bean.
Throws:
java.rmi.RemoteException - never.
AuthorisationFaultType - if the client is not authorised to access the resource or stream.
InternalFaultType - if some internal problem occurs that is not under the client's control.
RequestFaultType - if the session or stream is unknown to the resource.
ResourceBusyFaultType - if the resource is processing a request and so cannot service this request.
ResourceUnknownFaultType - if the resource is unknown to this service.
InternalFaultType - if some internal problem occurs that is not under the client's control.
See Also:
DataServicePortType.getBlock(uk.org.ogsadai.service.transport.types.GetBlock)

getNBlocks

public GetResponse getNBlocks(GetNBlocks parameters)
                       throws java.rmi.RemoteException,
                              ResourceBusyFaultType,
                              ResourceUnknownFaultType,
                              InternalFaultType,
                              RequestFaultType,
                              AuthorisationFaultType
Get part of a batch of data from a stream known to an active session of a specific data service resource.

Parameters:
parameters - Session ID and stream ID conjoined by ":" and the number of blocks to retrieve in a bean.
Returns:
the data.
Throws:
java.rmi.RemoteException - never.
AuthorisationFaultType - if the client is not authorised to access the resource or stream.
InternalFaultType - if some internal problem occurs that is not under the client's control.
RequestFaultType - if the session or stream is unknown to the resource.
ResourceBusyFaultType - if the resource is processing a request and so cannot service this request.
ResourceUnknownFaultType - if the resource is unknown to this service.
InternalFaultType - if some internal problem occurs that is not under the client's control.
See Also:
DataServicePortType.getNBlocks(uk.org.ogsadai.service.transport.types.GetNBlocks)

throwRequestFault

protected void throwRequestFault(DAIException e)
                          throws RequestFaultType
Throw information about a uk.org.ogsadai.exception.DAIException back to the client in a RequestFaultType. If the DAIException has child exceptions then these are represented as child ChainedFaultTypes.

Parameters:
e - Server-side exception.
Throws:
RequestFaultType - containing the information in the exception.

addAuthzComplexFault

private void addAuthzComplexFault(ComplexFaultType complex,
                                  DAIAuthorizationException exception)
Adds information about an authorization exception to a ComplexFaultType which is to be inserted into a RequestFaultType.

Parameters:
complex - ComplexFaultType
exception - The authorization exception.

addComplexFault

private void addComplexFault(ComplexFaultType complex,
                             java.lang.Throwable exception)
Adds information about an exception to a ComplexFaultType which is to be inserted into a RequestFaultType.

Parameters:
complex - ComplexFaultType
exception - The exception.

throwAuthorisationFault

protected void throwAuthorisationFault(DAIAuthorizationException exception)
                                throws AuthorisationFaultType
Throw a AuthorisationFaultType back to the client.

Parameters:
exception - Server-side exception with information about the authorisation fault.
Throws:
AuthorisationFaultType - containing the unique ID of the exception so the client can contact the service deployer if required.

throwResourceUnknownFault

protected void throwResourceUnknownFault(java.lang.String resourceID)
                                  throws ResourceUnknownFaultType
Throw a ResourceUnknownFaultType back to the client.

Parameters:
resourceID - ID of the unknown resource.
Throws:
ResourceUnknownFaultType - containing the ID of the unknown resource.

throwInternalFault

protected void throwInternalFault(java.lang.Throwable exception,
                                  boolean isFatal)
                           throws InternalFaultType
Throw an InternalFaultType - raised in response to a server-side problem - back to the client.

Parameters:
exception - Server-side exception.
isFatal - Is the error fatal? If so then log as fatal else log as error.
Throws:
InternalFaultType - containing the unique ID of the exception so the client can contact the service deployer if required.

getResourceHome

protected DataServiceResourceWrapperHome getResourceHome()
                                                  throws DAIResourceContextException
Obtain the service's resource home object.

The object is held the first time it is obtained - this overcomes problems that occur when accessing message contexts on different threads.

Returns:
ResourceHome object.
Throws:
DAIResourceContextException - if unable to access the home.

getDataServiceResource

protected DataServiceResource getDataServiceResource()
                                              throws ResourceUnknownFaultType,
                                                     InternalFaultType,
                                                     AuthorisationFaultType
From the current message and request context get the DataServiceResource specified by the client.

Returns:
data service resource.
Throws:
InternalFaultType - if some internal problem occurs that is not under the client's control.
ResourceUnknownFaultType - if the resource is unknown to this service.
AuthorisationFaultType - if the user is not authorized to access the resource

createResourceFromConfigDirectory

protected org.globus.wsrf.ResourceKey createResourceFromConfigDirectory(java.lang.Object id)
                                                                 throws ResourceIDAlreadyAssignedException,
                                                                        ResourceCreationException
Creates a data service resource using configuration details from the resource's configuration directory.

Parameters:
id - The ID of the resource to create. This ID should be unique within this container.
Returns:
The resource key of the newly created resource.
Throws:
ResourceIDAlreadyAssignedException - If the resource ID has already been assigned so a new resource with the same ID cannot be created.
ResourceCreationException - If an error occured while attempting to create the resource.

createResourceFromComponentFactory

protected org.globus.wsrf.ResourceKey createResourceFromComponentFactory(java.lang.Object id,
                                                                         DSRComponentFactory componentFactory)
                                                                  throws ResourceIDAlreadyAssignedException,
                                                                         ResourceCreationException
Creates a data service resource using a data service resource component factory to generate the required components of the resource.

Parameters:
id - The ID of the resource to create. This ID should be unique within this container.
componentFactory - A factory to create the require data service resource components.
Returns:
The resource key of the newly created resource.
Throws:
ResourceIDAlreadyAssignedException - If the resource ID has already been assigned so a new resource with the same ID cannot be created.
ResourceCreationException - If an error occured while attempting to create the resource.

createResourceFromComponents

protected org.globus.wsrf.ResourceKey createResourceFromComponents(java.lang.Object id,
                                                                   DataResourceAccessor dataResourceAccessor,
                                                                   ActivitiesConfig activitiesConfig,
                                                                   SessionComponentFactory sessionComponentFactory)
                                                            throws ResourceIDAlreadyAssignedException,
                                                                   ResourceCreationException
Creates a data service resource that is made up of the given components.

Parameters:
id - The ID of the resource to create. This ID should be unique within this container.
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.
Returns:
The ID of the newly created resource.
Throws:
ResourceIDAlreadyAssignedException - If the resource ID has already been assigned so a new resource with the same ID cannot be created.
ResourceCreationException - If an error occured while attempting to create the resource.

removeResource

protected void removeResource(java.lang.Object id)
                       throws NoSuchResourceIDException,
                              ResourceKeyInvalidException,
                              DAIResourceContextException
Remove a data service resource with the given ID

Parameters:
id - ID of the resource to remove
Throws:
NoSuchResourceIDException - if the resource ID is unknown
ResourceKeyInvalidException - if id is null.
DAIResourceContextException - if unable to access the resource home.

getNewResourceName

public java.lang.String getNewResourceName()
Description copied from interface: DataServiceResourceFactory
Returns a new resource name that is guaranteed to be unique within the host service.

Specified by:
getNewResourceName in interface DataServiceResourceFactory
Returns:
new data service resource name.

getNewResourceName

public java.lang.String getNewResourceName(java.lang.String prefix)
Description copied from interface: DataServiceResourceFactory
Returns a new resource name that is guaranteed to be unique within the host service. The name will being with the given prefix.

Specified by:
getNewResourceName in interface DataServiceResourceFactory
Parameters:
prefix - for the resource name.
Returns:
new data service resource name.

getResourceConfigDirectory

public java.io.File getResourceConfigDirectory(java.lang.String resourceName)
                                        throws DynamicDataServiceResourceCreationException
Description copied from interface: DataServiceResourceFactory
Returns the configuration files directory for the named resource. If the directory does not exist then it will be created.

Specified by:
getResourceConfigDirectory in interface DataServiceResourceFactory
Parameters:
resourceName - Name of the resource to create the directory for.
Returns:
the configuration files directory for the data service resource.
Throws:
DynamicDataServiceResourceCreationException - if an error occurs during the creation.

createResource

public void createResource(java.lang.String resourceName,
                           java.lang.String dataResourceClassName)
                    throws DynamicDataServiceResourceCreationException
Description copied from interface: DataServiceResourceFactory
Creates a new data service resource.

If it does not already exist then a configuration files directory will be created. The data resource accessor class configuration file will be written to the configuration directory.

Specified by:
createResource in interface DataServiceResourceFactory
Parameters:
resourceName - Name of the data service resource to create.
dataResourceClassName - Name of the data resource accessor class to be associated with the new data service resource.
Throws:
DynamicDataServiceResourceCreationException - if an error occurs during the creation.

removeResource

public void removeResource(java.lang.String resourceName,
                           boolean removeConfiguration)
                    throws DynamicDataServiceResourceRemovalException
Description copied from interface: DataServiceResourceFactory
Withdraw a data service resource from a service. If specified the configuration directory and files will be removed.

Specified by:
removeResource in interface DataServiceResourceFactory
Parameters:
resourceName - name of the data service resource to withdraw
removeConfiguration - indicates whether to remove the resource configuration files
Throws:
DynamicDataServiceResourceRemovalException - if an error occurs

createResource

public java.lang.String createResource(java.lang.String namePrefix,
                                       DataResourceAccessor dataResourceAccessor,
                                       ActivitiesConfig activitiesConfig,
                                       SessionComponentFactory sessionComponentFactory)
                                throws ResourceCreationException
Description copied from interface: DataServiceResourceFactory
Cteates a data service resource using the given details. This is a means of creating new data resouces without having to use configuration file. There will be no configuration directory corresponding to the created resource. The resource will not be persited through a container shutdown.

Specified by:
createResource in interface DataServiceResourceFactory
Parameters:
namePrefix - A perfix to use for the name of the data service resource. The name will begin with this prefix and will end with a sequence of character such that it is unique.
dataResourceAccessor - Data resource accessor used to access any underlying data resource. If there is no actual data resource then use an instance of uk.org.ogsadai.dataresource.NullDataResourceAccessor.
activitiesConfig - Details of which activities can be used with this data service resource.
sessionComponentFactory - Factory used to creation the session componets to be used by the data service resource.
Returns:
The name of the newly created data service resource.
Throws:
ResourceCreationException - if the resource cannot be created.

registerResourceWithMDS

public void registerResourceWithMDS(org.globus.wsrf.ResourceKey resourceKey)
Registers the specified resourced with the local MDS server. The resource will be registered if the resources configuration directory contains an MDS registration file. This file must be called mds-registration.xml.

Parameters:
resourceKey - The resource key of the resource to be registered.

loadAuthorization

private void loadAuthorization(java.lang.String configFile)
                        throws AuthorizationInitialisationException
Constructs a new authorization file.

Parameters:
configFile - path of the configuration file
Throws:
AuthorizationInitialisationException - if the authorization could not be created

authorizeResource

private void authorizeResource(DataServiceResource resource,
                               SecurityContext context)
                        throws AuthorisationFaultType
Authorizes a resource for access within the given security context.

Parameters:
resource - data service resource to access
context - security context of the request
Throws:
AuthorisationFaultType - if the user is not authorized the data service resource