org.norther.tammi.core.converter
Class DefaultObjectNameConverter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.core.converter.DefaultObjectConverter
          extended by org.norther.tammi.core.converter.DefaultObjectNameConverter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, ObjectConverter

public class DefaultObjectNameConverter
extends DefaultObjectConverter

A converter for references between related MBeans. It produces either direct references or javax.management.ObjectName instances.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static String MBEAN_REFERENCE_TYPE
          The MBean reference type.
static String OBJECT_NAME_TYPE
          The object name type.
 
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
DefaultObjectNameConverter()
          Constructs a new converter.
 
Method Summary
protected  Object getComponentInstance(String className, Object object, String pattern, Object minValue, Object maxValue)
          Gets object name instance converted from a string.
 boolean isConversionSupported(String className)
          Checks whether conversion of the specified class is supported.
protected  String toComponentString(String className, Object object, String pattern)
          Returns the string representation of an object name.
 
Methods inherited from class org.norther.tammi.core.converter.DefaultObjectConverter
fromLocalizedObject, getFormatPattern, getInstance, getInstance, getInstance, getLocalizedPattern, getResourceFinderName, postmanaged, setResourceFinderName, toLocalizedObject, toString, toString, toString, toStrings, toStrings, toStrings, unmanaged
 
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
 

Field Detail

OBJECT_NAME_TYPE

public static final String OBJECT_NAME_TYPE
The object name type.


MBEAN_REFERENCE_TYPE

public static final String MBEAN_REFERENCE_TYPE
The MBean reference type.

Constructor Detail

DefaultObjectNameConverter

public DefaultObjectNameConverter()
Constructs a new converter.

Method Detail

isConversionSupported

public boolean isConversionSupported(String className)
Description copied from interface: ObjectConverter
Checks whether conversion of the specified class is supported.

Specified by:
isConversionSupported in interface ObjectConverter
Overrides:
isConversionSupported in class DefaultObjectConverter
Parameters:
className - the class name.
Returns:
true for a supported conversion, false otherwise.

getComponentInstance

protected Object getComponentInstance(String className,
                                      Object object,
                                      String pattern,
                                      Object minValue,
                                      Object maxValue)
                               throws ConversionException
Gets object name instance converted from a string. First the source string is converted to an object name as such. If the conversion fails and the pattern is not null, the object name is searched for by using the pattern as an object name query key.

Overrides:
getComponentInstance in class DefaultObjectConverter
Parameters:
className - the name of the class.
object - the source object.
pattern - the conversion pattern.
minValue - the minimum value.
maxValue - the maximum value.
Returns:
the instance.
Throws:
ConversionException - if conversion fails.

toComponentString

protected String toComponentString(String className,
                                   Object object,
                                   String pattern)
Returns the string representation of an object name. If the pattern is not null and the object name is not a pattern, the string representation is either a key value from the object name mapped to the pattern or a value of a MBean attribute named according to the pattern. Otherwise the string representation is the object name itself as a string.

Overrides:
toComponentString in class DefaultObjectConverter
Parameters:
className - the name of the class.
object - the source object.
pattern - the conversion pattern.
Returns:
the string representation.


Copyright © 2004 The Norther Organization. All rights reserved.