Movatterモバイル変換


[0]ホーム

URL:


         


Interface EJBContext

All Known Subinterfaces:
EntityContext,MessageDrivenContext,SessionContext

public interfaceEJBContext

The EJBContext interface provides an instance with access to the container-provided runtime context of an enterprise Bean instance.

This interface is extended by the SessionContext and EntityContext interface to provide additional methods specific to the enterprise Bean type.


getCallerIdentity()
          Deprecated. Use Principal getCallerPrincipal() instead.
getCallerPrincipal()
          Obtain the java.security.Principal that identifies the caller.
getEJBHome()
          Obtain the enterprise bean's remote home interface.
getEJBLocalHome()
          Obtain the enterprise bean's local home interface.
getEnvironment()
          Deprecated. Use the JNDI naming context java:comp/env to access enterprise bean's environment.
getRollbackOnly()
          Test if the transaction has been marked for rollback only.
getUserTransaction()
          Obtain the transaction demarcation interface.
isCallerInRole(java.security.Identity role)
          Deprecated. Use boolean isCallerInRole(String roleName) instead.
isCallerInRole(java.lang.String roleName)
          Test if the caller has a given security role.
setRollbackOnly()
          Mark the current transaction for rollback.
 

getEJBHome

publicEJBHomegetEJBHome()
Obtain the enterprise bean's remote home interface.
Returns:
The enterprise bean's remote home interface.
Throws:
java.lang.IllegalStateException - if the enterprise bean does not have a remote home interface.

getEJBLocalHome

publicEJBLocalHomegetEJBLocalHome()
Obtain the enterprise bean's local home interface.
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.PropertiesgetEnvironment()
Deprecated. Use the JNDI naming context java:comp/env to access enterprise bean's environment.

Obtain the enterprise bean's environment properties.

Note: If the enterprise bean has no environment properties this method returns an empty java.util.Properties object. This method never returns null.

Returns:
The environment properties for the enterprise bean.

getCallerIdentity

public java.security.IdentitygetCallerIdentity()
Deprecated. Use Principal getCallerPrincipal() instead.

Obtain the java.security.Identity of the caller. This method is deprecated in EJB 1.1. The Container is allowed to return alway null from this method. The enterprise bean should use the getCallerPrincipal method instead.
Returns:
The Identity object that identifies the caller.

getCallerPrincipal

public java.security.PrincipalgetCallerPrincipal()
Obtain the java.security.Principal that identifies the caller.
Returns:
The Principal object that identifies the caller. This method never returns null.

isCallerInRole

public booleanisCallerInRole(java.security.Identity role)
Deprecated. Use boolean isCallerInRole(String roleName) instead.

Test if the caller has a given role.

This method is deprecated in EJB 1.1. The enterprise bean should use the isCallerInRole(String roleName) method instead.

Parameters:
role - The java.security.Identity of the role to be tested.
Returns:
True if the caller has the specified role.

isCallerInRole

public booleanisCallerInRole(java.lang.String roleName)
Test if the caller has a given security role.
Parameters:
roleName - The name of the security role. The role must be one of the security roles that is defined in the deployment descriptor.
Returns:
True if the caller has the specified role.

getUserTransaction

publicUserTransactiongetUserTransaction()                                   throws java.lang.IllegalStateException
Obtain the transaction demarcation interface. Only enterprise beans with bean-managed transactions are allowed to to use the UserTransaction interface. As entity beans must always use container-managed transactions, only session beans with bean-managed transactions are allowed to invoke this method.
Returns:
The UserTransaction interface that the enterprise bean instance can use for transaction demarcation.
Throws:
java.lang.IllegalStateException - The Container throws the exception if the instance is not allowed to use the UserTransaction interface (i.e. the instance is of a bean with container-managed transactions).

setRollbackOnly

public voidsetRollbackOnly()                     throws java.lang.IllegalStateException
Mark the current transaction for rollback. The transaction will become permanently marked for rollback. A transaction marked for rollback can never commit. Only enterprise beans with container-managed transactions are allowed to use this method.
Throws:
java.lang.IllegalStateException - The Container throws the exception if the instance is not allowed to use this method (i.e. the instance is of a bean with bean-managed transactions).

getRollbackOnly

public booleangetRollbackOnly()                        throws java.lang.IllegalStateException
Test if the transaction has been marked for rollback only. An enterprise bean instance can use this operation, for example, to test after an exception has been caught, whether it is fruitless to continue computation on behalf of the current transaction. Only enterprise beans with container-managed transactions are allowed to use this method.
Returns:
True if the current transaction is marked for rollback, false otherwise.
Throws:
java.lang.IllegalStateException - The Container throws the exception if the instance is not allowed to use this method (i.e. the instance is of a bean with bean-managed transactions).

         


[8]ページ先頭

©2009-2025 Movatter.jp