|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.sessions.SessionConfigurationLoader
This class loads an XML session configuration file conforming to the
session_config.xsd
schema. It then instantiates the
SessionManagerFactory
described by the
sessionManagerFactory element of the document. Finally, it
constructs a SimpleSessionCoordinator
using this factory.
The getSessionCoordinator
method provides access to this.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
private static DAILogger |
LOG
Logger object for this class |
private boolean |
mAreComponentsBuilt
Have the session components been built? |
private SessionCoordinator |
mCoordinator
Session coordinator component. |
private DataResourceAccessor |
mDataResourceAccessor
Data resource accessor associated with the session components |
private Properties |
mResourceProperties
Resource properties associated with the the session components |
private org.w3c.dom.Element |
mSessionConfig
Session configuration element |
private java.io.File |
mSessionConfigFile
Session configuration file |
private SessionManagerFactory |
mSessionManagerFactory
Session manager factory |
Constructor Summary | |
SessionConfigurationLoader(java.io.File sessionConfigFile)
Creates a SessionConfigurationLoader using the
specified session configuration file. |
Method Summary | |
private void |
buildComponents()
Builds the session components if they have not already been built. |
private org.w3c.dom.Element |
buildElement(java.io.File sessionConfiguration)
Builds a document from the specified XML file and returns the root element. |
(package private) SessionManagerFactory |
createSessionManagerFactory(java.lang.String className)
Creates and initialises a SessionManagerFactory
using reflection. |
SessionCoordinator |
getSessionCoordinator()
Gets the session coordinator for the data service resource. |
private java.lang.String |
parseFactoryClassName(org.w3c.dom.Element config)
Parses and returns the SessionManagerFactory class
name from the sessionConfiguration element. |
void |
setDataResourceAccessor(DataResourceAccessor dataResourceAccessor)
Specifies the data resource accessor associated with the data service resource. |
void |
setResourceProperties(Properties resourceProperties)
Specifies the data resource properties associated with the data 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 final DAILogger LOG
private final java.io.File mSessionConfigFile
private final org.w3c.dom.Element mSessionConfig
private final SessionManagerFactory mSessionManagerFactory
private DataResourceAccessor mDataResourceAccessor
private Properties mResourceProperties
private boolean mAreComponentsBuilt
private SessionCoordinator mCoordinator
Constructor Detail |
public SessionConfigurationLoader(java.io.File sessionConfigFile) throws SessionManagerFactoryCreationException
SessionConfigurationLoader
using the
specified session configuration file.
sessionConfigFile
- The session configuration file.
SessionManagerFactoryCreationException
- if the session manager factory could not be created.
java.lang.IllegalArgumentException
- if the sessionConfig
argument is
null
.Method Detail |
public void setDataResourceAccessor(DataResourceAccessor dataResourceAccessor)
SessionComponentFactory
setDataResourceAccessor
in interface SessionComponentFactory
dataResourceAccessor
- The data resource accessor.public void setResourceProperties(Properties resourceProperties)
SessionComponentFactory
setResourceProperties
in interface SessionComponentFactory
resourceProperties
- public SessionCoordinator getSessionCoordinator() throws DAIException
setDataResourceAccessor
and
setResourceProperties
methods have both been called.
getSessionCoordinator
in interface SessionComponentFactory
java.lang.IllegalStateException
- If this method is called before the
setDataResourceAccessor
and
setResourceProperties
methods have been called.
DAIException
- If an error occurs constructing the serssion coordinator.private void buildComponents() throws SessionManagerCreationException
SessionManagerCreationException
- If there is a error creating the session manager.private org.w3c.dom.Element buildElement(java.io.File sessionConfiguration) throws SessionManagerFactoryCreationException
sessionConfiguration
- Session manager factory configuration file.
SessionManagerFactoryCreationException
- if there is a
problem in the loading or parsing.private java.lang.String parseFactoryClassName(org.w3c.dom.Element config)
SessionManagerFactory
class
name from the sessionConfiguration
element.
An empty string is returned if the class name is not specified, but this should not happen because the XML Schema should ensure the attribute is present and specifies a Java class.
config
- XML fragment holding the class name.
SessionManagerFactory createSessionManagerFactory(java.lang.String className) throws SessionManagerFactoryCreationException
SessionManagerFactory
using reflection.
This method has package-level accessibility to facilitate testing.
className
- The name of the SessionManagerFactory
implementation class.
SessionManagerFactory
SessionManagerFactoryCreationException
- if there is a
problem in the creation or initialisation.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |