J2EE Enterprise Services
J2EE enterprise services are used by Web container and EJB container application components to access the resources and services available within the enterprise. The requirements may varyfrom a simple database access to a complex mainframe access through a messaging/CICS environment.
The concept behind all J2EE enterprise service APIs is shown in Figure 2.
Figure 2 Concept behind J2EE enterprise services.
As shown, J2EE service APIs provide a standard Java interface above specific services such as database connectivity and directory accesshiding the implementation-specific details from the eyes of the application. Thus, application programmers are exposed to a standard set of APIs, instead of those very specific to a given resource. This helps them to adopt easily across different service implementations.
For example, from a J2EE application component perspective, the way to access Sybase and Oracle databases is pretty much the same. All we need to change is the underlying JDBC driver that provides connectivity to the specific database; and, of course, to the database URL itself. Thus, with no code-level changes, programmers can access different databases effortlessly.
Java database connectivity API helps J2EE components to connect to a wide variety of relational databases.
The JDBC API provides a set of standard interfaces for all common database functions that are used by J2EE components to query and update the database. The specific implementations of these interfaces are taken care of by JDBC drivers.
Thus, the application codes stand independent of database-specific calls, and it is possible to switch over from one database to another with minimal effort.
In a distributed environment, naming and directory services enable the location and identification of different resources that are scattered across the network. Resources bind themselves with a unique name in a distributed hierarchical tree structure. Clients obtain a handle to the required resource by accessing the directory service.
Java Naming and Directory Interfaces (JNDI) standardize calls to enterprise naming and directory services. JNDI introduces a service layer above the specific vendor directory services such as LDAP, Novell Directory Service, or Active Directory Service, so that they can be accessed from J2EE components in a consistent manner.
Messaging services play a vital role in exposing heterogeneous systems, such as mainframes and other legacy systems, to J2EE middleware components. The essential communication link between these disparate systems is established by means of installing messaging service processes on either end. Applications talk to the messaging processes, which in turn transfer the message on a point-to-point or asynchronous methodology across other messaging processes along the network.
Java Messaging Services (JMS) APIs standardize calls to industry messaging services such as IBM's MQ series, Microsoft's MSMQ, or TIBCO's Rendezvous. JMS defines a layer above proprietary messaging API calls, so that J2EE applications stand independent of the actual messaging-service implementations.
As the name indicates, Javamail API is meant for providing e-mail services to J2EE components. It sits over specific mail server implementations such as SMTP and POP3, providing uniform access to all common services that might be required (such as message formatting and sending and receiving e-mails), with or without attachments.
Javamail API works in synchronization with the Javabean Activation Framework (JAF).
These two technologies allow intercommunication between J2EE components and CORBA (Common Object Request Broker Architecture) components.
CORBA is a famous distributed application framework from the Object Management Group that has been in existence for several years.
Although Java IDL is the recommended methodology for accessing all existing CORBA objects from J2EE environment, RMIIIOP can be used for exposing J2EE components to CORBA clients.
The Java XML APIs make the usage of XML documents within the J2EE realm easy. The services provided by JAX APIs include XML parsing (SAX and DOM), XML binding to Java objects, XML messaging, and XSLT transformations.
The JAX APIs lie at the foundation of exposing J2EE business logic components as Web services, as well as consuming Web services from a variety of environments.
Java connector allows the seamless integration of existing enterprise information systems such as ERP, mainframes, transaction-processing environments, databases, and other legacy systems with J2EE middleware. As in the case of other service APIs, JCA provides room for vendors to develop their own resource adopters, which then establish system-level contracts with any J2EE-compatible application server and application-level contracts with the application components that access the EIS resource.
Currently, J2EE-compatible resource adapters for many popular back-end environments have started appearing in the market.