J2EE1.4 SDK

com.sun.appserv.management.base
Class Util

java.lang.Object
  extended bycom.sun.appserv.management.base.Util

public final class Util
extends java.lang.Object

Utility routines pertinent to the MBean API.


Method Summary
static java.lang.String concatenateProps(java.lang.String props1, java.lang.String props2)
           
static java.lang.String concatenateProps(java.lang.String props1, java.lang.String props2, java.lang.String props3)
           
static java.util.Map createNameMap(java.util.Set amxs)
          Create a Map keyed by the value of the AMX.NAME_KEY with value the AMX item.
static java.util.Map createObjectNameMap(java.util.Set objectNames)
          Create a Map keyed by the value of the AMX.NAME_KEY with value the ObjectName.
static Extra getExtra(AMX proxy)
          Get extra information about this AMX.
static java.lang.String getFullTypeProps(ObjectName objectName, java.lang.String fullType)
          Get properties corresponding to the FullType of this ObjectName.
static java.lang.String getJ2EEType(ObjectName objectName)
           
static java.lang.String getName(ObjectName objectName)
          Get the value of the AMX.NAME_KEY property within the ObjectName or AMX.NO_NAME if not present.
static java.lang.String[] getNamesArray(java.util.Set objectNames)
          Extract the names from all ObjectNames.
static java.util.Set getNamesSet(java.util.Set objectNames)
          Extract the names from all ObjectNames.
static ObjectName getObjectName(AMX proxy)
          Get the ObjectName targeted by this AMX.
static ObjectName getObjectName(java.util.Map candidates, java.lang.String name)
          Get an ObjectName from a Map of AMX or Map of ObjectName where the values are keyed by name.
static java.util.Set getPatternKeys(java.lang.String fullType)
          Get all keys required for an ObjectName pattern which uniquely identifies the MBean.
static java.lang.String getSelfProp(ObjectName objectName)
          Extract the j2eeType and name properties and return it as a single property j2eeType=name
static java.lang.String[] getTypeArray(java.lang.String fullType)
          Get the FullType as a String[], last element being the j2eeType.
static java.lang.String makeJ2EETypeProp(java.lang.String value)
          Make an ObjectName property of the form j2eeType=value.
static java.lang.String makeNameProp(java.lang.String value)
          Make an ObjectName property of the form name=value.
static java.lang.String makeProp(java.lang.String name, java.lang.String value)
          Make an ObjectName property of the form name=value.
static java.lang.String makeRequiredProps(java.lang.String j2eeType, java.lang.String name)
           
static ObjectName newObjectName(java.lang.String name)
          Create a new ObjectName, caller is guaranteeing that the name is well-formed (a RuntimeException will be thrown if not).
static ObjectName newObjectName(java.lang.String domain, java.lang.String props)
          Build an ObjectName.
static ObjectName newObjectNamePattern(ObjectName objectName)
          Build an ObjectName pattern.
static ObjectName newObjectNamePattern(java.lang.String domain, java.lang.String props)
          Build an ObjectName pattern.
static ObjectName[] toObjectNames(AMX[] amx)
           
static java.util.Map toObjectNames(java.util.Map amxMap)
           
static java.util.Set toObjectNames(java.util.Set amxs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newObjectName

public static ObjectName newObjectName(java.lang.String name)
Create a new ObjectName, caller is guaranteeing that the name is well-formed (a RuntimeException will be thrown if not). This avoids having to catch all sorts of JMX exceptions.
NOTE: Do not call this method if there is not certainty of a well-formed name.

Parameters:
name -

newObjectName

public static ObjectName newObjectName(java.lang.String domain,
                                       java.lang.String props)
Build an ObjectName. Calls newObjectName( domain + ":" + props )

Parameters:
domain - the JMX domain
props - properties of the ObjectName

newObjectNamePattern

public static ObjectName newObjectNamePattern(java.lang.String domain,
                                              java.lang.String props)
Build an ObjectName pattern.

Parameters:
domain - the JMX domain
props - properties of the ObjectName

newObjectNamePattern

public static ObjectName newObjectNamePattern(ObjectName objectName)
Build an ObjectName pattern.

Parameters:
objectName -

makeProp

public static java.lang.String makeProp(java.lang.String name,
                                        java.lang.String value)
Make an ObjectName property of the form name=value.

Parameters:
name -
value -

makeJ2EETypeProp

public static java.lang.String makeJ2EETypeProp(java.lang.String value)
Make an ObjectName property of the form j2eeType=value.

Parameters:
value -

makeNameProp

public static java.lang.String makeNameProp(java.lang.String value)
Make an ObjectName property of the form name=value.

Parameters:
value -

makeRequiredProps

public static java.lang.String makeRequiredProps(java.lang.String j2eeType,
                                                 java.lang.String name)
Parameters:
j2eeType -
name -

getSelfProp

public static java.lang.String getSelfProp(ObjectName objectName)
Extract the j2eeType and name properties and return it as a single property j2eeType=name

Parameters:
objectName -

getFullTypeProps

public static java.lang.String getFullTypeProps(ObjectName objectName,
                                                java.lang.String fullType)
Get properties corresponding to the FullType of this ObjectName. Its j2eeType/name are included as j2eeType=name, not as j2eeType=j2eeType,name=name.

Parameters:
objectName -
fullType -
Returns:
String of relevant ObjectName properties

getName

public static java.lang.String getName(ObjectName objectName)
Get the value of the AMX.NAME_KEY property within the ObjectName or AMX.NO_NAME if not present.

Returns:
the name

getJ2EEType

public static java.lang.String getJ2EEType(ObjectName objectName)

getTypeArray

public static java.lang.String[] getTypeArray(java.lang.String fullType)
Get the FullType as a String[], last element being the j2eeType.

Parameters:
fullType - as returned from AMX.getFullType()

getPatternKeys

public static java.util.Set getPatternKeys(java.lang.String fullType)
Get all keys required for an ObjectName pattern which uniquely identifies the MBean.


concatenateProps

public static java.lang.String concatenateProps(java.lang.String props1,
                                                java.lang.String props2)

concatenateProps

public static java.lang.String concatenateProps(java.lang.String props1,
                                                java.lang.String props2,
                                                java.lang.String props3)

toObjectNames

public static java.util.Set toObjectNames(java.util.Set amxs)
Returns:
a Set of ObjectNames from a Set of AMX.

toObjectNames

public static java.util.Map toObjectNames(java.util.Map amxMap)
Returns:
a Map of ObjectNames from a Map whose values are AMX.

toObjectNames

public static ObjectName[] toObjectNames(AMX[] amx)
Returns:
an ObjectName[] from an AMX[]

getNamesSet

public static java.util.Set getNamesSet(java.util.Set objectNames)
Extract the names from all ObjectNames. The name is the value of the property NAME_KEY (See AMX). Note that if two or more ObjectNames share the same name, the resulting Set will be of smaller size() than the original.

Returns:
Set

getNamesArray

public static java.lang.String[] getNamesArray(java.util.Set objectNames)
Extract the names from all ObjectNames.

Returns:
String[] of names from the ObjectNames

createObjectNameMap

public static final java.util.Map createObjectNameMap(java.util.Set objectNames)
Create a Map keyed by the value of the AMX.NAME_KEY with value the ObjectName. Note that if two or more ObjectNames share the same name, the resulting Map will contain only one of the original ObjectNames.

Parameters:
objectNames - Set of ObjectName

createNameMap

public static final java.util.Map createNameMap(java.util.Set amxs)
Create a Map keyed by the value of the AMX.NAME_KEY with value the AMX item.

Parameters:
amxs - Set of AMX

getExtra

public static Extra getExtra(AMX proxy)
Get extra information about this AMX. 'Extra' is not an MBean Attribute; it exists only in the AMX.

Parameters:
proxy - an AMX

getObjectName

public static ObjectName getObjectName(AMX proxy)
Get the ObjectName targeted by this AMX.

Parameters:
proxy - an AMX

getObjectName

public static ObjectName getObjectName(java.util.Map candidates,
                                       java.lang.String name)
Get an ObjectName from a Map of AMX or Map of ObjectName where the values are keyed by name.

Parameters:
candidates -
name -
Returns:
ObjectName
Throws:
java.lang.IllegalArgumentException - if not found

J2EE1.4 SDK

Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.