org.norther.tammi.core.base
Class DefaultContainer

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.base.DefaultContainer
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Container, Manageable, MBeanDelegate
Direct Known Subclasses:
AbstractContainerFilter, DefaultBroker, DefaultConverter, DefaultFactory, DefaultSecureContainer

public class DefaultContainer
extends Adaptee
implements Container

A default implementation of Container.

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
  DefaultContainer()
          Constructs a new container.
  DefaultContainer(String ifname)
          Constructs a new container with a named interface.
protected DefaultContainer(String ifname, int capacity)
          Constructs a new container with a named interface and initial capacity.
 
Method Summary
 void clear()
          Clears all MBeans from this registry.
 boolean containsKey(String key)
          Checks whether the specified key is registered in this registry.
 Object get(String key)
          Gets the referent of the MBean in this registry.
 String getContainerKey(ObjectName name)
          Gets the key of a named MBean in this container.
 String getContainerKey(String ifname)
          Gets the key of an MBean of a specific class in this container.
 String getContainerKey(String ifname, ObjectName name)
          Gets the key of a named MBean of a specific class in this container.
 MBeanReference getMBean(String key)
          Gets a reference to the MBean in this registry.
protected  MBeanHandle getMBeanHandle(String key)
          Gets a reference to a mapped MBean.
protected  ConcurrentMap getMBeanHandles()
          Gets a map of MBean references.
 String getMBeanInterface()
          Gets the interface of MBeans in this registry.
 String getMBeanInterface(String key)
          Gets the interface of a registry MBean.
 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.
 ObjectName getQueryPattern(String key)
          Gets the query pattern, with which the MBean is registered in this registry.
 Set registryKeySet()
          Returns a read-only set of registered keys.
 Set registryKeySet(ObjectName name)
          Returns a set of registered keys a named MBean in this registry.
 Set registryKeySet(String ifname)
          Returns a set of registered keys of MBeans of a specific class in this registry.
 Set registryKeySet(String ifname, ObjectName name)
          Returns a set of registered keys of a named MBean of a specific class in this registry.
 Map registryMap()
          Returns a map view to this registry.
 int registrySize()
          Gets the size of the registry.
 void remove(String key)
          Removes an MBean from this registry.
 void setMBeanInterface(String key, String ifname)
          Sets the interface of a registry MBean.
 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.
 
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, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultContainer

public DefaultContainer()
Constructs a new container.


DefaultContainer

public DefaultContainer(String ifname)
Constructs a new container with a named interface.

Parameters:
ifname - the name of the interface.

DefaultContainer

protected DefaultContainer(String ifname,
                           int capacity)
Constructs a new container with a named interface and initial capacity.

Parameters:
ifname - the name of the interface.
capacity - the initial capacity.
Method Detail

getMBeanInterface

public String getMBeanInterface()
Description copied from interface: Container
Gets the interface of MBeans in this registry.

Specified by:
getMBeanInterface in interface Container
Returns:
the MBean interface or null for any.

getQueryPattern

public ObjectName getQueryPattern(String key)
Description copied from interface: Container
Gets the query pattern, with which the MBean is registered in this registry. The MBean registration is not checked from the MBean server.

Specified by:
getQueryPattern in interface Container
Parameters:
key - the registry key.
Returns:
the pattern or null if not registered.

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
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
Parameters:
key - the registry key.
ifname - the class or interface name.
name - the object name or query pattern.

getMBeanInterface

public String getMBeanInterface(String key)
Description copied from interface: Container
Gets the interface of a registry MBean.

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

setMBeanInterface

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

Specified by:
setMBeanInterface in interface Container
Parameters:
key - the registry key.
ifname - the class or interface name.

containsKey

public boolean containsKey(String key)
Description copied from interface: Container
Checks whether the specified key is registered in this registry.

Specified by:
containsKey in interface Container
Parameters:
key - the key to check.
Returns:
true if the key is registered, otherwise false.

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
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
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
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
Parameters:
key - the registry key.
Returns:
a set of object names or an empty set.

getContainerKey

public String getContainerKey(String ifname)
Description copied from interface: Container
Gets the key of an MBean of a specific class in this container.

Specified by:
getContainerKey in interface Container
Parameters:
ifname - the class or interface name.
Returns:
the container key or null.

getContainerKey

public String getContainerKey(ObjectName name)
Description copied from interface: Container
Gets the key of a named MBean in this container.

Specified by:
getContainerKey in interface Container
Parameters:
name - the object name or query pattern.
Returns:
the container key or null.

getContainerKey

public String getContainerKey(String ifname,
                              ObjectName name)
Description copied from interface: Container
Gets the key of a named MBean of a specific class in this container.

Specified by:
getContainerKey in interface Container
Parameters:
ifname - the class or interface name.
name - the object name or query pattern.
Returns:
the container key or null.

registrySize

public int registrySize()
Description copied from interface: Container
Gets the size of the registry.

Specified by:
registrySize in interface Container
Returns:
the registry size.

registryKeySet

public Set registryKeySet(String ifname)
Description copied from interface: Container
Returns a set of registered keys of MBeans of a specific class in this registry.

Specified by:
registryKeySet in interface Container
Parameters:
ifname - the class or interface name.
Returns:
the registry key set.

registryKeySet

public Set registryKeySet(ObjectName name)
Description copied from interface: Container
Returns a set of registered keys a named MBean in this registry.

Specified by:
registryKeySet in interface Container
Parameters:
name - the object name or query pattern.
Returns:
the registry key set.

registryKeySet

public Set registryKeySet(String ifname,
                          ObjectName name)
Description copied from interface: Container
Returns a set of registered keys of a named MBean of a specific class in this registry.

Specified by:
registryKeySet in interface Container
Parameters:
ifname - the class or interface name.
name - the object name or query pattern.
Returns:
the registry key set.

registryKeySet

public Set registryKeySet()
Description copied from interface: Container
Returns a read-only set of registered keys.

Specified by:
registryKeySet in interface Container
Returns:
a key set.

remove

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

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

clear

public void clear()
Description copied from interface: Container
Clears all MBeans from this registry.

Specified by:
clear in interface Container

registryMap

public Map registryMap()
Description copied from interface: Container
Returns a map view to this registry. The map is a clone of the transient state of the registry.

Specified by:
registryMap in interface Container
Returns:
a map of registered object names.

getMBeanHandle

protected MBeanHandle getMBeanHandle(String key)
Gets a reference to a mapped MBean.

Note that the reference is meant for internal use only.

Parameters:
key - the key to the MBean.
Returns:
the reference or null.

getMBeanHandles

protected ConcurrentMap getMBeanHandles()
Gets a map of MBean references.

Returns:
an updated map of MBean references.


Copyright © 2004 The Norther Organization. All rights reserved.