|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ow2.jasmine.monitoring.mbeancmd.AbstractCommand
org.ow2.jasmine.monitoring.mbeancmd.commands.Mbean
Command that can do any given action on any MBean.
Field Summary | |
private org.apache.commons.cli.CommandLine |
commandLine
Command line arguments. |
private java.lang.String |
method
Method to invoke. |
private javax.management.ObjectName |
on
The object name based on the "name" argument in the command line. |
private org.apache.commons.cli.Options |
options
List of options that should be parsed from the command line. |
private long |
period
Polling period in milliseconds. |
Fields inherited from class org.ow2.jasmine.monitoring.mbeancmd.AbstractCommand |
arguments, name, simpleDateFormat |
Constructor Summary | |
Mbean()
Constructor: calls setOptions() . |
Method Summary | |
int |
exec()
Implementation of inherited abstract method. |
private java.lang.String[] |
getAttToPoll()
|
private void |
mbeanGet()
Retrieves attributes of a mbean. |
private void |
mbeanInfo()
Prints information about MBeans. |
private void |
mbeanInvoke()
Invokes the operation given as command line argument. |
private void |
mbeanMGet()
Retrieves attributes of one or more mbeans. |
private void |
mbeanPoll()
Periodically polls attributes of one or more mbeans. |
private void |
mbeanQuery()
Queries the method method of the on object. |
private void |
mbeanSet()
Grabs the options for setting MBean attributes. |
private void |
mbeanUnregister()
Unregisters the MBean given as a command line argument. |
void |
parseCommandLine(java.lang.String[] args)
Parses the command line arguments into commandLine . |
private java.lang.Object[] |
parseMethodParams(java.lang.String[] args,
java.lang.String[] opSig)
Parses parameters of a given method. |
private java.lang.String[] |
parseMethodSig(java.lang.String[] args)
Parses a method signature to grab arguments |
private void |
printMBeanGet(javax.management.ObjectName ongot,
javax.management.AttributeList attl)
Prints the list of attributes for an MBean. |
private void |
printMBeanPoll(long t,
javax.management.AttributeList attl)
Prints the output data: date;time + atts. |
private void |
printMBeanPollHeader(java.lang.String[] atts)
Prints the output header: date;time + atts. |
void |
process()
Processes the request. |
private void |
setMethod()
Sets the GET method if the command line has the "get" option. |
private void |
setObjectName()
Sets the object name based on the "name" argument in the command line. |
private void |
setOptions()
Sets all options that are parseable from the command line. |
private void |
setPeriod()
Sets the period if the command line has the "p" option. |
java.lang.String |
summary()
Implementation of inherited abstract method. |
java.lang.String |
toString()
|
Methods inherited from class org.ow2.jasmine.monitoring.mbeancmd.AbstractCommand |
getHelpDoc, getName, help, setArgs |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private org.apache.commons.cli.Options options
private org.apache.commons.cli.CommandLine commandLine
private javax.management.ObjectName on
private java.lang.String method
private long period
Constructor Detail |
public Mbean()
setOptions()
.
Method Detail |
public int exec()
exec
in interface Command
exec
in class AbstractCommand
AbstractCommand.exec()
public java.lang.String summary()
summary
in interface Command
summary
in class AbstractCommand
AbstractCommand.summary()
public void parseCommandLine(java.lang.String[] args) throws org.apache.commons.cli.ParseException, javax.management.MalformedObjectNameException
commandLine
.
args
- Arguments to parse.
org.apache.commons.cli.ParseException
- If parsing fails.
javax.management.MalformedObjectNameException
- Object name given in the command
line is invalid.private void setObjectName() throws javax.management.MalformedObjectNameException
javax.management.MalformedObjectNameException
- Object name given in the command
line is invalid.private void setMethod()
private void setPeriod() throws java.lang.NumberFormatException
java.lang.NumberFormatException
- Number after the "p" option is invalid.private void mbeanQuery() throws java.lang.Exception
method
method of the on
object.
java.lang.Exception
- If anything fails.setMethod()
,
setObjectName()
private void mbeanGet() throws java.lang.Exception
java.lang.Exception
- If anything fails.private void mbeanMGet() throws java.lang.Exception
java.lang.Exception
- If anything fails.private void printMBeanGet(javax.management.ObjectName ongot, javax.management.AttributeList attl)
ongot
- Object name.attl
- List of attributes.private void mbeanPoll()
private java.lang.String[] getAttToPoll()
private void printMBeanPollHeader(java.lang.String[] atts)
atts
- List of attributes.private void printMBeanPoll(long t, javax.management.AttributeList attl)
t
- Time.attl
- List of attributes.private void mbeanInfo()
private void mbeanSet() throws java.lang.Exception
java.lang.Exception
- If anything fails.private java.lang.String[] parseMethodSig(java.lang.String[] args)
args
- Signature to parse.
private java.lang.Object[] parseMethodParams(java.lang.String[] args, java.lang.String[] opSig) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
args
- Method signature to parse.opSig
- @see parseMethodSig(String[])
java.lang.ClassNotFoundException
- Class not found.
java.lang.NoSuchMethodException
- Method not found.
java.lang.InstantiationException
- Cannot instantiate argument's class.
java.lang.IllegalAccessException
- Cannot access class.
java.lang.reflect.InvocationTargetException
- Invocation problem.private void mbeanInvoke() throws java.lang.Exception
java.lang.Exception
- If anything fails.private void mbeanUnregister()
private void setOptions()
options
public java.lang.String toString()
on
public void process() throws java.lang.Exception
java.lang.Exception
- If anything fails.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |