org.exist.management.client
Class JMXtoXML

java.lang.Object
  extended by org.exist.management.client.JMXtoXML

public class JMXtoXML
extends Object

Utility class to output database status information from eXist's JMX interface as XML.

Author:
wolf

Field Summary
static QName JMX_ELEMENT
           
static String JMX_NAMESPACE
           
static String JMX_PREFIX
           
static long PING_TIMEOUT
           
 
Constructor Summary
JMXtoXML()
           
 
Method Summary
 void connect()
          Connect to the local JMX instance.
 void connect(String address, int port)
          Connect to a remote JMX instance using address and port.
 String generateReport(String[] categories)
          Retrieve JMX output for the given categories and return a string of XML.
 Element generateXMLReport(String errcode, String[] categories)
          Retrieve JMX output for the given categories and return it as an XML DOM.
static void main(String[] args)
           
 long ping(String instance, long timeout)
          Ping the database to see if it is still responsive.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JMX_NAMESPACE

public static final String JMX_NAMESPACE
See Also:
Constant Field Values

JMX_PREFIX

public static final String JMX_PREFIX
See Also:
Constant Field Values

JMX_ELEMENT

public static final QName JMX_ELEMENT

PING_TIMEOUT

public static final long PING_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

JMXtoXML

public JMXtoXML()
Method Detail

connect

public void connect()
Connect to the local JMX instance.


connect

public void connect(String address,
                    int port)
             throws IOException
Connect to a remote JMX instance using address and port.

Parameters:
address -
port -
Throws:
IOException

generateReport

public String generateReport(String[] categories)
                      throws TransformerException
Retrieve JMX output for the given categories and return a string of XML. Valid categories are "memory", "instances", "disk", "system", "caches", "locking", "processes", "sanity", "all".

Parameters:
categories -
Returns:
report
Throws:
TransformerException

ping

public long ping(String instance,
                 long timeout)
Ping the database to see if it is still responsive. This will first try to get a database broker object and if it succeeds, run a simple query. If the server does not respond within the given timeout, the method will return an error code -99 (PING_TIMEOUT). If there's an error on the server, the return value will be less than 0. Otherwise the return value is the response time in milliseconds.

Parameters:
instance - the name of the database instance (default instance is "exist")
timeout - a timeout in milliseconds
Returns:
Response time in msec, less than 0 in case of an error on server or PING_TIMEOUT when server does not respond in time

generateXMLReport

public Element generateXMLReport(String errcode,
                                 String[] categories)
Retrieve JMX output for the given categories and return it as an XML DOM. Valid categories are "memory", "instances", "disk", "system", "caches", "locking", "processes", "sanity", "all".

Parameters:
errcode - an optional error description
categories -
Returns:
xml report
Throws:
TransformerException

main

public static void main(String[] args)
Parameters:
args -


Copyright (C) Wolfgang Meier. All rights reserved.