Behavior Client 

The behavior client is a java class which implements the behavior client server network protocol. It provides a complete high level API for controlling the behavior server. The client class can upload (java code) classes to the server, can cause the server to create instances of these classes, can send commands to the server to start, stop or delete instances. All classes uploaded to the server must be derived from Behavior (except the assistant classes). The server implements 'online authoring' this means a client can upload an other (newer) version of a class. In this case the instances of the replaced class (and the instances of the subclasses) will by restarted automatically.

The class provides two interfaces: The class can be used in other java programs and it provides a main method which implements a simple command line interface.

Command line options

The client class can be used as standalone program. It provides a simple command line interface for controlling the behavior server. The interface is very simple and slow because for each command the program is starting up, a connection will be established, the command will be sent and the program terminates.
 
Client <host> <port> upload <classname> Client <host> <port> redefine <classname> Client <host> <port> delclass <classname> Client <host> <port> classlist Client <host> <port> setclassparam <classname> <parameter> Client <host> <port> getclassparam <classname> Client <host> <port> new <classname> <restart> <parameter>* Client <host> <port> start <id> Client <host> <port> startall <classname> <subclasses> Client <host> <port> stop <id> Client <host> <port> stopall <classname> <subclasses> Client <host> <port> del <id> Client <host> <port> delall <classname> <subclasses> Client <host> <port> status <id> Client <host> <port> statusall <classname> <subclasses> Client <host> <port> shutdown Legend:
<host> The host name where the behavior server is running
<port> The port where the behavior server is listening
<classname> A fully qualified class name. E.g. mypackage.mysubpackage.Myclass
<restart> A restart flag. Must be "true" or "false". This flag determines whether an instance of an uploaded class should be restarted if the corresponding class (or super class) has changed.
<parameter> A parameter of an instance or a class. All parameters are handled as strings.
<subclasses> Must be "true" or "false". This flag determines whether a operation should include subclasses.
<id> A unique identifier of an instance (a number).

API

Because the command line interface is slow and not very comfortable a shell which provides a graphical interface was implemented. It uses the client class for communicating with the server.

Take a look at the API of the Client class.


Related Topics