|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.service.resource.factory.DataServiceResourceFactoryUtil
Class containing utilities for dynamic creation of data service
resources. It provides much of the functionality needed by classes
implementing the
uk.org.ogsadai.service.resource.factory.DataServiceResourceFactory
interface.
Field Summary | |
private static java.lang.String |
CLASS_CONFIG_FILENAME
Name of the class config file |
private static java.lang.String |
CLASS_CONFIG_TEMPLATE_FILENAME
Name of the template class config file |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
private static java.lang.String |
DATA_RESOURCE_ACCESSOR_CLASS_NAME_TOKEN
Token within the template class config file that will be replaced with the class name. |
private static DAILogger |
LOG
Logger object for logging in this class |
private java.io.File |
mConfigDirectory
Directory storing all OGSA-DAI configuration files |
private java.lang.Object |
mPersistResourceSynchronization
Persist resource synchronization object |
private java.io.File |
mSchemaDirectory
Directory storing OGSA-DAI XML Schema and WSDL |
static java.lang.String |
OGSADAI_SCHEMA_ROOT_TOKEN
Token used in configuration files to represent the root OGSADAI schema directory. |
Constructor Summary | |
DataServiceResourceFactoryUtil(java.io.File configDirectory,
java.io.File schemaDirectory)
Constructor. |
Method Summary | |
java.io.File |
createResourceConfigDirectory(java.lang.String resourceName)
Returns the configuration files directory for the named resource. |
java.lang.String |
getNewResourceName()
Returns a new resource name that is guaranteed to be unique within this service. |
java.lang.String |
getNewResourceName(java.lang.String prefix)
Returns a new resource name that is guaranteed to be unique within this service. |
void |
persistResource(java.lang.String resourceName,
java.io.File resourcesFile)
Perists a specified resource by writing an entry for it in the a data service resources file. |
void |
removePersistentResource(java.lang.String resourceName,
java.io.File resourcesFile)
Remove a resource from the data service resources file. |
boolean |
removeResourceConfigDirectory(java.lang.String resourceName)
Remove configuration files directory of the given resource. |
void |
replaceTokensInAllConfigFiles(java.lang.String resourceName)
Scans through all the files in the specified data service resources's configuration directory and replaces all occurrences of special tokens with corresponding values. |
void |
writeClassConfigFile(java.lang.String resourceName,
java.lang.String className)
Writes the data service resource accessor class configuration file for the named data service resource. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static DAILogger LOG
private static java.lang.String CLASS_CONFIG_FILENAME
private static java.lang.String CLASS_CONFIG_TEMPLATE_FILENAME
private static java.lang.String DATA_RESOURCE_ACCESSOR_CLASS_NAME_TOKEN
private java.io.File mConfigDirectory
private java.lang.Object mPersistResourceSynchronization
private java.io.File mSchemaDirectory
public static java.lang.String OGSADAI_SCHEMA_ROOT_TOKEN
schema
directory. All occurences of this token
will be replaced by the absolute schema path.
Constructor Detail |
public DataServiceResourceFactoryUtil(java.io.File configDirectory, java.io.File schemaDirectory) throws DAIConfigDirectoryException
Stores references to the given parameters.
configDirectory
- Absolute path to OGSA-DAI configuration files directory.schemaDirectory
- Absolute path to OGSA-DAI XML Schema and WSDL directory.
DAIConfigDirectoryException
- if
configDirectory
does not exist or is not a directory.Method Detail |
public java.lang.String getNewResourceName()
The implementation of this method is synchronized.
public java.lang.String getNewResourceName(java.lang.String prefix)
The implementation of this method is synchronized.
prefix
- prefix of new resource name
public java.io.File createResourceConfigDirectory(java.lang.String resourceName) throws CreateResourceConfigDirectoryException
resourceName
- Name of the resource to create the directory for.
CreateResourceConfigDirectoryException
- if there
is a problem in checking or creating the directory.public void writeClassConfigFile(java.lang.String resourceName, java.lang.String className) throws CreateResourceConfigFileException
This method uses a templace file in
dataResourceClassConfigTemplate.xml
.
resourceName
- Data service resource name.className
- Data service resource accessor class name.
CreateResourceConfigFileException
- if there is a problem
in creating the file.public void replaceTokensInAllConfigFiles(java.lang.String resourceName) throws CustomiseResourceConfigFileException
The special tokens replaced are:
%OGSADAI_SCHEMA_ROOT%
- the path to the
OGSA-DAI XML Schema and WSDL directory.
resourceName
- Data service resource name.
CustomiseResourceConfigFileException
- if a problem
arises during the customisation.
is a problem in checking or creating the directory.public void persistResource(java.lang.String resourceName, java.io.File resourcesFile) throws PersistResourceNameFileException
The implementation of this method is synchronized.
resourceName
- Data service resource name.resourcesFile
- Data service resources file into which to write resource
name.
PersistResourceNameFileException
- if a problem occurs.public void removePersistentResource(java.lang.String resourceName, java.io.File resourcesFile) throws RemoveResourceNameFileException
The implementation of this method is synchronized.
resourceName
- data service resource nameresourcesFile
- data service resources file
RemoveResourceNameFileException
- if a problem occurspublic boolean removeResourceConfigDirectory(java.lang.String resourceName)
resourceName
- name of the data service resource
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |