uk.org.ogsadai.sessions.impl
Class TransientSessionManagerFactory
java.lang.Object
|
+--uk.org.ogsadai.sessions.impl.TransientSessionManagerFactory
- All Implemented Interfaces:
- SessionManagerFactory
- public class TransientSessionManagerFactory
- extends java.lang.Object
- implements SessionManagerFactory
Factory for creating instances of TransientSessionManager
.
The format of the element passed to the createSessionManager()
method must conform to the description of the sessionManager
element in the session_configuration.xsd
schema. For example:
<sessionManager
factory="uk.org.ogsadai.sessions.impl.TransientSessionManagerFactory">
<timeout default="600000" max="unbounded"/>
<sessionAttribute name="MySessionAttribute1"
impl="uk.org.ogsadai.sessions.impl.MyStaticSessionAttribute">
<anyXML/>
</sessionAttribute>
<sessionAttribute name="MySessionAttribute2"
impl="uk.org.ogsadai.sessions.impl.MyStaticSessionAttribute">
<anyXML/>
</sessionAttribute>
</sessionManager>
This must contain timeout
child-element to specify the default and maximum timeout durations for any sessions created by the session manager. It may also contain a sequence of zero or more sessionAttribute
elements. These describe the static session attributes that will be present in every session created by the session manager. The name
attribute provides an identity that can be used for accessing the attribute from the session. The impl
attribute specifies the implementation class for the attribute value, and the specified class must implement the AttributeValue
interface. Each sessionAttribute
element may contain any child elements, and the entire element will be passed to the session attribute value object for initialisation purposes.
- 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 final DAILogger LOG
-
TransientSessionManagerFactory
public TransientSessionManagerFactory()
createSessionManager
public SessionManager createSessionManager(org.w3c.dom.Element configuration,
Properties properties,
DataResourceAccessor dataResource)
throws SessionManagerCreationException
- Description copied from interface:
SessionManagerFactory
-
Creates a new session manager instance.
This method is invoked only once when a data service resource is instantiated. The object returned is then used for managing all the sessions associated with that data service resource.
-
- Specified by:
createSessionManager
in interface SessionManagerFactory
-
- Parameters:
configuration
- The sessionConfiguration
element from the session configuration file. This may contain settings used to initialise the SessionManager
.
properties
- The properties associated with the session.
dataResource
- The data resource accessor associated with the session manager or null
if no data resource accessor is associated.
- Returns:
- a new
SessionManager
, initialised and ready for use.
- Throws:
SessionManagerCreationException
- if there is a problem creating the new session manager. The consequence of this is that the data service resource cannot be properly initialised, so requests cannot be processed.
parseAttributes
private java.util.Set parseAttributes(org.w3c.dom.Element parent)
throws SessionAttrCreationException
-
Parses each of the
sessionAttribute
child-elements, creating and initialising the corresponding objects then storing them in a set.
-
-
- Parameters:
parent
- XML fragment containing the attribute names and class names.
- Returns:
- the session attributes.
- Throws:
SessionAttrCreationException
- if there is a problem when creating any attribute object.
createAttribute
private StaticSessionAttribute createAttribute(org.w3c.dom.Element attributeElement)
throws SessionAttrCreationException
-
Creates a static session attribute from the specified element using the
name
and impl
attributes.
Reflection is used to instantiate the object then the initialise
method is invoked.
-
-
- Parameters:
attributeElement
- XML fragment containing the attribute name and class name.
- Returns:
- the session attribute.
- Throws:
SessionAttrCreationException
- if there is a problem when creating the attribute object.
createConfiguration
protected SessionConfiguration createConfiguration(long defaultTimeout,
long maxTimeout,
java.util.Set attributes,
Properties properties,
DataResourceAccessor dataResource)
-
Creates and returns an anonymous instance of the
TransientSessionConfiguration
class that simply returns the specified timeouts and static properties.
-
-
- Parameters:
defaultTimeout
- Default timeout for new sessions.
maxTimeout
- Maximum timeout for new sessions.
attributes
- Static session attribute set for new sessions.
properties
- Data service resource properties.
dataResource
- Data resource which needs to be informed of session events.
- Returns:
SessionConfiguration
.