uk.org.ogsadai.service.resource.config
Class FileBasedActivitiesConfig
java.lang.Object
|
+--uk.org.ogsadai.service.resource.config.FileBasedActivitiesConfig
- All Implemented Interfaces:
- ActivitiesConfig
- public class FileBasedActivitiesConfig
- extends java.lang.Object
- implements ActivitiesConfig
Activity configuration details read from a configuration file.
- Author:
- OGSA-DAI team
Constructor Summary |
FileBasedActivitiesConfig(java.io.File configFile)
Reads the activities configuration from the specified file. |
Method Summary |
private ActivityConfig |
getActivityConfig(org.w3c.dom.Element activityElement, java.lang.String configBase, java.lang.String schemaBase)
Constructs the activity configuration associated with a single activity. |
ActivityConfig[] |
getActivityConfigs()
Gets the configuration details of each of the activities. |
private ActivityConfig[] |
getActivityConfigs(org.w3c.dom.Document configDoc)
Gets the array of configuration details associated with each activity. |
org.w3c.dom.Document |
getBasePerformDocumentSchema()
Gets the XSD schema document that describes the base schema of the perform document. |
private org.w3c.dom.Document |
getBasePerformDocumentSchema(org.w3c.dom.Document configDoc)
Extracts the base perform document schema from the configuration document. |
private org.w3c.dom.Document |
getConfigFileAsDocument(java.io.File configFile)
Gets the configuration file as a DOM document. |
private java.util.Properties |
getProperties(org.w3c.dom.Element activityElement)
Extracts the properties from the given activity configuration element. |
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
-
Copyright statement
- See Also:
- Constant Field Values
DAILOG
private static final DAILogger DAILOG
-
mBasePerformDocumentSchema
private org.w3c.dom.Document mBasePerformDocumentSchema
-
mActivities
private ActivityConfig[] mActivities
-
FileBasedActivitiesConfig
public FileBasedActivitiesConfig(java.io.File configFile)
throws DAIFileContentError,
XMLFileException
-
Reads the activities configuration from the specified file.
- Parameters:
configFile
- Absolute path to the activity config file.
- Throws:
XMLFileException
- If the top level configuration file cannot be accessed.
DAIFileContentError
- If there is an error in the contents of the top level configuration file or any of the other configuration files refered to.
getBasePerformDocumentSchema
public org.w3c.dom.Document getBasePerformDocumentSchema()
-
Gets the XSD schema document that describes the base schema of the perform document. The full schema of accepted perform documents is derived from this base plus the schema corresponding to each activity's parameters.
-
- Specified by:
getBasePerformDocumentSchema
in interface ActivitiesConfig
-
- Returns:
- document with XSD schema of base perform document.
getActivityConfigs
public ActivityConfig[] getActivityConfigs()
-
Gets the configuration details of each of the activities.
-
- Specified by:
getActivityConfigs
in interface ActivitiesConfig
-
- Returns:
- Array of details of the individual activities.
getConfigFileAsDocument
private org.w3c.dom.Document getConfigFileAsDocument(java.io.File configFile)
throws DAIFileContentError,
XMLFileException
-
Gets the configuration file as a DOM document. The configuration file will also be validated by this method.
-
-
- Parameters:
configFile
- Absolute path to the configuration file.
- Returns:
- The configuration file as a DOM document.
- Throws:
XMLFileException
- If the top level configuration file cannot be accessed.
DAIFileContentError
- If there is an error in the contents of the top level configuration file or any of the other configuration files refered to.
getActivityConfigs
private ActivityConfig[] getActivityConfigs(org.w3c.dom.Document configDoc)
throws DAIMalformedURLException,
DAIURLReadIOException,
DAIURLContentException
-
Gets the array of configuration details associated with each activity.
-
-
- Parameters:
configDoc
- The top level activity configuration document.
- Returns:
- The array of individual activity configuration details.
- Throws:
DAIMalformedURLException
- If a URL specified in the configuration document is malformed.
DAIURLReadIOException
- If a URL specified in the configuration document cannot be read.
DAIURLContentException
- If there is an error in the contents of a URL specified in the configuation document.
getActivityConfig
private ActivityConfig getActivityConfig(org.w3c.dom.Element activityElement,
java.lang.String configBase,
java.lang.String schemaBase)
throws DAIMalformedURLException,
DAIURLReadIOException,
DAIURLContentException
-
Constructs the activity configuration associated with a single activity.
-
-
- Parameters:
activityElement
- The element containing the activity configuration.
configBase
- The name of the configuration files base path or null if none is specified.
schemaBase
- The name of the schema files base path or null if none is specified.
- Returns:
- Configuration details for a single activity.
- Throws:
DAIMalformedURLException
- If a URL specified in the configuration document is malformed.
DAIURLContentException
- If there is an error in the contents of a URL specified in the configuation document.
DAIURLReadIOException
getProperties
private java.util.Properties getProperties(org.w3c.dom.Element activityElement)
-
Extracts the properties from the given activity configuration element.
-
-
- Parameters:
activityElement
- Element with configuration of a single activity.
- Returns:
- The properties specified in the activity or null if there are none.
getBasePerformDocumentSchema
private org.w3c.dom.Document getBasePerformDocumentSchema(org.w3c.dom.Document configDoc)
throws DAIMalformedURLException,
DAIURLReadIOException,
DAIURLContentException
-
Extracts the base perform document schema from the configuration document.
-
-
- Parameters:
configDoc
- Top level activity configuration document.
- Returns:
- The base perform document schema document as specified in the top level activity configuration document.
- Throws:
DAIMalformedURLException
- If the URL that specified the location of the base schema document is malformed.
DAIURLReadIOException
- If the URL that specified the location of the base schema document cannot be read.
DAIURLContentException
- If there is an error in the contents of the URL specifiying the base perform document schema. For example the URL does not specify an XML document.