org.archive.util
Class JmxUtils

java.lang.Object
  extended by org.archive.util.JmxUtils

public class JmxUtils
extends java.lang.Object

Static utility used by JMX.

Version:
$Date: 2005-12-15 00:35:44 +0000 (Thu, 15 Dec 2005) $, $Revision: 4022 $
Author:
stack

Field Summary
static java.lang.String GUI_PORT
           
static java.lang.String HOST
           
static java.lang.String JMX_PORT
           
static java.lang.String JOB
           
static java.lang.String KEY
           
static javax.management.ObjectName MBEAN_SERVER_DELEGATE
           
static java.lang.String MOTHER
          Key for name of the Heritrix instance hosting a Job: i.e.
static java.lang.String NAME
           
static java.lang.String SERVICE
           
static java.lang.String TYPE
           
 
Constructor Summary
protected JmxUtils()
           
 
Method Summary
static void checkParamsCount(java.lang.String operationName, java.lang.Object[] params, int count)
           
static int convertImpact(int impact)
           
static javax.management.openmbean.OpenMBeanAttributeInfo convertToOpenMBeanAttribute(javax.management.MBeanAttributeInfo in)
           
static javax.management.openmbean.OpenMBeanAttributeInfo convertToOpenMBeanAttribute(javax.management.MBeanAttributeInfo in, java.lang.String prefix)
           
static javax.management.openmbean.OpenMBeanOperationInfo convertToOpenMBeanOperation(javax.management.MBeanOperationInfo in)
           
static javax.management.openmbean.OpenMBeanOperationInfo convertToOpenMBeanOperation(javax.management.MBeanOperationInfo in, java.lang.String prefix, javax.management.openmbean.OpenType returnType)
           
static javax.management.openmbean.OpenMBeanParameterInfo convertToOpenMBeanOperationInfo(javax.management.MBeanParameterInfo in)
           
static javax.management.openmbean.CompositeType createCompositeType(java.util.Map m, java.lang.String compositeTypeName, java.lang.String compositeTypeDescription)
           
static javax.management.openmbean.OpenMBeanAttributeInfo createOpenMBeanAttributeInfo(javax.management.openmbean.OpenType type, javax.management.MBeanAttributeInfo in, java.lang.String prefix)
           
static java.net.InetSocketAddress extractAddress(javax.management.ObjectName name)
           
static java.lang.String getLogRegistrationMsg(java.lang.String mbeanName, javax.management.MBeanServer mbeanServer, boolean registrationDone)
          Return a string suitable for logging on registration.
static java.lang.String getLogUnregistrationMsg(java.lang.String mbeanName, javax.management.MBeanServer mbeanServer)
           
static javax.management.openmbean.OpenType getOpenType(java.lang.String classString)
           
static javax.management.openmbean.OpenType getOpenType(java.lang.String classString, javax.management.openmbean.OpenType defaultType)
           
static java.lang.String getServerDetail(javax.management.MBeanServer server)
           
static java.lang.String getUid(javax.management.ObjectName on)
          Returns the UID portion of the name key property of an object name representing a "CrawlService.Job" bean.
static boolean isOpenType(java.lang.Class c)
           
static boolean isOpenType(java.lang.String classname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

public static final java.lang.String TYPE
See Also:
Constant Field Values

SERVICE

public static final java.lang.String SERVICE
See Also:
Constant Field Values

JOB

public static final java.lang.String JOB
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

HOST

public static final java.lang.String HOST
See Also:
Constant Field Values

JMX_PORT

public static final java.lang.String JMX_PORT
See Also:
Constant Field Values

GUI_PORT

public static final java.lang.String GUI_PORT
See Also:
Constant Field Values

KEY

public static final java.lang.String KEY
See Also:
Constant Field Values

MOTHER

public static final java.lang.String MOTHER
Key for name of the Heritrix instance hosting a Job: i.e. the CrawlJob's host/'mother'.

See Also:
Constant Field Values

MBEAN_SERVER_DELEGATE

public static final javax.management.ObjectName MBEAN_SERVER_DELEGATE
Constructor Detail

JmxUtils

protected JmxUtils()
Method Detail

getLogRegistrationMsg

public static java.lang.String getLogRegistrationMsg(java.lang.String mbeanName,
                                                     javax.management.MBeanServer mbeanServer,
                                                     boolean registrationDone)
Return a string suitable for logging on registration.

Parameters:
mbeanName - Mbean that got registered.
mbeanServer - Server we were registered to.
registrationDone - Whether we registered successfully or not.
Returns:
String suitable for logging.

getLogUnregistrationMsg

public static java.lang.String getLogUnregistrationMsg(java.lang.String mbeanName,
                                                       javax.management.MBeanServer mbeanServer)

getServerDetail

public static java.lang.String getServerDetail(javax.management.MBeanServer server)

checkParamsCount

public static void checkParamsCount(java.lang.String operationName,
                                    java.lang.Object[] params,
                                    int count)
Parameters:
operationName - Name of operation we're checking params on (Used in exception if one thrown).
params - Amount of params passed.
count - Count of params expected.

convertToOpenMBeanOperation

public static javax.management.openmbean.OpenMBeanOperationInfo convertToOpenMBeanOperation(javax.management.MBeanOperationInfo in)
Parameters:
in - MBeanOperation to convert.
Returns:
An OpenMBeanOperation version of the passed MBeanOperation.

convertToOpenMBeanOperation

public static javax.management.openmbean.OpenMBeanOperationInfo convertToOpenMBeanOperation(javax.management.MBeanOperationInfo in,
                                                                                            java.lang.String prefix,
                                                                                            javax.management.openmbean.OpenType returnType)
Parameters:
in - MBeanOperation to convert.
prefix - A prefix to add to the name of new operation.
returnType - Return type to use in new operation. Use this parameter to override the passed in return type.
Returns:
An OpenMBeanOperation version of the passed MBeanOperation.

convertImpact

public static int convertImpact(int impact)

convertToOpenMBeanOperationInfo

public static javax.management.openmbean.OpenMBeanParameterInfo convertToOpenMBeanOperationInfo(javax.management.MBeanParameterInfo in)
Parameters:
in - MBeanParameterInfo to convert to an OpenMBeanParameterInfo.
Returns:
OpenMBeanParameterInfo version of in

isOpenType

public static boolean isOpenType(java.lang.Class c)

isOpenType

public static boolean isOpenType(java.lang.String classname)

getOpenType

public static javax.management.openmbean.OpenType getOpenType(java.lang.String classString)
Parameters:
classString - Java class name.
Returns:
Its OpenType equivalent.

getOpenType

public static javax.management.openmbean.OpenType getOpenType(java.lang.String classString,
                                                              javax.management.openmbean.OpenType defaultType)
Parameters:
classString - Java class name.
defaultType - If no equivalent found, use passed defaultType.
Returns:
Its OpenType equivalent.

convertToOpenMBeanAttribute

public static javax.management.openmbean.OpenMBeanAttributeInfo convertToOpenMBeanAttribute(javax.management.MBeanAttributeInfo in)
Parameters:
in - AttributeInfo to convert.
Returns:
OpenMBeanAttributeInfo version of in.

convertToOpenMBeanAttribute

public static javax.management.openmbean.OpenMBeanAttributeInfo convertToOpenMBeanAttribute(javax.management.MBeanAttributeInfo in,
                                                                                            java.lang.String prefix)
Parameters:
in - AttributeInfo to convert.
prefix - Prefix to add to names of new attributes. If null, nothing is added.
Returns:
OpenMBeanAttributeInfo version of in.

createOpenMBeanAttributeInfo

public static javax.management.openmbean.OpenMBeanAttributeInfo createOpenMBeanAttributeInfo(javax.management.openmbean.OpenType type,
                                                                                             javax.management.MBeanAttributeInfo in,
                                                                                             java.lang.String prefix)
Parameters:
type - Type of new OpenMBeanAttributeInfo.
in - The MBeanAttributeInfo we're converting.
prefix - Prefix to add to name of new Attribute (If null, nothing is added).
Returns:
New OpenMBeanAttributeInfo based on in.

createCompositeType

public static javax.management.openmbean.CompositeType createCompositeType(java.util.Map m,
                                                                           java.lang.String compositeTypeName,
                                                                           java.lang.String compositeTypeDescription)
                                                                    throws javax.management.openmbean.OpenDataException
Parameters:
m - A map to make a CompositeType of (Assumption is that order does not matter. If it does, pass a map of sorted keys).
compositeTypeName - Name to give created compositeType.
compositeTypeDescription - Description.
Returns:
CompositeType made by examination of passed TreeMap.
Throws:
javax.management.openmbean.OpenDataException

extractAddress

public static java.net.InetSocketAddress extractAddress(javax.management.ObjectName name)

getUid

public static java.lang.String getUid(javax.management.ObjectName on)
Returns the UID portion of the name key property of an object name representing a "CrawlService.Job" bean. It is assumed that the name will have the format {crawl name}-{uid}.

Parameters:
on - A CrawlServer.Job object name.
Returns:
Uid for a CrawlServer.Job.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.