javax.ejb.EJBContext翻译

<!-- ========= START OF TOP NAVBAR ======= --> <!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->

javax.ejb
Interface EJBContext

All Known Subinterfaces:
EntityContext, MessageDrivenContext, SessionContext

public interface EJBContext

The EJBContext interface provides an instance with access to the container-provided runtime context of an enterprise Bean instance. EJBContext接口提供实例来访问企业Bean实例的容器提供的运行时上下文。

This interface is extended by the SessionContext, EntityContext, and MessageDrivenContext interfaces to provide additional methods specific to the enterprise interface Bean type. 该接口由SessionContext、EntityContext和MessageDrivenContext接口继承, 以提供企业接口Bean类型特有的方法。


<!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><!-- -->

Method Summary
Identity getCallerIdentity()
Deprecated.Use Principal getCallerPrincipal() instead. 用Principal getCallerPrincipal()替代。
Principal getCallerPrincipal()
Obtain the java.security.Principal that identifies the caller. 获得标识调用者的java.security.Principal。
EJBHome getEJBHome()
Obtain the enterprise bean's remote home interface. 获得企业bean的远程home接口。
EJBLocalHome getEJBLocalHome()
Obtain the enterprise bean's local home interface. 获得企业bean的本地home接口。
Properties getEnvironment()
Deprecated.Use the JNDI naming context java:comp/env to access enterprise bean's environment. 使用JNDI命名上下文java:comp/env访问企业bean环境。
boolean getRollbackOnly()
Test if the transaction has been marked for rollback only. 测试事务是否只被标记为回滚。
TimerService getTimerService()
Get access to the EJB Timer Service. 获得对EJB Timer服务的访问。
UserTransaction getUserTransaction()
Obtain the transaction demarcation interface. 获得事务边界接口。
boolean isCallerInRole(Identityrole)
Deprecated.Use boolean isCallerInRole(String roleName) instead. 用boolean isCallerInRole(String roleName)替代。
boolean isCallerInRole(StringroleName)
Test if the caller has a given security role. 测试调用者是否有指定的安全角色。
void setRollbackOnly()
Mark the current transaction for rollback. 将当前事务标记为回滚。

<!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><!-- -->

Method Detail
<!-- -->

getEJBHome

public EJBHome getEJBHome()
Obtain the enterprise bean's remote home interface. 获得企业bean的远程home接口。

Returns:
The enterprise bean's remote home interface. 企业bean的远程home接口。
Throws:
IllegalStateException - if the enterprise bean does not have a remote home interface. 如果企业bean没有远程home接口时抛出。

<!-- -->

getEJBLocalHome

public EJBLocalHome getEJBLocalHome()
Obtain the enterprise bean's local home interface. 获得企业bean的本地home接口。

Returns:
The enterprise bean's local home interface. 企业bean的本地home接口。
Throws:
IllegalStateException - if the enterprise bean does not have a local home interface. 如果企业bean没有本地home接口时抛出。

<!-- -->

getEnvironment

public Properties getEnvironment()
Deprecated. Use the JNDI naming context java:comp/env to access enterprise bean's environment. 使用JNDI命名上下文java:comp/env访问企业bean环境。

Obtain the enterprise bean's environment properties. 获得企业bean的环境属性。

Note: If the enterprise bean has no environment properties this method returns an empty java.util.Properties object. This method never returns null. 注意:如果企业bean没有环境属性,那么方法返回java.util.Properties对象,该方法不会返回null。

Returns:
The environment properties for the enterprise bean. 企业bean的环境属性。

<!-- -->

getCallerIdentity

public Identity getCallerIdentity()
Deprecated. Use Principal getCallerPrincipal() instead. 用Principal getCallerPrincipal()替代。

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. 获得调用者的java.security.Identity。该方法在EJB 1.1中已不再支持。 容器允许始终返回null。企业bean应当使用getCallerPrincipal方法替代。

Returns:
The Identity object that identifies the caller. 标识调用者的Identity对象。

<!-- -->

getCallerPrincipal

public Principal getCallerPrincipal()
Obtain the java.security.Principal that identifies the caller. 获得标识调用者的java.security.Principal。

Returns:
The Principal object that identifies the caller. This method never returns null. 标识调用者的java.security.Principal。方法从不返回null。
Throws:
IllegalStateException - The Container throws the exception if the instance is not allowed to call this method. 如果实例不允许调用该方法时,容器抛出该异常。

<!-- -->

isCallerInRole

public boolean isCallerInRole(Identityrole)
Deprecated. Use boolean isCallerInRole(String roleName) instead. 用boolean isCallerInRole(String roleName)替代。

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. 该方法在EJB 1.1中已不再支持。企业bean应当使用isCallerInRole(String roleName)方法替代。

Parameters:
role - The java.security.Identity of the role to be tested. 用来测试的角色的java.security.Identity。
Returns:
True if the caller has the specified role. 如果调用者有指定角色,返回true。

<!-- -->

isCallerInRole

public boolean isCallerInRole(StringroleName)
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. 如果调用者有指定角色,返回true。
Throws:
IllegalStateException - The Container throws the exception if the instance is not allowed to call this method. 如果实例不允许调用该方法时,容器抛出该异常。

<!-- -->

getUserTransaction

public UserTransaction getUserTransaction()
                                   throws 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 or message-driven beans with bean-managed transactions are allowed to invoke this method. 获得事务边界接口。只有bean管理事务的企业bean才可以使用UserTransaction接口。 因为实体bean必须使用容器管理事务,所以只有使用bean管理事务的会话bean和消息 驱动bean才能调用该方法。

Returns:
The UserTransaction interface that the enterprise bean instance can use for transaction demarcation. 企业bean实例用于事务边界的UserTransaction接口。
Throws:
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). 如果实例不允许使用UserTransaction接口(即使用容器管理事务的bean实例),容器抛出该异常。

<!-- -->

setRollbackOnly

public void setRollbackOnly()
                     throws 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. 将当前事务标记为回滚。事务将永久地标记为回滚。标记为回滚的事务不能提交。只有使用容器管理事务的企业bean才能使用该方法。

Throws:
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). 如果实例不允许使用该方法(即使用bean管理事务的bean实例),容器抛出该异常。

<!-- -->

getRollbackOnly

public boolean getRollbackOnly()
                        throws 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. 测试事务是否只被标记为回滚。企业bean实例可以使用该操作,比如在捕获异常 后,测试对于当前的事务继续计算是否无效。

Returns:
True if the current transaction is marked for rollback, false otherwise. 如果当前事务被标记为回滚,返回true,否则为false。
Throws:
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). 如果实例不允许使用该方法(即使用bean管理事务的bean实例),容器抛出该异常。

<!-- -->

getTimerService

public TimerService getTimerService()
                             throws IllegalStateException
Get access to the EJB Timer Service. 获得对EJB Timer服务的访问。

Throws:
IllegalStateException - The Container throws the exception if the instance is not allowed to use this method (e.g. if the bean is a stateful session bean) 如果实例不允许使用该方法(比如bean是一个有状态会话bean),容器抛出该异常。
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== --> <!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ======== END OF BOTTOM NAVBAR ======= -->
Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.

你可能感兴趣的:(bean,ejb,Security,Access,sun)