uk.org.ogsadai.service.resource.factory
Interface DataServiceResourceFactory

All Known Implementing Classes:
DataServiceImpl

public interface DataServiceResourceFactory

Interface for factory data service resources that can create and remove data service resources dynamically.

Author:
The OGSA-DAI Project Team

Method Summary
 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 dataResourceAccessorClassName)
          Creates a new 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.
 void removeResource(java.lang.String resourceName, boolean removeConfiguration)
          Withdraw a data service resource from a service.
 

Method Detail

createResource

public java.lang.String createResource(java.lang.String namePrefix,
                                       DataResourceAccessor dataResourceAccessor,
                                       ActivitiesConfig activitiesConfig,
                                       SessionComponentFactory sessionComponentFactory)
                                throws ResourceCreationException
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.

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.

getNewResourceName

public java.lang.String getNewResourceName()
Returns a new resource name that is guaranteed to be unique within the host service.

Returns:
new data service resource name.

getNewResourceName

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

Parameters:
prefix - for the resource name.
Returns:
new data service resource name.

getResourceConfigDirectory

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

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 dataResourceAccessorClassName)
                    throws DynamicDataServiceResourceCreationException
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.

Parameters:
resourceName - Name of the data service resource to create.
dataResourceAccessorClassName - 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
Withdraw a data service resource from a service. If specified the configuration directory and files will be removed.

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