Understanding the J2EE Common Services APIs

The J2EE architecture allows applications to access a wide range of services in a uniform manner. This section describes the technologies that provide access to infrastructure services such as databases, transactions, XML processing, naming and directory services, and enterprise information systems. As such, many J2EE APIs are available for use by developers and management by Application Server. Those of particular interest are summarized in the following sections.

Java Naming and Directory Interface

The Java Naming and Directory Interface (JNDI) is an API that provides applications with unified methods for performing standard naming and directory services. JNDI standardizes access to directory services, such as associating attributes with objects and searching for objects using their attributes. With JNDI, an application can store and retrieve any named Java object in a standard fashion. You learned about JNDI on Day 4, “Using JNDI for Naming Services and Components.”

Java Database Connectivity

Java Database Connectivity (JDBC) is an API that provides database-independent connectivity between the J2EE platform and a wide range of data sources. JDBC allows J2EE applications to connect to databases and perform all required operations through a standard set of APIs. You learned about JDBC on Day 9, “Using JDBC to Connect to a Database.”

Enterprise JavaBeans

This is the component framework that allows the development and deployment of multitier distributed enterprise applications. It provides a standard for building server-side components and specifies rich run-time common services and infrastructure support of deploying components.

JavaServer Pages

The JSP specification provides template-driven Web application development to deliver dynamic content. You learned about JSP on Day 7.

Java Servlet

The Servlet API provides an object-oriented abstraction for building Web applications to deliver dynamic content. You learned about the Servlet API on Day 7.

Java Message Service

The JMS API allows J2EE applications to access enterprise message-oriented middleware systems such as IBM's MQ Series and TIBCO's Rendezvous. JMS messages contain well-defined information that describes specific business actions.

Through the exchange of these messages, applications track the progress of enterprise activities. The JMS API supports both point-to-point and publish-subscribe styles of messaging. You learned about JMS on Day 13, “Understanding JMS and Message-Driven Beans.”

Java Authentication and Authorization Service

The Java Authentication and Authorization Service (JAAS) API provides security-checking mechanisms, such as authentication and authorization, to J2EE applications. You'll learn about JAAS on Day 19.

JavaMail

The JavaMail API provides a set of abstract classes and interfaces that comprise an electronic mail system. The abstract classes and interfaces support many different implementations of message stores, formats, and transports. Many simple applications will need to interact with the messaging system only through these base classes and interfaces.

The abstract classes in the JavaMail API can be subclassed to provide new protocols and add functionality when necessary. In addition, the JavaMail API includes concrete subclasses that implement widely used Internet mail protocols and conform to specifications RFC822 and RFC2045. They are ready to be used in application development. Developers can subclass JavaMail classes to provide implementations of particular messaging systems, such as IMAP4 (Internet Message Access Protocol version 4), POP3 (Post Office Protocol version 3), and SMTP (Simple Mail Transfer Protocol). You'll learn about JavaMail on Day 21, “Developing a Complete Enterprise Application.”

JavaBeans Activation Framework

The JavaBeans Activation Framework (JAF) API integrates support for MIME (Multipurpose Internet Mail Exchange) data types into the Java platform. JavaBeans components can be specified for operating on MIME data, such as viewing or editing the data. The JAF API also provides a mechanism to map filename extensions to MIME types.

The JAF API is required by the JavaMail API to handle the data included in e-mail messages. Typical applications won't need to use the JAF API directly, although applications making sophisticated use of e-mail might need it.

Java Transaction API

The Java Transaction API (JTA) specification allows applications to perform distributed transactions independent of specific implementations. JTA specifies standard Java interfaces between a transaction manager and all participants involved in a distributed transaction. Such participants are typically the J2EE application server, the resource managers, and the application components sharing the transaction. You'll learn about JTA in Day 16, “Understanding Transactions.”

Java API for XML Parsing

The Java API for XML Parsing (JAXP) technology provides abstractions for XML parsers and transformation APIs. It supports the processing of XML documents using the Document Object Model (DOM) and Extensible Stylesheet Language Transformation (XSLT) transformations. JAXP enables applications to parse and transform XML documents independent of a particular XML processing implementation.

Note

We won't cover JAXP in this book, but a brief summary of XML can be found in Appendix C, “Understanding XML.” More information about JAXP can be found at http://java.sun.com/products/jaxp.


Note

Web Services are new technology that allows applications to communicate with each other over the Web. They typically communicate by passing messages. The XML-based SOAP 1.1 protocol over HTTP transport is becoming a popular and standard way exchanging messages between these applications. WSDL (Web Services Description Language) can be used to describe abstractly a Web service and can bind it to a network endpoint. EJB 2.1 is implementing Web services using stateless session beans. Session beans define a Web service interface and implements that interface in the bean class conforming to the JAX-RPC rules. The interface is specified as a service endpoint in the deployment descriptor. The session bean can get the SOAP message and the properties using the MessageContext interface available from SessionContext interface. From the client's point of view, the session bean is completely hidden behind the Web service endpoint. Java clients, including all enterprise beans, can locate an endpoint using JNDI and accesses the interface by means of the JAX-RPC API.


J2EE Connector Architecture

The J2EE Connector Architecture (JCA) is a standard API for connecting the J2EE platform to enterprise information systems (EIS), such as enterprise resource planning (ERP), mainframe transaction processing, and database systems. The architecture addresses the issues involved when integrating existing EIS, such as SAP, CICS, legacy applications, and nonrelational databases, with an EJB server and enterprise applications. The JCA defines a set of scalable, secure, and transactional mechanisms for integrating an EIS with a J2EE platform.

The J2EE Connector Architecture is implemented both in Application Server and in an EIS-specific resource adapter (RA). A resource adapter is a system library specific to an EIS and provides an interface to the EIS. A resource adapter is analogous to a JDBC driver. The interface between a resource adapter and the EIS is specific to the underlying EIS, and can be a native interface. The JCA comprises the system-level contracts between Application Server and a given resource adaptor, a common interface for clients to access the adaptor, and interfaces for packaging and deploying resource adaptors to J2EE applications.

Note

We don't cover the JCA API in this book. More information about JCA can be found at http://java.sun.com/products/jca.


Summary of the J2EE APIs

Table 15.1 summarizes the J2EE APIs and the container from which they can be used. It also references the day in which the API is covered in this book (also refer to Figure 15.3).

Table 15.1. Summary of J2EE APIs and Containers
APIApplet ContainerApplication Client ContainerWeb ContainerEJB ContainerDay
JNDI-YYY4
JDBC-YYY9
JTA--YY16
JSP--Y-7
Servlet--Y-7
EJB-YYYMany
RMI/IIOP-YYY3
JMS-YYY13
JavaMail-YYY20
JAF-YYY20
JAXP-YYY-
JAAS-YYY19
JCA--YY-

Note

In EJB 2.1, EJB container provides timer services to enterprise beans for scheduling business tasks based on time events. Both stateless session beans and entity beans can utilize the timer services provided by the container. The EJB container invokes the callback method of the enterprise bean at a specified time or after a specified duration or in specified time intervals for enterprise beans that register with the container. The timer method of an enterprise bean implements the business logic to handle the timeout event. The timer services, however, are not intended for modeling real-time events. The EJB container provides reliable timer services that can survive container crashes, activation/passivation, and load/store cycles of enterprise beans. Further the containers manage timers that are part of transactions. The containers allow enterprise beans to create, locate, and cancel timers.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.59.192