net.eduvax.grant.xmlrpc
Class NodeXMLrpcServer

java.lang.Object
  extended by net.eduvax.grant.xmlrpc.NodeXMLrpcServer
All Implemented Interfaces:
java.lang.Runnable

public class NodeXMLrpcServer
extends java.lang.Object
implements java.lang.Runnable

XML RPC Server interface. maps node service to XML-RPC protocole.


Field Summary
(package private) static int CMD_ADD
           
(package private) static int CMD_HELP
           
(package private) static int CMD_REMOVE
           
(package private) static int CMD_START
           
(package private) static int CMD_STATUS
           
(package private) static int CMD_STOP
           
(package private) static int CMD_SUBMIT
           
(package private) static int DEFAULT_HTTP_PORT
           
(package private) static int DEFAULT_MAXLOAD
           
private  Node node
          node controlled by this xmlrpc server.
private  WebServer webserver
          Web server serving this xmlrpm server.
 
Constructor Summary
NodeXMLrpcServer(Node n)
          create xmlrpc server handler.
NodeXMLrpcServer(Node n, int port)
          create xmlrpc server handler.
 
Method Summary
 java.util.Hashtable addNode(java.lang.String name)
          Adding a node
static void cmdStart(java.lang.String nodeURL, int port, int maxLoad)
           
static void cmdSubmit(java.lang.String nodeURL, java.lang.String tasklet, java.lang.String taskletArgs)
           
 java.util.Hashtable execReport(java.lang.String taskId, java.lang.String taskURL, java.lang.String args, java.lang.String routerPath, java.lang.String routeStatus, int cr, long time, float cpu)
          node's executeReport method wrapper.
 java.util.Hashtable handleEvent(int eventType, java.lang.String taskId, java.lang.String taskURL, java.lang.String args, java.lang.String routerPath, java.lang.String routeStatus, java.lang.String data)
          handle event
static void help()
           
 java.util.Hashtable load()
           
static void main(java.lang.String[] argv)
          create and run a node and xmlrpc server.
 java.util.Hashtable removeNode(java.lang.String name)
          removing a node
 void run()
          run webserver.
 java.util.Hashtable shutdown()
          handle shutdown request
 java.util.Hashtable status()
           
 java.util.Hashtable submitRequest(java.lang.String taskId, java.lang.String taskURL, java.lang.String args, java.lang.String routerPath, java.lang.String status)
          node's executeRequest method wrapper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

node

private Node node
node controlled by this xmlrpc server.


webserver

private WebServer webserver
Web server serving this xmlrpm server.


CMD_HELP

static final int CMD_HELP
See Also:
Constant Field Values

CMD_START

static final int CMD_START
See Also:
Constant Field Values

CMD_STOP

static final int CMD_STOP
See Also:
Constant Field Values

CMD_ADD

static final int CMD_ADD
See Also:
Constant Field Values

CMD_REMOVE

static final int CMD_REMOVE
See Also:
Constant Field Values

CMD_STATUS

static final int CMD_STATUS
See Also:
Constant Field Values

CMD_SUBMIT

static final int CMD_SUBMIT
See Also:
Constant Field Values

DEFAULT_HTTP_PORT

static final int DEFAULT_HTTP_PORT
See Also:
Constant Field Values

DEFAULT_MAXLOAD

static final int DEFAULT_MAXLOAD
See Also:
Constant Field Values
Constructor Detail

NodeXMLrpcServer

public NodeXMLrpcServer(Node n)
create xmlrpc server handler. The server is listening to the default HTTP port (80)

Parameters:
n - node to wrap with this new server.

NodeXMLrpcServer

public NodeXMLrpcServer(Node n,
                        int port)
create xmlrpc server handler. The server is listening to specified HTTP port.

Parameters:
n - node to wrap with this new server.
port - TCP port number to listen to.
Method Detail

submitRequest

public java.util.Hashtable submitRequest(java.lang.String taskId,
                                         java.lang.String taskURL,
                                         java.lang.String args,
                                         java.lang.String routerPath,
                                         java.lang.String status)
node's executeRequest method wrapper.

Parameters:
taskId - task id.
taskURL - tasklet URI.
args - "command line" arguments.
routerPath - accumulating routing path.
status - route status
Returns:
xml rpc call result as a Map : should contain en entry called "routerPath" that is the full routing path.

execReport

public java.util.Hashtable execReport(java.lang.String taskId,
                                      java.lang.String taskURL,
                                      java.lang.String args,
                                      java.lang.String routerPath,
                                      java.lang.String routeStatus,
                                      int cr,
                                      long time,
                                      float cpu)
node's executeReport method wrapper.

Parameters:
taskId - task id.
taskURL - tasklet URI.
args - "command line" arguments.
routerPath - accumulating routing path.
routeStatus - routing status
cr - tasklet execution completion code (exit code).
time - tasklet execution time (execution duration).
cpu - cpu power used/available for/while running the tasklet.
Returns:
xml rpc call result as a Map : should contain en entry called "rc" that is the tasklet execution completion code.

load

public java.util.Hashtable load()
Returns:
node load

status

public java.util.Hashtable status()
Returns:
node status

shutdown

public java.util.Hashtable shutdown()
handle shutdown request


addNode

public java.util.Hashtable addNode(java.lang.String name)
Adding a node

Parameters:
name - new node name

removeNode

public java.util.Hashtable removeNode(java.lang.String name)
removing a node

Parameters:
name - new node name

handleEvent

public java.util.Hashtable handleEvent(int eventType,
                                       java.lang.String taskId,
                                       java.lang.String taskURL,
                                       java.lang.String args,
                                       java.lang.String routerPath,
                                       java.lang.String routeStatus,
                                       java.lang.String data)
handle event

Parameters:
eventType - event type
taskId - task id.
taskURL - tasklet URI.
args - "command line" arguments.
routerPath - accumulating routing path.
status - route status
data - event data

run

public void run()
run webserver.

Specified by:
run in interface java.lang.Runnable

main

public static void main(java.lang.String[] argv)
create and run a node and xmlrpc server.

Parameters:
argv - command line arguments. Not used yet.

cmdStart

public static void cmdStart(java.lang.String nodeURL,
                            int port,
                            int maxLoad)

cmdSubmit

public static void cmdSubmit(java.lang.String nodeURL,
                             java.lang.String tasklet,
                             java.lang.String taskletArgs)

help

public static void help()