public class JmxUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
JmxUtils.ProcessQueryThread
Executes either a getAttribute or getAttributes query.
|
static class |
JmxUtils.ProcessServerThread
Executes either a getAttribute or getAttributes query.
|
Constructor and Description |
---|
JmxUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
cleanupStr(java.lang.String name)
Replaces all . with _ and removes all spaces and double/single quotes.
|
static void |
execute(JmxProcess process)
Either invokes the servers multithreaded (max threads ==
jmxProcess.getMultiThreaded()) or invokes them one at a time.
|
static java.lang.String |
getConcatedTypeNameValues(java.util.List<java.lang.String> typeNames,
java.lang.String typeNameStr)
Given a typeName string, get the first match from the typeNames setting.
|
static java.lang.String |
getConcatedTypeNameValues(Query query,
java.util.List<java.lang.String> typeNames,
java.lang.String typeName)
Given a typeName string, get the first match from the typeNames setting.
|
static java.util.Map<java.lang.String,org.apache.commons.pool.KeyedObjectPool> |
getDefaultPoolMap()
Helper method which returns a default PoolMap.
|
static java.util.Map<java.lang.String,java.lang.String[]> |
getEnvironment(Server server)
Generates the proper username/password environment for JMX connections.
|
static JmxProcess |
getJmxProcess(java.io.File file)
Uses jackson to load json configuration from a File into a full object
tree representation of that json.
|
static java.lang.String |
getKeyString(Query query,
Result result,
java.util.Map.Entry<java.lang.String,java.lang.Object> values,
java.util.List<java.lang.String> typeNames,
java.lang.String rootPrefix)
Gets the key string.
|
static java.lang.String |
getKeyString2(Query query,
Result result,
java.util.Map.Entry<java.lang.String,java.lang.Object> values,
java.util.List<java.lang.String> typeNames,
java.lang.String rootPrefix) |
static <T extends org.apache.commons.pool.KeyedPoolableObjectFactory> |
getObjectPool(T factory)
Gets the object pool.
|
static javax.management.remote.JMXConnector |
getServerConnection(Server server)
Helper method for connecting to a Server.
|
static java.util.Map<java.lang.String,java.lang.String> |
getWebLogicEnvironment(Server server)
Generates the proper username/password environment for JMX connections.
|
static boolean |
isNumeric(java.lang.Object value)
Useful for figuring out if an Object is a number.
|
static boolean |
isNumeric(java.lang.String str)
Checks if the String contains only unicode digits.
|
static void |
mergeServerLists(java.util.List<Server> existing,
java.util.List<Server> adding)
Merges two lists of servers (and their queries).
|
static void |
prettyPrintJson(JmxProcess process)
Utility function good for testing things.
|
static void |
printJson(JmxProcess process)
Utility function good for testing things.
|
static void |
processQueriesForServer(javax.management.MBeanServerConnection mbeanServer,
Server server)
Either invokes the queries multithreaded (max threads ==
server.getMultiThreaded()) or invokes them one at a time.
|
static void |
processQuery(javax.management.MBeanServerConnection mbeanServer,
Query query)
Responsible for processing individual Queries.
|
static void |
processServer(Server server,
javax.management.remote.JMXConnector conn)
Does the work for processing a Server object.
|
static void |
registerJMX(ManagedObject mbean)
Register the scheduler in the local MBeanServer.
|
static void |
unregisterJMX(ManagedObject mbean)
Unregister the scheduler from the local MBeanServer.
|
public static void mergeServerLists(java.util.List<Server> existing, java.util.List<Server> adding)
public static void processQueriesForServer(javax.management.MBeanServerConnection mbeanServer, Server server) throws java.lang.Exception
java.lang.Exception
public static void processQuery(javax.management.MBeanServerConnection mbeanServer, Query query) throws java.lang.Exception
java.lang.Exception
public static javax.management.remote.JMXConnector getServerConnection(Server server) throws java.lang.Exception
java.lang.Exception
public static java.util.Map<java.lang.String,java.lang.String> getWebLogicEnvironment(Server server)
public static java.util.Map<java.lang.String,java.lang.String[]> getEnvironment(Server server)
public static void execute(JmxProcess process) throws java.lang.Exception
java.lang.Exception
public static void processServer(Server server, javax.management.remote.JMXConnector conn) throws java.lang.Exception
java.lang.Exception
public static void printJson(JmxProcess process) throws java.lang.Exception
java.lang.Exception
public static void prettyPrintJson(JmxProcess process) throws java.lang.Exception
java.lang.Exception
public static JmxProcess getJmxProcess(java.io.File file) throws org.codehaus.jackson.JsonParseException, org.codehaus.jackson.map.JsonMappingException, java.io.IOException
org.codehaus.jackson.JsonParseException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException
public static boolean isNumeric(java.lang.Object value)
public static boolean isNumeric(java.lang.String str)
Checks if the String contains only unicode digits. A decimal point is a digit and returns true.
null
will return false
. An empty String ("")
will return true
.
StringUtils.isNumeric(null) = false StringUtils.isNumeric("") = true StringUtils.isNumeric(" ") = false StringUtils.isNumeric("123") = true StringUtils.isNumeric("12 3") = false StringUtils.isNumeric("ab2c") = false StringUtils.isNumeric("12-3") = false StringUtils.isNumeric("12.3") = true
str
- the String to check, may be nulltrue
if only contains digits, and is non-nullpublic static <T extends org.apache.commons.pool.KeyedPoolableObjectFactory> org.apache.commons.pool.impl.GenericKeyedObjectPool getObjectPool(T factory)
T
- the generic typefactory
- the factorypublic static java.util.Map<java.lang.String,org.apache.commons.pool.KeyedObjectPool> getDefaultPoolMap()
public static void registerJMX(ManagedObject mbean) throws java.lang.Exception
mbean
- the mbeanjava.lang.Exception
- the exceptionpublic static void unregisterJMX(ManagedObject mbean) throws java.lang.Exception
mbean
- the mbeanjava.lang.Exception
- the exceptionpublic static java.lang.String getKeyString(Query query, Result result, java.util.Map.Entry<java.lang.String,java.lang.Object> values, java.util.List<java.lang.String> typeNames, java.lang.String rootPrefix)
query
- the queryresult
- the resultvalues
- the valuestypeNames
- the type namesrootPrefix
- the root prefixpublic static java.lang.String getKeyString2(Query query, Result result, java.util.Map.Entry<java.lang.String,java.lang.Object> values, java.util.List<java.lang.String> typeNames, java.lang.String rootPrefix)
public static java.lang.String cleanupStr(java.lang.String name)
name
- the namepublic static java.lang.String getConcatedTypeNameValues(java.util.List<java.lang.String> typeNames, java.lang.String typeNameStr)
typeNames
- the type namestypeNameStr
- the type name strpublic static java.lang.String getConcatedTypeNameValues(Query query, java.util.List<java.lang.String> typeNames, java.lang.String typeName)
query
- the querytypeNames
- the type namestypeName
- the type nameCopyright © 2013 Jon Stevens and a gang of pencils. All Rights Reserved. Build version: 20130828-162948-517c4427f5