org.norther.tammi.core.config
Class MBeanConfig

java.lang.Object
  extended by org.norther.tammi.core.base.MBeanBroker
      extended by org.norther.tammi.core.config.MBeanConfig
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BrokerTool, MBeanStartup

public class MBeanConfig
extends MBeanBroker

Extends MBean broker by providing configuration support for MBeans.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.MBeanBroker
MBEAN_BROKER
 
Constructor Summary
MBeanConfig()
          Constructs a new config.
MBeanConfig(MBeanServer server)
          Constructs a new config for a specific server.
 
Method Summary
 void configure(ObjectName name, String path)
          Configures the specified MBean.
 void configure(ObjectName name, String path, String encoding)
          Configures the specified MBean by applying the given encoding.
 void configure(String spec, String path)
          Configures the specified MBean.
 void configure(String spec, String path, String encoding)
          Configures the specified MBean by applying the given encoding.
 Object convert(String className, Object value)
          Converts an object by applying an appropriate converter MBean.
 Object convert(String className, Object value, String pattern)
          Converts an object with a pattern by applying an appropriate converter MBean.
 void copy(File source, File target)
          Copies a file.
 void copy(URL source, File target)
          Copies a URL.
protected  StreamConfigurator getConfigurator(String path)
          Gets the referent of the configurator MBean for the specified path.
 void setConverter(String className, ObjectName name)
          Sets the converter MBean for the specified class name.
 void setConverter(String className, String spec)
          Sets the converter MBean for the specified class name.
 
Methods inherited from class org.norther.tammi.core.base.MBeanBroker
adapt, adapt, adapt, adapt, adapt, adapt, adapt, adapt, adapt, adapt, adapt, create, create, create, create, create, create, create, create, create, find, find, find, find, findName, findName, findName, findName, findNames, findNames, findNames, findNames, findNames, findNames, get, get, get, get, getAllDomains, getBroker, getClassName, getClassName, getDefaultDomain, getDomain, getDomainName, getDomainNames, getFactory, getInfo, getInfo, getLoader, getLog, getMBeanServer, getPackage, getPackages, getSystemProperty, instantiate, instantiate, instantiate, invoke, invoke, invoke, invoke, invoke, invoke, isDefined, isInstanceOf, isInstanceOf, isRegistered, isRegistered, load, register, register, register, register, set, set, set, set, set, set, setAlias, setAlias, setFactory, setFactory, setMBeanServer, setSystemProperty, toObjectName, toPackageName, unregister, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanConfig

public MBeanConfig()
Constructs a new config.


MBeanConfig

public MBeanConfig(MBeanServer server)
Constructs a new config for a specific server. Note that MBean server cannot be serialized.

Parameters:
server - the MBean server.
Method Detail

setConverter

public void setConverter(String className,
                         String spec)
Sets the converter MBean for the specified class name. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
className - the class name.
spec - the MBean specification.

setConverter

public void setConverter(String className,
                         ObjectName name)
Sets the converter MBean for the specified class name.

Parameters:
className - the class name.
name - the object name of the MBean.

convert

public Object convert(String className,
                      Object value)
               throws LogException
Converts an object by applying an appropriate converter MBean.

Parameters:
className - the class name of the result.
value - the object to convert.
Returns:
the converted object instance.
Throws:
LogException - on errors.

convert

public Object convert(String className,
                      Object value,
                      String pattern)
               throws LogException
Converts an object with a pattern by applying an appropriate converter MBean.

Parameters:
className - the class name of the result.
value - the object to convert.
pattern - the pattern to apply.
Returns:
the converted object instance.
Throws:
LogException - on errors.

configure

public void configure(String spec,
                      String path)
               throws LogException
Configures the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
path - the configuration path.
Throws:
LogException - on errors.

configure

public void configure(String spec,
                      String path,
                      String encoding)
               throws LogException
Configures the specified MBean by applying the given encoding. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
path - the configuration path.
encoding - the encoding.
Throws:
LogException - on errors.

configure

public void configure(ObjectName name,
                      String path)
               throws LogException
Configures the specified MBean. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the object name of the MBean.
path - the configuration path.
Throws:
LogException - on errors.

configure

public void configure(ObjectName name,
                      String path,
                      String encoding)
               throws LogException
Configures the specified MBean by applying the given encoding. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the object name of the MBean.
path - the configuration path.
encoding - the encoding.
Throws:
LogException - on errors.

copy

public void copy(File source,
                 File target)
          throws LogException
Copies a file.

Parameters:
source - the source file.
target - the target file.
Throws:
LogException - on errors.

copy

public void copy(URL source,
                 File target)
          throws LogException
Copies a URL.

Parameters:
source - the source URL.
target - the target file.
Throws:
LogException - on errors.

getConfigurator

protected StreamConfigurator getConfigurator(String path)
Gets the referent of the configurator MBean for the specified path.

Parameters:
path - the path to resolve.
Returns:
the resolved configurator.
Throws:
UnsupportedOperationException - if not found.


Copyright © 2004 The Norther Organization. All rights reserved.