org.ow2.jasmine.probe.collectors.jmx.internal
Class FragmentUtil

java.lang.Object
  extended by org.ow2.jasmine.probe.collectors.jmx.internal.FragmentUtil

public class FragmentUtil
extends java.lang.Object

Manage JMX Attribute fragments. Attribute fragments are elements of complex attributes. Sometimes, users need to poll such attribute elements, for example an item in a Map, and don't need the entire attribute value. A naming policy is necessary to define the attributes elements to be polled by a JMX indicator. Also, when a JMX indicator specifies an attribute (or an attribute fragment) whose value has a complex type, the value must be decomposed in simple elements (elementary fragments). The naming policy is used to identify the fragments returned by a probe polling this indicator.

Author:
danesa

Field Summary
static java.lang.String BRACKLEFT
           
static java.lang.String BRACKRIGHT
           
static java.lang.String COMMA
           
static java.lang.String DOT
           
 
Constructor Summary
FragmentUtil()
           
 
Method Summary
static java.lang.String getAttributeName(java.lang.String name)
          Get the name of the attribute from a fragment's name
static java.lang.String getElementName(java.lang.String fragmentName)
          Get the name of an element from a fragment name.
static java.util.List<javax.management.Attribute> getFragments(javax.management.Attribute att)
          Decompose a JMX Attribute having a complex type into a list of Attributes having simple types (the fragments).
static java.lang.String getItemName(java.lang.String fragmentName)
          Get the name of an item's key from a fragment name.
static java.lang.String getNameForArrayElement(java.lang.String name, java.lang.String index)
          Generate the name of an element of an Array.
static java.lang.String getNameForItem(java.lang.String name, java.lang.String key)
          Generate the name of a fragment corresponding to a CompositeData's item.
static java.lang.String getNameForTabularElement(java.lang.String name, java.lang.Object[] indexes)
          Generate the name of a fragment corresponding to a row of in a TabularData
static boolean isFragmentName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOT

public static java.lang.String DOT

COMMA

public static java.lang.String COMMA

BRACKLEFT

public static java.lang.String BRACKLEFT

BRACKRIGHT

public static java.lang.String BRACKRIGHT
Constructor Detail

FragmentUtil

public FragmentUtil()
Method Detail

getFragments

public static java.util.List<javax.management.Attribute> getFragments(javax.management.Attribute att)
Decompose a JMX Attribute having a complex type into a list of Attributes having simple types (the fragments). The supported complex types are: The supported simple types are:

Parameters:
att - The initial attribute which may have a complex or a simple type. It its value has a simple type, the attribute is returned as it is. If it has a complex type, its value is decomposed in simple elements, the fragments.
Returns:
A list of fragments. A fragment is contained in an Attribute instance. A fragment's value is a simple value obtained by a complex value decomposition. A fragment's name is a name is based on the fragments naming policy. It starts with the initial attribute's name and contains a representation of the path followed by the decomposition process.

isFragmentName

public static boolean isFragmentName(java.lang.String name)
Parameters:
name - attribute or fragment name
Returns:
true if the name has a fragment name pattern

getNameForItem

public static java.lang.String getNameForItem(java.lang.String name,
                                              java.lang.String key)
Generate the name of a fragment corresponding to a CompositeData's item.

Parameters:
name - composite's name
key - the item's name

getNameForArrayElement

public static java.lang.String getNameForArrayElement(java.lang.String name,
                                                      java.lang.String index)
Generate the name of an element of an Array.

Parameters:
name - the name of the Array attribute or fragment
index - the element's index
Returns:

getNameForTabularElement

public static java.lang.String getNameForTabularElement(java.lang.String name,
                                                        java.lang.Object[] indexes)
Generate the name of a fragment corresponding to a row of in a TabularData

Parameters:
name - the name of the TabularData attribute or fragment
indexes - the row's indexes
Returns:

getAttributeName

public static java.lang.String getAttributeName(java.lang.String name)
                                         throws FragmentNameException
Get the name of the attribute from a fragment's name

Parameters:
name - fragment name
Returns:
attribute name
Throws:
FragmentNameException - An attribute name could not be identified as no DOT nor BRACKLEFT found.

getItemName

public static java.lang.String getItemName(java.lang.String fragmentName)
                                    throws FragmentNameException
Get the name of an item's key from a fragment name. Suppose that the fragment name has the following format: nameDOTkey

Parameters:
fragmentName - fragment name
Returns:
key
Throws:
FragmentNameException - A key name could not be identified.

getElementName

public static java.lang.String getElementName(java.lang.String fragmentName)
                                       throws FragmentNameException
Get the name of an element from a fragment name. Suppose that the fragment name has the following format: nameBRACKLEFTindexesBRACKRIGHT

Parameters:
fragmentName - fragment name
Returns:
the element name
Throws:
FragmentNameException


Copyright © 2011 OW2 Consortium. All Rights Reserved.