com.ibm.b2bi.im.portal
Class EpicContextBean

com.ibm.b2bi.im.portal.EpicContextBean

public class EpicContextBean
implements java.io.Serializable

This class can be used to hold the interaction context details during user's HTTP session. By default it comes with a root node with empty string as node name and this is used by the logon/initialization process to maintain some generic information that can be used across various services hosted in a solution desktop for e.g user name etc. Create child nodes for each service and use that node and its child nodes to maintain relevant session information for that service. This effectively eliminates various services overwriting data using same name in the HTTPSession object. See the appropriate documentaion for more details.

See Also:
Serialized Form

Field Summary
static java.lang.String copyrightNotice
           
 
Constructor Summary
EpicContextBean()
          EpicContextBean constructor comment.
 
Method Summary
 boolean addListener(java.lang.String service, CleanupConnections impl)
          Registers the listener for the given service.
 boolean contains(java.lang.String parentContext, java.lang.String childContext)
          Verifies if there is a child context node by the given name in the given parent context node.
 java.lang.String createContext(java.lang.String assignedName, java.lang.String parentContext)
          Creates a new context node with the given name under the given parent node.
 void destroyContext(java.lang.String contextName)
          Removes the named context node from the common root context.
 java.util.Hashtable getCompleteContext(java.lang.String contextName)
          Gets the entire list of values (contexts) stored under each node starting from the given node as the parent.
 java.lang.Object getContextValue(java.lang.String contextNodeName, java.lang.String contextName)
          Gets the value of the context with given name in the given context node.
 java.lang.String getCurrentContext(javax.servlet.http.HttpServletRequest request)
          Gets the name of the current context stored in given Request object.
 java.lang.String getParamDescription(java.lang.String contextID)
          Returns the context ID in the name/vale pair format.
 boolean hasChildContexts(java.lang.String context)
          Checks if the given node has any child nodes.
 boolean hasContextValues(java.lang.String context, boolean searchChildren)
          Checks if the given context has any context values in it.
 void removeContextValue(java.lang.String context, java.lang.String name)
          Removes the named value from the given context.
 void removeListener(java.lang.String service, CleanupConnections impl)
          Remove the registered cleanup connections listener for the given service.
 void setContextValue(java.lang.String context, java.lang.String name, java.lang.Object value)
          Puts the given context name and its value in the given node.
 void setCurrentContext(java.lang.String contextid, javax.servlet.http.HttpServletRequest request)
          Sets the context name associated with the request object.
 void updateListener(java.lang.String service, CleanupConnections impl)
          Updates the listener for existing service.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent se)
           
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent se)
           
 

Field Detail

copyrightNotice

public static final java.lang.String copyrightNotice
Constructor Detail

EpicContextBean

public EpicContextBean()
EpicContextBean constructor comment.
Method Detail

addListener

public boolean addListener(java.lang.String service,
                           CleanupConnections impl)
Registers the listener for the given service. When the logout operation is executed, these listeners are called to do their respective cleanup operations.
Returns:
boolean Returns true of successful, false of a listener is already registered for the service. Use the updateListener() method if you want to update the listener for this service.
Throws:
IMException -  

contains

public boolean contains(java.lang.String parentContext,
                        java.lang.String childContext)
                 throws NodeNotFoundException
Verifies if there is a child context node by the given name in the given parent context node.
Parameters:
parentContext - java.lang.String Parent context node under which, the child context node should be searched for.
childContext - java.lang.String Child context node name that is being searched for it existence.
Returns:
boolean Returns true if the child context was found in the given parent context. If parent context is null or "", root node is assumed.
Throws:
Throws - NodeNotFoundException if the given parent context node could not be found.

createContext

public java.lang.String createContext(java.lang.String assignedName,
                                      java.lang.String parentContext)
Creates a new context node with the given name under the given parent node. If no name is given for the new context, it creates a new unique name using an internal attribute. The newly created node is put as a child node of the given parent node. If no parent node name is given, it adds the new context to the root node. When you choose to give the name of the new node, please ensure that it is unique. It is advisible to pass an empty name to the method and let the API choose a unique name unless it is necessary.
Parameters:
assignedName - Name of the new context node.
parentContext - Name of the parent node.
Returns:
Returns the newly created context name, if successful.
Throws:
Throws - NodeNotFoundException run time exception, if the specified parent node is not found.

destroyContext

public void destroyContext(java.lang.String contextName)
Removes the named context node from the common root context. Removes the first occurance of a node with the given name.
Parameters:
contextName - Name of the context node to be removed.

getCompleteContext

public java.util.Hashtable getCompleteContext(java.lang.String contextName)
Gets the entire list of values (contexts) stored under each node starting from the given node as the parent. If node name is not given, it starts from the root node.
Parameters:
Name - of the node from which all context values have to be retrieved.
Returns:
List of contexts in a Hashtable or null if no valeus are available.
Throws:
Throws - NodeNotFoundException run time exception of the specified node is not found.

getContextValue

public java.lang.Object getContextValue(java.lang.String contextNodeName,
                                        java.lang.String contextName)
                                 throws NodeNotFoundException
Gets the value of the context with given name in the given context node. If there is no value for the context in the specified node, it will search for a value, iteratively, in the parent nodes. It will return null if the context value is not found upto the root node.
Parameters:
contextNodeName - Name of the context node.
contextName - Name of the context whose value is being requested.
Returns:
Value of the context,if found, null otherwise.
Throws:
Throws - NodeNotFoundException run time exception if the specified node name does not exist.

getCurrentContext

public java.lang.String getCurrentContext(javax.servlet.http.HttpServletRequest request)
Gets the name of the current context stored in given Request object. Tries to get the context name from the list of attributes stored in the request object or in the parameters list.
Parameters:
request - The request object which holds the name of the context.
Returns:
Name of the context associated with the given request object, null otherwise.

getParamDescription

public java.lang.String getParamDescription(java.lang.String contextID)
Returns the context ID in the name/vale pair format.
Parameters:
contextID - Name of the context.
Returns:
Context name in the name, value format.

hasChildContexts

public boolean hasChildContexts(java.lang.String context)
Checks if the given node has any child nodes. If the name of the context node is not given, it searches in the root node.
Parameters:
context - Name of the node to check for contexts.
Returns:
true if there are contexts in the node, false otherwise. It will return false, even if the given node could not be found.
Throws:
Throws - NodeNotFoundException at run time if the specified context node is not found.

hasContextValues

public boolean hasContextValues(java.lang.String context,
                                boolean searchChildren)
Checks if the given context has any context values in it. Use the searchChildren parameter to specify if you want to search child contexts for presence of any context value. The first instance where a context value is stored will return the with true.
Parameters:
context - Name of the context.
searchChildren - If true, specifies API to look for context value in children if no value is found in the given context itself.
Returns:
true if there is any context value.
Throws:
NodeNotFoundException - Thrown if the specified context is not existing.

removeContextValue

public void removeContextValue(java.lang.String context,
                               java.lang.String name)
Removes the named value from the given context.
Parameters:
context - name String indicating the name of the context node.
name - String indicating the name of the value to be removed from the given context node.

removeListener

public void removeListener(java.lang.String service,
                           CleanupConnections impl)
                    throws IMException
Remove the registered cleanup connections listener for the given service.

setContextValue

public void setContextValue(java.lang.String context,
                            java.lang.String name,
                            java.lang.Object value)
Puts the given context name and its value in the given node. If no node name is given, the context is put into the root context node.
Parameters:
context - The name of the context node into which the context value has to be stored.
name - Name of the context.
value - Value of the context.
Throws:
Throws - NodeNotFoundException at run time if the specifed node is not found. Throws NullPointerException if either the context name or its value is null.

setCurrentContext

public void setCurrentContext(java.lang.String contextid,
                              javax.servlet.http.HttpServletRequest request)
Sets the context name associated with the request object. It is stored as an atrribute of request object with the name as specified for the paramAttrName member variable.

updateListener

public void updateListener(java.lang.String service,
                           CleanupConnections impl)
                    throws IMException
Updates the listener for existing service. If the service is not registered yet, it registers and adds this listener.
Parameters:
service - java.lang.String
impl - com.ibm.b2bi.im.portal.CleanupConnections
Throws:
IMException - The exception description.

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent se)

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent se)