org.norther.tammi.core.base
Class DefaultBroker

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultContainer
          extended by org.norther.tammi.core.base.DefaultBroker
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Broker, Container, Manageable, MBeanDelegate

public class DefaultBroker
extends DefaultContainer
implements Broker

A default implementation of Broker.

This implementation provides also static convenience methods to access directly the search functionality of the default broker.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultBroker()
          Constructs a new broker.
 
Method Summary
 Object get(Class clazz)
          Gets the referent of the default MBean implementing a specific interface.
 Object get(String key)
          Gets the referent of the MBean in this registry.
 MBeanReference getMBean(Class clazz)
          Gets a reference to the default MBean implementing a specific interface.
 MBeanReference getMBean(String key)
          Gets a reference to the MBean in this registry.
 ObjectName getObjectName(String key)
          Gets the object name of the MBean in this registry, which is also registered in the MBean server.
 Set getObjectNames(String key)
          Gets a set of ojbect names registered in the MBean server with names matching the query pattern of the MBean in this registry.
 void postmanaged()
          This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.
 MBeanReference queryMBean(ObjectName query)
          Queries for an MBean.
 MBeanReference queryMBean(ObjectName query, QueryExp exp)
          Queries for an MBean with a query expression.
 MBeanReference queryMBean(ObjectName query, String className)
          Queries for an MBean of the specified class.
 MBeanReference queryMBean(String pattern)
          Queries for an MBean matching the given query pattern.
 MBeanReference queryMBean(String domain, Map keySet, String className)
          Queries for an MBean from the specific domain, with the given key set and of the specified class.
 MBeanReference queryMBean(String pattern, String className)
          Queries for an MBean matching the given query pattern and of the specified class.
 ObjectName queryObjectName(ObjectName query)
          Queries for an object name of an MBean.
 ObjectName queryObjectName(ObjectName query, QueryExp exp)
          Queries for an object name of an MBean with a query expression.
 ObjectName queryObjectName(ObjectName query, String className)
          Queries for an object name of an MBean of the specified class.
 ObjectName queryObjectName(String pattern)
          Queries for an object name of an MBean matching the given query pattern.
 ObjectName queryObjectName(String domain, Map keySet, String className)
          Queries for an object name of an MBean from the specific domain, with the given key set and of the specified class.
 ObjectName queryObjectName(String pattern, String className)
          Queries for an object name of an MBean matching the given query pattern and of the specified class.
 Set queryObjectNames(ObjectName query)
          Queries for a set of object names of MBeans.
 Set queryObjectNames(ObjectName query, QueryExp exp)
          Queries for a set of object names of MBeans with a query expression.
 Set queryObjectNames(ObjectName query, String className)
          Queries for a set of object names of MBeans of the specified class.
 Set queryObjectNames(String pattern)
          Queries for a set of object names of MBeans matching the given query pattern.
 Set queryObjectNames(String domain, Map keySet, String className)
          Queries for a set of object names of MBeans from the specific domain, with given key set and of the specified class.
 Set queryObjectNames(String pattern, String className)
          Queries for a set of object names of MBeans matching the given query pattern and of the specified class.
 void remove(String key)
          Removes an MBean from this registry.
 void setQueryPattern(String key, ObjectName name)
          Sets the object name of a registry MBean.
 void setQueryPattern(String key, String ifname, ObjectName name)
          Sets the interface and object name of a registry MBean.
 void unmanaged()
          This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.
 
Methods inherited from class org.norther.tammi.core.base.DefaultContainer
clear, containsKey, getContainerKey, getContainerKey, getContainerKey, getMBeanHandle, getMBeanHandles, getMBeanInterface, getMBeanInterface, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, setMBeanInterface
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.base.Container
clear, containsKey, getContainerKey, getContainerKey, getContainerKey, getMBeanInterface, getMBeanInterface, getQueryPattern, registryKeySet, registryKeySet, registryKeySet, registryKeySet, registryMap, registrySize, setMBeanInterface
 

Constructor Detail

DefaultBroker

public DefaultBroker()
Constructs a new broker.

Method Detail

postmanaged

public void postmanaged()
Description copied from interface: Manageable
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.

Specified by:
postmanaged in interface Manageable
Overrides:
postmanaged in class Adaptee

unmanaged

public void unmanaged()
               throws Exception
Description copied from interface: Manageable
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.

Specified by:
unmanaged in interface Manageable
Overrides:
unmanaged in class Adaptee
Throws:
Exception - if the adaptee refused to be unmanaged.

get

public Object get(Class clazz)
Description copied from interface: Broker
Gets the referent of the default MBean implementing a specific interface. The default MBean is the implementation mapped to the default alias key or, if not configured, the first implementation found from the domain of the default broker.

Specified by:
get in interface Broker
Parameters:
clazz - the MBean interface of the default MBean.
Returns:
the referent of the default MBean implementation or null.

getMBean

public MBeanReference getMBean(Class clazz)
Description copied from interface: Broker
Gets a reference to the default MBean implementing a specific interface. The default MBean is the implementation mapped to the default alias key or, if not configured, the first implementation found from the domain of the default broker.

Specified by:
getMBean in interface Broker
Parameters:
clazz - the MBean interface of the default MBean.
Returns:
a reference to the default MBean implementation or null.

get

public Object get(String key)
Description copied from interface: Container
Gets the referent of the MBean in this registry.

Specified by:
get in interface Container
Overrides:
get in class DefaultContainer
Parameters:
key - the registry key.
Returns:
the referent or null.

getMBean

public MBeanReference getMBean(String key)
Description copied from interface: Container
Gets a reference to the MBean in this registry.

Specified by:
getMBean in interface Container
Overrides:
getMBean in class DefaultContainer
Parameters:
key - the registry key.
Returns:
the reference or null.

getObjectName

public ObjectName getObjectName(String key)
Description copied from interface: Container
Gets the object name of the MBean in this registry, which is also registered in the MBean server.

Specified by:
getObjectName in interface Container
Overrides:
getObjectName in class DefaultContainer
Parameters:
key - the registry key.
Returns:
the name or null if not in registered.

getObjectNames

public Set getObjectNames(String key)
Description copied from interface: Container
Gets a set of ojbect names registered in the MBean server with names matching the query pattern of the MBean in this registry.

Specified by:
getObjectNames in interface Container
Overrides:
getObjectNames in class DefaultContainer
Parameters:
key - the registry key.
Returns:
a set of object names or an empty set.

setQueryPattern

public void setQueryPattern(String key,
                            ObjectName name)
Description copied from interface: Container
Sets the object name of a registry MBean.

Specified by:
setQueryPattern in interface Container
Overrides:
setQueryPattern in class DefaultContainer
Parameters:
key - the registry key.
name - the object name or query pattern.

setQueryPattern

public void setQueryPattern(String key,
                            String ifname,
                            ObjectName name)
Description copied from interface: Container
Sets the interface and object name of a registry MBean. If the registry is already configured for a specific interface, the interface name must correspond to it.

Specified by:
setQueryPattern in interface Container
Overrides:
setQueryPattern in class DefaultContainer
Parameters:
key - the registry key.
ifname - the class or interface name.
name - the object name or query pattern.

remove

public void remove(String key)
Description copied from interface: Container
Removes an MBean from this registry.

Specified by:
remove in interface Container
Overrides:
remove in class DefaultContainer
Parameters:
key - the registry key.

queryMBean

public MBeanReference queryMBean(ObjectName query)
Description copied from interface: Broker
Queries for an MBean.

Specified by:
queryMBean in interface Broker
Parameters:
query - a query pattern.
Returns:
the MBean found or null.

queryMBean

public MBeanReference queryMBean(ObjectName query,
                                 QueryExp exp)
Description copied from interface: Broker
Queries for an MBean with a query expression.

Specified by:
queryMBean in interface Broker
Parameters:
query - a query pattern.
exp - an optional query expression.
Returns:
the MBean found or null.

queryMBean

public MBeanReference queryMBean(ObjectName query,
                                 String className)
Description copied from interface: Broker
Queries for an MBean of the specified class.

Specified by:
queryMBean in interface Broker
Parameters:
query - a query pattern.
className - a class or interface, null for any.
Returns:
the MBean found or null.

queryMBean

public MBeanReference queryMBean(String pattern)
Description copied from interface: Broker
Queries for an MBean matching the given query pattern.

Specified by:
queryMBean in interface Broker
Parameters:
pattern - a query pattern as a string.
Returns:
the MBean found or null.

queryMBean

public MBeanReference queryMBean(String pattern,
                                 String className)
Description copied from interface: Broker
Queries for an MBean matching the given query pattern and of the specified class.

Specified by:
queryMBean in interface Broker
Parameters:
pattern - a query pattern as a string.
className - a class or interface, null for any.
Returns:
the MBean found or null.

queryMBean

public MBeanReference queryMBean(String domain,
                                 Map keySet,
                                 String className)
Description copied from interface: Broker
Queries for an MBean from the specific domain, with the given key set and of the specified class.

Specified by:
queryMBean in interface Broker
Parameters:
domain - the query domain, null for any.
keySet - a set of keys, null for any.
className - a class or interface, null for any.
Returns:
the MBean found or null.

queryObjectName

public ObjectName queryObjectName(ObjectName query)
Description copied from interface: Broker
Queries for an object name of an MBean.

Specified by:
queryObjectName in interface Broker
Parameters:
query - a query pattern.
Returns:
the found object name or null.

queryObjectName

public ObjectName queryObjectName(ObjectName query,
                                  QueryExp exp)
Description copied from interface: Broker
Queries for an object name of an MBean with a query expression.

Specified by:
queryObjectName in interface Broker
Parameters:
query - a query pattern.
exp - an optional query expression.
Returns:
the found object name or null.

queryObjectName

public ObjectName queryObjectName(ObjectName query,
                                  String className)
Description copied from interface: Broker
Queries for an object name of an MBean of the specified class.

Specified by:
queryObjectName in interface Broker
Parameters:
query - a query pattern.
className - a class or interface, null for any.
Returns:
the found object name or null.

queryObjectName

public ObjectName queryObjectName(String pattern)
Description copied from interface: Broker
Queries for an object name of an MBean matching the given query pattern.

Specified by:
queryObjectName in interface Broker
Parameters:
pattern - a query pattern as a string.
Returns:
the found object name or null.

queryObjectName

public ObjectName queryObjectName(String pattern,
                                  String className)
Description copied from interface: Broker
Queries for an object name of an MBean matching the given query pattern and of the specified class.

Specified by:
queryObjectName in interface Broker
Parameters:
pattern - a query pattern as a string.
className - a class or interface, null for any.
Returns:
the found object name or null.

queryObjectName

public ObjectName queryObjectName(String domain,
                                  Map keySet,
                                  String className)
Description copied from interface: Broker
Queries for an object name of an MBean from the specific domain, with the given key set and of the specified class.

Specified by:
queryObjectName in interface Broker
Parameters:
domain - the query domain, null for any.
keySet - a set of keys, null for any.
className - a class or interface, null for any.
Returns:
the found object name or null.

queryObjectNames

public Set queryObjectNames(ObjectName query)
Description copied from interface: Broker
Queries for a set of object names of MBeans.

Specified by:
queryObjectNames in interface Broker
Parameters:
query - a query pattern.
Returns:
a set of found object names or an empty set.

queryObjectNames

public Set queryObjectNames(ObjectName query,
                            QueryExp exp)
Description copied from interface: Broker
Queries for a set of object names of MBeans with a query expression.

Specified by:
queryObjectNames in interface Broker
Parameters:
query - a query pattern.
exp - an optional query expression.
Returns:
a set of found object names or an empty set.

queryObjectNames

public Set queryObjectNames(ObjectName query,
                            String className)
Description copied from interface: Broker
Queries for a set of object names of MBeans of the specified class.

Specified by:
queryObjectNames in interface Broker
Parameters:
query - a query pattern.
className - a class or interface, null for any.
Returns:
a set of found object names or an empty set.

queryObjectNames

public Set queryObjectNames(String pattern)
Description copied from interface: Broker
Queries for a set of object names of MBeans matching the given query pattern.

Specified by:
queryObjectNames in interface Broker
Parameters:
pattern - a query pattern as a string.
Returns:
a set of found object names or an empty set.

queryObjectNames

public Set queryObjectNames(String pattern,
                            String className)
Description copied from interface: Broker
Queries for a set of object names of MBeans matching the given query pattern and of the specified class.

Specified by:
queryObjectNames in interface Broker
Parameters:
pattern - a query pattern as a string.
className - a class or interface, null for any.
Returns:
a set of found object names or an empty set.

queryObjectNames

public Set queryObjectNames(String domain,
                            Map keySet,
                            String className)
Description copied from interface: Broker
Queries for a set of object names of MBeans from the specific domain, with given key set and of the specified class.

Specified by:
queryObjectNames in interface Broker
Parameters:
domain - the query domain, null for any.
keySet - a set of keys, null for any.
className - a class or interface, null for any.
Returns:
a set of found object names or an empty set.


Copyright © 2004 The Norther Organization. All rights reserved.