JBoss API: Class ConfigurationService

org.jboss.configuration
Class ConfigurationService

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--org.jboss.util.ServiceMBeanSupport
              |
              +--org.jboss.configuration.ConfigurationService
All Implemented Interfaces:
ConfigurationServiceMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, Service, ServiceMBean

public class ConfigurationService
extends ServiceMBeanSupport
implements ConfigurationServiceMBean

The ConfigurationService MBean is loaded when JBoss starts up by the JMX MLet.

The ConfigurationService in turn loads the jboss.jcml configuration when loadConfiguration() is invoked. This instantiates JBoss specific mbean services that wish to be controlled by the JBoss ServiceControl/Service lifecycle service.

Version:
$Revision: 1.30.2.5 $
Author:
Rickard Öberg (rickard.oberg@telkel.com), Scott.Stark@jboss.org, Jason Dillon <jason@planet57.com>
See Also:
Service, ServiceControl

Field Summary
static java.lang.String CONFIGURATION_FILE
          The name of the file initial configuration is read from.
static java.lang.String RUNNING_STATE_FILE
          The name of the file that running state will be written into.
 
Fields inherited from class org.jboss.util.ServiceMBeanSupport
log, server
 
Fields inherited from interface org.jboss.configuration.ConfigurationServiceMBean
OBJECT_NAME
 
Fields inherited from interface org.jboss.util.ServiceMBean
STARTED, STARTING, states, STOPPED, STOPPING
 
Constructor Summary
ConfigurationService()
          Construct a ConfigurationService that auto-trim attribute values.
ConfigurationService(boolean autoTrim)
          Construct a ConfigurationService.
 
Method Summary
 boolean getAutoTrim()
          Get the attribute value auto-trim flag.
 java.lang.String getName()
          Return the name of the service.
 javax.management.ObjectName getObjectName(javax.management.MBeanServer server, javax.management.ObjectName name)
          Get the name of this object.
 void load(org.w3c.dom.Document configuration)
          Parses the given configuration document and sets MBean attributes.
 void loadConfiguration()
          Load the configuration from the CONFIGURATION_FILE, installs and initailize configured MBeans and registeres the beans as services.
 java.lang.String save()
          Builds a string that consists of the configuration elements of the currently running MBeans registered in the server.
 void saveConfiguration()
          Saves the current configuration of each registered MBean to the RUNNING_STATE_FILE file.
 
Methods inherited from class org.jboss.util.ServiceMBeanSupport
destroy, destroyService, getServer, getState, getStateString, init, initService, nextSequenceNumber, postDeregister, postRegister, preDeregister, preRegister, start, startService, stop, stopService
 
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
 

Field Detail

CONFIGURATION_FILE

public static final java.lang.String CONFIGURATION_FILE
The name of the file initial configuration is read from.

RUNNING_STATE_FILE

public static final java.lang.String RUNNING_STATE_FILE
The name of the file that running state will be written into.
Constructor Detail

ConfigurationService

public ConfigurationService(boolean autoTrim)
Construct a ConfigurationService.
Parameters:
autoTrim - True to enable auto-trimming of attribute values.

ConfigurationService

public ConfigurationService()
Construct a ConfigurationService that auto-trim attribute values.
Method Detail

getAutoTrim

public boolean getAutoTrim()
Get the attribute value auto-trim flag.
Specified by:
getAutoTrim in interface ConfigurationServiceMBean
Returns:
True if attribute values are auto-trimmed.

getObjectName

public javax.management.ObjectName getObjectName(javax.management.MBeanServer server,
                                                 javax.management.ObjectName name)
                                          throws javax.management.MalformedObjectNameException
Get the name of this object. Always ignores the given object name.
Overrides:
getObjectName in class ServiceMBeanSupport
Parameters:
server - The server which the object is registered in.
name - The user specified object name (ignored).
Returns:
The name of this object.

getName

public java.lang.String getName()
Return the name of the service.
Overrides:
getName in class ServiceMBeanSupport
Returns:
Always "Configuration".

load

public void load(org.w3c.dom.Document configuration)
          throws java.lang.Exception
Parses the given configuration document and sets MBean attributes.
Specified by:
load in interface ConfigurationServiceMBean
Parameters:
configuration - The parsed configuration document.
Throws:
java.lang.Exception - Failed to load.

save

public java.lang.String save()
                      throws java.lang.Exception
Builds a string that consists of the configuration elements of the currently running MBeans registered in the server.
Specified by:
save in interface ConfigurationServiceMBean
Throws:
java.lang.Exception - Failed to construct configuration.

saveConfiguration

public void saveConfiguration()
                       throws java.lang.Exception
Saves the current configuration of each registered MBean to the RUNNING_STATE_FILE file. This will only occur if a file of the that name exists in the classpath.
Specified by:
saveConfiguration in interface ConfigurationServiceMBean
Throws:
java.lang.Exception - Failed to save configuration.

loadConfiguration

public void loadConfiguration()
                       throws java.lang.Exception
Load the configuration from the CONFIGURATION_FILE, installs and initailize configured MBeans and registeres the beans as services.

This is a 2-step process:

  1. Load user conf. and create MBeans from that.
  2. Apply user conf to created MBeans.
Specified by:
loadConfiguration in interface ConfigurationServiceMBean
Throws:
java.lang.Exception - ???


Copyright © 2000 The JBoss Organization. All Rights Reserved.