GBeans in Geronimo


You may have heard that Geronimo is all about GBeans. This simplified generalization is actually not too far from the truth.

A GBean is a Geronimo-Bean. In fact, all of the software components running inside a Geronimo server are GBeans. Like a regular JavaBean, a GBean has properties that can be accessed, and methods that can be invoked. Figure 5-1 provides an overview of a running Geronimo server.

image from book
Figure 5-1: Running Geronimo server comprises GBeans and a kernel

In Figure 5-1, note the following two sets of architectural components that make up a running Geronimo server:

  • Geronimo kernel

  • GBeans

If you could actually take a look inside a running Geronimo server, you would see that GBeans make up the bulk of the executing code, while the kernel occupies a very small footprint and is a very thin core layer of code.

The Geronimo kernel provides the GBean components with well-defined kernel-provided services. This set of services includes the following:

  • Configuration management

  • Lifecycle management

  • Manageability implementation

Each GBean hosted inside Geronimo can take advantage of any of these kernel-provided services.

GBeans and Modules

The Geronimo kernel provides GBeans with a configuration management service. In a nutshell, configuration management is the ability to handle specific grouping of GBeans as individual units.

Essentially, the Geronimo kernel can wire up a bunch of GBeans to form a larger grouping called a module. The kernel can provide the capability to persist these modules to permanent storage or to reconstruct the GBean grouping from a persisted image.

In creating a Geronimo configuration, you can alter the run-time behavior of a GBean by setting attributes to specific values. For example, a Tomcat HTTP 1.1 connector may be a GBean within the Tomcat server module. You may set the port number used by the connector by setting the value of the port attribute on this GBean. A module (or a specific configuration of a grouping of GBeans) in Geronimo is specified in a deployment plan. The deployment plan spells out in detail how a set of GBeans is to be configured together (the specific values for the GBean attributes and how they are related to one another).

Some readers may recognize this style of GBean wiring as very similar to the components wiring mechanism of the Spring Framework (an Open Source component system wiring framework - see www.springframework.org). Indeed, Geronimo’s XML-based component wiring mechanism is inspired by Spring.

Figure 5-2 illustrates how the Geronimo kernel performs configuration management.

image from book
Figure 5-2: Geronimo kernel configuration management service

In Figure 5-2, you can see that Module 1, Module 2, and Module 3 all consist of different GBeans running. For example, you may think of Module 1 as a Web application running in Tomcat, while Module 2 is a bunch of EJBs you have deployed to OpenEJB, and Module 3 may be a Web service that you have deployed in Geronimo.

Once the modules are deployed to the Geronimo server, the kernel keeps a image of the configuration in the repository. This allows the kernel to quickly restore the running configurations when the server restarts.

Later in this chapter, the section Configuration Management with Geronimo provides more details on how module images are kept in the Geronimo repository.

GBean Lifecycle Management

All the J2EE server components that you have seen in Chapter 4 are actually composed of GBeans. GBeans are the smallest chunk of code that the Geronimo kernel works with. The lifecycle of a GBean is managed by the Geronimo kernel. This means that the kernel can create a GBean instance and start, stop, and destroy it at any time.

Conceptually, then, the Geronimo server is able to deploy, start, and stop modules. Modules consist of grouping of GBeans. The Geronimo server starts and stops these groups of GBeans via its kernel.

GBeans and Manageability

A GBean can optionally expose attributes and operations (properties and methods, in system-management terms) through a Java standard management interface called Java Management Extension (JMX). (See http://java.sun.com/products/JavaManagement/index.jsp.) The Geronimo kernel provides this manageability service to any GBean that wishes to take advantage of it. The creator of the Geronimo GBean needs to write very little code to enable this manageability capability. Not all GBeans take advantage of this capability, however.




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