|
|||||||||
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.Stat
public class Stat
Periodically polls attributes of one or more mbeans on one or more J2EE servers.
Nested Class Summary | |
---|---|
private class |
Stat.StatContext
Statistics context. |
Field Summary | |
---|---|
private org.apache.commons.cli.CommandLine |
commandLine
Command line arguments. |
private Stat.StatContext[] |
context
Statistics contexts. |
private java.lang.String |
graphDef
Graph definitions, null for no graph output. |
private java.lang.String |
header
Header to use. |
private boolean |
isRefreshable
Is content refresheable ? |
private java.lang.String |
jasmineURI
URI of the JASMINe event switch, null for no JASMINe output. |
private javax.management.ObjectName |
on
ObjectNale to use. |
private org.apache.commons.cli.Options |
options
List of options that should be parsed from the command line. |
private java.lang.String |
outputFilePath
Output file path, null for no file output. |
private long |
period
Polling period in seconds. |
private java.io.PrintStream |
pout
Output stream. |
private long |
refreshPeriod
Refresh period, in seconds. |
private java.lang.String |
separator
Separator to use. |
Fields inherited from class org.ow2.jasmine.monitoring.mbeancmd.AbstractCommand |
---|
arguments, name, simpleDateFormat |
Constructor Summary | |
---|---|
Stat()
Constructor: calls setOptions() . |
Method Summary | |
---|---|
void |
exec()
Implementation of inherited abstract method. |
private java.lang.String[] |
getAttToPoll()
|
private java.lang.String |
getMBeanPollHeader(javax.management.AttributeList attl)
Prints a given header. |
void |
help()
Calls AbstractCommand.help() and prints the DTD for the graph. |
static void |
main(java.lang.String[] args)
Tests the Stat implementation. |
private void |
mbeanPoll()
Polls the MBeans. |
void |
parseCommandLine(java.lang.String[] args)
Parses the command line arguments into commandLine . |
private void |
printMBeanPoll(long t,
java.lang.String managee,
java.lang.String domain,
javax.management.AttributeList attl,
javax.management.ObjectName oname)
Prints out the poll data based on a header. |
private void |
process()
Initializes data polling and calls mbeanPoll() . |
private void |
putArrayIntoHeader(java.lang.StringBuffer buf,
javax.management.Attribute att)
Puts a list of attributes into a buffer. |
private void |
putCompositeDataIntoHeader(java.lang.StringBuffer buf,
javax.management.Attribute att)
Puts composite data into a buffer. |
private void |
putMapIntoHeader(java.lang.StringBuffer buf,
javax.management.Attribute att)
Puts a map of attributes into a buffer. |
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. |
private void |
setRefreshPeriod()
Sets the refresh period if the command line has the "r" option. |
java.lang.String |
summary()
Implementation of inherited abstract method. |
java.lang.String |
toString()
|
Methods inherited from class org.ow2.jasmine.monitoring.mbeancmd.AbstractCommand |
---|
Exit, getHelpDoc, getName, setArgs |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private Stat.StatContext[] context
private org.apache.commons.cli.Options options
private org.apache.commons.cli.CommandLine commandLine
private javax.management.ObjectName on
private long period
private long refreshPeriod
private boolean isRefreshable
private java.lang.String graphDef
private java.lang.String outputFilePath
private java.lang.String jasmineURI
private java.io.PrintStream pout
private java.lang.String separator
private java.lang.String header
Constructor Detail |
---|
public Stat()
setOptions()
.
Method Detail |
---|
public static void main(java.lang.String[] args)
args
- Arguments to pass to Stat#setArgs.public void exec()
exec
in interface Command
exec
in class AbstractCommand
AbstractCommand.exec()
public void help()
AbstractCommand.help()
and prints the DTD for the graph.
help
in interface Command
help
in class AbstractCommand
Command.help()
,
AbstractCommand.getHelpDoc()
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 setPeriod() throws java.lang.NumberFormatException
java.lang.NumberFormatException
- Number after the "p" option is invalid.private void setRefreshPeriod() throws java.lang.NumberFormatException
java.lang.NumberFormatException
- Number after the "r" option is invalid,
note that "never" is a valid number.private void mbeanPoll()
private java.lang.String[] getAttToPoll()
private java.lang.String getMBeanPollHeader(javax.management.AttributeList attl)
attl
- Header attributes.
private void putArrayIntoHeader(java.lang.StringBuffer buf, javax.management.Attribute att)
buf
- String buffer to print into.att
- Attribute list.private void putMapIntoHeader(java.lang.StringBuffer buf, javax.management.Attribute att)
buf
- String buffer to print into.att
- Attribute map.private void putCompositeDataIntoHeader(java.lang.StringBuffer buf, javax.management.Attribute att)
buf
- String buffer to print into.att
- Attribute data.private void printMBeanPoll(long t, java.lang.String managee, java.lang.String domain, javax.management.AttributeList attl, javax.management.ObjectName oname)
t
- Time.managee
- Managed server's name.domain
- Managed server's domain.attl
- Attribute list.oname
- Object to print as data.private void setOptions()
options
public java.lang.String toString()
toString
in class java.lang.Object
private void process()
mbeanPoll()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |