J2EE规范节选

J2EE规范节选(J2EE Standard Services标准服务部分)

 

1.1        Java EE标准服务

Java EE标准服务包括下述服务(后面的章节会进行更详细地描述)。一些标准服务实际上由Java SE提供。

1.1.1  HTTP

HTTP客户端API定义在java.net包中。HTTP服务器端API由Servlet, JSP和JSF接口定义,以及被那些是Java EE平台组成部分的Web服务支持。

1.1.2  HTTPS

支持HTTP协议的客户端和服务器端API也同样支持带SSL协议的HTTP协议。

1.1.3  JavaTM Transaction API (JTA)

Java事务API由两部分组成:

  • 一个应用程序级的边界划分接口,容器和应用程序组件用它来划分事务边界。
  • 一个介于事务管理器和资源管理器之间的Java EE SPI级接口。

1.1.4  RMI-IIOP

RMI-IIOP由API组成,这些API允许使用不依赖于底层协议的RMI风格编程。作为那些API的实现,它同时支持Java SE本地RMI协议和CORBA IIOP协议。通过支持IIOP协议,Java EE应用程序就可以使用RMI-IIOP来访问CORBA服务,并且该应用程序兼容RMI编程约束(请查看RMI-IIOP的详细说明)。这样的CORBA服务通常由Java EE产品之外的组件定义,一般存在于以前遗留下来的系统中。只要求Java EE应用程序客户端可以使用RMI-IIOP API来直接定义它们自己的CORBA服务。通常这样的CORBA对象用于在访问其它的CORBA对象时进行回调。

当访问EJB组件时,Java EE应用程序必须使用RMI-IIOP API,特别是javax.rmi.PortableRemoteObject类的narrow方法,正如EJB规范所描述的。这些企业Bean可以独立于协议。需要注意的是,当使用依赖注入代替JNDI就行查找时,通常不需要使用narrow方法; 在注入对象引用之前,容器会为应用程序执行narrow方法。Java EE产品必须能够使用IIOP协议输出和访问企业Bean,这在EJB规范中被明确规定。对IIOP协议的支持使Java EE产品之间的交互成为可能,不过,Java EE产品也可以使用其它的协议。

1.1.5  Java IDL

通过使用IIOP协议,Java IDL允许Java EE应用程序组件调用外部的CORBA对象。这些 CORBA对象可以用任何语言编写,并且通常存在于Java EE产品外部。Java EE应用程序可以使用Java IDL来担当CORBA服务的客户端,但是只有Java EE应用程序客户端可以直接使用Java IDL提供CORBA服务。

1.1.6  JDBCTM API

JDBC API是用来连接关系数据库系统的API。JDBC API 有两个部分: 一个是应用程序组件用来访问数据库的应用级接口,另一个是JDBC驱动接口。不要求Java EE产品对JDBC驱动接口提供支持。JDBC驱动应该被打包成一个资源适配器,通过使用连接器API的能力来连接Java EE产品。JDBC API包含在了Java SE中, 但是本规范包含了对JDBC设备驱动的额外标准。

1.1.7  JavaTM Persistence API(JPA)

Java持久化API是用于持久化和对象/关系映射管理的标准API。通过使用一个Java域模型来管理关系型数据库,本规范为应用程序开发者提供了一种对象/关系映射功能。Java EE必须对Java持久化API提供支持。它也可以用在Java SE环境中。

1.1.8  JavaTM Message Service (JMS)

Java消息服务是用于消息发送的标准API,它支持可靠的“点对点”消息发送和“发布-订阅”模型。本规范要求JMS供应商同时实现“点对点”消息发送和”发布/订阅”型消息发送。

1.1.9  Java Naming and Directory InterfaceTM (JNDI)

JNDI API是用于命名和目录访问的标准API。它有两个部分: 一个是应用程序组件用来访问命名和目录服务的应用程序级接口,另一个是用于连接命名和目录服务供应商的服务供应商接口。JNDI API包含在Java SE中, 但是本规范为它定义了额外的标准。

1.1.10              JavaMailTM

许多互联网应用程序需要发送邮件的功能,因此Java EE平台包含了JavaMail API以及相应的JavaMail服务供应商API,使应用程序组件可以发送互联网邮件。JavaMail API 有两个部分: 一个是应用程序组件用于发送邮件的应用程序级接口,另一个是Java EE SPI级的服务供应商接口。

1.1.11              JavaBeansTM Activation Framework (JAF)

JAF API提供了一个框架来处理不同MIME类型的数据,它们源于不同的格式和位置。JavaMail API使用了JAF API。JAF API包含在Java SE中,因此它可以被Java EE应用程序使用。

1.1.12              XML处理

JavaTM API for XML Processing (JAXP)支持工业标准化的SAX和DOM API,用以解析XML文档,也支持XSLT转换引擎。 Streaming API for XML (StAX)为XML提供了一种“拉式解析”型的API。JAXP和StAX API都包含在Java SE中,因此它们可以被Java EE应用程序使用。

1.1.13              Java EETM连接器体系结构

连接器体系结构是一种Java EE SPI,它允许将资源适配器插入到任何Java EE产品中,这个资源适配器支持对EIS的访问。连接器体系结构定义了一套标准的介于Java EE服务器和资源适配器之间的系统级协议。这些协议包括:

  • 连接管理协议,它让Java EE服务器将“连接”集中到底层EIS中,然后让应用程序组件与EIS连接。这种方式营造出了一种可伸缩的应用程序环境,它能支持大规模客户端对EIS系统的访问。
  • 事务管理器和EIS之间的事务管理协议,它支持对EIS资源管理器的事务型访问。这个协议让Java EE服务器使用事务管理器来管理跨多个资源管理器的事务。这个协议也支持EIS资源管理器内部管理的事务,而不需要牵连外部的事务管理器。
  • 安全协议,它实现了对EIS的安全访问。这个协议为安全的应用程序环境提供支持,它减少了对EIS的安全威胁并保护了EIS管理的重要信息资源。
  • 线程管理协议,它允许资源适配器将工作委托给其它的线程,并允许应用程序服务器管理线程池。通过工作线程,资源适配器可以控制安全上下文和事务上下文。
  • 消息传递协议,它允许资源适配器将消息传递到消息驱动Bean,此Bean不依赖于特定的消息格式,消息语义和传递消息的底层结构。这个协议也充当标准消息提供方即插即用协议,它允许通过资源适配器将消息提供方插入到任何Java EE服务器中。
  • 事务传递协议,它允许资源适配器将一个被导入的事务上下文传递给Java EE服务器,使得服务器和任意应用程序组件的交互成为被导入的事务的组成部分。这个协议维护了被导入事务的ACID(atomicity, consistency, isolation, durability)属性。
  • 可选协议,它提供了一个介于应用程序和资源适配器之间的通用命令接口。

1.1.14              安全服务

JavaTM Authentication and Authorization Service (JAAS)使服务能够基于用户进行验证和实施访问控制。它实现了一个Java版的标准的的Plugable Authentication Module (PAM)框架,并支持基于用户的授权。JavaTM Authorization Service Provider Contract for Containers (JACC) 定义了Java EE应用程序服务器和授权服务提供方之间的协议,允许将自定义的授权服务提供方插入任何Java EE产品中。

1.1.15              Web服务

Java EE为Web服务的客户端和终端提供了完整的支持。一些Java技术协同为Web服务提供支持。通过使用SOAP/HTTP协议,Java API for XML Web Services (JAX-WS)和Java API for XML-based RPC (JAX-RPC)都能为Web服务的调用提供了支持。新的JAX-WS是支持Web服务的首选API,它出现在JAX-RPC之后。JAX-WS 提供了更广泛的Web服务功能,并提供对多重“绑定-协议”的支持。当使用绑定于HTTP协议的SOAP1.1协议时,JAX-WS和JAX-RPC完全可以协同工作,但要受到WS-I基本概要规范的约束。

JAX-WS和Java Architecture for XML Binding (JAXB)定义了Java类和用于SOAP调用的XML之间的映射,并且对XML Schema提供了100%的支持。SOAP with Attachments API for Java (SAAJ) 对操作低层SOAP消息提供支持。Java EE规范中的Web服务标准完整地定义了Web服务的客户端和终端在Java EE中的部署,以及使用企业Bean的Web服务终端的实现。Web服务元数据规范定义了相应的Java语言注解来简化Web服务的开发。Java API for XML Registries (JAXR) 使客户端可以访问XML注册服务器。

Java API for RESTful Web Services (JAX-RS)对使用REST风格的Web服务提供了支持。RESTful Web服务更符合Web的设计风格,并且常常更易于使用多种编程语言对其进行访问。JAX-RS提供了一个简单的高层API来写入这样的Web服务,以及一个低层API来控制Web服务交互中的所有细节。

1.1.16              管理

Java 2平台企业版管理规范中定义了一种API,通过一种特殊的管理型企业Bean来管理Java EE服务器。JavaTM Management Extensions (JMX) API也提供了一些管理上的支持。

1.1.17              部署

Java 2平台企业版部署规范中定义了部署工具和Java EE产品之间的协议。Java EE产品提供了运行在部署工具上的插入式组件,它允许部署工具将应用程序部署到Java EE产品中。

部署工具提供了插入式组件可以使用的服务。


图 2-2 Java EE的交互

总结:主要的 J2EE 1.4 规范

  • Java Servlet 规范 2.4
  • JavaServer Pages 规范 2.0
  • Enterprise JavaBeans 规范 2.1
  • Enterprise JavaBeans 至 CORBA 的映射 1.1
  • RMI over IIOP
  • Java IDL API
  • 用于 J2EE V1.1 的 Web Service
  • 带附件的 SOAP Java API 规范 1.2
  • Java API for XML Processing 规范 1.2
  • Java API for XML Registries 规范 1.0
  • “针对基于 XML 的 RPC 的 Java API”规范 1.1
  • JDBC 规范 3.0、2.1 和可选包 API(2.0)
  • Java 连接器体系结构(JCA)1.5
  • Java 消息服务规范 1.1
  • JavaMail API 规范 1.3
  • Java Authorization Contract for Containers 1.0
  • Java 命名和目录接口规范 1.2.1
  • Java 事务 API 规范 1.0.1B
  • Java 事务服务规范 1.0
  • JavaBeans 激活框架规范 1.0.2

英文原文(J2EE 2.6)

J2EE.2.6 J2EE Standard Services
The J2EE standard services include the following (specified in more detail later in
this document). Some of these standard services are actually provided by J2SE.
J2EE.2.6.1 HTTP
The HTTP client-side API is defined by the java.net package. The HTTP serverside
API is defined by the servlet and JSP interfaces.
J2EE.2.6.2 HTTPS
Use of the HTTP protocol over the SSL protocol is supported by the same client and
server APIs as HTTP.
10 PLATFORM OVERVIEW
J2EE.2.6.3 Java™ Transaction API (JTA)
The Java Transaction API consists of two parts:
• An application-level demarcation interface that is used by the container and
application components to demarcate transaction boundaries.
• An interface between the transaction manager and a resource manager used at
the J2EE SPI level (in a future release).
J2EE.2.6.4 RMI-IIOP
The RMI-IIOP subsystem is composed of APIs that allow for the use of RMI-style
programming that is independent of the underlying protocol, as well as an
implementation of those APIs that supports both the J2SE native RMI protocol
(JRMP) and the CORBA IIOP protocol. J2EE applications can use RMI-IIOP, with
IIOP protocol support, to access CORBA services that are compatible with the RMI
programming restrictions (see the RMI-IIOP spec for details). Such CORBA
services would typically be defined by components that live outside of a J2EE
product, usually in a legacy system. Only J2EE application clients are required to be
able to define their own CORBA services directly, using the RMI-IIOP APIs.
Typically such CORBA objects would be used for callbacks when accessing other
CORBA objects.
J2EE applications are required to use the RMI-IIOP APIs (specifically the
narrow method of javax.rmi.PortableRemoteObject) when accessing Enterprise
JavaBeans components, as described in the EJB specification. This allows
enterprise beans to be protocol independent. In addition, J2EE products must be
capable of exporting enterprise beans using the IIOP protocol, and accessing
enterprise beans using the IIOP protocol, as specified in the EJB specification.
The ability to use the IIOP protocol is required to enable interoperability between
J2EE products, however a J2EE product may also use other protocols.
J2EE.2.6.5 Java IDL
Java IDL allows J2EE application components to invoke external CORBA objects
using the IIOP protocol. These CORBA objects may be written in any language and
typically live outside a J2EE product. J2EE applications may use Java IDL to act as
clients of CORBA services, but only J2EE application clients are required to be
allowed to use Java IDL directly to present CORBA services themselves.
J2EE Standard Services 11
J2EE.2.6.6 JDBC™ API
The JDBC API is the API for connectivity with relational database systems. The
JDBC API has two parts: an application-level interface used by the application
components to access a database, and a service provider interface to attach a JDBC
driver to the J2EE platform. Support for the service provider interface is not
required in J2EE products.
J2EE.2.6.7 Java™ Message Service (JMS)
The Java Message Service is a standard API for messaging that supports reliable
point-to-point messaging as well as the publish-subscribe model. This specification
requires a JMS provider that implements both point-to-point messaging as well as
publish-subscribe messaging.
J2EE.2.6.8 Java Naming and Directory Interface™ (JNDI)
The JNDI API is the standard API for naming and directory access. The JNDI API
has two parts: an application-level interface used by the application components to
access naming and directory services and a service provider interface to attach a
provider of a naming and directory service.
J2EE.2.6.9 JavaMail™
Many Internet applications require the ability to send email notifications, so the
J2EE platform includes the JavaMail API along with a JavaMail service provider
that allows an application component to send Internet mail. The JavaMail API has
two parts: an application-level interface used by the application components to send
mail, and a service provider interface used at the J2EE SPI level.
J2EE.2.6.10 JavaBeans™ Activation Framework (JAF)
The JAF API provides a framework for handling data in different MIME types,
originating in different formats and locations. The JavaMail API makes use of the
JAF API, so it must be included as well.
J2EE.2.6.11 Java™ API for XML Parsing (JAXP)
JAXP provides support for the industry standard SAX and DOM APIs for parsing
XML documents, as well as support for XSLT transform engines.
12 PLATFORM OVERVIEW
J2EE.2.6.12 J2EE™ Connector Architecture
The Connector architecture is a J2EE SPI that allows resource adapters that support
access to Enterprise Information Systems to be plugged in to any J2EE product. The
Connector architecture defines a standard set of system-level contracts between a
J2EE server and a resource adapter. The standard contracts include:
• A connection management contract that lets a J2EE server pool connections to
an underlying EIS, and lets application components connect to an EIS. This
leads to a scalable application environment that can support a large number of
clients requiring access to EIS systems.
• A transaction management contract between the transaction manager and an
EIS that supports transactional access to EIS resource managers. This contract
lets a J2EE server use a transaction manager to manage transactions across
multiple resource managers. This contract also supports transactions that are
managed internal to an EIS resource manager without the necessity of involving
an external transaction manager.
• A security contract that enables secure access to an EIS. This contract provides
support for a secure application environment, which reduces security
threats to the EIS and protects valuable information resources managed by the
EIS.
• A thread management contract that allows a resource adapter to delegate work
to other threads and allows the application server to manage a pool of threads.
The resource adapter can control the security context and transaction context
used by the worker thread.
• A contract that allows a resource adapter to deliver messages to message driven
beans independent of the specific messaging style, messaging semantics,
and messaging infrastructure used to deliver messages. This contract also
serves as the standard message provider pluggability contract that allows a
message provider to be plugged into any J2EE server via a resource adapter.
• A contract that allows a resource adapter to propagate an imported transaction
context to the J2EE server such that its interactions with the server and any
application components are part of the imported transaction. This contract
preserves the ACID (atomicity, consistency, isolation, durability) properties of
the imported transaction.
• An optional contract providing a generic command interface between an application
program and a resource adapter.
J2EE Standard Services 13
J2EE.2.6.13 Security Services
The Java™ Authentication and Authorization Service (JAAS) enables services to
authenticate and enforce access controls upon users. It implements a Java
technology version of the standard Plugable Authentication Module (PAM)
framework, and extends the access control architecture of the Java 2 Platform in a
compatible fashion to support user-based authorization. The Java™ Authorization
Service Provider Contract for Containers (JACC) defines a contract between a J2EE
application server and an authroization service provider, allowing custom
authorization service providers to be plugged into any J2EE product.
J2EE.2.6.14 Web Services
J2EE provides full support for both clients of web services as well as web service
endpoints. Several Java technologies work together to provide support for web
services. The Java API for XML-based RPC (JAX-RPC) provides support for web
service calls using the SOAP/HTTP protocol. JAX-RPC defines the mapping
between Java classes and XML as used in SOAP RPC calls. The SOAP with
Attachments API for Java (SAAJ) provides support for manipulating low level
SOAP messages. The Web Services for J2EE specification fully defines the
deployment of web service clients and web service endpoints in J2EE, as well as the
implementation of web service endpoints using enterprise beans. The Java API for
XML Registries (JAXR) provides client access to XML registry servers.
J2EE.2.6.15 Management
The Java 2 Platform, Enterprise Edition Management Specification defines APIs for
managing J2EE servers using a special management enterprise bean. The Java™
Management Extensions (JMX) API is also used to provide some management
support.
J2EE.2.6.16 Deployment
The Java 2 Platform, Enterprise Edition Deployment Specification defines a contract
between deployment tools and J2EE products. The J2EE products provide plug-in
components that run in the deployment tool and allow the deployment tool to deploy
14 PLATFORM OVERVIEW
applications into the J2EE product. The deployment tool provides services used by
these plug-in components.

 

详见新浪V盘

posted @ 2013-02-15 15:23  大树的博客  Views(254)  Comments(0Edit  收藏  举报