ava originally made its debut in browsers and client machines; at the time, many questioned whether it was suitable for server-side development. Now, with increasing third-party support for the Java 2 Platform, Enterprise Edition (J2EE), Java has become a widely accepted alternative for developing enterprise-strength server-side solutions.
Java最早出现与浏览器和客户端机器中。当时很多人都质疑它是否适合服务器端的开发。现在,随之对J2EE平台的第三方支持的日益增加,j2ee已经成为了开发企业级服务器端解决方案的首选之一。
The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered Web-based applications.
j2ee平台是由一整套服务(Services)、应用程序接口(APIs)以及一些可以为开发基于WEB的多层应用提供功能支持的协议组成。
In this article, we will examine the 13 core technologies that make up J2EE: JDBC, JNDI, EJBs, RMI, JSP, Java servlets, XML, JMS, Java IDL, JTS, JTA, JavaMail, and JAF. We will describe where and when it is appropriate to use each technology; we will also describe how the different technologies interact with each other.
在本文中我们将解释组成j2ee的13种核心技术:, JNDI, EJBs, RMI, JSP, Java servlets, XML, JMS, Java IDL, JTS, JTA, JavaMail, and JAF。同时我们会告诉大家在何时、何处使用这些技术;当然我们还会描述这些不同技术之间是如何进行交互的。
Moreover, to give J2EE a real-world feel, we'll look at its main technologies in the context of WebLogic Server, a widely used J2EE implementation from BEA Systems. With that in mind, this introductory article will be of interest to developers new to WebLogic Server and J2EE, as well as project managers and business analysts with an interest in understanding what J2EE has to offer.
此外,为了能让大家更真实的感受到j2ee的应用,我们将在Weblogic服务器-来自于BEA Systems的一种广泛应用与j2ee实施的产品-环境下讲解这个主要技术。不论对于Weblogic和j2ee的新手来说,还是想要了解j2ee能够带来什么好处的项目经理和商业分析师,本文肯定是很有价值的。
The big picture: Distributed architectures and J2EE
宏观印象:分布式结构和j2ee
In the past, two-tier applications -- also known as client/server applications -- were commonplace(常事,老生常谈). Figure 1 illustrates the typical two-tier architecture. In some cases, the only service provided by the server was that of a database server. In those situations, the client was then responsible for data access, applying business logic, converting the results into a format suitable for display, displaying the intended interface to the user, and accepting user input. The client/server architecture is generally easy to deploy at first, but is difficult to upgrade or enhance, and is usually based on proprietary protocols(专利的,所属的) -- typically proprietary database protocols. It also makes reuse of business and presentation logic difficult, if not impossible. Finally, and perhaps most important in the era of the Web, two-tier applications typically do not prove very scalable(可伸缩的,可扩展的;伸缩性) and are therefore not well suited to the Internet.
过去,二层化应用--也就是众所周知的client/server结构--是大家谈论最多的。图一举出了经典的二层化结构。在很多情况下,服务器能提供的唯一的服务就是数据库服务。在这种情况下,客户端程序主要负责数据访问、实现业务逻辑、用合适的格式显示结果、弹出预设的用户界面,接收用户输入等。C/S结构通常在第一次部署的时候比较容易,但是难于升级或改进,经常是基于某种专有的协议--通常是数据库协议。而且它使得重用业务逻辑和界面逻辑变得很难,更重要的是,,在WEB时代,二层化应用通常不能体现出很好的伸缩性,因而很难适应INTERNET的要求。
Figure 1. Two-tier application architecture |
图一.二层化应用结构
- Presentation: In a typical Web application, a browser running on the client machine handles presentation.
- 显示:在一个典型的WEB应用中,客户端机器上运行的浏览器负责实现用户界面。
- Dynamically generated presentation: Although a browser could handle some dynamically generated presentation, for the widest support of different browsers much of the action should be done on the Web server using JSPs, servlets, or XML (Extensible Markup Language) and XSL (Extensible Stylesheet Language).
- 动态生成显示: 尽管浏览器可以完成某些动态内容显示,但为了兼容不同的浏览器,这些动态生成工作应该放在WEB服务器端进行,使用JSP、SERVLETS,或者XML(可扩展标记语言)和(可扩展样式表语言)。
- Business logic: Business logic is best implemented in Session EJBs (described later).
- 业务逻辑:业务逻辑适合用SESSION EJBS(后面将介绍)来实现。
- Data access: Data access is best implemented in Entity EJBs (described later) and using JDBC.
数据访问:数据访问适合用ENTITY EJBS(后面将介绍)和JDBC来实现。
- Backend system integration: Integration with backend systems may use a variety of technologies. The best choice will depend upon the exact nature of the backend system.
- 后台系统集成: 同后台系统的集成可能需要用到许多不同的技术,至于何种最佳需要根据后台系统的特征而定。
You may begin to wonder: why have so many layers? Well, the layered approach makes for a more scalable enterprise application. It allows each layer to focus on a specific role -- for example, allowing a Web server to serve Webpages, an application server to serve applications, and a database server to serve databases.
您可能开始诧异:为什么有这么多的层?事实上,多层方式可以使企业级应用具有很强的伸缩性,它允许每层专注于特定的角色。例如,让WEB服务器负责提供页面,应用服务器处理应用逻辑,而数据库服务器提供数据库服务。
Because it's built on top of the Java 2 Platform, Standard Edition (J2SE), J2EE provides all the same advantages and features of J2SE. These include "Write Once, Run Anywhere" portability, JDBC for database access, CORBA technology for interaction with existing enterprise resources, and a proven security model. Building on this base, J2EE then adds support for Enterprise JavaBean (EJB) components, Java servlets, JavaServer Pages (JSPs), and XML technology.
由于J2EE建立在JAVA2平台标准版(J2SE)的基础上,所以具备了J2SE的所有优点和功能。包括“编写一次,到处可用”的可移植性、通过JDBC访问数据库、同原有企业资源进行交互的CORBA技术,以及一个经过验证的安全模型。在这些基础上,J2EE又增加了对EJB(企业级JAVA组件)、JAVA SERVLETS、JAVA服务器页面(JSPS)和XML技术的支持。
Distributed architectures with WebLogic Server
分布式结构与Weblogic服务器
J2EE provides a framework -- a standard API -- for developing distributed architectures. The implementation of an engine to implement this framework is left up to third-party vendors. Some vendors will focus on particular components of the overall J2EE architecture. For example, Apache's Tomcat provides support for JSPs and servlets. BEA Systems provides a fuller implementation of the J2EE specification with its WebLogic Server product.
J2EE提供了一个框架--一套标准API--用于开发分布式结构的应用,这个框架的实际实现留给了第三方厂商。部分厂商只是专注于整个J2EE架构中的的特定组件,例如APACHE的TOMCAT提供了对JSP和SERVLETS的支持,BEA系统公司则通过其WEBLOGIC应用服务器产品为整个J2EE规范提供了一个较为完整的实现。
By providing a complete implementation of the J2EE specifications, WebLogic Server makes it easy to build and deploy scalable, distributed applications. WebLogic Server and J2EE handle certain common programming tasks for you. These include the provision of transaction services, security realms, guaranteed messaging, naming and directory services, database access and connection pooling, thread pooling, load balancing, and fault tolerance.
WEBLOGIC服务器已使建立和部署伸缩性较好的分布式应用的过程大为简化。WEBLOGIC和J2EE代你处理了大量常规的编程任务,包括提供事务服务、安全领域、可靠的消息、名字和目录服务、数据库访问和连接池、线程池、负载平衡和容错处理等。
By providing these common services in an easy-to-use and standard way, products like WebLogic Server provide more scalable and maintainable applications. The result is increased availability of those applications to a larger number of users.
通过以一种标准、易用的方式提供这些公共服务,象WEBLOGIC服务器这样的产品造就了具有更好伸缩性和可维护性的应用系统,使其为大量的用户提供了增长的可用性。
The J2EE technologies
In the following sections, we'll describe each of the technologies making up J2EE, and see how WebLogic Server supports them in a distributed application. Perhaps the most commonly used J2EE technologies include JDBC, JNDI, EJB, JSPs, and servlets, upon which we therefore focus our attention.
在接下来的部分里,我们将描述构成J2EE的各种技术,并且了解WEBLOGIC服务器是如何在一个分布式应用中对它们进行支持的。最常用的J2EE技术应该是JDBC、JNDI、EJB、JSP和SERVLETS,对这些我们将作更仔细的考察。
Figure 2 illustrates where each of the J2EE technologies are most commonly used within a distributed application.
图2表示了在一个分布式应用中,J2EE技术的各个方面通常在何处发挥作用。
Figure 2. A sample n-tier application architecture 图2. 一个N层应用结构的例子 |
The JDBC API accesses a variety of databases in a uniform way. Like ODBC. JDBC hides proprietary database issues from the developer. Because it's built on Java, JDBC also is able to provide platform-independent access to databases.
The JDBC-ODBC Bridge proved most useful when JDBC was still in its infancy. With it, developers can use JDBC to access an ODBC data source. As a downside, it requires that an ODBC driver be installed on the client machine which, generally speaking, should be running a version of Microsoft Windows. By using this type of driver, you therefore sacrifice the platform independence of JDBC. Additionally, the ODBC driver requires client-side administration.
The JDBC-native driver bridge provides a JDBC interface built on top of a native database driver -- without using ODBC. The JDBC driver converts standard JDBC calls into native calls to the API of the database. Using a type 2 driver also sacrifices the platform independence of JDBC and requires installation of client-side native code.
JDBC-network bridge drivers remove the need for client-side database drivers. They make use of network-server middleware to access a database. This makes such techniques as load balancing, connection pooling, and data caching possible. Because type 3 drivers often involve a relatively small download time, are platform independent, and require no client-side installation or administration, they are good for Internet applications.
Type 4 provides direct database access using a pure Java database driver. Due to the way type 4 drivers run on the client and directly access a database, running in this mode would imply a two-tier architecture. A better use of type 4 drivers in an n-tier architecture would be to have an EJB contain the data access code, and have that EJB provide a database-independent service to its clients.
Our example assumes that you have a PhoneBook database set up in Cloudscape, and that this database contains a table
CONTACT_TABLE
with fields NAME
and PHONE
. We begin by loading the Cloudscape JDBC driver, and requesting that the driver manager obtain a connection to the PhoneBook Cloudscape database. Using this connection, we construct a Statement
object and use it to execute a simple SQL query. Finally, the loop iterates through all entries in the result set, writing the contents of the NAME
and PHONE
fields to the standard output.
import java.sql.*;
public class JDBCExample
{
public static void main( String args[] )
{
try
{
Class.forName("COM.cloudscape.core.JDBCDriver");
Connection conn = DriverManager.getConnection("jdbc:cloudscape:PhoneBook");
Statement stmt = conn.createStatement();
String sql = "SELECT name, phone FROM CONTACT_TABLE ORDER BY name";
ResultSet resultSet = stmt.executeQuery( sql );
String name;
String phone;
while ( resultSet.next() )
{
name = resultSet.getString(1).trim();
phone = resultSet.getString(2).trim();
System.out.println( name + ", " + phone );
}
}
catch ( Exception e )
{
// Handle exception here
e.printStackTrace();
}
}
}
The previous example is, by necessity, somewhat trivial. It also assumes a two-tier architecture. In an n-tier enterprise application, it is much more likely that the client will communicate with an EJB, which, in turn, will make the database connection. To enable improved scalability and performance, WebLogic Server provides support for connection pools.
weblogic.properties
file. (Refer to the examples in your weblogic.properties
file and the WebLogic Server documentation for more information.)
auto-commit
transaction mode by default. This can be overridden using the setAutoCommit()
method of the Connection
class.
The JNDI API is used to access naming and directory services. As such, it provides a consistent model for accessing and manipulating such enterprise-wide resources as DNS, LDAP(Lightweight Directory Access Protocol), local filesystems, or objects in an application server.
InitialContext
class:
CONTEXT CTX = NEW INITIALCONTEXT();
myApp.myEJB
. A client of this EJB, after obtaining an initial context, could then locate the home interface using:
MyEJBHome home = ctx.lookup( "myApp.myEJB" );
MYEJBHOME HOME = CTX.LOOKUP( "MYAPP.MYEJB" );
- Insert, or bind, an object into a context. This is effectively what you do when you deploy an EJB.
- Remove an object from a context.
- List all objects within a context.
- Create and delete subcontexts.
- 将一个对象插入或绑定到CONTEXT。这在你展开一个EJB的时候是很有效的。
- 从CONTEXT中移去对象。
- 列出CONTEXT中的所有对象。
- 创建或删除子一级的CONTEXT。
Next, let's turn our attention to EJBs.
接下来,我们要开始关注EJB了。
Enterprise Java Beans (EJB)
One of the J2EE technologies to receive a great deal of media attention is EJBs. They provide a framework for developing and deploying distributed business logic to clients, thereby significantly easing the development of scalable, highly complex enterprise applications. The EJB specification defines how and when EJB components should interact with their container. It is the responsibility of the container to provide for common services, such as directory services, transaction management, security, resource pooling, and fault tolerance.
J2EE技术之所以赢得某体广泛重视的原因之一就是EJB。它们提供了一个框架来开发和实施分布式业务逻辑,由此很显著地简化了具有可伸缩性和高度复杂的企业级应用的开发。EJB规范定义了EJB组件在何时如何与它们的容器进行交互作用。容器负责提供公用的服务,例如目录服务、事务管理、安全性、资源缓冲池以及容错性。
The EJBs specification defines three fundamental types of bean: EJB规范定义了3中基本的BEAN类型:
-
Stateless session beans: These provide a single-use service, do not maintain any state, do not survive server crashes, and are relatively short lived. For example, a stateless session bean may be used to perform temperature conversion.
-
STATELESS SESSION BEANS: 提供某种单一的服务,不维持任何状态,在服务器故障发生时无法继续存在,生命期相对较短。例如,一个STATELESS SESSION BEAN可能被用于执行温度转换计算。
-
Stateful session bean: These provide a conversational interaction with the client and, as such, store state on the behalf of the client. An online shopping cart is a classic example of a stateful session bean. Stateful session beans do not survive server crashes, are also relatively short lived, and each instance can be used only by a single thread.
-
STATEFUL SESSION BEAN: T提供了与客户端的会话交互,可以存储状态从而代表一个客户。典型例子是购物车。STATEFUL SESSION BEAN在服务器故障时无法继续生存,生命气相对较短。每一个实例只用于一个单个的线程。
-
Entity beans: These provide a representation of persistent data -- typically stored in a database -- and can therefore survive a server crash. Multiple clients can use EJBs that represent the same data. An example of an entity EJB: a customer's account information.
-
ENTITY BEANS: 提供了一致性数据的表示-- 通常存放在数据库中 -- 在服务器故障发生后能继续存在。多用户情况下可以使用EJB来表示相同的数据。ENTITY EJB的一个典型例子是客户的帐号信息。
In spite of their differences, all EJBs have much in common. They all possess a home interface that defines how a client can create and destroy the EJB; a remote interface that defines the methods a client can invoke on the bean; and a bean class that implements the main business logic.
尽管有以上的区别,所有的EJB还是有许多的共同之处。它们都处理HOME INTERFACE。它定义了一个客户端是如何创建与消亡EJB的。可以在BEAN中对定义了客户端方法的远程接口进行调用;BEAN类则执行了主要的商务逻辑。
Describing how to develop an EJB is beyond the scope of this article. However, once an EJB has been developed or purchased from a third party, it must be deployed in your application server. WebLogic Server 5.1 comes with an EJB Deployer Tool to assist with deployment of EJBs. When you deploy an EJB using the EJB Deployer Tool, you specify the JNDI name used by clients to locate the EJB. The Deployer Tool will then generate wrapper classes to handle communications with the container and bundle the required Java classes together in a jar file.
描述EJB的开发已经超出了本文的范围。但是,如果一个EJB已经被开发了或者从第三方进行了购买,它就必须在应用服务器中进行发布。WEBLOGIC SERVER 5.1带有一个EJB DEPLOYER TOOL来协助处理EJB的发布。当你使用EJB DEPLOYER TOOL的时候,你要定义客户端所用的JNDI名字来定位EJB。DEPLOYER TOOL将生成WRAPPER类来处理和容器的通信以及在一个JAR文件中把被请求的JAVA类绑定在一起。
Once an EJB has been deployed, a client can locate the EJB using its JNDI name. First, it must obtain a reference to the home interface. Then, using that interface, the client can invoke one of the bean's create()
methods to obtain a handle to a bean instance running on the server. Finally, the client may use this handle to invoke methods on the bean.
一旦EJB被发布,客户端就可以使用它的JNDI名字来定位EJB。首先,它必须得到一个到HOME接口的REFERENCE。然后,客户端可以使用该接口,调用一个 CREATE() 方法来得到服务器上运行的某个BEAN实例的句柄;最后,客户端可以使用该句柄在BEAN中调用方法。
From EJBs, we shift to JSPs.
JavaServer Pages (JSPs)
Some of you may already be familiar with Microsoft's Active Server Pages (ASPs); JSPs are the platform-independent equivalent. They were designed to help Web content developers create dynamic Webpages with relatively little coding. Web designers who don't know how to program can use JSPs to create dynamic pages. A JavaServer Page consists of HTML code interspersed with Java code. The server processes the Java code when the page is requested by the client, returning the generated HTML page to the browser.
我们中间可能已经有许多人已经熟悉MICROSOFT的ACTIVE SERVER PAGES (ASP)技术了。JSP和ASP相对应的,但更具有平台对立性。他们被设计用以帮助WEB内容开发人员创建动态网页,并且只需要相对较少的代码。 即使WEB设计师不懂得如何编程也可以使用JSP,因为JSP应用是很方便的。 JSP页面由HTML代码和嵌入其中的JAVA代码所组成。服务器在页面被客户端所请求以后对这些JAVA代码进行处理,然后将生成的HTML页面返回给客户端的浏览器。
Let's look at a simple example of a JSP that displays the server's current date and time. An explanation of the details of this is beyond the scope of this article; however, note the Java code between the <%
and %>
symbols, followed by the Java expression between the <%=
and %>
symbols.
下面我们来看一个JSP的简单实例。它只显示了服务器的当前日期和时间。虽然,对语法的具体解释已经超出了本文的范围,但我们还是可以很直观地看到,JAVA代码被放在的中间,而JAVA的表达式则放在之间。
<html>
<head>
<title>Sample JSP Page</title>
</head>
<body>
<h1>Date JSP sample</h1>
<h2>
<% response.setHeader("Refresh", 5); %>
The current date is <%= new Date() %>.
</h2>
</body>
</html>
You may occasionally hear reference to JHTML, an older standard since superseded by JSPs. WebLogic Server can support JSPs as well as JHTML. Note that, by default, JSPs are not enabled within WebLogic Server. To enable them, you must edit the weblogic.properties
file and enable the Web server -- if it hasn't already been enabled -- as well as the JSPServlet.
您可能有时候听说过JHTML。这是JSP以前的一种较老的标准。WEBLOGIC服务器既可支持JSP,又可支持JHTML。请注意,在缺省状况下,JSP在WEBLOGIC服务器中并没有处于有效状态。要使之有效,你可以编辑WEBLOGIC.PROPERTIES文件。如果WEB服务器还没有处于有效状态,则要先使之有效。SERVLET的情况和JSP是一样的。
Next up: Java servlets
Java servlets
A servlet provides much the same functionality as a JSP, albeit by taking a somewhat different approach. Whereas JSPs typically consist mostly of HTML code interspersed(点缀,散布) with small amounts of Java code, servlets, on the other hand, are written totally in Java and produce HTML code.
SERVLET提供的功能大多与JSP类似,不过实现的方式不同。JSP通常是大多数HTML代码中嵌入少量的JAVA代码,而SERVLETS全部由JAVA写成并且生成HTML。
A servlet is a small Java program that extends the functionality of a Web server. It is a server-side application dynamically executed when requested, much like CGI Perl scripts in more traditional Web servers. One of the major differences between CGI scripts and servlets: CGI scripts require a whole new process to be started -- incurring additional overhead -- whereas servlets are executed as a separate thread within the servlet engine. Servlets therefore tend to offer improved scalability.
SERVLET是一种小型的JAVA程序,它扩展了WEB服务器的功能。作为一种服务器端的应用,当被请求时开始执行,这和CGI PERL脚本很相似。SERVLETS和CGI脚本的一个很大的区别是:每一个CGI在开始的时候都要求开始一个新的进程 -- 而SERVLETS是在SERVLET引擎中以分离的线程来运行的。因此SERVLETS在可伸缩性上提供了很好的改进。
When developing servlets, you will generally want to extend the javax.servlet.http.HttpServlet
class, and override some of its methods. The methods of most interest include:
-
service()
: Acts as a dispatcher to command-specific methods -
doGet()
: Handles an HTTP GET request from a client -
doPost()
: Handles an HTTP POST request from a client
在开发SERVLETS的时候,您常常需要扩展JAVAX.SERVLET.HTTP.HTTPSERVLET 类,并且OVERRIDE一些它的方法,其中包括:
SERVICE(): 作为DISPATCHER来实现命令-定义方法
DOGET(): 处理客户端的HTTP GET请求。
DOPOST(): 进行HTTP POST操作
Other methods exist to handle different types of HTTP requests -- refer to the HttpServlet API documentation for more information (see Resources).
其它的方法还包括处理不同类型的HTTP请求 -- 可以参考HTTPSERVLET API文档。
The methods described above are all part of the standard J2EE Servlet API. WebLogic Server provides a full implementation of this API. Once you have developed your servlet, you can deploy it in WebLogic Server by registering it in the weblogic.properties
file.
以上描述的是标准J2EE SERVLET API的各种方法。WEBLOGIC服务器提供了一个该API完整的实现途径。一旦你开发了一个SERVLET,你就可以在WEBLOGIC.PROPERTIES 中加以注册并由此可以在WEBLOGIC服务器中对它进行配置。
With Java servlets, we've reached the end of J2EE's major technologies, but that's not the end to what J2EE has to offer. In the next sections, we'll take a brief look at the remaining technologies, including RMI, Java IDL and CORBA, JTA, and XML, to name a few.
通过JAVA SERVLETS,我们已经到达了J2EE主要技术的末尾了。但J2EE所提供的并不止于这些。下面的段落中我们将简要地看一下现存的一些技术,包括RMI, JAVA IDL和CORBA, JTA, 以及XML,等等。
Remote Method Invocation (RMI)
As its name suggests, the RMI protocol invokes methods on remote objects. It uses serialization to pass data between the client and the server. RMI is the underlying protocol used by EJBs.
正如其名字所表示的那样,RMI协议是在远程对象上调用一些方法。它使用了连续序列方式在客户端和服务器端传递数据。RMI是一种被EJB使用的更下层的协议。
Java IDL/CORBA
With Java's IDL support, developers can integrate Java with CORBA. They can create Java objects that can be deployed within a CORBA ORB, and they can create Java classes that act as clients to CORBA objects deployed within other ORBs. The latter approach provides another way in which Java can be used to integrate your new application with legacy systems.
在JAVA IDL的支持下,开发人员可以将JAVA和CORBA集成在一起。 他们可以创建JAVA对象并使之可在CORBA ORB中展开, 或者他们还可以创建JAVA类并作为和其它ORB一起展开的CORBA对象的客户。后一种方法提供了另外一种途径,通过它JAVA可以被用于将你的新的应用和LEGACY系统相集成。
Java Transaction Architecture (JTA)/Java Transaction Service (JTS)
JTA defines a standard API that applications can use to access transaction monitors.
JTA定义了一种标准的API,应用系统由此可以存取各种事务监控。
JTS is a basic implementation of a CORBA OTS transaction monitor. JTS specifies the implementation of a Transaction Manager that supports the Java Transaction API (JTA) specification at a high level and implements the Java mapping of the OMG OTS specification at a low level. A JTS Transaction Manager provides transaction services to the application server, the resource manager, standalone applications, and the Communications Resource Manager.
JTS是CORBA OTS事务监控的基本的实现。JTS规定了事务管理器的实现方式。该事务管理器是在高层支持JAVA TRANSACTION API (JTA)规范,并且在较底层实现OMG OTS SPECIFICATION的JAVA映像。JTS事务管理器为应用服务器、资源管理器、独立的应用以及通信资源管理器提供了事务服务。
JavaMail and JavaBeans Activation Framework
JavaMail is an API for accessing mail servers. The JavaMail API provides a set of abstract classes that model a mail system. Both SMTP and IMAP servers are supported.
JAVAMAIL是用于存取邮件服务器的API,它提供了一套邮件服务器的抽象类。不仅支持SMTP服务器,也支持IMAP服务器。
JavaMail makes use of the JavaBeans Activation Framework (JAF) to handle MIME(Multipurpose Internet Mail Extensions)-encoded mail attachments. MIME byte streams can be converted to and from Java objects. Most applications will not have to use JAF directly.
JAVAMAIL利用JAVABEANS ACTIVATION FRAMEWORK (JAF)来处理MIME-编码的邮件附件。MIME(多功能Internet 邮件扩充服务)的字节流可以被转换成JAVA对象,或者转换自JAVA对象。由此大多数应用都可以不需要直接使用JAF。
Java Messaging Service (JMS)
JMS is an API for communicating with message-oriented middleware. It supports both the point-to-point domain and the publish/subscribe domain, and provides support for guaranteed message delivery, transactional message delivery, persistent messages, and durable subscribers. JMS provides another way of integrating your application with legacy backend systems.
JMS是用于和面向消息的中间件相互通信的应用程序接口(API)。它既支持点对点的域,有支持发布/订阅(PUBLISH/SUBSCRIBE)类型的域,并且提供对下列类型的支持:经认可的消息传递,事务型消息的传递,一致性消息和具有持久性的订阅者支持。JMS还提供了另一种方式来对您的应用与LEGACY BACKEND系统相集成。
Extensible Markup Language (XML)
XML is a language for defining other markup languages. It can be used to share data between businesses. XML was developed independently from Java; however, it shares similar goals in that it is platform independent. By combining Java with XML, you have a completely platform-independent solution. Various companies are working on developing a tight integration between Java and XML. For more information, visit Sun's Java-XML page, or the XML Zone at IBM's developerWorks (see Resources for the URLs).
XML是一种可以用来定义其它标记语言的语言。它被用来在不同的商务过程中共享数据。XML的发展和JAVA是相互独立的,但是,它和JAVA具有的相同目标正是平台独立性。通过将JAVA和XML的组合,您可以得到一个完美的具有平台独立性的解决方案。目前正有许多不同的公司在为JAVA和XML的组合而努力。如果要了解更多的这方面的信息,可以访问SUN的JAVA-XML页面,或者IBM DEVELOPERWORKS的XML ZONE。
Conclusion
In this article, we introduced distributed architectures built upon J2EE, and we described WebLogic Server's support for J2EE. This, however, is just the tip of the iceberg, as no 3,000 word article could begin to do justice to J2EE's potential impact on your enterprise applications.
We focused our attention on the technologies that you are most likely to encounter when you begin working with J2EE: JDBC, JNDI, EJBs, JSPs, and servlets. We also provided you with some background information on the less well-known J2EE technologies. Whether you are a developer, business analyst, or project manager, you now should have a good idea of what J2EE and WebLogic Server have to offer you, your enterprise, and your enterprise applications.
在本文中,我们介绍了建立在J2EE上的分布式应用结构,并且描述了WEBLOGIC服务器对J2EE的各种支持。 然而,我们所揭示的仅仅是冰山之一角而已,要以一篇数千字的文章来展示J2EE潜在的对您的企业级应用的影响可是很不公平的。
我们已经关注了在您开始用J2EE进行工作时最有可能遇到的各类技术:JDBC, JNDI, EJB, JSP和SERVLET。我们也为您提供了一些尚未常见的J2EE技术的背景知识。不管您是一名开发人员,商务应用分析师,或者项目经理,都应该对J2EE和WEBLOGIC服务器所能提供给我们,给我们的企业以及我们的企业级应用所带来的意义有一个更好的认识。