|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.rt.VariableX
public class VariableX
A lightweight Variable implementation supporting a fixed set of dynamic attributes only. VariableX doesn't implement NotificationBroadcaster, which prevents its use with handles. The meta-data of the attribute set is locked and shared with other instances of the same virtual type by default making the memory footprint smaller.
| Field Summary | |
|---|---|
static String |
MBEAN_CONST_DESCRIPTION
Constructor description. |
static MBeanAttributeInfo[] |
VARIABLE_ATTRIBUTES
Variable attributes. |
static MBeanConstructorInfo[] |
VARIABLE_CONSTRUCTORS
Variable constructors. |
static MBeanNotificationInfo[] |
VARIABLE_NOTIFICATIONS
Variable notifications. |
static MBeanOperationInfo[] |
VARIABLE_OPERATIONS
Variable operations. |
| Fields inherited from interface org.norther.tammi.core.base.ReferableMBean |
|---|
DEFAULT_ID, ID, MBEAN, MBEAN_DESCRIPTION, TYPE |
| Constructor Summary | |
|---|---|
VariableX()
Constructs a new variable. |
|
VariableX(String type)
Constructs a new variable with a type. |
|
| Method Summary | |
|---|---|
boolean |
addAttributeInfo(Collection attrs)
Adds attribute info of new attributes to this variable if they're not already present. |
protected boolean |
addAttributeInfoIfAbsent(Collection c)
Adds a collection of attribute info instances without cloning. |
void |
addTraceListener(TraceListener listener)
Adds a listener if not already present. |
void |
addValidatedElement(String name,
int index,
Object value)
Adds an indexed element to an array attribute with validation. |
void |
addValidatedElement(String name,
Object value)
Adds an element to an array attribute with validation. |
void |
applyAttributeExporter(AttributeExporter exporter)
Applies an attribute exporter. |
void |
applyAttributeImporter(AttributeImporter importer)
Applies an attribute importer. |
void |
applyAttributeValidator(AttributeValidator validator)
Applies an attribute validator. |
Collection |
attributeInfo()
Returns attribute info of dynamic attributes of this variable. |
VariableAttributeInfo |
attributeInfo(String name)
Returns attribute info for a named attribute. |
VariableAttributeInfo |
attributeInfo(String name,
boolean unlocked)
Returns optionally unlocked attribute info for a named attribute. |
protected void |
attributeInfoRegistered(VariableAttributeInfo info)
Callback for a registered attribute info. |
int |
attributeLength(String name)
Returns the length of an array attribute. |
List |
attributeList()
Returns attribute info for all attributes in the definition order without internal attributes. |
List |
attributeList(boolean unlocked)
Returns optionally unlocked attribute info for all attributes in the definition order without internal attributes. |
List |
attributeList(String group)
Returns attribute info for attributes of the specified group in the definition order without internal attributes. |
List |
attributeList(String group,
boolean unlocked)
Returns optionally unlocked attribute info for attributes of the specified group in the definition order without internal attributes. |
AttributeList |
attributesToStrings()
Returns values of all attributes as strings. |
void |
clearAttributeInfo()
Clears attribute info of dynamic attributes of this variable. |
void |
clearAttributeValues()
Clears attribute values of the current attributes. |
void |
clearTraceListeners()
Clears all listeners from this traceable. |
Object |
clone()
Clones this variable. |
boolean |
containsAttribute(String name)
Checks whether the named attribute exists. |
AttributeList |
exportAttributes(Identity id,
Object source,
boolean foreign)
Exports attribute values to another variable identified by the specified Identity and obtained from an external source by applying
the exporter of this variable. |
AttributeList |
exportAttributes(Object target)
Exports attribute values to another object. |
AttributeList |
exportAttributes(Object target,
AttributeFilter filter)
Exports filtered attribute values to another object. |
AttributeList |
exportAttributes(Variable other,
Object source,
boolean foreign)
Exports attribute values to another variable obtained from an external source by applying the exporter of this variable. |
Object |
getAttribute(String name)
Gets the value of the named internal or dynamic attribute without access checks and any variable specific validation. |
AttributeList |
getAttributes(String[] names)
Gets the values of the named internal or dynamic attributes without access checks and any variable specific validation. |
Object |
getAttributeValue(String name)
Gets the value of the named dynamic attribute without access checks and any variable specific validation. |
protected Object |
getAttributeValue(VariableAttributeInfo info,
boolean validate)
Gets the attribute value. |
String |
getCanonicalName()
Gets the canonical object name of the MBean as a string. |
protected Object |
getInternalAttributeValue(VariableAttributeInfo info,
boolean reset)
Gets the internal attribute value. |
long |
getLastInitialized()
Gets the timestamp of the last initialization of the traced object. |
long |
getLastModified()
Gets the timestamp of the last modification of the traced object. |
long |
getLastModified(Object key)
Gets the timestamp of the last modification of the specified resource. |
MBeanReference |
getMBean()
Gets a reference to the MBean. |
MBeanInfo |
getMBeanInfo()
|
protected MBeanServer |
getMBeanServer()
Gets the MBean server. |
protected ObjectName |
getObjectName()
Gets the object name. |
Object |
getValidatedElement(String name,
int index)
Gets the indexed element of an array attribute with validation. |
Object |
getValidatedValue(String name)
Gets the value of a named dynamic attribute with validation. |
Map |
getValidatedValues()
Gets attribute values as a map of name value bindings with validation. |
Object |
getVariableId()
Gets the id of this variable corresponding its primary attributes. |
String |
getVariableType()
Gets the type of this variable in the variable registry. |
AttributeList |
importAttributes(Identity id,
Object source,
boolean foreign)
Imports attribute values from another variable identified by the specified Identity and obtained from an external source by
applying the importer of this variable. |
AttributeList |
importAttributes(Object source)
Imports attribute values from another object. |
AttributeList |
importAttributes(Object source,
AttributeFilter filter)
Imports filtered attribute values from another object. |
AttributeList |
importAttributes(Variable other,
Object source,
boolean foreign)
Imports attribute values from another variable obtained from an external source by applying the importer of this variable. |
Object |
invoke(String name,
Object[] params,
String[] signature)
|
boolean |
isEmpty()
Checks whether this variable contains any attributes. |
boolean |
isModifiable()
Checks whether attribute definitions can be modified during run-time. |
void |
postDeregister()
|
void |
postRegister(Boolean done)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
|
protected Object |
putAttributeValue(VariableAttributeInfo info,
Object value,
boolean validate)
Sets the attribute value with validation. |
protected Object |
putInternalAttributeValue(VariableAttributeInfo info,
Object value,
boolean reset)
Puts the internal attribute value. |
protected Object |
putInternalAttributeValue(VariableAttributeInfo info,
Object value,
long timestamp,
boolean reset)
Puts the internal attribute value with a modification timestamp. |
protected void |
registerAttributeInfo(OrderedMap map)
Sets the attribute info map. |
protected void |
registerVariable(String type)
Registers the type of the variable in the variable registry. |
void |
removeTraceListener(TraceListener listener)
Removes a listener. |
Object |
removeValidatedElement(String name,
int index)
Removes the indexed element from an array attribute. |
boolean |
removeValidatedElement(String name,
Object value)
Removes an element from an array attribute. |
void |
replaceAttributeInfo(Collection attrs)
Replaces attribute info of dynamic attributes of this variable. |
Map |
resetValidatedValues(Map attributes)
Resets attribute values in a map of name value bindings with validation. |
void |
sendNotification(String message,
String name,
String type,
Object oldValue,
Object newValue)
Sends a modification notification. |
void |
setAttribute(Attribute attr)
Sets the value of the given internal or dynamic attribute without access checks and any variable specific validation. |
protected void |
setAttributeElement(VariableAttributeInfo info,
int index,
boolean add,
Object value)
Sets the indexed attribute value with full validation. |
AttributeList |
setAttributes(AttributeList attrs)
Sets the values of the listed internal or dynamic attributes without access checks and any variable specific validation. |
void |
setAttributeValue(String name,
Object value)
Sets the value of the named dynamic attribute without access checks and any variable specific validation. |
void |
setCanonicalName(String name)
Sets the canonical object name of the MBean as a string. |
protected void |
setInternalAttributeElement(VariableAttributeInfo info,
int index,
boolean add,
Object value)
Sets the indexed internal attribute value. |
void |
setLastModified(Object key,
long timestamp)
Sets the timestamp of the last modification of the specified resource. |
protected void |
setObjectName(ObjectName name)
Sets the object name. |
void |
setValidatedElement(String name,
int index,
Object value)
Sets the indexed element of an array attribute with validation. |
void |
setValidatedValue(String name,
Object value)
Sets the value of an attribute as a name value pair with validation. |
void |
setValidatedValues(Map attributes)
Sets attribute values in a map of name value bindings with validation. |
void |
setVariableId(Object id)
Sets the id of this variable corresponding its primary attributes. |
protected Map |
validateAttributes(Map attributes,
OrderedMap valid)
Validates attribute values in a map of name value bindings. |
protected Object |
validateAttributeValue(VariableAttributeInfo info,
Object value)
Validates the attribute value by meta-data with run-time exceptions. |
Map |
validateAttributeValues()
Validates attribute values of the current attributes. |
Map |
validateAttributeValues(Map attributes)
Validates attribute values in a map of name value bindings. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String MBEAN_CONST_DESCRIPTION
public static final MBeanConstructorInfo[] VARIABLE_CONSTRUCTORS
public static final MBeanAttributeInfo[] VARIABLE_ATTRIBUTES
public static final MBeanOperationInfo[] VARIABLE_OPERATIONS
public static final MBeanNotificationInfo[] VARIABLE_NOTIFICATIONS
| Constructor Detail |
|---|
public VariableX()
public VariableX(String type)
type - the variable type.| Method Detail |
|---|
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws Exception
preRegister in interface MBeanRegistrationExceptionpublic void postRegister(Boolean done)
postRegister in interface MBeanRegistration
public void preDeregister()
throws Exception
preDeregister in interface MBeanRegistrationExceptionpublic void postDeregister()
postDeregister in interface MBeanRegistrationpublic Object clone()
Variable
clone in interface Variableclone in class Objectpublic MBeanReference getMBean()
ReferableMBean
getMBean in interface ReferableMBean
public Object getAttribute(String name)
throws AttributeNotFoundException,
ReflectionException,
MBeanException
Variable
getAttribute in interface DynamicMBeangetAttribute in interface Variablename - the attribute name.
AttributeNotFoundException - if the name is unknown.
ReflectionException - if a getter is not found.
MBeanException - if getting of the value fails.
public void setAttribute(Attribute attr)
throws AttributeNotFoundException,
InvalidAttributeValueException,
ReflectionException,
MBeanException
Variable
setAttribute in interface DynamicMBeansetAttribute in interface Variableattr - the attribute to set.
AttributeNotFoundException - if the name is unknown.
InvalidAttributeValueException - if the value is invalid.
ReflectionException - if a getter is not found.
MBeanException - if getting of the value fails.public AttributeList getAttributes(String[] names)
Variable
getAttributes in interface DynamicMBeangetAttributes in interface Variablenames - an array of attribute names.
public AttributeList setAttributes(AttributeList attrs)
Variable
setAttributes in interface DynamicMBeansetAttributes in interface Variableattrs - the attributes to set.
public Object getAttributeValue(String name)
throws AttributeNotFoundException
Variable
getAttributeValue in interface Variablename - the attribute name.
AttributeNotFoundException - if the name is unknown.
public void setAttributeValue(String name,
Object value)
throws AttributeNotFoundException,
InvalidAttributeValueException
Variable
setAttributeValue in interface Variablename - the attribute name.value - the attribute value.
AttributeNotFoundException - if the name is unknown.
InvalidAttributeValueException - if the value is invalid.public Map getValidatedValues()
Variable
getValidatedValues in interface Variablepublic void setValidatedValues(Map attributes)
Variable
setValidatedValues in interface Variableattributes - the attributes map.public Map resetValidatedValues(Map attributes)
VariableInvalid attributes are returned in a map binding an invalid attribute name to a validation exception. An empty map indicates that all attributes were valid.
Note that if the attributes map does not contain any settable values, null is returned.
resetValidatedValues in interface Variableattributes - the attributes map.
public Map validateAttributeValues(Map attributes)
VariableInvalid attributes are returned in a map binding an invalid attribute name to a validation exception. An empty map indicates that all attributes were valid.
Note that if the attributes map does not contain any settable values, null is returned.
validateAttributeValues in interface Variableattributes - the attributes map.
public Map validateAttributeValues()
VariableInvalid attributes are returned in a map binding an invalid attribute name to a validation exception. An empty map indicates that all attributes were valid.
validateAttributeValues in interface Variablepublic void clearAttributeValues()
Variable
clearAttributeValues in interface Variable
public Object getValidatedValue(String name)
throws AttributeNotFoundException
Variable
getValidatedValue in interface Variablename - the attribute name.
AttributeNotFoundException - if the name is unknown.
public void setValidatedValue(String name,
Object value)
throws AttributeNotFoundException,
InvalidAttributeValueException
Variable
setValidatedValue in interface Variablename - the attribute name.value - the attribute value.
AttributeNotFoundException - if the name is unknown.
InvalidAttributeValueException - if the value is invalid.
public Object getValidatedElement(String name,
int index)
throws AttributeNotFoundException
Variable
getValidatedElement in interface Variablename - the attribute name.index - the element index.
AttributeNotFoundException - if the name is unknown.
public void setValidatedElement(String name,
int index,
Object value)
throws AttributeNotFoundException,
InvalidAttributeValueException
Variable
setValidatedElement in interface Variablename - the attribute name.index - the element index.value - the value of the element.
AttributeNotFoundException - if the name is unknown.
InvalidAttributeValueException - if the value is invalid.
public void addValidatedElement(String name,
Object value)
throws AttributeNotFoundException,
InvalidAttributeValueException
Variable
addValidatedElement in interface Variablename - the attribute name.value - the value of the element.
AttributeNotFoundException - if the name is unknown.
InvalidAttributeValueException - if the value is invalid.
public void addValidatedElement(String name,
int index,
Object value)
throws AttributeNotFoundException,
InvalidAttributeValueException
Variable
addValidatedElement in interface Variablename - the attribute name.index - the element index.value - the value of the element.
AttributeNotFoundException - if the name is unknown.
InvalidAttributeValueException - if the value is invalid.
public boolean removeValidatedElement(String name,
Object value)
throws AttributeNotFoundException
Variable
removeValidatedElement in interface Variablename - the attribute name.value - the value of the element.
AttributeNotFoundException - if the name is unknown.
public Object removeValidatedElement(String name,
int index)
throws AttributeNotFoundException
Variable
removeValidatedElement in interface Variablename - the attribute name.index - the element index.
AttributeNotFoundException - if the name is unknown.
public int attributeLength(String name)
throws AttributeNotFoundException
Variable
attributeLength in interface Variablename - the attribute name.
AttributeNotFoundException - if the name is unknown.public boolean containsAttribute(String name)
Variable
containsAttribute in interface Variablename - the name of the attribute.
public VariableAttributeInfo attributeInfo(String name)
Variable
attributeInfo in interface Variablename - the name of the attribute.
public VariableAttributeInfo attributeInfo(String name,
boolean unlocked)
Variable
attributeInfo in interface Variablename - the name of the attribute.unlocked - true for unlocked, false otherwise.
public List attributeList()
Variable
attributeList in interface Variablepublic List attributeList(boolean unlocked)
Variable
attributeList in interface Variableunlocked - true for unlocked, false otherwise.
public List attributeList(String group)
Variable
attributeList in interface Variablegroup - the group.
public List attributeList(