中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > Java > J2EE
J2EE FAQ @ JDJ
作者:未知 时间:2005-08-10 20:34 出处:Java频道 责编:chinaitpower
              摘要:J2EE FAQ @ JDJ

Q.  What is EJB 2.0?

A. EJB 2.0 is the latest release of the Enterprise JavaBean specification.  The major releases of the EJB specification have been 1.0, 1,1, and 2.0.  EJB 2.0 adds several crucial features to version 1.1, including message-driven beans, local interfaces, an enhanced xontainer-managed persistence, and EJB-QL (Query Language).


Q. What are the Main Interfaces in EJB 2.0?

A. The figure below illustrates the class hierarchy for EJB 2.0 and the interfaces that are included. The main interfaces for EJBs are packaged under javax.ejb; they’re standard extensions to the core Java classes.

The javax.ejb package defines the interfaces you need to extend your application’s components. By definition, Enterprise JavaBean is a specification for distributed architecture. In Java terms, this means that a Java class running in one JVM should be able to communicate with an EJB component in another via an RMI call. First, let’s look at the EJBObject and EJBHome interfaces, which are shown in the middle pane of the figure. These interfaces extend the java.rmi.Remote interface. The Remote interface serves to identify interfaces whose methods may be invoked from a nonlocal virtual machine. Any object that’s a remote object must implement this interface.

As you probably know, EJBs can only run inside a J2EE EJB container. The container abstracts many of the low-level services from the application developer (you). One set of services that it abstracts is the life-cycle management of the EJBs. The EJBHome interface is used to create this abstraction and can be accessed remotely to create or find the actual EJB component. The methods are invoked by the remote client, but are executed by the container.

The EJBObject interface is used to define the business methods for your EJB component. The interface defines methods to access the actual EJB class and to remove it when it’s no longer needed. The EJBObject is a delegator interface that delegates the actual execution of the business objects to the enterprise bean.

The latest release of the EJB specification adds classes and interfaces to support the concept of colocated EJBs (local interfaces). As you can see in the left pane of the figure, the local interfaces (EJBLocalObject and EJBLocalHome) don’t extend the java.rmi.Remote interface. You can’t use them to access distributed objects. The local interfaces were added to the EJB specification in 2.0 so that component accesses to EJB components within the same JVM don’t have to be done through RMI, which is very expensive since each call requires a distributed call.

The enterprise bean interfaces are illustrated on the left side of the figure. These interfaces were added to the EJB specification in 2.0. Local interfaces support the concept of colocated EJBs (local interfaces). The local interfaces (EJBLocalObject and EJBLocalHome) don’t extend the java.rmi.Remote interface so you can’t use them to access distributed objects. Other than that, the EJBLocalObject is the equivalent of the EJBObject, and the EJBLocalHome is the equivalent of EJBHome. Note that the same EJB component can implement both interfaces simultaneously, thus allowing remote access through RMI and local access through a local method call.

The right pane of the figure shows the interfaces used to create the actual implementation class. The EnterpriseBean interface is a serializable interface for creating the EJB component. The three types of EJBs supported in 2.0 are EntityBean, SessionBean, and MessageDrivenBean. Each of these extends the EntityBean interface.

As an application developer, for each enterprise JavaBean in your application, you need to extend the appropriate home and remote interfaces (local/remote) and provide an implementation for the appropriate enterprise bean (entity/session/messagedrivenbean).

Details on developing the interfaces and classes for your application’s EJBs will be covered in subsequent FAQs.

 

 

 

 

 


J2EE ROADMAP
The Java 2 Platform, Enterprise Edition defines the APIs for building enterprise-level applications.

J2SE                            v. 1.2

Enterprise JavaBeans API        v. 1.1

Java Servlets                   v. 2.2

JavaServer Pages Technology     v. 1.1

JDBC Standard Extension         v. 2.0

Java Naming and Directory       v. 1.2
Interface API

RMI/IIOP                        v. 1.0

Java Transaction API            v. 1.0

JavaMail API                    v. 1.1

Java Messaging Service          v. 1.0


Useful URLs:
Java 2 Platform, Enterprise Edition
www.java.sun.com/j2ee/

J2EE Blueprints
www.java.sun.com/j2ee/blueprints

J2EE Technology Center
http://developer.java.sun.com/developer/products/j2ee/

J2EE Tutorial
http://java.sun.com/j2ee/tutorial/

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有