org.w3c.jigsaw.admin
Class JigKill

java.lang.Object
  extended by org.w3c.jigsaw.admin.JigKill

public class JigKill
extends java.lang.Object

Simple class used to save and/or kill Jigsaw.

Options:
-u username User name (defaults to "admin")
-p password Password (required)
--username username Same as -u
--password password Same as -p
--save Save configuration of all servers
--stop Stop all servers
--ping check if servers are reachable
(The last argument is assumed to be the URL to the Admin server, see Usage examples below...)

Example usage:
(be sure that jigsaw's *.jar file is in CLASSPATH, e.g. export CLASSPATH=~/Jigsaw/classes/jigsaw.zip: ${CLASSPATH})
- Save and exit the server http://gyros.informatik.med.uni-giessen.de:
java org.w3c.jigsaw.admin.JigKill -u admin -p for#8pj http://gyros.informatik.med.uni-giessen.de:8009/
OR (using explicit options)
java org.w3c.jigsaw.admin.JigKill -u admin -p for#8pj --save --stop http://gyros.informatik.med.uni-giessen.de:8009/
- Stop a server (as fast as possible, e.g. for system shutdown):
java org.w3c.jigsaw.admin.JigKill -u admin -p for#8pj --stop http://gyros.informatik.med.uni-giessen.de:8009/
- Save the servers current configuration:
java org.w3c.jigsaw.admin.JigKill -u admin -p for#8pj --save http://gyros.informatik.med.uni-giessen.de:8009/
- Check if a server is still alive:
java org.w3c.jigsaw.admin.JigKill -u admin -p for#8pj --ping http://gyros.informatik.med.uni-giessen.de:8009/

Changes from V1.1 to 1.2:
- Added --stop option: Simply stop jigsaw quick&savely.
- Added --save option: Snapshot the current config (something for a daily crontab job).
- Added --ping option to see if the server is still running (usefull for scripts).
- Added --username and --password options as aliases for -u and -p.
- JigKill now returns 0 for success and non-0 for failure (of the requested operation) EVERYTIMES (except the JVM cores) to make script-processing as much as easy.
- -u option now defaults to "admin", as jigsaw's default config does.
- JigKill now saves all servers first before stopping them all (first backup, then destroy...).

ToDo:
- Adding a --restart option.


Field Summary
protected  RemoteResource adminServer
           
protected  RemoteResource[] ctrls
           
protected static int EXIT_FAILURE
          Exit value of the JVM on failure of the requested operation.
protected static int EXIT_SUCCESS
          Exit value of the JVM on success of the requested operation.
 
Constructor Summary
JigKill(java.net.URL adminURL, java.lang.String username, java.lang.String password)
          Contructor.
 
Method Summary
protected  void doLoadResource(java.lang.String cmd)
          Send a "command" to all servers and the admin server.
protected  RemoteResource[] getControls(RemoteResource admin)
          Get all the server's ControlResource.
 void kill()
          Save the configuration of the servers and the admin server and then kill all servers (including the admin server).
static void main(java.lang.String[] args)
          Main program entry.
 void save()
          Save the configuration of the servers and the admin server.
 void stop()
          Stop the servers and the admin server.
protected static void usage()
          Print usage description and exit with exit status EXIT_FAILURE
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXIT_SUCCESS

protected static final int EXIT_SUCCESS
Exit value of the JVM on success of the requested operation.

See Also:
Constant Field Values

EXIT_FAILURE

protected static final int EXIT_FAILURE
Exit value of the JVM on failure of the requested operation.

See Also:
Constant Field Values

adminServer

protected RemoteResource adminServer

ctrls

protected RemoteResource[] ctrls
Constructor Detail

JigKill

public JigKill(java.net.URL adminURL,
               java.lang.String username,
               java.lang.String password)
        throws RemoteAccessException
Contructor.

Parameters:
adminURL - the admin server URL
username - the username
password - the password
Throws:
RemoteAccessException
Method Detail

usage

protected static void usage()
Print usage description and exit with exit status EXIT_FAILURE

See Also:
main(String[])

getControls

protected RemoteResource[] getControls(RemoteResource admin)
                                throws RemoteAccessException
Get all the server's ControlResource.

Parameters:
admin - the admin server (a RemoteResource)
Returns:
an array of RemoteResource
Throws:
RemoteAccessException - if any remote error occurs.

kill

public void kill()
          throws RemoteAccessException
Save the configuration of the servers and the admin server and then kill all servers (including the admin server).

Throws:
RemoteAccessException - if any remote error occurs.
See Also:
save(), stop()

stop

public void stop()
          throws RemoteAccessException
Stop the servers and the admin server.

Throws:
RemoteAccessException - if any remote error occurs.
Since:
JigKill 1.2
See Also:
doLoadResource(String), kill()

save

public void save()
          throws RemoteAccessException
Save the configuration of the servers and the admin server.

Throws:
RemoteAccessException - if any remote error occurs.
Since:
JigKill 1.2
See Also:
doLoadResource(String), kill()

doLoadResource

protected void doLoadResource(java.lang.String cmd)
                       throws RemoteAccessException
Send a "command" to all servers and the admin server.

Parameters:
cmd - name of the resource to load.
Throws:
RemoteAccessException - if any remote error occurs.
Since:
JigKill 1.2
See Also:
save(), stop()

main

public static void main(java.lang.String[] args)
Main program entry. This method exits the JVM with either EXIT_SUCCESS or EXIT_FAILURE for the requested operation.

Parameters:
args - program arguments
See Also:
usage()