Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The above diagram is a basic a layout of how the Kernel component works. The Geronimo Console is a web based way to start/stop applications, change JMS information etc. If a user wanted to stop an application, for example. The , the user would log into the web console and select the application to stop. When the action to stop the application occured, the web console wouldn't access tomcat Tomcat directly. Instead the web console would communicate with the kernel and then the kernel would reflectively execute the appropriate stop function in Tomcat. Note that this allows testing of the web console, the kernel and Tomcat separately from each other. Also note that the Kernel module is accessed via the Kernel interface. All of the operations on the GBean occur via calls to an implementation of the Kernel interface. Behind the scenes, the BasicKernel class that implements the Kernel interface employs the assitance of other classes, but these are hiddent behind the Kernel interface.

Kernel

The Kernel interface is where it all starts. Below is a class diagram of Geronimo kernel. Note that many details have been ommitted, such as each of the methods of the Kernel interface, so as to not cloud the core concepts of the kernel.

...

The purpose of the kernel is to operate on GBeans that are hooked into Geronimo. In the above diagram, Kernel is an Interface and BasicKernel and KernelGBean are shown to implement that interface. The kernel is wrapped in a GBean just like Tomcat or ActiveMQ are. To achieve this, KernelGBean is a Decorator of Kernel. An instance of Kernel is passed in via the constructor and so all of the methods of Kernel are delegated to that instance. The new functionality that is added to Kernel is the getGBeanInfo method, needed to make Kernel a GBean. BasicKernel is the concrete implementation of Kernel that has the functionality to manipulate GBeans. Calling getAttribute for a given GBean will return the results of calling the getter method passed in via the method paramters (those parameters will be discussed in detail below. The invoke() methods, similar to the getAttribute() methods, will execute a particular method on the GBean. Note other normal operations that you'd want are there as well, like starting or stopping a GBean.

...

Referencing GBeans

In the above class diagram, the Kernel class has a method named loadGBean. This method takes an instance of GBeanData (which is essentially just a wrapper around GBean information) and a classloader as input. Recall from GBeans that GBeans aren't required to implement any interface. So the GBeanData object is a wrapper wraps information on how the GBean should be accessed (it's name) and methods/attributes of that GBean. BasicKernel takes the GBeanData and passes it with other information to the GBeanInstance constructor. GBeanInstance is what all of the methods that relate to GBeans will operate onGBeanInstance to create the object that will be used for all references to that GBean. GBeanInstance has all of the methods that are able to be called, links to the references and dependencies on the other GBeans etc. One of the most important pieces of information that is contained in the GBeanInstance is how it's referenced. Looking through the javadocs for the kernel (link here) will reveal that many of the methods in the interface are overridden four times. Each of these overridden methods have similar method signatures. This is because there are four possible ways to reference a GBean. There is the AbstractNameabstract name, the ShortName, the ObjectName and the class typeshort name, the object name and the class type. Below is a table of the four types with definitions of each of the names:

Name

Object Type

Description

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0dd1ce50-820b-4ffe-9b85-229bd9c77cce"><ac:plain-text-body><![CDATA[

Abstract Name

AbstractName

Geronimo specific name of the object. It's a URI that uniquely identifies a given GBean. From the javadocs, it is defined by: [vendorId]/artifactId/[version]/[type]?key=value[,key=value][,...]

]]></ac:plain-text-body></ac:structured-macro>

Object Name

ObjectName

JMX name for a GBean. This is required by the JMX spec and would be used by JMX based tools to reference GBean objects

Short Name

String

Will reference a GBean by name (a key/value pair of the Abstract Name)

Type

Class

References based on type from the URI in the Abstract Name

Although there are four ways to access a GBean, essentially there are only two, and then two short-hand ways. If a bean is referenced via a Short Name, or via it's Type, all of the abstract names are queried looking for which abstract name the type or short name belongs to. Then once that is found, it is referenced by Abstract Name. In the BasicRegistry, there are two data structures of GBean references. One for Object Names and one for GBeans. When a GBean is added an entry is made for both to enable fast searching by Abstract Name or by Object Name.