The Business Tier


The business tier is where developers create their business logic components. In a J2EE 1.4 server such as Geronimo, the business logic code at the business tier is always encapsulated as Enterprise JavaBeans (EJBs).

Components Deployable at the Business Tier

The only type of software component deployable at the business tier are EJBs. EJBs are specially constructed Java classes coded to the EJB 2.x specification. There are currently three distinct types of EJBs that can reside in the business tier:

  • Session beans

  • Entity beans

  • Message Driven Beans

Of the different types of EJBs, session beans are further divided into stateless session beans and stateful session beans. The session beans exist only in context of a user session. Stateless session beans are typically used to perform operations on entity beans. Stateful session beans maintain state information between invocations; they are useful to hold data that a developer needs to keep around while the application is running but that does not need to be saved to a database.

Entity beans are associated with data stored in a database (typically relational), while Message Driven Beans (MDBs) are called when incoming messages are received by at a specific Java Message Service (JMS) destination.

Figure 4-3 shows the EJBs that can be deployed at the business tier.

image from book
Figure 4-3: EJBs deployable at Geronimo’s business tier

All of these classifications are more important to application developers than to administrators/deployers.

Most EJBs are prebundled as a module for deployment. Geronimo administrators and deployers work with a bundled archive rather than individual EJBs.

An important thing to realize from Figure 4-3 is that entity beans may require the configuration of a Java Database Connectivity (JDBC) data source for storing the related data, and deployment of MDBs may require the configuration and setup of a JMS destination. Of course, code within the EJB implementation may also reference other business-tier EJBs that may not reside within the same archive bundle.

Deployable Module at Geronimo’s Business Tier

EJBs to be deployed to the Geronimo server must be bundled in an EJB JAR file. According to the J2EE 1.4 specifications, the EJBs must be bundled together with a standard deployment descriptor called ejb-jar.xml, placed in the META-INF directory of the archive.

Deploying EJBs As Part of an Enterprise Application

Most likely, especially in production, the EJBs in an EJB JAR file is just a part of a larger enterprise application. In this case, a WAR file (for the Web-tier components) is combined with an EJB JAR file to create a new archive called an Enterprise Application Archive, or an EAR file. An EAR file is just a JAR file with an .ear extension.

An EAR file can contain one or more WAR files containing servlets and JSPs, and one or more JAR files containing EJBs (as well as other resource adapter JARs). It must include a standard deployment descriptor, called application.xml, in the META-INF directory. This deployment descriptor should reference the modules that are a part of the overall enterprise application.

OpenEJB at the Business Tier

The EJB container inside Geronimo is a special version of the OpenEJB version 2.1 container. OpenEJB is an Open Source EJB container, hosted at Codehaus, that is released under the Apache 2.0 license. For more information on OpenEJB, see:

http://openejb.codehaus.org/

The OpenEJB container integration within Geronimo features the following:

  • Support of EJB 2 Container Managed Persistence 2

  • Support of EJB QL

  • Support of EJB 2.1 Web services interoperation

  • CORBA interoperation

The specially adapted OpenEJB container inside Geronimo makes full use of Geronimo’s container services. This includes JNDI support, fully configurable transactional support and security.

Chapter 12 will provide detailed information on the configuration and deployment of EJBs (either alone in an EJB JAR or as a part of an EAR) to the OpenEJB container.

ActiveMQ at the Business Tier

To provide support for MDBs and general message queues (MQ) services for software components, Geronimo uses ActiveMQ. ActiveMQ is a very popular Open Source message queues broker implementation. ActiveMQ provides a JCA 1.5–compatible resource adapter, which is integrated into Geronimo. This allows application developer to use the convenient JMS API to access all the features of ActiveMQ.

ActiveMQ supports MDBs by accepting inbound connections. This means that messages sent to a message destination (such as a JMS topic or queue) can be used to trigger a call to an MDB. This support is leveraged by Geronimo in its MDB implementation.

Chapter 16 provides more details on configuration of ActiveMQ at the business tier.




Professional Apache Geronimo
Professional Apache Geronimo (Wrox Professional Guides)
ISBN: 0471785431
EAN: 2147483647
Year: 2004
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net