javax.ejb
Interface EJBContext

All Known Subinterfaces:
EntityContext, MessageDrivenContext, SessionContext

public interface EJBContext

Allows to gets some info on the bean.

Author:
Florent Benoit
See Also:
EJB 3.1 specification

Method Summary
 Identity getCallerIdentity()
          Deprecated.  
 Principal getCallerPrincipal()
           
 Map<String,Object> getContextData()
          Enables a business method, lifecycle callback method, or timeout method to retrieve any interceptor/webservices context associated with its invocation.
 EJBHome getEJBHome()
           
 EJBLocalHome getEJBLocalHome()
           
 Properties getEnvironment()
          Deprecated.  
 boolean getRollbackOnly()
          Check if current transaction is marked as rollback only.
 TimerService getTimerService()
          Gets the timer service.
 UserTransaction getUserTransaction()
          Gets the current transaction.
 boolean isCallerInRole(Identity role)
          Deprecated.  
 boolean isCallerInRole(String roleName)
          Check if the given role is in the roles of the current caller's principal.
 Object lookup(String name)
          Search the given name in java:comp/env ENC environment.
 void setRollbackOnly()
          Sets the current transaction in rollback only mode.
 

Method Detail

getEJBHome

EJBHome getEJBHome()
                   throws IllegalStateException
Returns:
the Home(remote) interface of the bean. throws IllegalStateException if home is not retrieved
Throws:
IllegalStateException

getEJBLocalHome

EJBLocalHome getEJBLocalHome()
                             throws IllegalStateException
Returns:
the local home interface of the bean. throws IllegalStateException if local home is not retrieved
Throws:
IllegalStateException

getEnvironment

Properties getEnvironment()
Deprecated. 

Returns:
deprecated

getCallerIdentity

Identity getCallerIdentity()
Deprecated. 

Returns:
deprecated

getCallerPrincipal

Principal getCallerPrincipal()
                             throws IllegalStateException
Returns:
the caller principal object.
Throws:
IllegalStateException - if not authorized

isCallerInRole

boolean isCallerInRole(Identity role)
Deprecated. 

Parameters:
role - deprecated
Returns:
deprecated

isCallerInRole

boolean isCallerInRole(String roleName)
                       throws IllegalStateException
Check if the given role is in the roles of the current caller's principal.

Parameters:
roleName - the role to check.
Returns:
true if it is included, else false.
Throws:
IllegalStateException - if not authorized

getUserTransaction

UserTransaction getUserTransaction()
                                   throws IllegalStateException
Gets the current transaction.

Returns:
the transaction object
Throws:
IllegalStateException - in case of Container Managed Transaction.

setRollbackOnly

void setRollbackOnly()
                     throws IllegalStateException
Sets the current transaction in rollback only mode.

Throws:
IllegalStateException - in CMT case

getRollbackOnly

boolean getRollbackOnly()
                        throws IllegalStateException
Check if current transaction is marked as rollback only.

Returns:
true if current tx is in rollback mode.
Throws:
IllegalStateException - if used with CMT.

getTimerService

TimerService getTimerService()
                             throws IllegalStateException
Gets the timer service.

Returns:
an instance of the timer service.
Throws:
IllegalStateException - if used within a SFSB.

lookup

Object lookup(String name)
              throws IllegalArgumentException
Search the given name in java:comp/env ENC environment.

Parameters:
name - the name to search
Returns:
null if not found, else an instance of the object found.
Throws:
IllegalArgumentException - if the entry is not matching
Since:
EJB 3.0 version.

getContextData

Map<String,Object> getContextData()
Enables a business method, lifecycle callback method, or timeout method to retrieve any interceptor/webservices context associated with its invocation.

Returns:
the shared context
Since:
EJB 3.1 version.


Copyright © 2007-2012 OW2 Consortium. All Rights Reserved.