|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.dataresource.SQLMultipleDataResourceAccessor
A data resource accessor that provides access to a number of data resources. These should be relational databases.
The configuration file is named dataResourceConfig.xml
and is assumed to reside in the configuration files directory for
the data service resource that owns this data resource accessor.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
private static java.lang.String |
DATA_SERVICE_CONFIG_ELEMENT
The element describing each one of the data service resources connected to the multiple data service resource. |
private static DAILogger |
LOG
Logger object for logging in this class. |
private static java.lang.String |
MAIN_CONFIG_FILE_NAME
The name of XML configuration file |
private java.lang.String |
mDataResourceName
the name of the multiple data service resource |
private DataServiceInfo[] |
mMultipleDS
information about data service resources connected to the multiple data service resource. |
private Property[] |
mProperties
the properties of this data service resource |
private StatusOfDataServices |
mStatusCallback
the status of the data service resources connected to the multiple data service resource. |
Constructor Summary | |
SQLMultipleDataResourceAccessor()
|
Method Summary | |
private Property[] |
constructProperties()
Constructs the data resource properties. |
private org.w3c.dom.Document |
getConfigAsDOM(java.lang.String name,
java.io.File configDirectory)
Reads the main configuration file and returns the XML as a DOM. |
DataServiceInfo[] |
getMultipleDS()
Get Info for multiple Data Services. |
Property[] |
getProperties()
Returns the resource properties that will be available to service users via the resource properties mechanism. |
void |
onBeginRequest()
Notifies the data resource that a new request is about to be processed. |
void |
onBeginSession()
Notifies the data resource that a new session has been started. |
void |
onContainerShutdown()
Notifies the data resource that the container is about to shutdown. |
void |
onEndRequest()
Notifies the data resource that a request has ended. |
void |
onEndSession()
Notifies the data resource that a session has ended. |
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 |
private static final java.lang.String COPYRIGHT_NOTICE
private static DAILogger LOG
private static final java.lang.String MAIN_CONFIG_FILE_NAME
private static final java.lang.String DATA_SERVICE_CONFIG_ELEMENT
private java.lang.String mDataResourceName
private Property[] mProperties
private DataServiceInfo[] mMultipleDS
private StatusOfDataServices mStatusCallback
Constructor Detail |
public SQLMultipleDataResourceAccessor()
Method Detail |
public void setResourceName(java.lang.String resourceName)
DataResourceAccessor
setResourceName
in interface DataResourceAccessor
resourceName
- Name of the data service resource which will use this data
resource accessor to mediate access to a data resource.public void restoreFromConfig(java.io.File directory) throws DataResourceAccessorConfigException, DataResourceAccessorMetaDataException, DataResourceAccessorSetupException, java.lang.IllegalArgumentException
PersistInFiles
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.
restoreFromConfig
in interface PersistInFiles
directory
- Directory containing the data service resource configuration files.
This includes the data resource accessor configuration files.
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.public Property[] getProperties()
getProperties
in interface DataResourceAccessor
public void onBeginSession()
The implementation of this method must be thread safe as multiple threads may begin new session concurrently.
public void onEndSession()
The implementation of this method must be thread safe as multiple threads may end sessions concurrently.
public void onBeginRequest()
The implementation of this method must be thread safe as multiple threads may process requests concurrently.
public void onEndRequest()
The implementation of this method must be thread safe as multiple threads may be process requests concurrently.
public void onContainerShutdown()
There is no guarantee that calls to other methods will not be received during or after this call.
public DataServiceInfo[] getMultipleDS()
private org.w3c.dom.Document getConfigAsDOM(java.lang.String name, java.io.File configDirectory) throws DataResourceAccessorConfigException
configDirectory
- Data resource configuration directory.
DataResourceConfigException
- Thrown if there was an error in the configuration
details.
DAIFileNotFoundException
- Thrown if the configuration file is not found.
DAIFileReadIOException
- Thrown if there is an error reading the configuration file.
DAIFileContentError
- Thrown if there is an error in the contents of the
configuration file, i.e. the XML is invalid according to
the schema.
InternalException
DataResourceAccessorConfigException
private Property[] constructProperties()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |