com.dracoware.rsplib
Class RspParser

java.lang.Object
  extended by com.dracoware.rsplib.RspParser

public class RspParser
extends java.lang.Object

The RspParser implements a common way of parsing stored RSP history data. This object should be used to retrieve and work with stored history data (from a MySQL database or a History Listener).


Field Summary
static int PARSE_MYSQL
          Data is stored in a MySQL database.
static int PARSE_REMOTE
          Data is stored in a History Listener database.
 
Constructor Summary
RspParser()
          Constructs a new RspParser object.
 
Method Summary
 void beginParse(java.lang.String host, java.lang.String module, java.lang.String key, long beginTime, long endTime, boolean dataString)
          Begins parsing data.
 void getHostsAndModules(java.util.Vector hosts, java.util.Vector modules)
          Connect to the server and get a list of hosts and modules from it.
 void getKeys(java.lang.String host, java.lang.String module, java.util.Vector keys)
          Connect to the host and get a list of keys based on the given host and module.
 RspParseLine nextLine()
          After calling the begin() method, use this method to return each successive incident found in the RSP history data.
 void parseInfoMySQL(java.lang.String host, int port, java.lang.String login, java.lang.String password, java.lang.String database, int timeout)
          If parsing history data from a MySQL database server, this method allows you to specify the necessary information to access the required data.
 void parseInfoRemote(java.lang.String host, int port, int timeout)
          If parsing history data from a History Listener, this method allows you to specify the address and port of the History Listener server.
 void remoteUseSSL(java.io.File keyfile)
          If parsing from a History Listener, this method specifies to connect secure with SSL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSE_REMOTE

public static final int PARSE_REMOTE
Data is stored in a History Listener database.

See Also:
Constant Field Values

PARSE_MYSQL

public static final int PARSE_MYSQL
Data is stored in a MySQL database.

See Also:
Constant Field Values
Constructor Detail

RspParser

public RspParser()
Constructs a new RspParser object.

Method Detail

parseInfoRemote

public void parseInfoRemote(java.lang.String host,
                            int port,
                            int timeout)
                     throws RspParseException
If parsing history data from a History Listener, this method allows you to specify the address and port of the History Listener server.

Parameters:
host - The address of the server.
port - The port of the server.
timeout - A timeout in seconds.
Throws:
RspParseException - If an error occurs, this is thrown with an error message.

remoteUseSSL

public void remoteUseSSL(java.io.File keyfile)
                  throws RspParseException
If parsing from a History Listener, this method specifies to connect secure with SSL.

Parameters:
keyfile - Where the SSL keyfile is located, or if it doesn't exist, where it should be created.
Throws:
RspParseException - If an error occurs, this is thrown with an error message.

parseInfoMySQL

public void parseInfoMySQL(java.lang.String host,
                           int port,
                           java.lang.String login,
                           java.lang.String password,
                           java.lang.String database,
                           int timeout)
                    throws RspParseException
If parsing history data from a MySQL database server, this method allows you to specify the necessary information to access the required data.

Parameters:
host - The address of the server.
port - The port of the server.
login - The user name to login with.
password - Password necessary to login with given the user name.
database - The name of the database containing the RSP history data.
timeout - A timeout in seconds.
Throws:
RspParseException - If an error occurs, this is thrown with an error message.

getHostsAndModules

public void getHostsAndModules(java.util.Vector hosts,
                               java.util.Vector modules)
                        throws RspParseException
Connect to the server and get a list of hosts and modules from it.

Parameters:
hosts - An empty Vector for hosts.
modules - An empty Vector for modules.
Throws:
RspParseException - If an error occurs, this is thrown with an error message.

getKeys

public void getKeys(java.lang.String host,
                    java.lang.String module,
                    java.util.Vector keys)
             throws RspParseException
Connect to the host and get a list of keys based on the given host and module.

Parameters:
host - A specific host on the server.
module - A specific module on the server.
keys - An empty Vector for keys.
Throws:
RspParseException - If an error occurs, this is thrown with an error message.

beginParse

public void beginParse(java.lang.String host,
                       java.lang.String module,
                       java.lang.String key,
                       long beginTime,
                       long endTime,
                       boolean dataString)
                throws RspParseException
Begins parsing data. Before calling this function, make sure you have setup the parser appropriately (such as specifying where to find history data).

Parameters:
host - The host whose data we want to collect.
module - The module whose data will be collected.
key - If dataString is set to false, this is graph key whose data we will retrieve.
beginTime - The beginning of the window of time through which to look, in seconds since the epoch (UNIX time).
endTime - The end of the window of time through which to look, in seconds since the epoch (UNIX time).
dataString - Specifies if we want full data strings (if true) or graph data (if false).
Throws:
RspParseException - If an error occurs, this is thrown with an error message.

nextLine

public RspParseLine nextLine()
                      throws RspParseException
After calling the begin() method, use this method to return each successive incident found in the RSP history data. When this returns null, there is no more data to be returned.

Returns:
The incident found in the RSP history data (or null).
Throws:
RspParseException - If an error occurs, this is thrown with an error message.