Pentagaia toolbox - Start

Back to start-docs .

Installing a kernel hack

What does this mean? Installing a kernel hack means to fetch the lifecycle of the kernel or customize the behavior. You should read how to install a sun service first.

Implement the interface IPdsKernelProvider and install it as a service. Your service will only be loaded if the configuration property com.pentagaia.tb.start.Secured.Providers lists it or is not defined. See the description in the start-docs .

The method onPreStartup will be called during startup phase before the pds kernel exists . But you will get some kind of pre kernel instance and this instance allows to install various helper classes (meaning the hacks).

Available kernel hacks

The kernel listener

The kernel listener provides a callback object that listens on various kernel events. If you need to know when the pds kernel is available or when all services are loaded and started, implement and install a kernel listener. This hack is meant to fetch the kernel lifecycle.

App kernel app context

The pentagaia project requires dynamic installation of additional services and managers. This interface will be used as some kind of wrapper to extend the default AppKernelAppContext implementation. There can only be one instance per kernel. Whenever you need to replace manager and service implementations dynamically at runtime you should use this hack.

Class loader extension

You are able to extends the class loading. You may add access to your own class loaders or may want to manipulate the byte code before the class is loaded. You will find a detailed description of this feature in the class loading doc .

Property parser

Before the kernel is started you may want to verify or manipulate the properties. There are two properties available: The system property (=sgs configuration file) and the application properties. Do you want to complain a missing property before the kernel starts up? Do you want to manipulate the properties before the kernel starts?

NOTE:
If you use properties inside your kernel provider or sub classes it is creating be aware that you may not be notified about changing properties. You will only see the properties as they are present during startup phase. There is no guaranteed order of the kernel providers.

The kernel core

The kernel core represents the instance of com.sun.sgs.impl.kernel.Kernel. However this is package private and may not be visible to your application so we return an object here. But some extensions may need to access the kernel object and fields.

The component registry

The component registry represents the same object that is given to a service constructor. It contains various core components (f.e. DataService).