使用无状态会话EJB组件
有状态会话ejb组件的实现同样可以非常简单。
The stateful session EJB component implementation can likewise be very simple.
图19显示了一个实现本地和远程接口会话EJB组件的典型设计。
Figure 19 shows a typical design of a session EJB component implementing both local and remote interfaces.
如果不存在活动会话,则组件会在现有的工作范围单元或本地事务的上下文中执行。
If an activity session is not present, the component will execute in the context of the existing unit of work scope or a local transaction.
总而言之,有状态会话ejb组件为管理应用程序状态提供了一种重量级机制。
All in all, stateful session EJB components provide a heavyweight mechanism for managing application state.
MessageConsumer:会话创建的组件,用于从目的地接收消息。
MessageConsumer: a component that a session creates and that's used for receiving messages from a destination.
MessageProducer:会话创建的组件,用于将消息发送到目的地。
MessageProducer: a component that a session creates and that's used for sending messages to a destination.
图5显示了一个基于servlet的实现bean的生命周期,图6显示了一个会话ejb组件的生命周期。
Figure 5 shows the lifecycle of a servlet-based implementation bean and Figure 6 shows the lifecycle of a session EJB component.
首先,打开一个Sametime会话,加载所需的组件。
First, a Sametime session is opened, and the required components are loaded.
本文讨论的方案并未包含所有情形,但是它们代表了有状态通信环境中的servlet和会话EJB组件的一些最常见用法。
The scenarios discussed here don't cover every situation, but they are representative of some of the most common uses for servlets and session EJB components in a stateful communication context.
有了EJB2之后,“Home”实体可用于相同的目的——当存在一个代表用户角色的实体时,便不再需要额外的会话Bean组件。
After EJB 2, the entity "home" could be used to serve the same purpose — eliminating the need for the extra session bean component in cases where there is an entity that represents the user role.
True:组件将在活动会话的上下文中执行。
True: Component will execute in the context of an activity session.
在CustomerSession中定义的方法,将调用无状态会话ejb组件的方法(这个bean起到一个外观(facade)的作用),例如OrderService,从而调用EIS上的事务。
Methods defined in CustomerSession make calls to methods on stateless session EJB components (with the bean serving as a facade) such as OrderService, to invoke transactions on an EIS.
通过使用 WSAD中支持的Web服务向导,我们能够很容易地生成所需的构件来将我们的计算器服务无状态的会话EJB组件作为 Web 服务公开。
We were able to easily generate the necessary artifacts to expose our calculator service stateless session EJB component as a Web service using the Web Services wizard support in WSAD.
STSession对象保存与Sametime会话相关联的组件集。
The STSession object holds the set of components associated with the Sametime session.
Seam 中的名为manager的组件是会话beanManagerAction,正如该类中@Name注解指定的。
The manager component in Seam is the ManagerAction session bean, as specified by the @Name annotation on the class.
在该示例Web应用程序中,客户机(web层中的jsp页面)保存了一个对CustomerSession状态会话ejb组件的一个实例的引用,并调用该实例上的方法。
In this example Web application, the client (a JSP page in the Web tier) holds a reference to, and calls methods on, an instance of the CustomerSession stateful session EJB component.
下面所示的这些代码将会调用 EJB组件并将数据存储在会话范围之内。
The code that will invoke the EJB component and store the data in the session scope is shown below.
这带来了如何向语音通道组件发起SIP(会话发起协议,SessionInitiation Protocol)调用的问题。
This leads to the question of how to initiate the SIP (Session Initiation Protocol) call to the voice modality component.
首先,您将选择通用的组件类型(如servlet和会话bean)。
First you will select the general component types (such as servlets and session beans).
创建了STSession对象后,载入机器人所使用的组件并启动Sametime会话。
After creating the STSession object, you load the components the bot USES and start the Sametime session.
True 会在通过服务引用调用组件之前挂起当前活动会话(如果存在)。
True suspends the current activity session (if present) before invoking a component via a service reference.
还可能需要将游戏与其他组件集成;例如,在游戏会话之间,要保持每个人的游戏状态。
It is likely that you will need to integrate the game with other components; for example, to keep each person's game state intact between game sessions.
portlet使用一个会话bean来维护和传递 portlet 和组件状态。
The portlet uses a session bean to maintain and pass around the portlet and component state.
FacesContext对象包含了JSF用来管理当前会话中当前请求的GUI组件状态所需要的所有状态信息。
The FacesContext object contains all the state information JSF needs to manage the GUI component's state for the current request in the current session.
OpenSessionInView拦截器和过滤器允许每个线程跨不同组件使用同一会话。
OpenSessionInView interceptor and filter which allow the usage of the same session per thread across different components.
EJB 3.0简化API:定义用于编码 EJB组件(特别是会话Bean和消息驱动的 Bean)的新简化的 API。
EJB 3.0 Simplified API: Defines the new simplified API used to code EJB components; specifically, session beans and message-driven beans.
似乎除了有状态会话Bean之外,您已经为所有的EJB组件类型找到了合适的用途。
It seems like you have found a good use for every EJB component type — other than stateful session beans.
现代Web框架还有会话、请求等不同作用域范围的组件,框架会在进入作用域的时候相应地处理依赖注入。
Modern web frameworks have session and request scoped components and handle the dependency injection for them as those scopes come into life.
让我们举一个例子:WebBeans促进了上下文相关组件(比如事件、页面、请求、会话、业务流程)的思想。
Lets take an example: Web Beans promotes the idea of contextual components (event, page, request, conversation, business process for example).
应用推荐