org.apache.geronimo.kernel.basic
Class BasicKernel

java.lang.Object
  extended by org.apache.geronimo.kernel.basic.BasicKernel
All Implemented Interfaces:
Kernel

public class BasicKernel
extends Object
implements Kernel

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 the event of system failure. TODO: Describe the order of method invocation (e.g. if loadGbean may be before boot)


Field Summary
 
Fields inherited from interface org.apache.geronimo.kernel.Kernel
KERNEL, KERNEL_NAME
 
Constructor Summary
BasicKernel(String kernelName)
          Construct a Kernel with the specified name.
 
Method Summary
 void boot()
          Boot this Kernel, triggering the instantiation of the MBeanServer and DependencyManager, and the registration of ConfigurationStore
 AbstractName getAbstractNameFor(Object service)
          Assuming the argument represents a service running in the kernel, returns an AbstractName for it.
 Object getAttribute(AbstractName abstractName, String attributeName)
          Gets the value of an attribute on the specified gbean
 Object getAttribute(Class type, String attributeName)
           
 Object getAttribute(ObjectName objectName, String attributeName)
           
 Object getAttribute(String shortName, Class type, String attributeName)
           
 Object getAttribute(String shortName, String attributeName)
           
 Date getBootTime()
          Returns the time this kernel was last booted.
 ClassLoader getClassLoaderFor(AbstractName name)
          Gets the ClassLoader used to register the specified GBean
 ClassLoader getClassLoaderFor(Class type)
           
 ClassLoader getClassLoaderFor(String shortName)
           
 ClassLoader getClassLoaderFor(String shortName, Class type)
           
 DependencyManager getDependencyManager()
          Deprecated. this will be removed as when we add generalized dependencies to gbeans... the only current user is Configuration
 Object getGBean(AbstractName name)
          Gets the specified GBean instance.
 Object getGBean(Class type)
           
 Object getGBean(ObjectName name)
           
 Object getGBean(String shortName)
           
 Object getGBean(String shortName, Class type)
           
 GBeanData getGBeanData(AbstractName name)
          Return the GBeanData for a GBean instance.
 GBeanData getGBeanData(Class type)
           
 GBeanData getGBeanData(String shortName)
           
 GBeanData getGBeanData(String shortName, Class type)
           
 GBeanInfo getGBeanInfo(AbstractName name)
          Return the GBeanInfo for a registered GBean instance.
 GBeanInfo getGBeanInfo(Class type)
           
 GBeanInfo getGBeanInfo(ObjectName name)
           
 GBeanInfo getGBeanInfo(String shortName)
           
 GBeanInfo getGBeanInfo(String shortName, Class type)
           
 long getGBeanStartTime(AbstractName name)
          Gets the time the specified GBean was started
 long getGBeanStartTime(Class type)
           
 long getGBeanStartTime(String shortName)
           
 long getGBeanStartTime(String shortName, Class type)
           
 int getGBeanState(AbstractName name)
          Gets the state of the specified GBean.
 int getGBeanState(Class type)
           
 int getGBeanState(ObjectName name)
           
 int getGBeanState(String shortName)
           
 int getGBeanState(String shortName, Class type)
           
 String getKernelName()
          Get the name of this kernel
 LifecycleMonitor getLifecycleMonitor()
          Deprecated. don't use this yet... it may change or go away
 Naming getNaming()
          Gets the naming system used by this kernel.
 ProxyManager getProxyManager()
          Deprecated. don't use this yet... it may change or go away
 String getShortNameFor(Object service)
          Assuming the argument represents a service running in the kernel, returns the short name of the service.
 String getStateReason(AbstractName abstractName)
          Deprecated. Experimental feature
 Object invoke(AbstractName abstractName, String methodName)
          Invokes a no-argument method on the specified GBean
 Object invoke(AbstractName abstractName, String methodName, Object[] args, String[] types)
          Invokes a method on the specified GBean with the specified arguments
 Object invoke(Class type, String methodName)
           
 Object invoke(Class type, String methodName, Object[] args, String[] types)
           
 Object invoke(ObjectName objectName, String methodName)
           
 Object invoke(ObjectName objectName, String methodName, Object[] args, String[] types)
           
 Object invoke(String shortName, Class type, String methodName)
           
 Object invoke(String shortName, Class type, String methodName, Object[] args, String[] types)
           
 Object invoke(String shortName, String methodName)
           
 Object invoke(String shortName, String methodName, Object[] args, String[] types)
           
 boolean isLoaded(AbstractName name)
          Is there a GBean registered with the kernel under the specified name?
 boolean isLoaded(Class type)
           
 boolean isLoaded(String shortName)
           
 boolean isLoaded(String shortName, Class type)
           
 boolean isRunning()
          Has the kernel been booted
 boolean isRunning(AbstractName name)
          Is there a GBean registered with the kernel under the specified name and is it running?
 boolean isRunning(Class type)
           
 boolean isRunning(String shortName)
           
 boolean isRunning(String shortName, Class type)
           
 Set listGBeans(AbstractNameQuery query)
          Gets the AbstractNames of all GBeans matching the abstractNameQuery.
 Set listGBeans(ObjectName pattern)
          Returns a Set with elements of type ObjectName
 Set listGBeans(Set patterns)
          Returns a Set of all GBeans matching the set of object name pattern
 Set listGBeansByInterface(String[] interfaces)
           
 void loadGBean(GBeanData gbeanData, ClassLoader classLoader)
          Load a specific GBean into this kernel.
 void registerShutdownHook(Runnable hook)
          Registers a runnable to execute when the kernel is shutdown
 void setAttribute(AbstractName abstractName, String attributeName, Object attributeValue)
          Sets the value of an attribute on the specified gbean
 void setAttribute(Class type, String attributeName, Object attributeValue)
           
 void setAttribute(String shortName, Class type, String attributeName, Object attributeValue)
           
 void setAttribute(String shortName, String attributeName, Object attributeValue)
           
 void shutdown()
          Shut down this kernel instance, unregistering the MBeans and releasing the MBeanServer.
 void startGBean(AbstractName name)
          Start a specific GBean.
 void startGBean(Class type)
           
 void startGBean(String shortName)
           
 void startGBean(String shortName, Class type)
           
 void startRecursiveGBean(AbstractName name)
          Start a specific GBean and its children.
 void startRecursiveGBean(Class type)
           
 void startRecursiveGBean(String shortName)
           
 void startRecursiveGBean(String shortName, Class type)
           
 void stopGBean(AbstractName name)
          Stop a specific GBean.
 void stopGBean(Class type)
           
 void stopGBean(String shortName)
           
 void stopGBean(String shortName, Class type)
           
 void unloadGBean(AbstractName name)
          Unload a specific GBean.
 void unloadGBean(Class type)
           
 void unloadGBean(String shortName)
           
 void unloadGBean(String shortName, Class type)
           
 void unregisterShutdownHook(Runnable hook)
          Unregisters a runnable from the list to execute when the kernel is shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicKernel

public BasicKernel(String kernelName)
Construct a Kernel with the specified name.

Parameters:
kernelName - the name of the kernel
Method Detail

getKernelName

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

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

getNaming

public Naming getNaming()
Description copied from interface: Kernel
Gets the naming system used by this kernel.

Specified by:
getNaming in interface Kernel
Returns:
the naming system used by this kernel

getDependencyManager

public DependencyManager getDependencyManager()
Deprecated. this will be removed as when we add generalized dependencies to gbeans... the only current user is Configuration

Description copied from interface: Kernel
Gets the dependency manager kernel service

Specified by:
getDependencyManager in interface Kernel
Returns:
the dependency manager or null if the kernel is not running

getLifecycleMonitor

public LifecycleMonitor getLifecycleMonitor()
Deprecated. don't use this yet... it may change or go away

Gets the lifecycle monitor.

Specified by:
getLifecycleMonitor in interface Kernel
Returns:
the lifecycle monitor or null if the kernel is not running

getProxyManager

public ProxyManager getProxyManager()
Deprecated. don't use this yet... it may change or go away

Gets the proxy manager.

Specified by:
getProxyManager in interface Kernel
Returns:
the proxy manager or null if the kernel is not running

getAttribute

public Object getAttribute(ObjectName objectName,
                           String attributeName)
                    throws GBeanNotFoundException,
                           NoSuchAttributeException,
                           Exception
Specified by:
getAttribute in interface Kernel
Throws:
GBeanNotFoundException
NoSuchAttributeException
Exception

getAttribute

public Object getAttribute(AbstractName abstractName,
                           String attributeName)
                    throws GBeanNotFoundException,
                           NoSuchAttributeException,
                           Exception
Description copied from interface: Kernel
Gets the value of an attribute on the specified gbean

Specified by:
getAttribute in interface Kernel
Parameters:
abstractName - the name of the gbean from which the attribute will be retrieved
attributeName - the name of the attribute to fetch
Returns:
the value of the attribute
Throws:
GBeanNotFoundException - if there is not a gbean under the specified name
NoSuchAttributeException - if the gbean does not contain the specified attribute
Exception - if the gbean throws an exception from the getter

getAttribute

public Object getAttribute(String shortName,
                           String attributeName)
                    throws GBeanNotFoundException,
                           NoSuchAttributeException,
                           Exception
Specified by:
getAttribute in interface Kernel
Throws:
GBeanNotFoundException
NoSuchAttributeException
Exception

getAttribute

public Object getAttribute(Class type,
                           String attributeName)
                    throws GBeanNotFoundException,
                           NoSuchAttributeException,
                           Exception
Specified by:
getAttribute in interface Kernel
Throws:
GBeanNotFoundException
NoSuchAttributeException
Exception

getAttribute

public Object getAttribute(String shortName,
                           Class type,
                           String attributeName)
                    throws GBeanNotFoundException,
                           NoSuchAttributeException,
                           Exception
Specified by:
getAttribute in interface Kernel
Throws:
GBeanNotFoundException
NoSuchAttributeException
Exception

setAttribute

public void setAttribute(AbstractName abstractName,
                         String attributeName,
                         Object attributeValue)
                  throws GBeanNotFoundException,
                         NoSuchAttributeException,
                         Exception
Description copied from interface: Kernel
Sets the value of an attribute on the specified gbean

Specified by:
setAttribute in interface Kernel
Parameters:
abstractName - the name of the gbean from in which the new attribute value will be set
attributeName - the name of the attribute to set
attributeValue - the new value of the attribute
Throws:
GBeanNotFoundException - if there is not a gbean under the specified name
NoSuchAttributeException - if the gbean does not contain the specified attribute
Exception - if the gbean throws an exception from the setter

setAttribute

public void setAttribute(String shortName,
                         String attributeName,
                         Object attributeValue)
                  throws GBeanNotFoundException,
                         NoSuchAttributeException,
                         Exception
Specified by:
setAttribute in interface Kernel
Throws:
GBeanNotFoundException
NoSuchAttributeException
Exception

setAttribute

public void setAttribute(Class type,
                         String attributeName,
                         Object attributeValue)
                  throws GBeanNotFoundException,
                         NoSuchAttributeException,
                         Exception
Specified by:
setAttribute in interface Kernel
Throws:
GBeanNotFoundException
NoSuchAttributeException
Exception

setAttribute

public void setAttribute(String shortName,
                         Class type,
                         String attributeName,
                         Object attributeValue)
                  throws GBeanNotFoundException,
                         NoSuchAttributeException,
                         Exception
Specified by:
setAttribute in interface Kernel
Throws:
GBeanNotFoundException
NoSuchAttributeException
Exception

invoke

public Object invoke(ObjectName objectName,
                     String methodName)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Specified by:
invoke in interface Kernel
Throws:
GBeanNotFoundException
NoSuchOperationException
InternalKernelException
Exception

invoke

public Object invoke(AbstractName abstractName,
                     String methodName)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Description copied from interface: Kernel
Invokes a no-argument method on the specified GBean

Specified by:
invoke in interface Kernel
Parameters:
abstractName - the name of the gbean from in which the new attribute value will be set
methodName - the name of the method to invoke
Returns:
the return value of the method or null if the specified method does not return a value
Throws:
GBeanNotFoundException - if there is not a gbean under the specified name
NoSuchOperationException - if the gbean does not have the specified operation
InternalKernelException - if an error occurs within the kernel itself
Exception - if the method throws an exception

invoke

public Object invoke(String shortName,
                     String methodName)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Specified by:
invoke in interface Kernel
Throws:
GBeanNotFoundException
NoSuchOperationException
InternalKernelException
Exception

invoke

public Object invoke(Class type,
                     String methodName)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Specified by:
invoke in interface Kernel
Throws:
GBeanNotFoundException
NoSuchOperationException
InternalKernelException
Exception

invoke

public Object invoke(String shortName,
                     Class type,
                     String methodName)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Specified by:
invoke in interface Kernel
Throws:
GBeanNotFoundException
NoSuchOperationException
InternalKernelException
Exception

invoke

public Object invoke(ObjectName objectName,
                     String methodName,
                     Object[] args,
                     String[] types)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Specified by:
invoke in interface Kernel
Throws:
GBeanNotFoundException
NoSuchOperationException
InternalKernelException
Exception

invoke

public Object invoke(AbstractName abstractName,
                     String methodName,
                     Object[] args,
                     String[] types)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Description copied from interface: Kernel
Invokes a method on the specified GBean with the specified arguments

Specified by:
invoke in interface Kernel
Parameters:
abstractName - the name of the gbean from in which the new attribute value will be set
methodName - the name of the method to invoke
args - the arguments to pass to the method
types - the types of the arguments; the types are used to determine the signature of the mehod that should be invoked
Returns:
the return value of the method or null if the specified method does not return a value
Throws:
GBeanNotFoundException - if there is not a gbean under the specified name
NoSuchOperationException - if the gbean does not have the specified operation
InternalKernelException - if an error occurs within the kernel itself
Exception - if the method throws an exception

invoke

public Object invoke(String shortName,
                     String methodName,
                     Object[] args,
                     String[] types)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Specified by:
invoke in interface Kernel
Throws:
GBeanNotFoundException
NoSuchOperationException
InternalKernelException
Exception

invoke

public Object invoke(Class type,
                     String methodName,
                     Object[] args,
                     String[] types)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Specified by:
invoke in interface Kernel
Throws:
GBeanNotFoundException
NoSuchOperationException
InternalKernelException
Exception

invoke

public Object invoke(String shortName,
                     Class type,
                     String methodName,
                     Object[] args,
                     String[] types)
              throws GBeanNotFoundException,
                     NoSuchOperationException,
                     InternalKernelException,
                     Exception
Specified by:
invoke in interface Kernel
Throws:
GBeanNotFoundException
NoSuchOperationException
InternalKernelException
Exception

isLoaded

public boolean isLoaded(AbstractName name)
Description copied from interface: Kernel
Is there a GBean registered with the kernel under the specified name?

Specified by:
isLoaded in interface Kernel
Parameters:
name - the name to check
Returns:
true if there is a gbean registered under the specified name; false otherwise

isLoaded

public boolean isLoaded(String shortName)
Specified by:
isLoaded in interface Kernel

isLoaded

public boolean isLoaded(Class type)
Specified by:
isLoaded in interface Kernel

isLoaded

public boolean isLoaded(String shortName,
                        Class type)
Specified by:
isLoaded in interface Kernel

getGBean

public Object getGBean(String shortName)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Specified by:
getGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

getGBean

public Object getGBean(Class type)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Specified by:
getGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

getGBean

public Object getGBean(String shortName,
                       Class type)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Specified by:
getGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

getGBean

public Object getGBean(ObjectName name)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Specified by:
getGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

getGBean

public Object getGBean(AbstractName name)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Description copied from interface: Kernel
Gets the specified GBean instance.

Specified by:
getGBean in interface Kernel
Parameters:
name - the GBean instance to get
Throws:
GBeanNotFoundException - if the GBean could not be found
InternalKernelException - if there is a general error
IllegalStateException - If the gbean is disabled

getGBeanInfo

public GBeanInfo getGBeanInfo(ObjectName name)
                       throws GBeanNotFoundException
Specified by:
getGBeanInfo in interface Kernel
Throws:
GBeanNotFoundException

getGBeanInfo

public GBeanInfo getGBeanInfo(AbstractName name)
                       throws GBeanNotFoundException
Description copied from interface: Kernel
Return the GBeanInfo for a registered GBean instance.

Specified by:
getGBeanInfo in interface Kernel
Parameters:
name - the name of the GBean whose info should be returned
Returns:
the info for that instance
Throws:
GBeanNotFoundException - if there is no instance with the supplied name

getGBeanInfo

public GBeanInfo getGBeanInfo(String shortName)
                       throws GBeanNotFoundException
Specified by:
getGBeanInfo in interface Kernel
Throws:
GBeanNotFoundException

getGBeanInfo

public GBeanInfo getGBeanInfo(Class type)
                       throws GBeanNotFoundException
Specified by:
getGBeanInfo in interface Kernel
Throws:
GBeanNotFoundException

getGBeanInfo

public GBeanInfo getGBeanInfo(String shortName,
                              Class type)
                       throws GBeanNotFoundException
Specified by:
getGBeanInfo in interface Kernel
Throws:
GBeanNotFoundException

getGBeanData

public GBeanData getGBeanData(AbstractName name)
                       throws GBeanNotFoundException,
                              InternalKernelException
Description copied from interface: Kernel
Return the GBeanData for a GBean instance.

Specified by:
getGBeanData in interface Kernel
Parameters:
name - the name of the GBean whose info should be returned
Returns:
the info for that instance
Throws:
GBeanNotFoundException - if there is no instance with the supplied name
InternalKernelException

getGBeanData

public GBeanData getGBeanData(String shortName)
                       throws GBeanNotFoundException,
                              InternalKernelException
Specified by:
getGBeanData in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException

getGBeanData

public GBeanData getGBeanData(Class type)
                       throws GBeanNotFoundException,
                              InternalKernelException
Specified by:
getGBeanData in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException

getGBeanData

public GBeanData getGBeanData(String shortName,
                              Class type)
                       throws GBeanNotFoundException,
                              InternalKernelException
Specified by:
getGBeanData in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException

loadGBean

public void loadGBean(GBeanData gbeanData,
                      ClassLoader classLoader)
               throws GBeanAlreadyExistsException,
                      InternalKernelException
Description copied from interface: Kernel
Load a specific GBean into this kernel. This is intended for applications that are embedding the kernel.

Specified by:
loadGBean in interface Kernel
Parameters:
gbeanData - the GBean to load
classLoader - the class loader to use to load the gbean
Throws:
GBeanAlreadyExistsException - if the name is already used
InternalKernelException - if there is a problem during registration

startGBean

public void startGBean(AbstractName name)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Description copied from interface: Kernel
Start a specific GBean.

Specified by:
startGBean in interface Kernel
Parameters:
name - the GBean to start
Throws:
GBeanNotFoundException - if the GBean could not be found
InternalKernelException - if there GBean is not state manageable or if there is a general error
IllegalStateException - If the gbean is disabled

startGBean

public void startGBean(String shortName)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Specified by:
startGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

startGBean

public void startGBean(Class type)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Specified by:
startGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

startGBean

public void startGBean(String shortName,
                       Class type)
                throws GBeanNotFoundException,
                       InternalKernelException,
                       IllegalStateException
Specified by:
startGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

startRecursiveGBean

public void startRecursiveGBean(AbstractName name)
                         throws GBeanNotFoundException,
                                InternalKernelException,
                                IllegalStateException
Description copied from interface: Kernel
Start a specific GBean and its children.

Specified by:
startRecursiveGBean in interface Kernel
Parameters:
name - the GBean to start
Throws:
GBeanNotFoundException - if the GBean could not be found
InternalKernelException - if there GBean is not state manageable or if there is a general error
IllegalStateException - If the gbean is disabled

startRecursiveGBean

public void startRecursiveGBean(String shortName)
                         throws GBeanNotFoundException,
                                InternalKernelException,
                                IllegalStateException
Specified by:
startRecursiveGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

startRecursiveGBean

public void startRecursiveGBean(Class type)
                         throws GBeanNotFoundException,
                                InternalKernelException,
                                IllegalStateException
Specified by:
startRecursiveGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

startRecursiveGBean

public void startRecursiveGBean(String shortName,
                                Class type)
                         throws GBeanNotFoundException,
                                InternalKernelException,
                                IllegalStateException
Specified by:
startRecursiveGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

isRunning

public boolean isRunning(AbstractName name)
Description copied from interface: Kernel
Is there a GBean registered with the kernel under the specified name and is it running?

Specified by:
isRunning in interface Kernel
Parameters:
name - the name to check
Returns:
true if there is a gbean registered under the specified name and is it running; false otherwise

isRunning

public boolean isRunning(String shortName)
Specified by:
isRunning in interface Kernel

isRunning

public boolean isRunning(Class type)
Specified by:
isRunning in interface Kernel

isRunning

public boolean isRunning(String shortName,
                         Class type)
Specified by:
isRunning in interface Kernel

stopGBean

public void stopGBean(AbstractName name)
               throws GBeanNotFoundException,
                      InternalKernelException,
                      IllegalStateException
Description copied from interface: Kernel
Stop a specific GBean.

Specified by:
stopGBean in interface Kernel
Parameters:
name - the GBean to stop
Throws:
GBeanNotFoundException - if the GBean could not be found
InternalKernelException - if there GBean is not state manageable or if there is a general error
IllegalStateException - If the gbean is disabled

stopGBean

public void stopGBean(String shortName)
               throws GBeanNotFoundException,
                      InternalKernelException,
                      IllegalStateException
Specified by:
stopGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

stopGBean

public void stopGBean(Class type)
               throws GBeanNotFoundException,
                      InternalKernelException,
                      IllegalStateException
Specified by:
stopGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

stopGBean

public void stopGBean(String shortName,
                      Class type)
               throws GBeanNotFoundException,
                      InternalKernelException,
                      IllegalStateException
Specified by:
stopGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

unloadGBean

public void unloadGBean(AbstractName name)
                 throws GBeanNotFoundException,
                        InternalKernelException,
                        IllegalStateException
Description copied from interface: Kernel
Unload a specific GBean. This is intended for applications that are embedding the kernel.

Specified by:
unloadGBean in interface Kernel
Parameters:
name - the name of the GBean to unregister
Throws:
GBeanNotFoundException - if the GBean could not be found
InternalKernelException - if there GBean is a problem while unloading the GBean
IllegalStateException

unloadGBean

public void unloadGBean(String shortName)
                 throws GBeanNotFoundException,
                        InternalKernelException,
                        IllegalStateException
Specified by:
unloadGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

unloadGBean

public void unloadGBean(Class type)
                 throws GBeanNotFoundException,
                        InternalKernelException,
                        IllegalStateException
Specified by:
unloadGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

unloadGBean

public void unloadGBean(String shortName,
                        Class type)
                 throws GBeanNotFoundException,
                        InternalKernelException,
                        IllegalStateException
Specified by:
unloadGBean in interface Kernel
Throws:
GBeanNotFoundException
InternalKernelException
IllegalStateException

getGBeanState

public int getGBeanState(ObjectName name)
                  throws GBeanNotFoundException
Specified by:
getGBeanState in interface Kernel
Throws:
GBeanNotFoundException

getGBeanState

public int getGBeanState(AbstractName name)
                  throws GBeanNotFoundException
Description copied from interface: Kernel
Gets the state of the specified GBean.

Specified by:
getGBeanState in interface Kernel
Parameters:
name - the name of the GBean
Returns:
the state of the GBean
Throws:
GBeanNotFoundException - if the GBean could not be found

getGBeanState

public int getGBeanState(String shortName)
                  throws GBeanNotFoundException
Specified by:
getGBeanState in interface Kernel
Throws:
GBeanNotFoundException

getGBeanState

public int getGBeanState(Class type)
                  throws GBeanNotFoundException
Specified by:
getGBeanState in interface Kernel
Throws:
GBeanNotFoundException

getGBeanState

public int getGBeanState(String shortName,
                         Class type)
                  throws GBeanNotFoundException
Specified by:
getGBeanState in interface Kernel
Throws:
GBeanNotFoundException

getGBeanStartTime

public long getGBeanStartTime(AbstractName name)
                       throws GBeanNotFoundException
Description copied from interface: Kernel
Gets the time the specified GBean was started

Specified by:
getGBeanStartTime in interface Kernel
Parameters:
name - the name of the GBean
Returns:
the start time of the GBean or 0 if not running
Throws:
GBeanNotFoundException - if the GBean could not be found

getGBeanStartTime

public long getGBeanStartTime(String shortName)
                       throws GBeanNotFoundException
Specified by:
getGBeanStartTime in interface Kernel
Throws:
GBeanNotFoundException

getGBeanStartTime

public long getGBeanStartTime(Class type)
                       throws GBeanNotFoundException
Specified by:
getGBeanStartTime in interface Kernel
Throws:
GBeanNotFoundException

getGBeanStartTime

public long getGBeanStartTime(String shortName,
                              Class type)
                       throws GBeanNotFoundException
Specified by:
getGBeanStartTime in interface Kernel
Throws:
GBeanNotFoundException

listGBeans

public Set listGBeans(ObjectName pattern)
Description copied from interface: Kernel
Returns a Set with elements of type ObjectName

Specified by:
listGBeans in interface Kernel

listGBeans

public Set listGBeans(Set patterns)
Description copied from interface: Kernel
Returns a Set of all GBeans matching the set of object name pattern

Specified by:
listGBeans in interface Kernel
Parameters:
patterns - the queries to execute
Returns:
a List of AbstractNameName of matching GBeans registered with this kernel

listGBeans

public Set listGBeans(AbstractNameQuery query)
Description copied from interface: Kernel
Gets the AbstractNames of all GBeans matching the abstractNameQuery.

Specified by:
listGBeans in interface Kernel
Parameters:
query - the query to execute
Returns:
the AbstractNames of all matching GBeans

listGBeansByInterface

public Set listGBeansByInterface(String[] interfaces)

getAbstractNameFor

public AbstractName getAbstractNameFor(Object service)
Description copied from interface: Kernel
Assuming the argument represents a service running in the kernel, returns an AbstractName for it. If the argument is not a service or the kernel cannot produce an AbstractName for it, returns null.

Specified by:
getAbstractNameFor in interface Kernel

getShortNameFor

public String getShortNameFor(Object service)
Description copied from interface: Kernel
Assuming the argument represents a service running in the kernel, returns the short name of the service. If the argument is not a service, returns null.

Specified by:
getShortNameFor in interface Kernel

boot

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

Specified by:
boot in interface Kernel
Throws:
Exception - if the boot fails

getBootTime

public Date getBootTime()
Description copied from interface: Kernel
Returns the time this kernel was last booted.

Specified by:
getBootTime in interface Kernel
Returns:
the time this kernel was last booted; null if the kernel has not been

registerShutdownHook

public void registerShutdownHook(Runnable hook)
Description copied from interface: Kernel
Registers a runnable to execute when the kernel is shutdown

Specified by:
registerShutdownHook in interface Kernel
Parameters:
hook - a runnable to execute when the kernel is shutdown

unregisterShutdownHook

public void unregisterShutdownHook(Runnable hook)
Description copied from interface: Kernel
Unregisters a runnable from the list to execute when the kernel is shutdown

Specified by:
unregisterShutdownHook in interface Kernel
Parameters:
hook - the runnable that should be removed

shutdown

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

Specified by:
shutdown in interface Kernel

isRunning

public boolean isRunning()
Description copied from interface: Kernel
Has the kernel been booted

Specified by:
isRunning in interface Kernel
Returns:
true if the kernel has been booted; false otherwise

getClassLoaderFor

public ClassLoader getClassLoaderFor(AbstractName name)
                              throws GBeanNotFoundException
Description copied from interface: Kernel
Gets the ClassLoader used to register the specified GBean

Specified by:
getClassLoaderFor in interface Kernel
Parameters:
name - the name of the gbean from which the class loader should be extracted
Returns:
the class loader associated with the specified GBean
Throws:
GBeanNotFoundException - if the specified GBean is not registered with the kernel

getClassLoaderFor

public ClassLoader getClassLoaderFor(String shortName)
                              throws GBeanNotFoundException
Specified by:
getClassLoaderFor in interface Kernel
Throws:
GBeanNotFoundException

getClassLoaderFor

public ClassLoader getClassLoaderFor(Class type)
                              throws GBeanNotFoundException
Specified by:
getClassLoaderFor in interface Kernel
Throws:
GBeanNotFoundException

getClassLoaderFor

public ClassLoader getClassLoaderFor(String shortName,
                                     Class type)
                              throws GBeanNotFoundException
Specified by:
getClassLoaderFor in interface Kernel
Throws:
GBeanNotFoundException

getStateReason

public String getStateReason(AbstractName abstractName)
Deprecated. Experimental feature

Specified by:
getStateReason in interface Kernel


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