首页 > 代码库 > Java EE 7 教程 第一部分 简介 第1章 概述 第1.8节 Java平台中的Java EE 7 API, 标准版7
Java EE 7 教程 第一部分 简介 第1章 概述 第1.8节 Java平台中的Java EE 7 API, 标准版7
原文:http://docs.oracle.com/javaee/7/tutorial/doc/overview008.htm
翻译:石卓林 shizhuolin@hotmail.com
1.8 Java EE 7 APIs in the Java Platform, Standard Edition 7
Several APIs that are required by the Java EE 7 platform are included in the Java Platform, Standard Edition 7 (Java SE 7) and are thus available to Java EE applications.
1.8 Java平台中的Java EE 7 API, 标准版 7
Java EE 7平台所必须的Several API包含在Java平台标准版7(Java SE 7)中,从而可用于Java EE应用.
1.8.1 Java Database Connectivity API
The Java Database Connectivity (JDBC) API lets you invoke SQL commands from Java programming language methods. You use the JDBC API in an enterprise bean when you have a session bean access the database. You can also use the JDBC API from a servlet or a JSP page to access the database directly without going through an enterprise bean.
The JDBC API has two parts:
- An application-level interface used by the application components to access a database
- A service provider interface to attach a JDBC driver to the Java EE platform
The Java SE 7 platform requires JDBC 4.1.
1.8.1 Java数据库连接API
Java数据库连接(JDBC) API让你可以在Java程序语言方法中调用SQL命令. 当你有一个会话bean访问数据库时你可以在企业bean中使用JDBC API. 当然你也可以在servlet或jsp页面中使用JDBC API直接连接数据库而不需要通过企业bean.
JDBC API包含两部分:
- 一个用于应用组件访问数据库的应用级接口
- 一个用于在Java EE平台中附加JDBC驱动的服务提供接口
Java SE 7平台要求JDBC 4.1.
1.8.2 Java Naming and Directory Interface API
The Java Naming and Directory Interface (JNDI) API provides naming and directory functionality, enabling applications to access multiple naming and directory services, such as LDAP, DNS, and NIS. The JNDI API provides applications with methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes. Using JNDI, a Java EE application can store and retrieve any type of named Java object, allowing Java EE applications to coexist with many legacy applications and systems.
Java EE naming services provide application clients, enterprise beans, and web components with access to a JNDI naming environment. Anaming environment allows a component to be customized without the need to access or change the component‘s source code. A container implements the component‘s environment and provides it to the component as a JNDInaming context.
The naming environment provides four logical namespaces: java:comp, java:module, java:app, and java:global for objects available to components, modules, or applications or shared by all deployed applications. A Java EE component can access named system-provided and user-defined objects. The names of some system-provided objects, such as a default JDBC DataSource object, a default JMS connection factory, and a JTA UserTransaction object, are stored in the java:comp namespace. The Java EE platform allows a component to name user-defined objects, such as enterprise beans, environment entries, JDBC DataSource objects, and messaging destinations.
A Java EE component can also locate its environment naming context by using JNDI interfaces. A component can create a javax.naming.InitialContext object and look up the environment naming context in InitialContext under the name java:comp/env. A component‘s naming environment is stored directly in the environment naming context or in any of its direct or indirect subcontexts.
1.8.2 Java命名和目录接口API
Java命名和目录接口(JNDI) API提供命名和目录服务功能, 使应用可以访问多个命名和目录服务,例如LDAP, DNS和NIS. 此JNDI API提供了应用和方法以处理标准目录操作, 例如对象属性访问和使用属性搜索对象. 使用JNDI,Java EE应用可以存储和恢复任意Java命名对象类型, 允许Java EE应用与很多传统应用和系统共存.
Java EE命名服务为应用客户端,企业bean和web组件访问JNDI命名提供环境. 一个命名环境允许自定义组件访问而不需要更改组件源码. 容器实现组件的环境,并将其提供给该组件作为JNDI命名上下文.
此命名环境为所有部署应用中的有效组件,模块,应用或共享等对象提供四种逻辑命名空间: java:comp, java:module, java:app和java:global. 一个Java EE组件可以访问系统命名提供的或用户定义的对象. 一些系统提供的对象的名称, 例如一个默认的JDBC数据源对象,一个默认的JMS连接工厂和默认的JTA用户事务对象, 包括被存储在java:comp命名空间中的对象. Java EE 平台允许用户定义组件为命名对象,例如企业bean,环境项, JDBC数据源对象和消息目的地.
在Java EE组件中还可以通过使用JNDI接口找到它的环境命名上下文. 一个组件可以创建一个javax.naming.InitialContext对象并且在InitialContext中的java:comp/env名称中查询环境命名上下文.组件的命名环境是直接存储在环境命名上下文或任何直接或间接的子上下文中.
1.8.3 JavaBeans Activation Framework
The JavaBeans Activation Framework (JAF) is used by the JavaMail API. JAF provides standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and create the appropriate JavaBeans component to perform those operations.
1.8.3 JavaBeans活化框架
JavaBeans活化框架(JAF)用于JavaMail API. JAF提供标准服务以确定任意数据类型,封装其访问,发现其可用操作并且创建相应的JavaBean组件来执行这些操作.
1.8.4 Java API for XML Processing
The Java API for XML Processing (JAXP), part of the Java SE platform, supports the processing of XML documents using Document Object Model (DOM), Simple API for XML (SAX), and Extensible Stylesheet Language Transformations (XSLT). JAXP enables applications to parse and transform XML documents independently of a particular XML-processing implementation.
JAXP also provides namespace support, which lets you work with schemas that might otherwise have naming conflicts. Designed to be flexible, JAXP lets you use any XML-compliant parser or XSL processor from within your application and supports the Worldwide Web Consortium (W3C) schema. You can find information on the W3C schema at http://www.w3.org/XML/Schema.
1.8.4 用于XML处理的Java API
用于XML处理的Java API(JAXP)是Java SE平台的一部分,其支持使用文档对象模型(DOM)处理XML文档, XML简单API(SAX)和扩展样式语言转换(XSLT). JAXP使应用程序可以使用特定XML处理实现做到独立解析和转换XML文档.
JAXP也提供命名空间支持, 可以在你有可能的命名冲突时使用架构工作.通过灵活设计, JAXP让你可以在你的应用中使用任意的适合的XML解析器和XSL处理器,并且支持万维网WEB联盟(W3C)架构.你可以在W3C计划http://www.w3.org/XML/Schema中找到相关信息.
1.8.5 Java Architecture for XML Binding
The Java Architecture for XML Binding (JAXB) provides a convenient way to bind an XML schema to a representation in Java language programs. JAXB can be used independently or in combination with JAX-WS, in which case it provides a standard data binding for web service messages. All Java EE application client containers, web containers, and EJB containers support the JAXB API.
The Java EE 7 platform requires JAXB 2.2.
1.8.5 用于XML绑定的Java体系结构
用于XML绑定的体系结构(JAXB)为在Java语言程序中绑定XML架构到表现层提供便捷方法. JAXB可以单独使用或与JAX-WS组合使用, 它在一些案例中为web服务消息提供标准的数据绑定. 所有Java EE应用客户端容器,web容器和EJB容器支持JAXB API.
Java EE 7平台要求JAXB 2.2.
1.8.6 Java API for XML Web Services
The Java API for XML Web Services (JAX-WS) specification provides support for web services that use the JAXB API for binding XML data to Java objects. The JAX-WS specification defines client APIs for accessing web services as well as techniques for implementing web service endpoints. The Implementing Enterprise Web Services specification describes the deployment of JAX-WS-based services and clients. The EJB and Java Servlet specifications also describe aspects of such deployment. JAX-WS-based applications can be deployed using any of these deployment models.
The JAX-WS specification describes the support for message handlers that can process message requests and responses. In general, these message handlers execute in the same container and with the same privileges and execution context as the JAX-WS client or endpoint component with which they are associated. These message handlers have access to the same JNDI namespace as their associated component. Custom serializers and deserializers, if supported, are treated in the same way as message handlers.
The Java EE 7 platform requires JAX-WS 2.2.
1.8.6 用于XML Web服务的Java API
用于XML Web服务的Java API(JAX-WS)规范为在WEB服务中使用JAXB绑定XML数据和Java对象提供支持. JAX-WS规范为web服务客户端访问web服务的技术实现定义客户端API.实现了企业web服务规范化的基于JAX-WS的服务服务和客户端部署描述 . EJB和Java Servlet规范也为部署提供部分描述.基于JAX-WS的应用可以使用任意部署模型部署.
JAX-WS规范描述为处理消息请求和响应的消息处理程序提供支持. 在通常情况中, 这些消息处理程序在同一个容器中用相同的权限和执行上下文的JAX-WS客户端或与其关联的终端组件一起执行. 这些消息处理程序可以访问相同的JNDI命名空间及其相关组件. 如果支持自定义序列化和反序列化的话, 则以同样的方式对待消息处理程序.
Java EE 7平台要求JAX-WS 2.2.
1.8.7 SOAP with Attachments API for Java
The SOAP with Attachments API for Java (SAAJ) is a low-level API on which JAX-WS depends. SAAJ enables the production and consumption of messages that conform to the SOAP 1.1 and 1.2 specifications and the SOAP with Attachments note. Most developers do not use the SAAJ API, instead using the higher-level JAX-WS API.
1.8.7 Java中附带的SOAP API
Java中附带的SOAP API(SAAJ)是一种依赖JAX-WS的低级API. SAAJ使消息的生产和消费尊从SOAP 1.1/1.2规范和附带的SOAP注释. 多数开发人员不使用SAAJ API,反而使用高级JAX-WS API.
1.8.8 Java Authentication and Authorization Service
The Java Authentication and Authorization Service (JAAS) provides a way for a Java EE application to authenticate and authorize a specific user or group of users to run it.
JAAS is a Java programming language version of the standard Pluggable Authentication Module (PAM) framework, which extends the Java platform security architecture to support user-based authorization.
1.8.8 Java认证和认证服务
Java和认证服务(JAAS)为Java EE应用授权和验证运行它的特定用户或组提供方法.
JAAS是标准可插入认证模块框架的Java程序语言版本, 那些扩展的Java平台安全体系支持基于用户的认证.
1.8.9 Common Annotations for the Java Platform
Annotations enable a declarative style of programming in the Java platform.
The Java EE 7 platform requires Common Annotations for the Java Platform 1.2.
1.8.9 Java平台通用注解
注解使得在Java平台中可以使用编程的方式声明样式.
Java EE 7平台要求Java平台通用注解 1.2.
Java EE 7 教程 第一部分 简介 第1章 概述 第1.8节 Java平台中的Java EE 7 API, 标准版7