org.objectweb.jonas_ejb.container
Class JContext

java.lang.Object
  |
  +--org.objectweb.jonas_ejb.container.JContext
All Implemented Interfaces:
javax.ejb.EJBContext
Direct Known Subclasses:
JEntityContext, JSessionContext

public class JContext
extends java.lang.Object
implements javax.ejb.EJBContext

This class implements javax.ejb.EJBContext class. It may be extended in JSessionContext or JEntityContext

Author:
Philippe Coq

Field Summary
protected  JFactory bf
           
protected  JContainer cont
           
protected  JHome home
           
protected  javax.ejb.EnterpriseBean instance
           
protected  JLocalHome localhome
           
protected  java.security.Guard roleGuard
           
protected  javax.transaction.TransactionManager tm
           
 
Constructor Summary
JContext(JFactory bf, javax.ejb.EnterpriseBean i)
          Constructs a JContext
 
Method Summary
 java.security.Identity getCallerIdentity()
          Deprecated.  
 java.security.Principal getCallerPrincipal()
          Obtain the java.security.Principal that identifies the caller. throws a java.lang.IllegalStateException if there is no security context available
 javax.ejb.EJBHome getEJBHome()
          the enterprise bean's home interface.
 javax.ejb.EJBLocalHome getEJBLocalHome()
          Obtain the enterprise bean's local home interface.
 java.util.Properties getEnvironment()
          Deprecated.  
 boolean getRollbackOnly()
          Tests if the transaction has been marked for rollback only.
 javax.transaction.UserTransaction getUserTransaction()
          Obtains the transaction demarcation interface.
 boolean isCallerInRole(java.security.Identity role)
          Deprecated. Use boolean isCallerInRole(String roleName) instead. Tests if the caller has a given role.
 boolean isCallerInRole(java.lang.String roleLink)
          Test if the caller has a given role.
 void setRollbackOnly()
          Marks the current transaction for rollback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected javax.ejb.EnterpriseBean instance

bf

protected JFactory bf

home

protected JHome home

localhome

protected JLocalHome localhome

cont

protected JContainer cont

roleGuard

protected java.security.Guard roleGuard

tm

protected javax.transaction.TransactionManager tm
Constructor Detail

JContext

public JContext(JFactory bf,
                javax.ejb.EnterpriseBean i)
Constructs a JContext
Parameters:
bf - - the BeanFactory
i - - the bean instance
Method Detail

getCallerIdentity

public java.security.Identity getCallerIdentity()
Deprecated.  

Obtains the java.security.Identity of the caller.
Specified by:
getCallerIdentity in interface javax.ejb.EJBContext
Returns:
The Identity object that identifies the caller.

getCallerPrincipal

public java.security.Principal getCallerPrincipal()
                                           throws java.lang.IllegalStateException
Obtain the java.security.Principal that identifies the caller. throws a java.lang.IllegalStateException if there is no security context available
Specified by:
getCallerPrincipal in interface javax.ejb.EJBContext
Returns:
The Principal object that identifies the caller.

getEJBHome

public javax.ejb.EJBHome getEJBHome()
                             throws java.lang.IllegalStateException
the enterprise bean's home interface.
Specified by:
getEJBHome in interface javax.ejb.EJBContext
Returns:
The enterprise bean's home interface.
Throws:
java.lang.IllegalStateException - - if the enterprise bean does not have a local home interface.

getEJBLocalHome

public javax.ejb.EJBLocalHome getEJBLocalHome()
                                       throws java.lang.IllegalStateException
Obtain the enterprise bean's local home interface.
Specified by:
getEJBLocalHome in interface javax.ejb.EJBContext
Returns:
The enterprise bean's local home interface.
Throws:
java.lang.IllegalStateException - if the enterprise bean does not have a local home interface.

getEnvironment

public java.util.Properties getEnvironment()
Deprecated.  

Obtains the enterprise bean's environment properties for EJB 1.0 style. (Conform to EJB 1.1 specification for a container chooses to provide support for EJB 1.0 style environment properties. Cf EJB 1.1 Chapter 14.5, pages 216-217) Note: If the enterprise bean has no environment properties, this method returns an empty java.util.Properties object. This method never returns null.
Specified by:
getEnvironment in interface javax.ejb.EJBContext
Returns:
The environment properties for the enterprise bean.

getRollbackOnly

public boolean getRollbackOnly()
Tests if the transaction has been marked for rollback only.
Specified by:
getRollbackOnly in interface javax.ejb.EJBContext
Returns:
true if transaction will rollback

getUserTransaction

public javax.transaction.UserTransaction getUserTransaction()
                                                     throws java.lang.IllegalStateException
Obtains the transaction demarcation interface.
Specified by:
getUserTransaction in interface javax.ejb.EJBContext
Returns:
The UserTransaction interface that the enterprise bean instance can use for transaction demarcation.
Throws:
IllegalStateException: - Thrown if the instance container does not make the UserTransaction interface available to the instance. (not bean managed)

isCallerInRole

public boolean isCallerInRole(java.security.Identity role)
Deprecated. Use boolean isCallerInRole(String roleName) instead. Tests if the caller has a given role.

Specified by:
isCallerInRole in interface javax.ejb.EJBContext
Parameters:
role - - The java.security.Identity of the role to be tested.
Returns:
True if the caller has the specified role.

isCallerInRole

public boolean isCallerInRole(java.lang.String roleLink)
                       throws java.lang.IllegalStateException
Test if the caller has a given role.
Specified by:
isCallerInRole in interface javax.ejb.EJBContext
Parameters:
roleLink - The name of the security role. The role must be one of the security-role-ref that is defined in the deployment descriptor.
Returns:
True if the caller has the specified role.

setRollbackOnly

public void setRollbackOnly()
Marks the current transaction for rollback. The transaction will become permanently marked for rollback.
Specified by:
setRollbackOnly in interface javax.ejb.EJBContext