uk.org.ogsadai.dataresource
Class DataResourceAccessorFactory
java.lang.Object
|
+--uk.org.ogsadai.dataresource.DataResourceAccessorFactory
- public class DataResourceAccessorFactory
- extends java.lang.Object
Factory to create data resource accessors.
Data resource accessor classes are specified within a data resource accessor class configuration file (dataResourceClassConfig.xml) within the configuration files directory of the data service resource that is to use the accessor. The class specified must implement the PersistedDataResourceAccessor interface.
- Author:
- The OGSA-DAI Project Team
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
-
- See Also:
- Constant Field Values
LOG
private static DAILogger LOG
-
mStaticResourceFactory
private static DataResourceAccessorFactory mStaticResourceFactory
-
CLASS_CONFIG_FILENAME
private static final java.lang.String CLASS_CONFIG_FILENAME
-
- See Also:
- Constant Field Values
DataResourceAccessorFactory
private DataResourceAccessorFactory()
-
Private constructor.
Use getInstance() to obtain an instance of this class.
getInstance
public static DataResourceAccessorFactory getInstance()
-
Gets the singleton instance of this class.
-
- Returns:
- data resource accessor factory.
createDataResourceAccessor
public DataResourceAccessor createDataResourceAccessor(java.lang.String name,
java.io.File configDirectory)
throws DataResourceAccessorConfigException,
DataResourceAccessorCreationException,
DataResourceAccessorMetaDataException,
DataResourceAccessorSetupException
-
Creates a new data resource accessor.
The class implementing the data resource accessor is found within a dataResourceClassConfig.xml file in the given directory.
-
- Parameters:
name - Name of the data service resource that will use this data resource accessor.
configDirectory - The directory containing the configuration files for the data service resource.
- Returns:
- a configured instance of the data resource accessor.
- Throws:
DataResourceAccessorCreationException - if there is a problem in reading the data resource accessor configuration file or creating an instance of the data resource accessor.
DataResourceAccessorConfigException - if an error occurs reading the configuration files for the data resource accessor instance.
DataResourceAccessorMetaDataException - if an error occurs when constructing data resource accessor meta data properties.
DataResourceAccessorSetupException - if an error occurs when setting up the data resource accessor after having read the configuration files.
getDataResourceClassName
private java.lang.String getDataResourceClassName(java.lang.String name,
java.io.File configDirectory)
throws DataResourceAccessorCreationException
-
Gets the name of a data resource accessor class from a data resource accessor class configuration file.
-
- Parameters:
name - Name of the data service resource that will use this data resource accessor.
configDirectory - Directory holding data service resource configuration files including the data resource accessor class configuration file.
- Returns:
- the data resource accessor class name.
- Throws:
DataResourceAccessorCreationException - if there is a problem in reading the data resource accessor configuration file.
createDataResourceAccessorInstance
private DataResourceAccessor createDataResourceAccessorInstance(java.lang.String name,
java.lang.String className)
throws DataResourceAccessorCreationException
-
Creates a new
DataResourceAccessor object which is an instance of the given class name. The specified class must implement the DataResourceAccessor interface.
-
- Parameters:
name - Name of the data service resource that will use this data resource accessor.
className - Name of data resource accessor class. This class must implement the DataResourceAccessor interface.
- Returns:
- a newly created instance of the specified class.
- Throws:
DataResourceAccessorCreationException - if an instance of the data resource accessor cannot be created.