org.apache.avalon.merlin.kernel.impl
Class DefaultKernel

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended byorg.apache.avalon.merlin.kernel.impl.DefaultKernel
All Implemented Interfaces:
Controller, DefaultKernelMBean, Home, Kernel, javax.management.NotificationBroadcaster

public class DefaultKernel
extends javax.management.NotificationBroadcasterSupport
implements Kernel, DefaultKernelMBean

Implementation of the default Merlin Kernel.

Version:
$Revision: 1.15 $ $Date: 2003/09/14 13:11:34 $
Author:
Avalon Development Team

Constructor Summary
DefaultKernel(KernelContext context)
          Creation of a new Merlin Kernel.
DefaultKernel(javax.management.MBeanServer server, KernelContext context)
          Creation of a new Merlin Kernel.
 
Method Summary
 String getHomeDirectoryPath()
          Return the home path
 String getKernelState()
          Return the state of the kernel.
 String getLibraryDirectoryPath()
          Return the library path
 long getMemoryFree()
          Return an approximation to the total amount of memory currently available for future allocated objects, measured in bytes.
 long getMemoryTotal()
          Returns the total amount of memory in the Java virtual machine.
 int getMemoryVariableRatio()
          Return the percentage of free memory available.
 String getRepositoryDirectoryPath()
          Return the runtime repository path.
 String getTempDirectoryPath()
          Return the temporary directory path
 int getThreadCount()
          Return the number of active threads.
 void release(Object source, Object instance)
          Release an object
 Object resolve(Object source)
          Resolve a object to a value.
 Object resolve(Object source, Class[] ref)
          Resolve a object to a value relative to a supplied set of interface classes.
 void shutdown()
          Shutdown the kernel during which orderly shutdown of all installed blocks is undertaken.
 void startup()
          Initiate the establishment of the root container.
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultKernel

public DefaultKernel(KernelContext context)
              throws KernelException
Creation of a new Merlin Kernel.

Parameters:
context - the kernel context
Throws:
KKernelException - if a kernel creation error occurs
KernelException

DefaultKernel

public DefaultKernel(javax.management.MBeanServer server,
                     KernelContext context)
              throws KernelException
Creation of a new Merlin Kernel.

Parameters:
context - the kernel context
Throws:
KernelException - if a kernel creation error occurs
Method Detail

getKernelState

public String getKernelState()
Return the state of the kernel.

Specified by:
getKernelState in interface DefaultKernelMBean
Returns:
a string representing the kernel state

getMemoryFree

public long getMemoryFree()
Return an approximation to the total amount of memory currently available for future allocated objects, measured in bytes.

Specified by:
getMemoryFree in interface DefaultKernelMBean
Returns:
the number of bytes of estimated free memory

getMemoryTotal

public long getMemoryTotal()
Returns the total amount of memory in the Java virtual machine. The value returned by this method may vary over time, depending on the host environment.

Specified by:
getMemoryTotal in interface DefaultKernelMBean
Returns:
the total amount of memory currently available for current and future objects, measured in bytes.

getMemoryVariableRatio

public int getMemoryVariableRatio()
Return the percentage of free memory available.

Specified by:
getMemoryVariableRatio in interface DefaultKernelMBean
Returns:
the free memory percentage

getThreadCount

public int getThreadCount()
Return the number of active threads.

Specified by:
getThreadCount in interface DefaultKernelMBean
Returns:
the active thread count

getRepositoryDirectoryPath

public String getRepositoryDirectoryPath()
Return the runtime repository path.

Specified by:
getRepositoryDirectoryPath in interface DefaultKernelMBean
Returns:
the repository path

getHomeDirectoryPath

public String getHomeDirectoryPath()
Return the home path

Specified by:
getHomeDirectoryPath in interface DefaultKernelMBean
Returns:
the home path (possibly null)

getTempDirectoryPath

public String getTempDirectoryPath()
Return the temporary directory path

Specified by:
getTempDirectoryPath in interface DefaultKernelMBean
Returns:
the path (possibly null)

getLibraryDirectoryPath

public String getLibraryDirectoryPath()
Return the library path

Specified by:
getLibraryDirectoryPath in interface DefaultKernelMBean
Returns:
the path (possibly null)

resolve

public Object resolve(Object source)
               throws Exception
Resolve a object to a value.

Specified by:
resolve in interface Home
Parameters:
source - the context within the the resolution is applied
Returns:
the resolved object
Throws:
Exception - if an error occurs

resolve

public Object resolve(Object source,
                      Class[] ref)
               throws Exception
Resolve a object to a value relative to a supplied set of interface classes.

Specified by:
resolve in interface Home
Parameters:
source - the aquiring source
ref - the castable service classes
Returns:
the resolved object
Throws:
Exception - if an error occurs

release

public void release(Object source,
                    Object instance)
Release an object

Specified by:
release in interface Home
Parameters:
source - the client that obtained the intial reference
instance - the object to be released

startup

public void startup()
             throws Exception
Initiate the establishment of the root container.

Specified by:
startup in interface Controller
Throws:
Exception - if a startup error occurs

shutdown

public void shutdown()
Shutdown the kernel during which orderly shutdown of all installed blocks is undertaken.

Specified by:
shutdown in interface Controller


Copyright © Apache Software Foundation. All Rights Reserved.