org.apache.avalon.merlin.impl
Class DefaultKernel

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

public class DefaultKernel
extends NotificationBroadcasterSupport
implements Kernel, DefaultKernelMBean

Implementation of the default Merlin Kernel.

Version:
$Revision: 1.1 $ $Date: 2003/12/08 15:37:13 $
Author:
Avalon Development Team

Constructor Summary
DefaultKernel(Logger logger, KernelCriteria criteria, Block system, Block application)
          Creation of a new Merlin Kernel.
 
Method Summary
 String getAnchorPath()
          Return the anchor directory to be used when resolving library declarations in classload specifications.
 Block getBlock()
          Return the root application block.
 String getConfigPath()
          Return the root directory to the merlin configurations
 String getContextPath()
          Return the context directory from which relative runtime home directories will be established for components referencing urn:avalon:home
 String getHomePath()
          Return the root directory to the merlin installation
 String getKernelPath()
          Return the url to the kernel confiuration
 String getKernelState()
          Return the state of the kernel.
 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 getRepositoryDirectory()
          Return the root directory to the shared repository.
 String getSystemPath()
          Return the root directory to the merlin system repository
 String getTempPath()
          Return the temporary directory.
 int getThreadCount()
          Return the number of active threads.
 String getWorkingPath()
          Return the working client directory.
 boolean isDebugEnabled()
          Return debug policy.
 boolean isInfoEnabled()
          Return info generation policy.
 Appliance locate(String path)
          Return the block matching the supplied path.
 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(Logger logger,
                     KernelCriteria criteria,
                     Block system,
                     Block application)
              throws KernelException
Creation of a new Merlin Kernel.

Parameters:
logger - the assigned logging channel
criteria - the kernel creation criteria
system - the system block
application - the application block
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

getRepositoryDirectory

public String getRepositoryDirectory()
Return the root directory to the shared repository.

Specified by:
getRepositoryDirectory in interface DefaultKernelMBean
Returns:
the avalon home root repository directory

getHomePath

public String getHomePath()
Return the root directory to the merlin installation

Specified by:
getHomePath in interface DefaultKernelMBean
Returns:
the merlin home directory

getSystemPath

public String getSystemPath()
Return the root directory to the merlin system repository

Specified by:
getSystemPath in interface DefaultKernelMBean
Returns:
the merlin system repository directory

getConfigPath

public String getConfigPath()
Return the root directory to the merlin configurations

Specified by:
getConfigPath in interface DefaultKernelMBean
Returns:
the merlin configuration directory

getKernelPath

public String getKernelPath()
Return the url to the kernel confiuration

Specified by:
getKernelPath in interface DefaultKernelMBean
Returns:
the kernel configuration url

getWorkingPath

public String getWorkingPath()
Return the working client directory.

Specified by:
getWorkingPath in interface DefaultKernelMBean
Returns:
the working directory

getTempPath

public String getTempPath()
Return the temporary directory.

Specified by:
getTempPath in interface DefaultKernelMBean
Returns:
the temp directory

getContextPath

public String getContextPath()
Return the context directory from which relative runtime home directories will be established for components referencing urn:avalon:home

Specified by:
getContextPath in interface DefaultKernelMBean
Returns:
the working directory

getAnchorPath

public String getAnchorPath()
Return the anchor directory to be used when resolving library declarations in classload specifications.

Specified by:
getAnchorPath in interface DefaultKernelMBean
Returns:
the anchor directory

isInfoEnabled

public boolean isInfoEnabled()
Return info generation policy. If TRUE the parameters related to deployment will be listed on startup.

Specified by:
isInfoEnabled in interface DefaultKernelMBean
Returns:
the info policy

isDebugEnabled

public boolean isDebugEnabled()
Return debug policy. If TRUE all logging channels will be set to debug level (useful for debugging).

Specified by:
isDebugEnabled in interface DefaultKernelMBean
Returns:
the debug policy

locate

public Appliance locate(String path)
                 throws KernelException
Return the block matching the supplied path.

Specified by:
locate in interface Kernel
Parameters:
path - an appliance path
Returns:
the corresponding appliance
Throws:
KernelException

getBlock

public Block getBlock()
Return the root application block.

Specified by:
getBlock in interface Kernel
Returns:
the application containment block

startup

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

Specified by:
startup in interface KernelController
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 KernelController


Copyright © Apache Software Foundation. All Rights Reserved.