dk.netarkivet.monitor.webinterface
Class JMXStatusEntry

java.lang.Object
  extended by dk.netarkivet.monitor.webinterface.JMXStatusEntry
All Implemented Interfaces:
StatusEntry, java.lang.Comparable<StatusEntry>

public class JMXStatusEntry
extends java.lang.Object
implements StatusEntry

Implementation of StatusEntry, that receives its data from the MBeanServer (JMX).


Constructor Summary
JMXStatusEntry(javax.management.ObjectName mBeanName)
          Constructor for the JMXStatusEntry.
 
Method Summary
 int compareTo(StatusEntry o)
          Compares two entries according to first their location, then their machine name, then their ports, and then their application name, and then their index.
 java.lang.String getApplicationName()
          Get the name of the application that this status entry is from.
 java.lang.String getHostName()
          Get the name of the host this status entry is from.
 java.lang.String getHTTPPort()
          Get the HTTP port used by the application this status entry is from.
 java.lang.String getIndex()
          Get the index in the list of most recent log messages that this status entry is from.
 java.lang.String getLocation()
          Get the location this status entry is from, e.g.
 java.lang.String getLogMessage(java.util.Locale l)
          Gets the log message from this status entry.
static java.util.List<StatusEntry> queryJMX(java.lang.String query)
          Query the JMX system for system status mbeans.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMXStatusEntry

public JMXStatusEntry(javax.management.ObjectName mBeanName)
Constructor for the JMXStatusEntry.

Parameters:
mBeanName - The ObjectName to be assigned to the MBean representing this JMXStatusEntry.
Method Detail

getLocation

public java.lang.String getLocation()
Description copied from interface: StatusEntry
Get the location this status entry is from, e.g. KB.

Specified by:
getLocation in interface StatusEntry
Returns:
the location designated by the key JMXSummaryUtils.JMXLocationProperty

getHostName

public java.lang.String getHostName()
Description copied from interface: StatusEntry
Get the name of the host this status entry is from.

Specified by:
getHostName in interface StatusEntry
Returns:
the hostname designated by the key JMXSummaryUtils.JMXHostnameProperty

getHTTPPort

public java.lang.String getHTTPPort()
Description copied from interface: StatusEntry
Get the HTTP port used by the application this status entry is from. Used for HTTP and self-identification.

Specified by:
getHTTPPort in interface StatusEntry
Returns:
the http-port designated by the key JMXSummaryUtils.JMXHttpportProperty

getApplicationName

public java.lang.String getApplicationName()
Description copied from interface: StatusEntry
Get the name of the application that this status entry is from.

Specified by:
getApplicationName in interface StatusEntry
Returns:
the application name designated by the key JMXSummaryUtils.JMXApplicationnameProperty

getIndex

public java.lang.String getIndex()
Description copied from interface: StatusEntry
Get the index in the list of most recent log messages that this status entry is from.

Specified by:
getIndex in interface StatusEntry
Returns:
the index designated by the key JMXSummaryUtils.JMXIndexProperty

getLogMessage

public java.lang.String getLogMessage(java.util.Locale l)
Gets the log message from this status entry. This implementation actually talks to an MBeanServer to get the log message. Will return an explanation if remote host does not respond, throws exception or returns null.

Specified by:
getLogMessage in interface StatusEntry
Parameters:
l - the current Locale
Returns:
A log message.
Throws:
ArgumentNotValid - if the current Locale is null

compareTo

public int compareTo(StatusEntry o)
Compares two entries according to first their location, then their machine name, then their ports, and then their application name, and then their index.

Specified by:
compareTo in interface java.lang.Comparable<StatusEntry>
Parameters:
o - The object to compare with
Returns:
A negative number if this entry comes first, a positive if it comes second and 0 if they are equal.

queryJMX

public static java.util.List<StatusEntry> queryJMX(java.lang.String query)
                                            throws javax.management.MalformedObjectNameException
Query the JMX system for system status mbeans.

Parameters:
query - A JMX request, e.g. dk.netarkivet.logging:location=KB,httpport=8080,*
Returns:
A list of status entries for the mbeans that match the query.
Throws:
javax.management.MalformedObjectNameException - If the query has wrong format.