org.apache.geronimo.kernel
Class Kernel

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended byorg.apache.geronimo.kernel.Kernel
All Implemented Interfaces:
KernelMBean, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter

public class Kernel
extends javax.management.NotificationBroadcasterSupport
implements KernelMBean

The core of a Geronimo instance. A Kernel is responsible for managing the Configurations that comprise a Geronimo system and exposing them using JMX. Each Kernel is associated with an MBeanServer that is used to register the Configurations themselves and the MBeans they define.

Dependencies between MBeans are handled by a dedicated DependencyManager that is responsible for tracking those dependencies and ensuring that the dependent objects follow the appropriate lifecycle and receive appropriate notifications.

The Kernel also provides a ConfigurationStore which is used to stage installed Configurations (providing a local filesystem based classpath) and used hold the persistent state of each Configuration. This allows Configurations to restart in he event of system failure.

Version:
$Revision: 1.38 $ $Date: 2004/08/01 02:06:18 $

Field Summary
static javax.management.ObjectName KERNEL
          The JMX name used by a Kernel to register itself when it boots.
 
Constructor Summary
Kernel()
          No-arg constructor allowing this class to be used as a GBean reference.
Kernel(String domainName)
          Construct a Kernel which does not have a config store.
Kernel(String kernelName, String domainName)
          Construct a Kernel which does not have a config store.
 
Method Summary
 void boot()
          Boot this Kernel, triggering the instantiation of the MBeanServer and DependencyManager, and the registration ConfigurationStore
 Object getAttribute(javax.management.ObjectName objectName, String attributeName)
           
 ConfigurationManager getConfigurationManager()
           
 int getConfigurationState(URI configID)
           
 DependencyManager getDependencyManager()
           
static Kernel getKernel(String name)
          Get a particular kernel indexed by a name
 String getKernelName()
          Get the name of this kernel
 javax.management.MBeanServer getMBeanServer()
          Get the MBeanServer used by this kernel
static Kernel getSingleKernel()
          Obtain the single kernel that's registered.
 Object invoke(javax.management.ObjectName objectName, String methodName)
           
 Object invoke(javax.management.ObjectName objectName, String methodName, Object[] args, String[] types)
           
 boolean isLoaded(javax.management.ObjectName name)
           
 boolean isRunning()
           
 List listConfigurations(javax.management.ObjectName storeName)
          Return info about the configurations in a store.
 List listConfigurationStores()
          Return a list of the stores this kernel knows about.
 Set listGBeans(javax.management.ObjectName query)
          Return the names of GBeans that match the query.
 void loadGBean(javax.management.ObjectName name, org.apache.geronimo.gbean.jmx.GBeanMBean gbean)
          Load a specific GBean into this kernel.
 void registerShutdownHook(Runnable hook)
           
 void setAttribute(javax.management.ObjectName objectName, String attributeName, Object attributeValue)
           
 void shutdown()
          Shut down this kernel instance, unregistering the MBeans and releasing the MBeanServer.
 javax.management.ObjectName startConfiguration(URI configID)
           
 void startGBean(javax.management.ObjectName name)
          Start a specific GBean.
 void startRecursiveGBean(javax.management.ObjectName name)
          Start a specific GBean and its children.
 void stopConfiguration(URI configID)
           
 void stopGBean(javax.management.ObjectName name)
          Stop a specific GBean.
 void unloadGBean(javax.management.ObjectName name)
          Unload a specific GBean.
 void unregisterShutdownHook(Runnable hook)
           
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KERNEL

public static final javax.management.ObjectName KERNEL
The JMX name used by a Kernel to register itself when it boots.

Constructor Detail

Kernel

public Kernel()
No-arg constructor allowing this class to be used as a GBean reference.


Kernel

public Kernel(String domainName)
Construct a Kernel which does not have a config store.

Parameters:
domainName - the domain name to be used for the JMX MBeanServer

Kernel

public Kernel(String kernelName,
              String domainName)
Construct a Kernel which does not have a config store.

Parameters:
kernelName - the name of the kernel that uniquely indentifies the kernel in a VM
domainName - the domain name to be used for the JMX MBeanServer
Method Detail

getMBeanServer

public javax.management.MBeanServer getMBeanServer()
Description copied from interface: KernelMBean
Get the MBeanServer used by this kernel

Specified by:
getMBeanServer in interface KernelMBean
Returns:
the MBeanServer used by this kernel

getKernelName

public String getKernelName()
Description copied from interface: KernelMBean
Get the name of this kernel

Specified by:
getKernelName in interface KernelMBean
Returns:
the name of this kernel

getKernel

public static Kernel getKernel(String name)
Get a particular kernel indexed by a name

Parameters:
name - the name of the kernel to be obtained
Returns:
the kernel that was registered with that name

getSingleKernel

public static Kernel getSingleKernel()
Obtain the single kernel that's registered.

This method assumes that there is only one kernel registered and will throw an IllegalStateException if more than one has been registered.

Returns:
the single kernel that's registered
Throws:
IllegalStateException - if more than one

getDependencyManager

public DependencyManager getDependencyManager()

getConfigurationManager

public ConfigurationManager getConfigurationManager()
Specified by:
getConfigurationManager in interface KernelMBean

getAttribute

public Object getAttribute(javax.management.ObjectName objectName,
                           String attributeName)
                    throws Exception
Specified by:
getAttribute in interface KernelMBean
Throws:
Exception

setAttribute

public void setAttribute(javax.management.ObjectName objectName,
                         String attributeName,
                         Object attributeValue)
                  throws Exception
Specified by:
setAttribute in interface KernelMBean
Throws:
Exception

invoke

public Object invoke(javax.management.ObjectName objectName,
                     String methodName)
              throws Exception
Specified by:
invoke in interface KernelMBean
Throws:
Exception

invoke

public Object invoke(javax.management.ObjectName objectName,
                     String methodName,
                     Object[] args,
                     String[] types)
              throws Exception
Specified by:
invoke in interface KernelMBean
Throws:
Exception

isLoaded

public boolean isLoaded(javax.management.ObjectName name)
Specified by:
isLoaded in interface KernelMBean

loadGBean

public void loadGBean(javax.management.ObjectName name,
                      org.apache.geronimo.gbean.jmx.GBeanMBean gbean)
               throws javax.management.InstanceAlreadyExistsException,
                      InvalidConfigException
Description copied from interface: KernelMBean
Load a specific GBean into this kernel. This is intended for applications that are embedding the kernel.

Specified by:
loadGBean in interface KernelMBean
Parameters:
name - the name to register the GBean under
gbean - the GBean to register
Throws:
InvalidConfigException - if there is a problem during registration
javax.management.InstanceAlreadyExistsException - if the name is already used

startGBean

public void startGBean(javax.management.ObjectName name)
                throws javax.management.InstanceNotFoundException,
                       InvalidConfigException
Description copied from interface: KernelMBean
Start a specific GBean.

Specified by:
startGBean in interface KernelMBean
Parameters:
name - the GBean to start
Throws:
javax.management.InstanceNotFoundException - if the GBean could not be found
InvalidConfigException

startRecursiveGBean

public void startRecursiveGBean(javax.management.ObjectName name)
                         throws javax.management.InstanceNotFoundException,
                                InvalidConfigException
Description copied from interface: KernelMBean
Start a specific GBean and its children.

Specified by:
startRecursiveGBean in interface KernelMBean
Parameters:
name - the GBean to start
Throws:
javax.management.InstanceNotFoundException - if the GBean could not be found
InvalidConfigException

stopGBean

public void stopGBean(javax.management.ObjectName name)
               throws javax.management.InstanceNotFoundException,
                      InvalidConfigException
Description copied from interface: KernelMBean
Stop a specific GBean.

Specified by:
stopGBean in interface KernelMBean
Parameters:
name - the GBean to stop
Throws:
javax.management.InstanceNotFoundException - if the GBean could not be found
InvalidConfigException

unloadGBean

public void unloadGBean(javax.management.ObjectName name)
                 throws javax.management.InstanceNotFoundException
Description copied from interface: KernelMBean
Unload a specific GBean. This is intended for applications that are embedding the kernel.

Specified by:
unloadGBean in interface KernelMBean
Parameters:
name - the name of the GBean to unregister
Throws:
javax.management.InstanceNotFoundException - if the GBean could not be found

listGBeans

public Set listGBeans(javax.management.ObjectName query)
Description copied from interface: KernelMBean
Return the names of GBeans that match the query.

Specified by:
listGBeans in interface KernelMBean
Parameters:
query - the query to be performed
Returns:
a Set of the names of online GBeans that match the query

listConfigurationStores

public List listConfigurationStores()
Description copied from interface: KernelMBean
Return a list of the stores this kernel knows about.

Specified by:
listConfigurationStores in interface KernelMBean
Returns:
a List of the stores this kernel controls

listConfigurations

public List listConfigurations(javax.management.ObjectName storeName)
                        throws NoSuchStoreException
Description copied from interface: KernelMBean
Return info about the configurations in a store.

Specified by:
listConfigurations in interface KernelMBean
Parameters:
storeName - the store
Returns:
a List of information about the store's configurations
Throws:
NoSuchStoreException - if this store does not exist

startConfiguration

public javax.management.ObjectName startConfiguration(URI configID)
                                               throws NoSuchConfigException,
                                                      IOException,
                                                      InvalidConfigException
Specified by:
startConfiguration in interface KernelMBean
Throws:
NoSuchConfigException
IOException
InvalidConfigException

stopConfiguration

public void stopConfiguration(URI configID)
                       throws NoSuchConfigException
Specified by:
stopConfiguration in interface KernelMBean
Throws:
NoSuchConfigException

getConfigurationState

public int getConfigurationState(URI configID)
                          throws NoSuchConfigException
Specified by:
getConfigurationState in interface KernelMBean
Throws:
NoSuchConfigException

boot

public void boot()
          throws Exception
Boot this Kernel, triggering the instantiation of the MBeanServer and DependencyManager, and the registration ConfigurationStore

Throws:
Exception - if the boot fails

registerShutdownHook

public void registerShutdownHook(Runnable hook)
Specified by:
registerShutdownHook in interface KernelMBean

unregisterShutdownHook

public void unregisterShutdownHook(Runnable hook)
Specified by:
unregisterShutdownHook in interface KernelMBean

shutdown

public void shutdown()
Shut down this kernel instance, unregistering the MBeans and releasing the MBeanServer.

Specified by:
shutdown in interface KernelMBean

isRunning

public boolean isRunning()
Specified by:
isRunning in interface KernelMBean


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.