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 getApplicationInstanceID()
          Get the instance id of the application that this status entry is from.
 java.lang.String getApplicationName()
          Get the name of the application that this status entry is from.
 java.lang.String getArchiveReplicaName()
          Get the replica id of the application that this status entry is represents.
 java.lang.String getHarvestPriority()
          Get the priority of the harvest queue that 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 getLogMessage(java.util.Locale l)
          Gets the log message from this status entry.
 java.lang.String getMachineName()
          Get the name of the host (machine) this status entry is from.
 java.lang.String getPhysicalLocation()
          Get the (physical) location this status entry is from, e.g.
static java.util.List<StatusEntry> queryJMX(java.lang.String query)
          Query the JMX system for system status mbeans.
static void unregisterJMXInstance(java.lang.String query)
          Unregister an JMX MBean instance.
 
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

getPhysicalLocation

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

Specified by:
getPhysicalLocation in interface StatusEntry
Returns:
the location designated by the key JMXSummaryUtils.JMXPhysLocationProperty

getMachineName

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

Specified by:
getMachineName in interface StatusEntry
Returns:
the hostname designated by the key JMXSummaryUtils.JMXMachineNameProperty

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

getApplicationInstanceID

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

Specified by:
getApplicationInstanceID in interface StatusEntry
Returns:
the application inst id designated by the key JMXSummaryUtils.JMXApplicationInstIdProperty

getHarvestPriority

public java.lang.String getHarvestPriority()
Description copied from interface: StatusEntry
Get the priority of the harvest queue that this status entry is from.

Specified by:
getHarvestPriority in interface StatusEntry
Returns:
the harvest priority designated by the key JMXSummaryUtils.JMXHarvestPriorityProperty

getArchiveReplicaName

public java.lang.String getArchiveReplicaName()
Description copied from interface: StatusEntry
Get the replica id of the application that this status entry is represents.

Specified by:
getArchiveReplicaName in interface StatusEntry
Returns:
the replica id designated by the key JMXSummaryUtils.JMXArchiveReplicaNameProperty

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=EAST,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.

unregisterJMXInstance

public static void unregisterJMXInstance(java.lang.String query)
                                  throws javax.management.MalformedObjectNameException,
                                         javax.management.InstanceNotFoundException,
                                         javax.management.MBeanRegistrationException
Unregister an JMX MBean instance.

Parameters:
query - A JMX request, for picking the beans to unregister.
Throws:
javax.management.MalformedObjectNameException - if query is malformed.
javax.management.InstanceNotFoundException - if the instanced unregistered doesn't exists.
javax.management.MBeanRegistrationException - if unregeterBean is thrown.