org.jboss.system
Class ServiceConfigurator

java.lang.Object
  extended by org.jboss.system.ServiceConfigurator

public class ServiceConfigurator
extends Object

Service configuration helper.

Version:
$Revision: 57205 $
Author:
Marc Fleury, Hiram Chirino, David Jencks, Jason Dillon, Dimitris Andreadis

Constructor Summary
ServiceConfigurator(javax.management.MBeanServer server, ServiceController serviceController, ServiceCreator serviceCreator)
          Constructor
 
Method Summary
protected  void configure(javax.management.ObjectName objectName, javax.management.ObjectName loaderName, Element mbeanElement, List mbeans)
          The configure method configures an mbean based on the xml element configuration passed in.
 String getConfiguration(javax.management.ObjectName[] objectNames)
          Builds a string that consists of the configuration elements of the currently running MBeans registered in the server.
static StringBuffer getElementContent(Element element)
          A utility method that transforms the contents of the argument element into a StringBuffer representation that can be reparsed.
 List install(Element config, javax.management.ObjectName loaderName)
          The install method iterates through the mbean tags in the supplied xml configuration and creates and configures the mbeans shown.
 void setServiceBinding(ServiceBinding serviceBinding)
          Dynamically plug-in a ServiceBinding policy to possibly override the configuration of a service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceConfigurator

public ServiceConfigurator(javax.management.MBeanServer server,
                           ServiceController serviceController,
                           ServiceCreator serviceCreator)
Constructor

Parameters:
server -
serviceController -
serviceCreator -
Method Detail

setServiceBinding

public void setServiceBinding(ServiceBinding serviceBinding)
Dynamically plug-in a ServiceBinding policy to possibly override the configuration of a service.

Parameters:
serviceBinding - policy

install

public List install(Element config,
                    javax.management.ObjectName loaderName)
             throws DeploymentException
The install method iterates through the mbean tags in the supplied xml configuration and creates and configures the mbeans shown. The mbean configuration can be nested.

Parameters:
config - the xml Element containing the configuration of the mbeans to create and configure.
Returns:
a List of ObjectNames of created mbeans.
Throws:
DeploymentException - if an error occurs

getConfiguration

public String getConfiguration(javax.management.ObjectName[] objectNames)
                        throws Exception
Builds a string that consists of the configuration elements of the currently running MBeans registered in the server.

Throws:
Exception - Failed to construct configuration.

configure

protected void configure(javax.management.ObjectName objectName,
                         javax.management.ObjectName loaderName,
                         Element mbeanElement,
                         List mbeans)
                  throws Exception
The configure method configures an mbean based on the xml element configuration passed in. Three formats are supported: <attribute name="(name)">(value)</attribute> <depends optional-attribute-name="(name)">(object name of mbean referenced)</depends> <depends-list optional-attribute-name="(name)"> [list of] </depends-list-element>(object name)</depends-list-element> </depends-list> The last two can include nested mbean configurations or ObjectNames. SIDE-EFFECT: adds all mbeans this one depends on to the ServiceContext structures.

Parameters:
mbeanElement - an Element value
Throws:
Exception - if an error occurs

getElementContent

public static StringBuffer getElementContent(Element element)
                                      throws IOException,
                                             TransformerException
A utility method that transforms the contents of the argument element into a StringBuffer representation that can be reparsed. [FIXME] This is not a general DOMUtils method because of its funny contract. It does not support multiple child elements neither can it deal with text content.

Parameters:
element - - the parent dom element whose contents are to be extracted as an xml document string.
Returns:
the xml document string.
Throws:
IOException
TransformerException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.