您现在的位置: 中国教师站 >> 教师关注 >> 电脑技术 >> 编程技术 >> Java >> 正文

Google
Understanding JBoss
作者:Siny 文章来源:中国教师站cn-teacher 点击数: 更新时间:2007-4-22 15:09:33

Understanding JBoss

Forest Hou
 之所以用英文写这篇文章,是想看看自己能否用另一种文字表达清楚这东东。丝毫没有别的意思。  This article analyzes some critical techniques of JBoss: interceptor, dynamic proxy in rmi, and automatic object persistence. It is based on JBoss 2.2.1 source code. Through this article you can not only understand how JBoss implements the EJB model, but also realize these techniques could be used in other projects. The UML pictures only show the critical classes that would help you to understand the code. The code is abstracted from JBoss software to describe these concepts.

1. Basic EJB Interfaces

 

1.1  Does EJB specification only define interfaces? We can understand major parts of EJB by above class diagram. It shows the relationship of interfaces.

1.2  Using HelloWorld as an example, the EJB developer needs implement at least following classes:
    public interface Hello extends EJBObject;
    public interface HelloHome extends EJBHome;
    public class HelloBean implements SessionBean (or EntityBean);

1.3   “Hello” and “HelloHome” are remote interfaces. It is the EJB container (or application server)’s responsibility to implement the remote object and stub objects. The remote object delegates remote call for the enterprise bean (here is HelloBean). Hence the container separates the enterprise bean from remote world, and adds diverse services for the enterprise bean.

1.4  The container should also implements EJBContext and EJBMetaData interfaces for a specified enterprise bean.
 

2. Jboss Infrastructure

 

2.1  Application is the deployment unit. It is represented as a jar file physically, such as hello.jar.

2.2  An application contains several enterprise beans and it creates a Container instance for each enterprise bean. You can regard the container as the implementation of the EJBObject and EJBHome interfaces.

2.3  The configuration information of Enterprise beans is described in the ejb-jar.xml file. Their containers are configured in the standardjboss.xml and jboss.xml files. The ejb-jar.xml and jboss.xml files are included in the application jar file as the metadata . The standardjboss.xml defines the stand bean containers (CMP EntityBean, BMP EntityBean, Stateless SessionBean, Stateful SessionBean, Message Driven Bean).
Because the ejb-jar.xml file defines the bean type, JBoss can select the container type for an enterprise bean, then create the container instance for it.

2.4  The “deployments” field of the ContainerFactory class stores current deployed applications. ContainerFactory is a singleton object; it is used to create different containers for an application. The application server can run many applications simultaneously.

2.5  ContainerInvoker is the linkage of the remote world and the Container, and Container is the delegation of your enterprise beans.

2.6  The container is responsible to automatically persist its enterprise bean. This is the most attractive feature of EJB. The StatefulSessionPersistenceManager and EntityPersistenceManager interfaces are called by the container when it decides to persist an enterprise bean instance. Because the Stateless bean

[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

相关专题:
 
 网友评论:(评论内容只代表网友观点,与本站立场无关!)
GOOGLE广告

阅读排行

| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 |
中国教师站

中国教师站 版权所有 Copyright © 2006-2020 All Rights Reserved 站长:Sina & Siny
[备用域名:www.JXZYW.Com] 有事请留言有事请留言
【实力成就精品 诚信呵护品牌】

信息产业部备案
苏ICP备06018635号