org.norther.tammi.core.rt
Class DefaultVariableConverter

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.rt.DefaultVariableConverter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Manageable, MBeanDelegate, ObjectConverter, VariableConverter

public class DefaultVariableConverter
extends DefaultObjectConverter
implements VariableConverter

A default implementation of VariableConverter.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static String VARIABLE_MBEAN_TYPE
          The variable MBean 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
DefaultVariableConverter()
          Constructs a new converter.
 
Method Summary
protected  Object getComponentInstance(String className, Object object, String pattern, Object minValue, Object maxValue)
          Gets a variable MBean instance of the type specified by the object if it represents a character sequence.
 ObjectName getVariableRegistryName()
          Gets the the variable registry of this converter.
 boolean isConversionSupported(String className)
          Checks whether conversion of the specified class is supported.
 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.
 void setVariableRegistryName(ObjectName registry)
          Sets the variable registry of this converter.
protected  String toComponentString(String className, Object object, String pattern)
          Returns the variable type of a variable MBean or its attribute value specified by the pattern if available.
 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.converter.DefaultObjectConverter
fromLocalizedObject, getFormatPattern, getInstance, getInstance, getInstance, getLocalizedPattern, getResourceFinderName, setResourceFinderName, toLocalizedObject, toString, toString, toString, toStrings, toStrings, toStrings
 
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.converter.ObjectConverter
getFormatPattern, getInstance, getInstance, getInstance, getLocalizedPattern, getResourceFinderName, setResourceFinderName, toString, toString, toString, toStrings, toStrings, toStrings
 

Field Detail

VARIABLE_MBEAN_TYPE

public static final String VARIABLE_MBEAN_TYPE
The variable MBean type.

Constructor Detail

DefaultVariableConverter

public DefaultVariableConverter()
Constructs a new converter.

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 DefaultObjectConverter

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 DefaultObjectConverter
Throws:
Exception - if the adaptee refused to be unmanaged.

getVariableRegistryName

public ObjectName getVariableRegistryName()
Description copied from interface: VariableConverter
Gets the the variable registry of this converter.

Specified by:
getVariableRegistryName in interface VariableConverter
Returns:
the object name of the variable registry or a query.

setVariableRegistryName

public void setVariableRegistryName(ObjectName registry)
Description copied from interface: VariableConverter
Sets the variable registry of this converter. If it is not set, the default one will be used.

Specified by:
setVariableRegistryName in interface VariableConverter
Parameters:
registry - the object name of the variable registry or a query.

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 a variable MBean instance of the type specified by the object if it represents a character sequence.

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 variable type of a variable MBean or its attribute value specified by the pattern if available.

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.