Essential EJB Container Services

All EJB instances run within an EJB container. The container provides system-level services to its EJBs and controls their life cycle. Because the container handles most system-level issues, the EJB developer does not have to include this logic with the business methods of the enterprise bean. In general, J2EE containers provide three main types of services: common vertical services, common horizontal services, and common deployment tools (refer to Figure 1.4).

In the next few sections, we'll discuss the definition of these services. We'll discuss some of the services in detail in the following days.

Common Vertical Services

The common vertical services are inherent services that are provided by the EJB container and are not specified explicitly by the J2EE architecture APIs. They contribute to the performance and runtime aspects of the EJBs and the services provided to them. EJB developers need not include any logic to manage these services. The following is a list of these common services:

  • Life cycle management: The container creates and destroys enterprise bean instances based on client demand. This is done to maximize performance and minimize resource usage such as memory. In addition, a container may transparently multiplex a pool of instances to share among several clients.

  • Security: The security services are designed to ensure that only authorized users access resources. J2EE specifies a simple role-based security model for enterprise beans and Web components. In addition, vendors typically provide integration with third-party security providers such as LDAP.

  • Remote method invocation: The container transparently manages the communication between enterprise beans and other components. So, you do not have to worry about low-level communication issues such as initiating the connections, and marshalling/unmarshalling the method parameters. A bean developer simply writes the business methods as if they'll be invoked on a local platform.

  • Transaction management: The transaction services relieve the enterprise bean developer from dealing with the complex issues of managing distributed transactions that span multiple enterprise beans and resources such as databases. The container ensures that updates to all the databases occur successfully; otherwise, it rolls back all aspects of the transaction.

  • Persistence: Persistence services simplify the connection between the application and database tiers. Container-managed persistence of entity beans simplifies the coding effort for application developers.

  • Passivation/activation: The mechanism that is used by the container to store an inactive enterprise bean to disk, and restore its state when the bean is invoked. The container uses this mechanism in support of both entity and stateful session beans. This allows the servicing of more active clients by dynamically freeing critical resources such as memory.

  • Clustering: Supports replication of EJBs and services across multiple application server instances installed on the same machine or in different environments. Clustering involves load-balancing the requested services and EJBs among the replicated instances. It also supports fail-over—should one instance fail, the load will be picked up by another.

  • Concurrency: Supports multithreading management. All components must be developed as single-threaded, and the container manages the concurrency and serialization access to the shared resources.

  • Resource pooling: Supports the allocation of a pool of instances, and then assigns them to the requesting clients. When an instance is free, it goes back to the pool. This is applied for JDBC connections, stateless session beans, and entity beans.

Common Horizontal Services

Common horizontal services are the services specified in the J2EE architecture. They're commonly known as J2EE APIs, and are provided by the EJB server to all the containers running on the server. Here's the standard list of the J2EE APIs:

  • Java Naming and Directory Interface (JNDI): Provides Java-technology-enabled applications with a unified interface to multiple naming and directory services in the enterprise.

  • Java Database Connectivity (JDBC): Provides access to virtually any tabular data source for J2EE applications.

  • JavaServer Pages (JSP): Enables Web developers and designers to rapidly develop and easily maintain information-rich, dynamic Web pages that leverage existing business systems.

  • Java Servlet: Provides Web developers with a simple, consistent mechanism for extending the functionality of a Web server and for accessing existing business systems.

  • Java Transaction API (JTA): The standard Java interfaces between a transaction manager and the parties involved in a distributed transaction system: the resource manager, the application server, and the transactional applications.

  • Java Message Service (JMS): A common API and provider framework that enables the development of portable, message-based enterprise applications.

  • J2EE Connector Architecture (JCA): The key component for enterprise application integration in the Java platform. In addition to facilitating enterprise application integration, the JCA helps to integrate existing enterprise applications and information systems with Web services and applications.

  • Java API for XML Processing (JAXP): Enables applications to parse and transform XML documents independent of a particular XML processing implementation.

  • RMI over IIOP (RMI/IIOP): Delivers Common Object Request Broker Architecture (CORBA) distributed computing capabilities to the J2EE platform.

  • Java Authentication and Authorization Security (JAAS): Enables services to authenticate and enforce access controls upon users.

  • JavaMail: Provides a platform- and protocol-independent framework for building Java-technology-based mail and messaging applications.

  • JavaBean Activation Framework (JAF): Standard services used by JavaMail to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and instantiate the appropriate bean to perform said operation.

Common Deployment Tools

These are the deployment services and tools provided by the EJB server; they are also available to the container. Here's a list of these services:

  • Deployment tools: These are used to compile and deploy J2EE applications. They unpack the application package file and interpret all the runtime properties to install the EJB and other components of the applications.

  • Object-relational mapping tools: A new generation of tools, such as TopLink, that map relational data in a database to its object counterpart properties in memory.

  • Monitoring tools: These are used to monitor applications while they are running. Such tools are vital to checking the health of your application, and enable you to provide solutions when issues arise.

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

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