org.sape.carbon.services.carbonmanagement
Class DefaultCarbonManagementServiceImpl

java.lang.Object
  |
  +--org.sape.carbon.services.carbonmanagement.DefaultCarbonManagementServiceImpl
All Implemented Interfaces:
CarbonManagementService, Configurable, FunctionalInterface

public class DefaultCarbonManagementServiceImpl
extends Object
implements CarbonManagementService, Configurable

Default implementation of CarbonManagementService Copyright 2002 Sapient

Since:
carbon 1.2
Version:
$Revision: 1.10 $($Author: atayal $ / $Date: 2003/04/29 13:40:30 $)
Author:
Douglas Voet, Dec 19, 2002

Field Summary
private static String ARROW
          String constant for drawing a text arrow.
private  CarbonManagementServiceConfiguration config
          Holds the components configuration.
private  org.apache.commons.logging.Log log
          Provides a handle to Apache-commons logger
private static String NEW_LINE
          String constant for generating a new line.
private static String TAB
          String constant for a tab without child.
private static String TAB_WITH_CHILD
          String constant for a tab with child.
 
Constructor Summary
DefaultCarbonManagementServiceImpl()
           
 
Method Summary
private  void appendSubtreeToBuffer(StringBuffer buffer, Node subtree, int depth)
          Recursive method that does a depth first traversal of the configuration node hierachy, appending the text representation of the subtree to the buffer.
 void configure(ComponentConfiguration configuration)
          Configures the component.
 int getActiveThreadCount()
          Retrieves the number of active threads in the JVM
 int getActiveThreadGroupCount()
          Retrieves the number of active thread groups in the JVM
 int getAvailableProcessors()
          Retrieves the number of processes available to this JVM
 String getDeploymentProperties()
          This implementation uses configuration to specify which deployment properties to return.
 String getDeploymentProperty(String propertyName)
          Returns the value of the specified deployment property.
 Map getDeploymentPropertyMap()
          This implementation uses configuration to specify which deployment properties to return.
 long getFreeMemory()
          Retrieves the free memory available to the JVM
 long getMaximumMemory()
          Retrieves the amount of memory the JVM may attempt to use
private  ThreadGroup getRootThreadGroup()
          Gets the root thread group in the system.
 long getTotalMemory()
          Retrieves the amount of memory researved by the JVM
 void loadComponent(String componentName)
          Loads the component specified by componentName.
 void refreshAllComponentConfigurations()
          Refreshes all the components loaded in the system.
 void refreshAllConfigurations()
          Refreshes all configurations loaded in the system.
 void refreshConfiguration(String configuationPath)
          Forces a configuration to refresh from the store.
 String viewConfigurationTree()
          Generates an HTML representation of the configuration tree.
 String viewConfigurationXML(String configuationPath)
          Genereates an Xml representation of the configuration tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private org.apache.commons.logging.Log log
Provides a handle to Apache-commons logger


config

private CarbonManagementServiceConfiguration config
Holds the components configuration.


TAB

private static final String TAB
String constant for a tab without child.

See Also:
Constant Field Values

TAB_WITH_CHILD

private static final String TAB_WITH_CHILD
String constant for a tab with child.

See Also:
Constant Field Values

NEW_LINE

private static final String NEW_LINE
String constant for generating a new line.

See Also:
Constant Field Values

ARROW

private static final String ARROW
String constant for drawing a text arrow.

See Also:
Constant Field Values
Constructor Detail

DefaultCarbonManagementServiceImpl

public DefaultCarbonManagementServiceImpl()
Method Detail

configure

public void configure(ComponentConfiguration configuration)
               throws InvalidConfigurationException
Configures the component.

Specified by:
configure in interface Configurable
Parameters:
configuration - configuration for this component
Throws:
InvalidConfigurationException - indicates an invalid configuration

viewConfigurationXML

public String viewConfigurationXML(String configuationPath)
                            throws ConfigurationNotFoundException
Genereates an Xml representation of the configuration tree.

Specified by:
viewConfigurationXML in interface CarbonManagementService
Parameters:
configuationPath - path to configuration to view
Returns:
an Xml representation of the configuration tree
Throws:
ConfigurationNotFoundException - indicates no configuration could be found at the given path

viewConfigurationTree

public String viewConfigurationTree()
Generates an HTML representation of the configuration tree.

Specified by:
viewConfigurationTree in interface CarbonManagementService
Returns:
Html representation of the configuration tree

refreshAllConfigurations

public void refreshAllConfigurations()
Description copied from interface: CarbonManagementService
Refreshes all configurations loaded in the system.

Specified by:
refreshAllConfigurations in interface CarbonManagementService

refreshConfiguration

public void refreshConfiguration(String configuationPath)
                          throws ConfigurationNotFoundException
Forces a configuration to refresh from the store.

Specified by:
refreshConfiguration in interface CarbonManagementService
Parameters:
configuationPath - path to configuration to refresh.
Throws:
ConfigurationNotFoundException - indicates no configuration was found at the given path

refreshAllComponentConfigurations

public void refreshAllComponentConfigurations()
Description copied from interface: CarbonManagementService
Refreshes all the components loaded in the system.

Specified by:
refreshAllComponentConfigurations in interface CarbonManagementService

loadComponent

public void loadComponent(String componentName)
                   throws ComponentNotFoundException
Description copied from interface: CarbonManagementService
Loads the component specified by componentName.

Specified by:
loadComponent in interface CarbonManagementService
Parameters:
componentName - name of the component to load
Throws:
ComponentNotFoundException - if the component is not found
See Also:
Lookup.fetchComponent(java.lang.String)

getDeploymentProperties

public String getDeploymentProperties()
This implementation uses configuration to specify which deployment properties to return.

Specified by:
getDeploymentProperties in interface CarbonManagementService
Returns:
an HTML string representation of the deployment properties.

getDeploymentPropertyMap

public Map getDeploymentPropertyMap()
This implementation uses configuration to specify which deployment properties to return.

Specified by:
getDeploymentPropertyMap in interface CarbonManagementService
Returns:
the deployment property map for all properties listed in configuration

getDeploymentProperty

public String getDeploymentProperty(String propertyName)
Description copied from interface: CarbonManagementService
Returns the value of the specified deployment property.

Specified by:
getDeploymentProperty in interface CarbonManagementService
Parameters:
propertyName - name of the property to return
Returns:
String the value of the deployment property
See Also:
BootStrapper.getDeploymentProperty(java.lang.String)

appendSubtreeToBuffer

private void appendSubtreeToBuffer(StringBuffer buffer,
                                   Node subtree,
                                   int depth)
Recursive method that does a depth first traversal of the configuration node hierachy, appending the text representation of the subtree to the buffer.

Parameters:
buffer - the buffer to extend the subtree to
subtree - the subtree to append
depth - used to determine number of tabs to output before each node

getFreeMemory

public long getFreeMemory()
Retrieves the free memory available to the JVM

Specified by:
getFreeMemory in interface CarbonManagementService
Returns:
the amount of free memory in the JVM
See Also:
Runtime.freeMemory()

getTotalMemory

public long getTotalMemory()
Retrieves the amount of memory researved by the JVM

Specified by:
getTotalMemory in interface CarbonManagementService
Returns:
the amount of memory researved by the JVM
See Also:
Runtime.totalMemory()

getMaximumMemory

public long getMaximumMemory()
Retrieves the amount of memory the JVM may attempt to use

Specified by:
getMaximumMemory in interface CarbonManagementService
Returns:
the amount of memory the JVM may attempt to use
See Also:
Runtime.maxMemory()

getAvailableProcessors

public int getAvailableProcessors()
Retrieves the number of processes available to this JVM

Specified by:
getAvailableProcessors in interface CarbonManagementService
Returns:
the number of processes available to this JVM
See Also:
Runtime.availableProcessors()

getRootThreadGroup

private ThreadGroup getRootThreadGroup()
Gets the root thread group in the system.

Returns:
root thread group in the system

getActiveThreadCount

public int getActiveThreadCount()
Retrieves the number of active threads in the JVM

Specified by:
getActiveThreadCount in interface CarbonManagementService
Returns:
the number of active threads in the JVM
See Also:
Thread.activeCount()

getActiveThreadGroupCount

public int getActiveThreadGroupCount()
Retrieves the number of active thread groups in the JVM

Specified by:
getActiveThreadGroupCount in interface CarbonManagementService
Returns:
the number of active thread groups in the JVM
See Also:
ThreadGroup.activeGroupCount()


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.