Versions Compared

Key

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

...

The Kernel interface is where it all starts. Looking at the interface in the javadocs (link here), it's easy to be overwhelmed by the many methods, so we'll just focus of a few of them. 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. Finally, how do GBeans get added to the kernel? GBeans are stored in an instance of the BasicRegistry class which is detailed below.

...

Registering a New GBean

In the above class diagram, the Kernel class has a method named loadGBean. This method takes an instance of GBeanData and a classloader as input. Recall from GBeans that GBeans aren't required to implement any interface. So the GBeanData object is a wrapper 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 on. 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. This is because there are four possible ways to reference a GBean. There is the AbstractName, the ShortName, the ObjectName and the class type.