uk.org.ogsadai.examples.demoTransientFactory
Class DemoTransientFactoryDataResourceAccessor

java.lang.Object
  |
  +--uk.org.ogsadai.examples.demoTransientFactory.DemoTransientFactoryDataResourceAccessor
All Implemented Interfaces:
ChildDataServiceResourceComponentProvider, DataResourceAccessor, PersistInFiles

public class DemoTransientFactoryDataResourceAccessor
extends java.lang.Object
implements DataResourceAccessor, PersistInFiles, ChildDataServiceResourceComponentProvider

A very simple data resource accessor that allows activities to obtain the configuration directory of the data service resource that is using the accessor.

This functionality allows data service resource factory activities to copy default configuration files from the parent data service resource to a newly created child data service resource.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
(package private)  ActivitiesConfig mChildActivitiesConfig
          Child activities config
(package private)  java.lang.String mResourceName
          Data service resource name
(package private)  SessionComponentFactory mSessionComponentFactory
          Child session component factory
 
Constructor Summary
DemoTransientFactoryDataResourceAccessor()
           
 
Method Summary
 ActivitiesConfig getChildActivitiesConfig()
          Gets the activity configuration associated with the child data service resource.
 SessionComponentFactory getChildSessionComponentFactory()
          Gets the session component factory that can create the neccessary session components for use with the child data service resource.
 Property[] getProperties()
          Gets the resource properties associated with the data resource accessor.
 void restoreFromConfig(java.io.File directory)
          Configures the data resource accessor by reading any relevant configuration files in the given directory.
 void setResourceName(java.lang.String resourceName)
          Sets the name of the resource.
 
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

mResourceName

java.lang.String mResourceName
Data service resource name


mChildActivitiesConfig

ActivitiesConfig mChildActivitiesConfig
Child activities config


mSessionComponentFactory

SessionComponentFactory mSessionComponentFactory
Child session component factory

Constructor Detail

DemoTransientFactoryDataResourceAccessor

public DemoTransientFactoryDataResourceAccessor()
Method Detail

setResourceName

public void setResourceName(java.lang.String resourceName)
Description copied from interface: DataResourceAccessor
Sets the name of the resource. This method will be called one before any other methods in this interface are called. Data resource accessors are not required to do anything with this name although it is sometimes useful to include it in any error messages.

Specified by:
setResourceName in interface DataResourceAccessor
Parameters:
resourceName - Name of the data service resource which will use this data resource accessor to mediate access to a data resource.

restoreFromConfig

public void restoreFromConfig(java.io.File directory)
                       throws DataResourceAccessorConfigException,
                              DataResourceAccessorMetaDataException,
                              DataResourceAccessorSetupException,
                              java.lang.IllegalArgumentException
Description copied from interface: PersistInFiles
Configures the data resource accessor by reading any relevant configuration files in the given directory.

If a data service resource is being constructed by reading from a configuration file this method will be called once immediately after the setName method is called. The data resource accessor should read its configuration from the files in the given directory of the data service resource which uses it.

Data resource accessors are free to add, amend or delete files in the given directory at any time throughout their lifetime. The exception to this rule is the dataResourceClassConfig.xml file which must be left unaltered since this specifies the data resource accessor class name.

Specified by:
restoreFromConfig in interface PersistInFiles
Parameters:
directory - Directory containing the data service resource configuration files. This includes the data resource accessor configuration files.
Throws:
java.lang.IllegalArgumentException - if the directory argument is null or is not a directory.
DataResourceAccessorSetupException - if an error occurs when setting up the data resource accessor after having read the configuration files.
DataResourceAccessorConfigException - if an error occurs reading the configuration files.
DataResourceAccessorMetaDataException - if an error occurs when constructing data resource accessor meta data properties.

getProperties

public Property[] getProperties()
Description copied from interface: DataResourceAccessor
Gets the resource properties associated with the data resource accessor. These are made available as properties of the data service resource to which the data resource accessor belongs.

This method should be called once after the readConfig method has been called but before any other methods are called.

Specified by:
getProperties in interface DataResourceAccessor
Returns:
The resource proporties. If there are no resource properties then a zero-sized array will be returned.

getChildActivitiesConfig

public ActivitiesConfig getChildActivitiesConfig()
Description copied from interface: ChildDataServiceResourceComponentProvider
Gets the activity configuration associated with the child data service resource.

Specified by:
getChildActivitiesConfig in interface ChildDataServiceResourceComponentProvider
Returns:
configuration details of which activities can be executed on the child data service resource.

getChildSessionComponentFactory

public SessionComponentFactory getChildSessionComponentFactory()
Description copied from interface: ChildDataServiceResourceComponentProvider
Gets the session component factory that can create the neccessary session components for use with the child data service resource.

Specified by:
getChildSessionComponentFactory in interface ChildDataServiceResourceComponentProvider
Returns:
session component factory for use with child data service resource.