cz.cuni.amis.pogamut.base.utils.jmx
Class PogamutJMX

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.utils.jmx.PogamutJMX

public class PogamutJMX
extends java.lang.Object

PogamutJMX serves as a placeholder for creating ObjectNames for various Pogamut components (classes).

It will be important to you only in the case when you will need to interface Pogamut agents via JMX, it will allow you to construct correct ObjectNames that identifies them inside the MBean server.

Still the biggest trick is to obtain IAgentId (or at least its IAgentId.getToken()) in order to obtain correct getAgentObjectName(IToken).

Note that concrete object names of various agent's components might be obtained by calling static method on concrete class, i.e., JMXLogCategories#getJMXLogCategoryName.


Field Summary
static java.lang.String ACT_NAME
          Used by Act class
static java.lang.String AGENT_LOGGER_SUBTYPE
          Used by AgentLogger class.
static java.lang.String AGENT_SUBTYPE
          Used by AbstractAgent (i.e., AgentJMXComponents) class
static java.lang.String FLAGS_SUBTYPE
          Flag class
static java.lang.String INTROSPECTION_NAME
          introspection FolderToJMXEnabledAdapter class
static java.lang.String LOGCATEGORIES_NAME
          Used by LogCategory class
static java.lang.String LOGCATEGORY_SUBTYPE
          LogCategory class
 
Constructor Summary
PogamutJMX()
           
 
Method Summary
static javax.management.ObjectName getAgentObjectName(IToken agentId)
          Returns an ObjectName for the Pogamut's agents given by his 'agentId'.
static javax.management.ObjectName getAgentObjectName(java.lang.String agentId)
          Returns an ObjectName for the Pogamut's agents given by his 'agentId'.
static javax.management.ObjectName getObjectName(javax.management.ObjectName parent, java.lang.String childName)
          Creates hierarchical ObjectNames given a parent and name of the MBean.
static javax.management.ObjectName getObjectName(javax.management.ObjectName parent, java.lang.String childName, java.lang.String childTypeExtra)
          Creates hierarchical ObjectNames given a parent and name of the MBean.
static javax.management.ObjectName getObjectName(java.lang.String jmxDomain, java.lang.String type, java.lang.String name)
          Returns well formed JMX indentificator based on the domain / type / name.
static java.lang.String getPogamutJMXDomain()
          Returns an JMX Domain id used by Pogamut's agents.
static java.lang.String getSafeObjectNamePart(java.lang.String str)
          Replaces JMX URL chars with '_'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AGENT_SUBTYPE

public static final java.lang.String AGENT_SUBTYPE
Used by AbstractAgent (i.e., AgentJMXComponents) class

See Also:
Constant Field Values

ACT_NAME

public static final java.lang.String ACT_NAME
Used by Act class

See Also:
Constant Field Values

LOGCATEGORIES_NAME

public static final java.lang.String LOGCATEGORIES_NAME
Used by LogCategory class

See Also:
Constant Field Values

LOGCATEGORY_SUBTYPE

public static final java.lang.String LOGCATEGORY_SUBTYPE
LogCategory class

See Also:
Constant Field Values

FLAGS_SUBTYPE

public static final java.lang.String FLAGS_SUBTYPE
Flag class

See Also:
Constant Field Values

INTROSPECTION_NAME

public static final java.lang.String INTROSPECTION_NAME
introspection FolderToJMXEnabledAdapter class

See Also:
Constant Field Values

AGENT_LOGGER_SUBTYPE

public static java.lang.String AGENT_LOGGER_SUBTYPE
Used by AgentLogger class.

Constructor Detail

PogamutJMX

public PogamutJMX()
Method Detail

getAgentObjectName

public static javax.management.ObjectName getAgentObjectName(IToken agentId)
Returns an ObjectName for the Pogamut's agents given by his 'agentId'.

Used by AgentJMXComponents.

Parameters:
agentId - id of the agent that

getAgentObjectName

public static javax.management.ObjectName getAgentObjectName(java.lang.String agentId)
Returns an ObjectName for the Pogamut's agents given by his 'agentId'.

Used by AgentJMXComponents.

Parameters:
agentId - id of the agent that

getPogamutJMXDomain

public static java.lang.String getPogamutJMXDomain()
Returns an JMX Domain id used by Pogamut's agents.

Returns:
jmx domain used by Pogamut's agents.

getObjectName

public static javax.management.ObjectName getObjectName(javax.management.ObjectName parent,
                                                        java.lang.String childName,
                                                        java.lang.String childTypeExtra)
                                                 throws PogamutJMXNameException
Creates hierarchical ObjectNames given a parent and name of the MBean. Extra elements can be inserted into the path through typeExtra param.

Parameters:
parent - parent's ObjectName
childName - name of this object, if null no name element will be appended
childTypeExtra - extra element inserted to the end of hierarchical path, may be null
Returns:
ObjectName of form: domain=[parent's domain],type=[parent's type].[parent's name].[child extra type],name=[childName]
Throws:
PogamutJMXNameException

getObjectName

public static javax.management.ObjectName getObjectName(javax.management.ObjectName parent,
                                                        java.lang.String childName)
                                                 throws PogamutJMXNameException
Creates hierarchical ObjectNames given a parent and name of the MBean. Extra elements can be inserted into the path through typeExtra param.

Parameters:
parent - parent's ObjectName
childName - name of this object, if null no name element will be appended
Returns:
ObjectName of form: domain=[parent's domain],type=[parent's type].[parent's name],name=[name]
Throws:
PogamutJMXNameException

getSafeObjectNamePart

public static java.lang.String getSafeObjectNamePart(java.lang.String str)
Replaces JMX URL chars with '_'.

Parameters:
str -
Returns:

getObjectName

public static javax.management.ObjectName getObjectName(java.lang.String jmxDomain,
                                                        java.lang.String type,
                                                        java.lang.String name)
                                                 throws PogamutJMXNameException
Returns well formed JMX indentificator based on the domain / type / name.

Can be used to create ObjectName instance from javax.management package to identify the object inside MBeanServer.

Parameters:
jmxDomain - must be well formed
type - must be well formed
name - may be null, may contain invalid chars (will be replaced with '_')
Returns:
instance containing well-formed ObjectName
Throws:
PogamutJMXNameException