com.ls.lars.server
Class LarsShutdown

java.lang.Object
  |
  +--com.ls.lars.server.LarsShutdown
All Implemented Interfaces:
IFromLars

public class LarsShutdown
extends Object
implements IFromLars

This utility can be used for shutting down a running lars platform from the console.
The program awaits the following parameters:

-administrator
the name of the administrator, who wants to shut down the lars platform
-password
the administrator's password
-config (optional)
a config file, where to read the administrator's name & password from
-larsid
the lars platform's id
-ip
the lars platform's ip address
-type
the kind of communication to be used (rmi, socket, as defined here
-port
the port, where an appropriate AgentListener is watching
-loglevel
the log level of the system logger (default: ILogger.ERROR)
-logtype
the log type of the system logger (see SystemLogger.setLogType(byte))

Version:
$Revision: 1.15 $
Author:
Last modified by $Author: OHittmeyer $

Method Summary
 boolean interpret(Message currentMessage)
          This methods awaits either the ILarsConstants.SERVICE_SHUTDOWN_PLATFORM_IN_PROGRESS, ILarsConstants.SERVICE_SHUTDOWN_PLATFORM_DECLINED or ILarsConstants.SERVICE_CLOSE_CONNECTION in the message's service attribute.
static void main(String[] args)
          Interprets the command line parameters and tries to create a LarsShutdown instance.
 int performShutdown()
          Performs the shutdown operation.
This method sends a ILarsConstants.SERVICE_SHUTDOWN_PLATFORM to the AgentManager of the lars platform and blocks until the response message arrives.
 Map preloadConfiguration(String filename)
          Loads the configuration from the config file specified by filename and returns the resulting Map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

performShutdown

public int performShutdown()
Performs the shutdown operation.
This method sends a ILarsConstants.SERVICE_SHUTDOWN_PLATFORM to the AgentManager of the lars platform and blocks until the response message arrives. This response message will then be interpreted.
Returns:
0 if the operation was successful, else > 0

interpret

public boolean interpret(Message currentMessage)
This methods awaits either the ILarsConstants.SERVICE_SHUTDOWN_PLATFORM_IN_PROGRESS, ILarsConstants.SERVICE_SHUTDOWN_PLATFORM_DECLINED or ILarsConstants.SERVICE_CLOSE_CONNECTION in the message's service attribute. Any other service will result in an error message.
Specified by:
interpret in interface IFromLars
Parameters:
currentMessage - message to interpret
Returns:
true if the platform shutdown was successful, else false

preloadConfiguration

public Map preloadConfiguration(String filename)
Loads the configuration from the config file specified by filename and returns the resulting Map.
Parameters:
filename - the config file's name
Returns:
the configuration settings

main

public static void main(String[] args)
Interprets the command line parameters and tries to create a LarsShutdown instance. If the instance can be created successful, performShutdown() will be invoked.
This method returns:
0 if the shutdown was successful, 1 if the given administrator is not allowed to shut the platform down 2 if an error occured
Parameters:
args - string array with the command line parameters