org.jbpm.integration.console.session
Class AbstractSessionManager

java.lang.Object
  extended by org.jbpm.integration.console.session.AbstractSessionManager
All Implemented Interfaces:
SessionManager
Direct Known Subclasses:
MVELSingleSessionManager

public abstract class AbstractSessionManager
extends Object
implements SessionManager

Abstract manager that provides some helpful methods used by concrete SessionManager implementations


Constructor Summary
AbstractSessionManager()
           
 
Method Summary
protected  void bindToJNDI(String businessKey, org.drools.runtime.StatefulKnowledgeSession session)
          Bind given session into JNDI under given JNDI name as business key
protected  Context createSubcontext(Context ctx, Name name)
          Utility method to create subcontext in JNDI if needed
protected  int getPersistedSessionId(String location)
          Retrieves session id from serialized file named jbpmSessionId.ser from given location.
protected  org.drools.runtime.StatefulKnowledgeSession lookUpInJNDI(String businessKey)
          Looks up session from JNDI by given business key
protected  void persistSessionId(String location, int ksessionId)
          Stores gives ksessionId in a serialized file in given location under jbpmSessionId.ser file name
protected  void removeFromJNDI(String businessKey)
          Removes object bound to given business key from JNDI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jbpm.integration.console.session.SessionManager
disposeSession, getSession, getSession, getSession
 

Constructor Detail

AbstractSessionManager

public AbstractSessionManager()
Method Detail

getPersistedSessionId

protected int getPersistedSessionId(String location)
Retrieves session id from serialized file named jbpmSessionId.ser from given location.

Parameters:
location - directory where jbpmSessionId.ser file should be
Returns:
sessionId if file was found otherwise 0

persistSessionId

protected void persistSessionId(String location,
                                int ksessionId)
Stores gives ksessionId in a serialized file in given location under jbpmSessionId.ser file name

Parameters:
location - directory where serialized file should be stored
ksessionId - value of ksessionId to be stored

lookUpInJNDI

protected org.drools.runtime.StatefulKnowledgeSession lookUpInJNDI(String businessKey)
Looks up session from JNDI by given business key

Parameters:
businessKey - JNDI name to look up
Returns:
session instance if found in JNDI otherwise null

removeFromJNDI

protected void removeFromJNDI(String businessKey)
Removes object bound to given business key from JNDI

Parameters:
businessKey - JNDI name to be unbound

bindToJNDI

protected void bindToJNDI(String businessKey,
                          org.drools.runtime.StatefulKnowledgeSession session)
Bind given session into JNDI under given JNDI name as business key

Parameters:
businessKey - JNDI name to bind the session
session - session to be bind into JNDI

createSubcontext

protected Context createSubcontext(Context ctx,
                                   Name name)
                            throws NamingException
Utility method to create subcontext in JNDI if needed

Parameters:
ctx - parent context
name - JNDI name including subcontexts
Returns:
returns last sub context for given name
Throws:
NamingException


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.