net.eduvax.grant.core
Class ExecRequest

java.lang.Object
  extended by net.eduvax.grant.core.ExecRequest

public class ExecRequest
extends java.lang.Object

Execute request descriptor. handler for all information relating to a task execution request.


Field Summary
private  java.lang.String args
          tasklet command arguments.
private static int idCount
          task id count
private static java.lang.String idSeed
          task id prefix.
static char PATHDELIM
           
static int ROUTE_DELAYED
           
static int ROUTE_OK
           
static int ROUTE_OVERLOAD
           
static int ROUTE_PROGRESS
           
private  java.lang.String[] routerPath
          routing path : accumulating while routing.
private  int status
          routing status
private  java.lang.String taskId
          task ID, this ID is created by first requester.
private  java.lang.String taskURL
          tasklet to run (URL where to donwload tasklet).
 
Constructor Summary
private ExecRequest()
          Default empty constructor.
  ExecRequest(java.lang.String tURL, java.lang.String params)
          create new execute request.
  ExecRequest(java.lang.String tId, java.lang.String tURL, java.lang.String params, java.lang.String rp, java.lang.String s)
          create new execute request.
 
Method Summary
 ExecRequest appendNode(Node node)
          append node to route path.
 java.lang.String getArgs()
          gets task arguments.
 java.lang.String getChild(Node node)
          get a node child in router path.
private static int getIdCount()
          computes and return next id count.
 int getLength()
          gets router path length
 java.lang.String getParent(Node node)
          get a node parent in router path.
 java.lang.String getRootNodeName()
          gets root node name
 java.lang.String getRouterPath()
          gets accumulated router path as string.
 int getRouteStatus()
           
 java.lang.String getTaskId()
          gets task Id.
 java.lang.String getTaskURL()
          gets task URL.
 boolean member(Node node)
          checks if a node is present in routing path.
 void setRouteStatus(int s)
          change route status
protected  java.lang.String[] splitRouterPath(java.lang.String rp)
          Split a string router path as an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATHDELIM

public static final char PATHDELIM
See Also:
Constant Field Values

taskId

private java.lang.String taskId
task ID, this ID is created by first requester. It is something like requester_hostname.counter, should be unique all over the grant.


taskURL

private java.lang.String taskURL
tasklet to run (URL where to donwload tasklet).


args

private java.lang.String args
tasklet command arguments.


routerPath

private java.lang.String[] routerPath
routing path : accumulating while routing.


status

private int status
routing status


idSeed

private static java.lang.String idSeed
task id prefix. Must be unique for each JVM running nodes. Since prefix includes hostname and time stamp, may not be unique when 2 ore more JVM are started exactly at the same time on the same host...


idCount

private static int idCount
task id count


ROUTE_PROGRESS

public static final int ROUTE_PROGRESS
See Also:
Constant Field Values

ROUTE_OK

public static final int ROUTE_OK
See Also:
Constant Field Values

ROUTE_OVERLOAD

public static final int ROUTE_OVERLOAD
See Also:
Constant Field Values

ROUTE_DELAYED

public static final int ROUTE_DELAYED
See Also:
Constant Field Values
Constructor Detail

ExecRequest

public ExecRequest(java.lang.String tId,
                   java.lang.String tURL,
                   java.lang.String params,
                   java.lang.String rp,
                   java.lang.String s)
create new execute request. This constructor should be use by Node borkers implementation only as a way to deserialize exec request. Normale way to create an execute request is to create it from scratch : without any router path.

Parameters:
tId - task Id.
tURL - task url.
params - task "command line" arguments.
rp - accumulating routing path.
s - status code

ExecRequest

public ExecRequest(java.lang.String tURL,
                   java.lang.String params)
create new execute request.

Parameters:
tURL - task url.
params - task "command line" arguments.

ExecRequest

private ExecRequest()
Default empty constructor. privatized to avoid external use.

Method Detail

getTaskId

public java.lang.String getTaskId()
gets task Id.

Returns:
taskId

getTaskURL

public java.lang.String getTaskURL()
gets task URL. should be called getURI ?

Returns:
taskURL

getArgs

public java.lang.String getArgs()
gets task arguments.

Returns:
task arguments

getRouteStatus

public int getRouteStatus()
Returns:
route status

setRouteStatus

public void setRouteStatus(int s)
change route status

Parameters:
s - new status

getRouterPath

public java.lang.String getRouterPath()
gets accumulated router path as string. sould be use bye node borker implementation only as a way to serialize router path.

Returns:
route path

splitRouterPath

protected java.lang.String[] splitRouterPath(java.lang.String rp)
Split a string router path as an array.

Parameters:
rp - string to split.
Returns:
splitted router path.

appendNode

public ExecRequest appendNode(Node node)
append node to route path.

Parameters:
node - node to append.
Returns:
new ExecRequest with node appended.

getParent

public java.lang.String getParent(Node node)
get a node parent in router path.

Parameters:
node - node whose parentis searched.
Returns:
predecessor URL when found, null when not any (node not found or node is root).

getChild

public java.lang.String getChild(Node node)
get a node child in router path.

Parameters:
node - node whose parentis searched.
Returns:
successor URL when found, null when not any (node not found or node is leaf).

member

public boolean member(Node node)
checks if a node is present in routing path.

Parameters:
node - node to check
Returns:
tru when node is found in router path, false when not found

getLength

public int getLength()
gets router path length

Returns:
node count.

getRootNodeName

public java.lang.String getRootNodeName()
gets root node name

Returns:
root node name or null node path is empty.

getIdCount

private static int getIdCount()
computes and return next id count.

Returns:
next id count.