javax.ejb
Interface EJBContext

All Known Subinterfaces:
EntityContext, MessageDrivenContext, SessionContext
All Known Implementing Classes:
FakedSessionContext

public interface EJBContext

Allows to gets some info on the bean.

Author:
Florent Benoit
See Also:
EJB 3.0 specification

Method Summary
 java.security.Identity getCallerIdentity()
          Deprecated. 
 java.security.Principal getCallerPrincipal()
           
 EJBHome getEJBHome()
           
 EJBLocalHome getEJBLocalHome()
           
 java.util.Properties getEnvironment()
          Deprecated. 
 boolean getRollbackOnly()
          Check if current transaction is marked as rollback only.
 TimerService getTimerService()
          Gets the timer service.
 javax.transaction.UserTransaction getUserTransaction()
          Gets the current transaction.
 boolean isCallerInRole(java.security.Identity role)
          Deprecated. 
 boolean isCallerInRole(java.lang.String roleName)
          Check if the given role is in the roles of the current caller's principal.
 java.lang.Object lookup(java.lang.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()
Returns:
the Home(remote) interface of the bean. throws IllegalStateException if home is not retrieved

getEJBLocalHome

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

getEnvironment

@Deprecated
java.util.Properties getEnvironment()
Deprecated. 

Returns:
deprecated

getCallerIdentity

@Deprecated
java.security.Identity getCallerIdentity()
Deprecated. 

Returns:
deprecated

getCallerPrincipal

java.security.Principal getCallerPrincipal()
Returns:
the caller principal object.

isCallerInRole

@Deprecated
boolean isCallerInRole(java.security.Identity role)
Deprecated. 

Parameters:
role - deprecated
Returns:
deprecated

isCallerInRole

boolean isCallerInRole(java.lang.String roleName)
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.

getUserTransaction

javax.transaction.UserTransaction getUserTransaction()
                                                     throws java.lang.IllegalStateException
Gets the current transaction.

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

setRollbackOnly

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

Throws:
java.lang.IllegalStateException - in CMT case

getRollbackOnly

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

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

getTimerService

TimerService getTimerService()
                             throws java.lang.IllegalStateException
Gets the timer service.

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

lookup

java.lang.Object lookup(java.lang.String name)
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.
Since:
EJB 3.0 version.


Copyright © 2008. All Rights Reserved.