org.garret.jipc.client
Class JIPCServerMonitor

java.lang.Object
  |
  +--org.garret.jipc.client.JIPCServerMonitor

public class JIPCServerMonitor
extends java.lang.Object

Server monitor class is used to send commands to the JIPC server spawned in daemon mode (without user dialog).

    Usage: 
        java org.garret.jipc.client.JIPCServerMonitor HOSTNAME PORT [command]
    Commands:
        SHUTDOWN            shutdown server
        INFO                dump information about server status
 
If command is not specified in command line, server monitor starts interactive dialog. In this dialog, except SHTDOWN and INFO commands it also supports EXIT and HELP commands. EXIT command is used to close dialog, HELP shows list of available commands.


Constructor Summary
JIPCServerMonitor(java.lang.String hostname, int port)
          Server monitor constructor.
 
Method Summary
 boolean executeCommand(java.io.PrintStream out, java.lang.String cmd)
          Send command to the server
static void main(java.lang.String[] args)
          Server monitor main function.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JIPCServerMonitor

public JIPCServerMonitor(java.lang.String hostname,
                         int port)
                  throws java.lang.Exception
Server monitor constructor. This constructor creates clinet session and establish connection with the server.

Parameters:
hostname - address of the server
port - server port
Method Detail

executeCommand

public boolean executeCommand(java.io.PrintStream out,
                              java.lang.String cmd)
                       throws java.lang.Exception
Send command to the server

Parameters:
out - print stream where result will be printed (for INFO command)
cmd - command to be executed (INFO or SHUTDOWN)
Returns:
true if command was succefully executed
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Server monitor main function. It should be called with 2 or 3 command line parameters. Mandatory parameters are HOSTNAME and PORT. Optional third parameter specifies command to be executed. If third parameter is absent, interactive dialog is started. Otherwise monitor will exit after execution of the command.

Parameters:
args - command line
java.lang.Exception