org.norther.tammi.core.base
Class MBeanBroker

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

public class MBeanBroker
extends Object
implements Serializable

An MBean broker resolving MBean references and supporting access to their properties and methods. Internally, it utilizes services provided by the default broker.

It may be used in situations where direct access to the above services is not available, like in template contexts and scripting environments. It can also resolve parameter signatures automatically based on their class types, which makes script access to MBeans more convenient.

Version:
$Id: MBeanBroker.java,v 1.36 2009/09/28 15:08:42 cvsimp Exp $
Author:
Marketta Priha, Ilkka Priha
See Also:
Serialized Form

Field Summary
static String MBEAN_BROKER
          The global MBean broker bean.
 
Constructor Summary
MBeanBroker()
          Constructs a new broker.
MBeanBroker(MBeanServer server)
          Constructs a new broker for a specific server.
 
Method Summary
 ObjectName adapt(String className)
          Adapts and registers an MBean with the default name.
 ObjectName adapt(String className, ObjectName name)
          Adapts and registers an MBean with an object name .
 ObjectName adapt(String className, ObjectName name, String ifname)
          Adapts and registers an MBean with an object name and interface.
 ObjectName adapt(String className, ObjectName name, String ifname, Object params)
          Adapts and registers an MBean with an object name, interface and parameters.
 ObjectName adapt(String className, ObjectName name, String ifname, ObjectName loader, Object params, Object sign)
          Adapts and registers an MBean with an object name, interface, class loader, parameters and signature.
 ObjectName adapt(String className, ObjectName name, String ifname, Object params, Object sign)
          Adapts and registers an MBean with an object name, interface, parameters and signature.
 ObjectName adapt(String className, String ifname)
          Adapts and registers an MBean with the default name and interface.
 ObjectName adapt(String className, String name, String ifname)
          Adapts and registers an MBean with a string name and interface.
 ObjectName adapt(String className, String name, String ifname, Object params)
          Adapts and registers an MBean with a string name, interface and parameters.
 ObjectName adapt(String className, String name, String ifname, Object params, Object sign)
          Adapts and registers an MBean with a string name, interface, parameters and signature.
 ObjectName adapt(String className, String name, String ifname, String loader, Object params, Object sign)
          Adapts and registers an MBean with a string name, interface, class loader, parameters and signature.
 boolean containsAlias(String alias)
          Checks an alias of the specified MBean.
 boolean containsFactory(String className)
          Checks the factory MBean for the specified class name.
 ObjectName create(String className)
          Creates and registers an MBean with the default name.
 ObjectName create(String className, ObjectName name)
          Creates and registers an MBean with an object name.
 ObjectName create(String className, ObjectName name, Object params)
          Creates and registers an MBean with an object name and parameters.
 ObjectName create(String className, ObjectName name, ObjectName loader, Object params, Object sign)
          Creates and registers an MBean with an object name, class loader, parameters and signature.
 ObjectName create(String className, ObjectName name, Object params, Object sign)
          Creates and registers an MBean with an object name, parameters and signature.
 ObjectName create(String className, String name)
          Creates and registers an MBean with a string name.
 ObjectName create(String className, String name, Object params)
          Creates and registers an MBean with a string name and parameters.
 ObjectName create(String className, String name, Object params, Object sign)
          Creates and registers an MBean with a string name, parameters and signature.
 ObjectName create(String className, String name, String loader, Object params, Object sign)
          Creates and registers an MBean with a string name, class loader, parameters and signature.
 Object find(ObjectName name)
          Finds the referent of the specified MBean.
 Object find(ObjectName name, String className)
          Finds a direct reference to the specified MBean implementing a specific class.
 Object find(String spec)
          Finds the referent of the specified MBean.
 Object find(String name, String className)
          Finds the referent of the MBean with the specified name string implementing a specific class.
 ObjectName findName(ObjectName name)
          Finds an object name of the specified MBean.
 ObjectName findName(ObjectName name, String className)
          Finds an object name of the specified MBean implementing a specific class.
 ObjectName findName(String spec)
          Finds the object name of the specified MBean.
 ObjectName findName(String name, String className)
          Finds the object name of the MBean with the specified name string implementing a specific class.
 Set<ObjectName> findNames(boolean all)
          Finds a set of object names registered to the domains of this application.
 Set<ObjectName> findNames(boolean all, String className)
          Finds a set of object names implementing a specific class registered to the domains of this application.
 Set<ObjectName> findNames(ObjectName name)
          Finds a set of object name of the specified MBeans.
 Set<ObjectName> findNames(ObjectName name, String className)
          Finds a set of object name of the specified MBeans implementing a specific class.
 Set<ObjectName> findNames(String spec)
          Finds a set of object names of the specified MBeans.
 Set<ObjectName> findNames(String name, String className)
          Finds a set of object name of MBeans with the specified name string implementing a specific class.
 Object get(ObjectName name, String key)
          Gets an attribute value of the specified MBean.
 Object get(ObjectName name, String key, Object tag)
          Gets a taggeg attribute value of the specified MBean.
 Object get(String spec, String key)
          Gets an attribute value of the specified MBean.
 Object get(String spec, String key, String tag)
          Gets a tagged attribute value of the specified MBean.
 ObjectName getAlias(String alias)
          Gets an alias of the specified MBean.
 String[] getAllDomains()
          Gets all domains.
protected  Broker getBroker()
          Gets the broker.
 String getClassName(ObjectName name)
          Gets the class name of the specified MBean.
 String getClassName(String spec)
          Gets the class name of the specified MBean.
 String getDefaultDomain()
          Gets the default domain.
protected  Domain getDomain()
          Gets the domain.
 String getDomainName()
          Gets the domain name.
 String[] getDomainNames()
          Gets the domain names.
protected  Factory getFactory()
          Gets the factory.
 ObjectName getFactory(String className)
          Gets the factory MBean for the specified class name.
 String getImplementationVersion()
          Gets the implementation version.
 MBeanInfo getInfo(ObjectName name)
          Gets MBean info about the specified MBean.
 MBeanInfo getInfo(String spec)
          Gets MBean info about the specified MBean.
protected  Loader getLoader()
          Gets the loader.
 Log getLog()
          Gets a log.
 MBeanServer getMBeanServer()
          Gets a reference to the MBean server.
 Package getPackage(String name)
          Gets the named package.
 Package[] getPackages()
          Gets all known packages.
 String getSpecificationVersion()
          Gets the specification version.
 String getSystemProperty(String name)
          Gets a system property.
 Object instantiate(String className)
          Intantiates an object.
 Object instantiate(String className, Object params)
          Intantiates an object with parameters.
 Object instantiate(String className, Object params, Object sign)
          Intantiates an object with parameters and a signature.
 Object invoke(ObjectName name, String method)
          Invokes a method of the specified MBean.
 Object invoke(ObjectName name, String method, Object params)
          Invokes a method of the specified MBean with parameters.
 Object invoke(ObjectName name, String method, Object params, Object sign)
          Invokes a method of the specified MBean with parameters and a signature.
 Object invoke(String spec, String method)
          Invokes a method of the specified MBean.
 Object invoke(String spec, String method, Object params)
          Invokes a method of the specified MBean with parameters.
 Object invoke(String spec, String method, Object params, Object sign)
          Invokes a method of the specified MBean with parameters and a signature.
 boolean isDefined(String className)
          Checks whether a class is defined.
 boolean isInstanceOf(ObjectName name, String className)
          Checks whether the named MBean implements a specific class.
 boolean isInstanceOf(String name, String className)
          Checks whether an MBean with a string name implements a specific class.
 boolean isRegistered(ObjectName name)
          Checks whether the named MBean is registered.
 boolean isRegistered(String name)
          Checks whether an MBean with a string name is registered.
 Class<?> load(String className)
          Loads a class.
 ObjectName register(Object object)
          Registers an unnamed MBean.
 ObjectName register(Object object, ObjectName name)
          Registers the named MBean.
 ObjectName register(Object object, ObjectName name, String ifname)
          Registers the named MBean exposing the specified class or interface.
 ObjectName register(Object object, String name)
          Registers an MBean with a string name.
 void set(ObjectName name, String key, Object value)
          Sets an attribute value of the specified MBean.
 void set(ObjectName name, String key, Object tag, Object value)
          Sets a tagged attribute value of the specified MBean.
 void set(ObjectName name, String key, Object tag, Object value, String type)
          Sets a tagged and typed attribute value of the specified MBean.
 void set(String spec, String key, Object value)
          Sets an attribute value of the specified MBean.
 void set(String spec, String key, Object tag, Object value)
          Sets a tagged attribute value of the specified MBean.
 void set(String spec, String key, Object tag, Object value, String type)
          Sets a tagged and typed attribute value of the specified MBean.
 void setAlias(String alias, ObjectName name)
          Sets an alias of the specified MBean.
 void setAlias(String alias, String spec)
          Sets an alias for the specified MBean.
 void setFactory(String className, ObjectName name)
          Sets the factory MBean for the specified class name.
 void setFactory(String className, String spec)
          Sets the factory MBean for the specified class name.
protected  void setMBeanServer(MBeanServer server)
          Sets a reference to the MBean server.
 void setSystemProperty(String name, String value)
          Sets a system property.
 void sleep(long msecs)
          Sleeps the specified time.
 ObjectName toObjectName(String name)
          Converts a string to an object name.
 String toPackageName(String uri)
          Converts an URI path to a package name.
 void unregister(ObjectName name)
          Unregisters the named MBean.
 void unregister(String name)
          Unregisters an MBean with a string name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MBEAN_BROKER

public static final String MBEAN_BROKER
The global MBean broker bean.

See Also:
Constant Field Values
Constructor Detail

MBeanBroker

public MBeanBroker()
Constructs a new broker.


MBeanBroker

public MBeanBroker(MBeanServer server)
Constructs a new broker for a specific server. Note that the MBean server cannot be serialized.

Parameters:
server - the MBean server.
Method Detail

findNames

public Set<ObjectName> findNames(boolean all)
Finds a set of object names registered to the domains of this application.

Parameters:
all - true for all names, false for default names.
Returns:
a set of object names or an empty set.

findNames

public Set<ObjectName> findNames(boolean all,
                                 String className)
Finds a set of object names implementing a specific class registered to the domains of this application.

Parameters:
all - true for all names, false for default names.
className - the class name.
Returns:
a set of object names or an empty set.

find

public Object find(String spec)
Finds the referent of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
Returns:
the MBean reference or null.

findName

public ObjectName findName(String spec)
Finds the object name of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
Returns:
the object name or null.

findNames

public Set<ObjectName> findNames(String spec)
Finds a set of object names of the specified MBeans. The MBeans can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
Returns:
a set of object names or an empty set.

find

public Object find(String name,
                   String className)
Finds the referent of the MBean with the specified name string implementing a specific class. The name string can be a query pattern or fully qualified object name.

Parameters:
name - the name string or pattern.
className - the class name.
Returns:
the MBean reference or null.

findName

public ObjectName findName(String name,
                           String className)
Finds the object name of the MBean with the specified name string implementing a specific class. The name string can be a query pattern or fully qualified object name.

Parameters:
name - the name string or pattern.
className - the class name.
Returns:
the object name or null.

findNames

public Set<ObjectName> findNames(String name,
                                 String className)
Finds a set of object name of MBeans with the specified name string implementing a specific class. The name string can be a query pattern or fully qualified object name.

Parameters:
name - the name string or pattern.
className - the class name.
Returns:
a set of object names or an empty set.

find

public Object find(ObjectName name)
Finds the referent of the specified MBean. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
Returns:
the MBean reference or null.

findName

public ObjectName findName(ObjectName name)
Finds an object name of the specified MBean. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
Returns:
the MBean reference or null.

findNames

public Set<ObjectName> findNames(ObjectName name)
Finds a set of object name of the specified MBeans. The MBeans can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
Returns:
a set of object names or an empty set.

find

public Object find(ObjectName name,
                   String className)
Finds a direct reference to the specified MBean implementing a specific class. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
className - the class name.
Returns:
the MBean reference or null.

findName

public ObjectName findName(ObjectName name,
                           String className)
Finds an object name of the specified MBean implementing a specific class. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
className - the class name.
Returns:
the object name or null.

findNames

public Set<ObjectName> findNames(ObjectName name,
                                 String className)
Finds a set of object name of the specified MBeans implementing a specific class. The MBeans can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
className - the class name.
Returns:
a set of object names or an empty set.

getClassName

public String getClassName(String spec)
                    throws LogException
Gets the class name of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
Returns:
the class name of the MBean.
Throws:
LogException - on errors.

getInfo

public MBeanInfo getInfo(String spec)
                  throws LogException
Gets MBean info about the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
Returns:
info about the MBean.
Throws:
LogException - on errors.

setAlias

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

Parameters:
alias - the alias key.
spec - the MBean specification.

setFactory

public void setFactory(String className,
                       String spec)
Sets the factory 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.

get

public Object get(String spec,
                  String key)
           throws LogException
Gets an attribute value of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
key - the attribute key.
Returns:
the value of the attribute.
Throws:
LogException - on errors.

set

public void set(String spec,
                String key,
                Object value)
         throws LogException
Sets an attribute value of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
key - the attribute key.
value - the attribute value.
Throws:
LogException - on errors.

get

public Object get(String spec,
                  String key,
                  String tag)
           throws LogException
Gets a tagged attribute value of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
key - the attribute key.
tag - the attribute tag.
Returns:
the value of the attribute.
Throws:
LogException - on errors.

set

public void set(String spec,
                String key,
                Object tag,
                Object value)
         throws LogException
Sets a tagged attribute value of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
key - the attribute key.
tag - the attribute tag.
value - the attribute value.
Throws:
LogException - on errors.

set

public void set(String spec,
                String key,
                Object tag,
                Object value,
                String type)
         throws LogException
Sets a tagged and typed attribute value of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
key - the attribute key.
tag - the attribute tag.
value - the attribute value.
type - the attribute type.
Throws:
LogException - on errors.

invoke

public Object invoke(String spec,
                     String method)
              throws LogException
Invokes a method of the specified MBean. The MBean can be specified by a broker alias, query pattern or fully qualified object name.

Parameters:
spec - the MBean specification.
method - the method name.
Returns:
the return value of the method.
Throws:
LogException - on errors.

invoke

public Object invoke(String spec,
                     String method,
                     Object params)
              throws LogException
Invokes a method of the specified MBean with parameters. The MBean can be specified by a broker alias, query pattern or fully qualified object name. A single parameter can be given as an object and multiple parameters as a list or an array.

Parameters:
spec - the MBean specification.
method - the method name.
params - the parameters to the method.
Returns:
the return value of the method.
Throws:
LogException - on errors.

invoke

public Object invoke(String spec,
                     String method,
                     Object params,
                     Object sign)
              throws LogException
Invokes a method of the specified MBean with parameters and a signature. The MBean can be specified by a broker alias, query pattern or fully qualified object name. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
spec - the MBean specification.
method - the method name.
params - the parameters to the method.
sign - the signature of the parameters.
Returns:
the return value of the method.
Throws:
LogException - on errors.

create

public ObjectName create(String className)
                  throws LogException
Creates and registers an MBean with the default name.

Parameters:
className - the class name of the MBean.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

create

public ObjectName create(String className,
                         String name)
                  throws LogException
Creates and registers an MBean with a string name.

Parameters:
className - the class name of the MBean.
name - the string name of the MBean.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

create

public ObjectName create(String className,
                         String name,
                         Object params)
                  throws LogException
Creates and registers an MBean with a string name and parameters. A single parameter can be given as an object and multiple parameters as a list or an array.

Parameters:
className - the class name of the MBean.
name - the string name of the MBean.
params - the parameter to the constructor.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

create

public ObjectName create(String className,
                         String name,
                         Object params,
                         Object sign)
                  throws LogException
Creates and registers an MBean with a string name, parameters and signature. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
className - the class name of the MBean.
name - the string name of the MBean.
params - the parameter to the constructor.
sign - the signature of the parameters.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

create

public ObjectName create(String className,
                         String name,
                         String loader,
                         Object params,
                         Object sign)
                  throws LogException
Creates and registers an MBean with a string name, class loader, parameters and signature. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
className - the class name of the MBean.
name - the string name of the MBean.
loader - the string name of the loader.
params - the parameter to the constructor.
sign - the signature of the parameters.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className)
                 throws LogException
Adapts and registers an MBean with the default name.

Parameters:
className - the class name of the MBean.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        String ifname)
                 throws LogException
Adapts and registers an MBean with the default name and interface.

Parameters:
className - the class name of the MBean.
ifname - the interface of the MBean.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        String name,
                        String ifname)
                 throws LogException
Adapts and registers an MBean with a string name and interface.

Parameters:
className - the class name of the MBean.
name - the string name of the MBean.
ifname - the interface of the MBean.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        String name,
                        String ifname,
                        Object params)
                 throws LogException
Adapts and registers an MBean with a string name, interface and parameters. A single parameter can be given as an object and multiple parameters as a list or an array.

Parameters:
className - the class name of the MBean.
name - the string name of the MBean.
ifname - the interface of the MBean.
params - the parameter to the constructor.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        String name,
                        String ifname,
                        Object params,
                        Object sign)
                 throws LogException
Adapts and registers an MBean with a string name, interface, parameters and signature. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
className - the class name of the MBean.
name - the string name of the MBean.
ifname - the interface of the MBean.
params - the parameter to the constructor.
sign - the signature of the parameters.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        String name,
                        String ifname,
                        String loader,
                        Object params,
                        Object sign)
                 throws LogException
Adapts and registers an MBean with a string name, interface, class loader, parameters and signature. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
className - the class name of the MBean.
name - the string name of the MBean.
ifname - the interface of the MBean.
loader - the string name of the loader.
params - the parameter to the constructor.
sign - the signature of the parameters.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

register

public ObjectName register(Object object,
                           String name)
                    throws LogException
Registers an MBean with a string name.

Parameters:
object - the object to register.
name - the string name of the MBean.
Returns:
the object name of the registered MBean.
Throws:
LogException - on errors.

unregister

public void unregister(String name)
                throws LogException
Unregisters an MBean with a string name.

Parameters:
name - the string name of the MBean.
Throws:
LogException - on errors.

isRegistered

public boolean isRegistered(String name)
Checks whether an MBean with a string name is registered.

Parameters:
name - the string name of the MBean.
Returns:
true if registered, otherwise false.

isInstanceOf

public boolean isInstanceOf(String name,
                            String className)
                     throws LogException
Checks whether an MBean with a string name implements a specific class.

Parameters:
name - the string name of the MBean.
className - the name of the class.
Returns:
true if the MBean is an instance of the given class.
Throws:
LogException - on errors.

getClassName

public String getClassName(ObjectName name)
                    throws LogException
Gets the class name of 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.
Returns:
the class name of the MBean.
Throws:
LogException - on errors.

getInfo

public MBeanInfo getInfo(ObjectName name)
                  throws LogException
Gets MBean info about 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.
Returns:
info about the MBean.
Throws:
LogException - on errors.

containsAlias

public boolean containsAlias(String alias)
Checks an alias of the specified MBean.

Parameters:
alias - the alias key.
Returns:
true for an alias, false otherwise.

getAlias

public ObjectName getAlias(String alias)
Gets an alias of the specified MBean.

Parameters:
alias - the alias key.
Returns:
the object name of the MBean or null.

setAlias

public void setAlias(String alias,
                     ObjectName name)
Sets an alias of the specified MBean.

Parameters:
alias - the alias key.
name - the object name of the MBean.

containsFactory

public boolean containsFactory(String className)
Checks the factory MBean for the specified class name.

Parameters:
className - the class name.
Returns:
true for a class specific factory, false for the default factory.

getFactory

public ObjectName getFactory(String className)
Gets the factory MBean for the specified class name.

Parameters:
className - the class name.
Returns:
the object name of the factory MBean or the default factory.

setFactory

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

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

get

public Object get(ObjectName name,
                  String key)
           throws LogException
Gets an attribute value of 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.
key - the attribute key.
Returns:
the value of the attribute.
Throws:
LogException - on errors.

set

public void set(ObjectName name,
                String key,
                Object value)
         throws LogException
Sets an attribute value of the specified MBean. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
key - the attribute key.
value - the attribute value.
Throws:
LogException - on errors.

get

public Object get(ObjectName name,
                  String key,
                  Object tag)
           throws LogException
Gets a taggeg attribute value of 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.
key - the attribute key.
tag - the attribute tag.
Returns:
the value of the attribute.
Throws:
LogException - on errors.

set

public void set(ObjectName name,
                String key,
                Object tag,
                Object value)
         throws LogException
Sets a tagged attribute value of the specified MBean. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
key - the attribute key.
tag - the attribute tag.
value - the attribute value.
Throws:
LogException - on errors.

set

public void set(ObjectName name,
                String key,
                Object tag,
                Object value,
                String type)
         throws LogException
Sets a tagged and typed attribute value of the specified MBean. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
key - the attribute key.
tag - the attribute tag.
type - the attribute type.
value - the attribute value.
Throws:
LogException - on errors.

invoke

public Object invoke(ObjectName name,
                     String method)
              throws LogException
Invokes a method of the specified MBean. The MBean can be specified by a query pattern or fully qualified object name.

Parameters:
name - the MBean name.
method - the method name.
Returns:
the return value of the method.
Throws:
LogException - on errors.

invoke

public Object invoke(ObjectName name,
                     String method,
                     Object params)
              throws LogException
Invokes a method of the specified MBean with parameters. The MBean can be specified by a query pattern or fully qualified object name. A single parameter can be given as an object and multiple parameters as a list or an array.

Parameters:
name - the MBean name.
method - the method name.
params - the parameters to the method.
Returns:
the return value of the method.
Throws:
LogException - on errors.

invoke

public Object invoke(ObjectName name,
                     String method,
                     Object params,
                     Object sign)
              throws LogException
Invokes a method of the specified MBean with parameters and a signature. The MBean can be specified by a query pattern or fully qualified object name. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
name - the MBean name.
method - the method name.
params - the parameters to the method.
sign - the signature of the parameters.
Returns:
the return value of the method.
Throws:
LogException - on errors.

create

public ObjectName create(String className,
                         ObjectName name)
                  throws LogException
Creates and registers an MBean with an object name.

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

create

public ObjectName create(String className,
                         ObjectName name,
                         Object params)
                  throws LogException
Creates and registers an MBean with an object name and parameters. A single parameter can be given as an object and multiple parameters as a list or an array.

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
params - the parameter to the constructor.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

create

public ObjectName create(String className,
                         ObjectName name,
                         Object params,
                         Object sign)
                  throws LogException
Creates and registers an MBean with an object name, parameters and signature. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
params - the parameter to the constructor.
sign - the signature of the parameters.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

create

public ObjectName create(String className,
                         ObjectName name,
                         ObjectName loader,
                         Object params,
                         Object sign)
                  throws LogException
Creates and registers an MBean with an object name, class loader, parameters and signature. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
loader - the object name of the loader.
params - the parameter to the constructor.
sign - the signature of the parameters.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        ObjectName name)
                 throws LogException
Adapts and registers an MBean with an object name .

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        ObjectName name,
                        String ifname)
                 throws LogException
Adapts and registers an MBean with an object name and interface.

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
ifname - the interface of the MBean.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        ObjectName name,
                        String ifname,
                        Object params)
                 throws LogException
Adapts and registers an MBean with an object name, interface and parameters. A single parameter can be given as an object and multiple parameters as a list or an array.

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
ifname - the interface of the MBean.
params - the parameter to the constructor.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        ObjectName name,
                        String ifname,
                        Object params,
                        Object sign)
                 throws LogException
Adapts and registers an MBean with an object name, interface, parameters and signature. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
ifname - the interface of the MBean.
params - the parameter to the constructor.
sign - the signature of the parameters.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

adapt

public ObjectName adapt(String className,
                        ObjectName name,
                        String ifname,
                        ObjectName loader,
                        Object params,
                        Object sign)
                 throws LogException
Adapts and registers an MBean with an object name, interface, class loader, parameters and signature. A single parameter can be given as an object and multiple parameters as a list or an array. If the parameters are given as a list, the signature must be null or also a list.

Parameters:
className - the class name of the MBean.
name - the object name of the MBean.
ifname - the interface of the MBean.
loader - the object name of the loader.
params - the parameter to the constructor.
sign - the signature of the parameters.
Returns:
the object name of the new MBean.
Throws:
LogException - on errors.

instantiate

public Object instantiate(String className)
                   throws LogException
Intantiates an object.

Parameters:
className - the class name of the object.
Returns:
the new object instance.
Throws:
LogException - on errors.

instantiate

public Object instantiate(String className,
                          Object params)
                   throws LogException
Intantiates an object with parameters.

Parameters:
className - the class name of the object.
params - the parameters to the constructor.
Returns:
the new object instance.
Throws:
LogException - on errors.

instantiate

public Object instantiate(String className,
                          Object params,
                          Object sign)
                   throws LogException
Intantiates an object with parameters and a signature.

Parameters:
className - the class name of the object.
params - the parameters to the constructor.
sign - the signature of the parameters.
Returns:
the new object instance.
Throws:
LogException - on errors.

register

public ObjectName register(Object object)
                    throws LogException
Registers an unnamed MBean.

Parameters:
object - the object to register.
Returns:
the object name of the registered MBean.
Throws:
LogException - on errors.

register

public ObjectName register(Object object,
                           ObjectName name)
                    throws LogException
Registers the named MBean.

Parameters:
object - the object to register.
name - the object name or name pattern of the MBean.
Returns:
the object name of the registered MBean.
Throws:
LogException - on errors.

register

public ObjectName register(Object object,
                           ObjectName name,
                           String ifname)
                    throws LogException
Registers the named MBean exposing the specified class or interface.

Parameters:
object - the object to register.
name - the object name or name pattern of the MBean.
ifname - the class name.
Returns:
the object name of the registered MBean.
Throws:
LogException - on errors.

unregister

public void unregister(ObjectName name)
                throws LogException
Unregisters the named MBean.

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

isRegistered

public boolean isRegistered(ObjectName name)
Checks whether the named MBean is registered.

Parameters:
name - the object name of the MBean.
Returns:
true if registered, otherwise false.

isInstanceOf

public boolean isInstanceOf(ObjectName name,
                            String className)
                     throws LogException
Checks whether the named MBean implements a specific class.

Parameters:
name - the object name of the MBean.
className - the name of the class.
Returns:
true if the MBean is an instance of the given class.
Throws:
LogException - on errors.

getDomainName

public String getDomainName()
Gets the domain name.

Returns:
the domain name or null.

getDomainNames

public String[] getDomainNames()
Gets the domain names.

Returns:
an array of domain names.

getDefaultDomain

public String getDefaultDomain()
Gets the default domain.

Returns:
the default domain or null.

getAllDomains

public String[] getAllDomains()
                       throws LogException
Gets all domains.

Returns:
the alls domains.
Throws:
LogException - on errors.

toObjectName

public ObjectName toObjectName(String name)
                        throws LogException
Converts a string to an object name.

Parameters:
name - the string.
Returns:
the object name.
Throws:
LogException - on errors.

toPackageName

public String toPackageName(String uri)
Converts an URI path to a package name.

Parameters:
uri - the URI path to convert.
Returns:
the package name or null.

getPackage

public Package getPackage(String name)
Gets the named package.

Parameters:
name - the name of the package.
Returns:
the corresponding package or null if not found.

getPackages

public Package[] getPackages()
Gets all known packages.

Returns:
an array of packages.

getSpecificationVersion

public String getSpecificationVersion()
Gets the specification version.

Returns:
the specification version.

getImplementationVersion

public String getImplementationVersion()
Gets the implementation version.

Returns:
the implementation version.

getSystemProperty

public String getSystemProperty(String name)
Gets a system property.

Parameters:
name - the property name.
Returns:
the property value.

setSystemProperty

public void setSystemProperty(String name,
                              String value)
Sets a system property.

Parameters:
name - the property name.
value - the property value.

load

public Class<?> load(String className)
              throws ClassNotFoundException
Loads a class.

Parameters:
className - the class name.
Returns:
the loaded class.
Throws:
ClassNotFoundException - if not found.

isDefined

public boolean isDefined(String className)
Checks whether a class is defined.

Parameters:
className - the class name.
Returns:
the true if defined, false otherwise.

getLog

public Log getLog()
Gets a log.

Returns:
the log.

sleep

public void sleep(long msecs)
Sleeps the specified time.

Parameters:
msecs - the time in msecs.

getMBeanServer

public MBeanServer getMBeanServer()
Gets a reference to the MBean server.

Returns:
the server or null.

setMBeanServer

protected void setMBeanServer(MBeanServer server)
Sets a reference to the MBean server.

Parameters:
server - the server.

getLoader

protected Loader getLoader()
Gets the loader.

Returns:
the loader or null.

getDomain

protected Domain getDomain()
Gets the domain.

Returns:
the domain or null.

getBroker

protected Broker getBroker()
Gets the broker.

Returns:
the broker or null.

getFactory

protected Factory getFactory()
Gets the factory.

Returns:
the factory or null.


Copyright © 2004 The Norther Organization. All rights reserved.