org.ow2.jonas.lib.ejb21
Class JSessionContext

java.lang.Object
  extended by org.ow2.jonas.lib.ejb21.JContext
      extended by org.ow2.jonas.lib.ejb21.JSessionContext
All Implemented Interfaces:
Serializable, EJBContext, SessionContext
Direct Known Subclasses:
JStatefulContext, JStatelessContext

public abstract class JSessionContext
extends JContext
implements SessionContext, Serializable

This class implements javax.ejb.SessionContext interface. it should be implemented by JStatefulContext and JStatelessContext depending if the beans is stateful or stateless.

Author:
Philippe Coq, Philippe Durieux
See Also:
Serialized Form

Field Summary
protected  JSessionSwitch bs
           
protected  boolean ismarkedremoved
           
 
Fields inherited from class org.ow2.jonas.lib.ejb21.JContext
bf, CTX_STATE_ACTIVE, CTX_STATE_COMMITTING, CTX_STATE_FINDING, CTX_STATE_INITIAL, CTX_STATE_PASSIVE, myinstance, tm
 
Constructor Summary
JSessionContext(JSessionFactory bf, SessionBean eb)
          Constructs a SessionContext
 
Method Summary
<T> T
getBusinessObject(Class<T> businessInterface)
          Obtain an object that can be used to invoke the current bean through the given business interface.
 EJBLocalObject getEJBLocalObject()
          Obtain a reference to the EJB local object that is currently associated with the instance.
 EJBObject getEJBObject()
          Obtains a reference to the EJB object that is currently associated with the instance.
 SessionBean getInstance()
          Returns the bean instance of this context Used in the generated classes to retrieve the instance
 Class getInvokedBusinessInterface()
          Obtain the business interface through which the current business method invocation was made.
abstract  MessageContext getMessageContext()
          Obtain a reference to the JAX-RPC MessageContext.
 boolean getRollbackOnly()
          Tests if the transaction has been marked for rollback only.
 void initSessionContext(JSessionSwitch bs)
          Reinit Context for reuse
 boolean isMarkedRemoved()
           
abstract  void setConnectionList(List conlist)
           
abstract  void setRemoved()
           
 
Methods inherited from class org.ow2.jonas.lib.ejb21.JContext
getCallerIdentity, getCallerPrincipal, getEJBHome, getEJBLocalHome, getEnvironment, getState, getTimerService, getUserTransaction, getWorkManager, isCallerInRole, isCallerInRole, lookup, setActive, setCommitting, setFinding, setPassive, setRollbackOnly, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.ejb.EJBContext
getCallerIdentity, getCallerPrincipal, getEJBHome, getEJBLocalHome, getEnvironment, getTimerService, getUserTransaction, isCallerInRole, isCallerInRole, lookup, setRollbackOnly
 

Field Detail

bs

protected JSessionSwitch bs

ismarkedremoved

protected boolean ismarkedremoved
Constructor Detail

JSessionContext

public JSessionContext(JSessionFactory bf,
                       SessionBean eb)
Constructs a SessionContext

Parameters:
bf - The Session Factory
eb - The Session bean instance
Method Detail

getEJBObject

public EJBObject getEJBObject()
                       throws IllegalStateException
Obtains a reference to the EJB object that is currently associated with the instance.

Specified by:
getEJBObject in interface SessionContext
Returns:
The EJB object currently associated with the instance.
Throws:
IllegalStateException - Thrown if the instance invokes this method while the instance is in a state that does not allow the instance to invoke this method.

getEJBLocalObject

public EJBLocalObject getEJBLocalObject()
                                 throws IllegalStateException
Obtain a reference to the EJB local object that is currently associated with the instance.

Specified by:
getEJBLocalObject in interface SessionContext
Returns:
The EJB local object currently associated with the instance.
Throws:
IllegalStateException - - if the instance invokes this method while the instance is in a state that does not allow the instance to invoke this method, or if the instance does not have a local interface.

getMessageContext

public abstract MessageContext getMessageContext()
                                          throws IllegalStateException
Obtain a reference to the JAX-RPC MessageContext.

Specified by:
getMessageContext in interface SessionContext
Returns:
The MessageContext for this web service invocation.
Throws:
IllegalStateException - - the instance is in a state that does not allow access to this method.

getRollbackOnly

public boolean getRollbackOnly()
                        throws IllegalStateException
Tests if the transaction has been marked for rollback only.

Specified by:
getRollbackOnly in interface EJBContext
Overrides:
getRollbackOnly in class JContext
Returns:
true if transaction will rollback
Throws:
IllegalStateException - if state is 0

initSessionContext

public void initSessionContext(JSessionSwitch bs)
Reinit Context for reuse

Parameters:
bs - The SessionSwitch to reuse.

getInstance

public SessionBean getInstance()
                        throws RemoteException
Returns the bean instance of this context Used in the generated classes to retrieve the instance

Returns:
the bean instance
Throws:
RemoteException - if no instance

isMarkedRemoved

public boolean isMarkedRemoved()
Returns:
True if bean instance is marked removed.

getBusinessObject

public <T> T getBusinessObject(Class<T> businessInterface)
                    throws IllegalStateException
Obtain an object that can be used to invoke the current bean through the given business interface.

Specified by:
getBusinessObject in interface SessionContext
Type Parameters:
T - the interface of the bean
Parameters:
businessInterface - One of the local business interfaces or remote business interfaces for this session bean.
Returns:
The business object corresponding to the given business interface.
Throws:
IllegalStateException - - Thrown if this method is invoked with an invalid business interface for the current bean.

getInvokedBusinessInterface

public Class getInvokedBusinessInterface()
                                  throws IllegalStateException
Obtain the business interface through which the current business method invocation was made.

Specified by:
getInvokedBusinessInterface in interface SessionContext
Returns:
the business interface through which the current business method invocation was made.
Throws:
IllegalStateException - - Thrown if this method is called and the bean has not been invoked through a business interface.

setRemoved

public abstract void setRemoved()
                         throws RemoteException,
                                RemoveException
Throws:
RemoteException
RemoveException

setConnectionList

public abstract void setConnectionList(List conlist)


Copyright © 2010 OW2 Consortium. All Rights Reserved.