public class RunDescriptor extends Object
Copyright: Copyright 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Modifier and Type | Field and Description |
---|---|
private boolean |
authorized |
private String |
command |
static int |
CommandLine |
static int |
Internal |
static int |
JavaClass |
private static int |
Last |
static int |
None |
private int |
type |
Constructor and Description |
---|
RunDescriptor() |
RunDescriptor(RunDescriptor r)
Copy constructor
|
RunDescriptor(String text)
Constructor to be used in conjunction with the toString() method; builds
a new RunDescriptor from a String with the syntax of toString().
|
RunDescriptor(String text,
int startAt)
Same as the RunDescriptor(String) constructor, but takes a starting point
in the string, and updates lastPosition to indicate the point in
the string where it finished parsing
|
Modifier and Type | Method and Description |
---|---|
protected Class<?> |
getclass(String s) |
String |
getCommandLine()
Returns the command line if this RunDescriptor is of the command line
type, null otherwise.
|
String |
getInternal()
Returns the specification as a string if this RunDescriptor is of the internal type, null otherwise.
|
String |
getJavaClass()
Returns the specification as a string if this RunDescriptor is of the Java class
type, null otherwise.
|
protected String |
getReplacedCommand(int port,
int lac,
String path) |
int |
getType()
Returns the type of this RunDescriptor.
|
boolean |
isAuthorized()
Determines whether the command in this RunDescriptor has been authorized or not.
|
int |
parse(String text,
int startAt) |
private String |
replace(String in,
String replace,
String with) |
int |
run(int port,
int lac,
String path,
TransientAgent agent)
Attempts to start a new agent based on the type of RunDescriptor this is.
|
boolean |
setAuthorized(boolean newVal)
Set the value of authorized
|
void |
setCommandLine(String commandLine)
Make this RunDescriptor a command line run descriptor and specify
the command line to execute to run the agent.
|
void |
setInternal(String internalClass)
see setJavaClass().
|
void |
setJavaClass(String javaClass)
Set this RunDescriptor to be a Java class run descriptor.
|
String |
toString() |
protected Object |
translateObjValue(String obj,
int port,
int lacPort,
String path) |
public static final int None
public static final int CommandLine
public static final int JavaClass
public static final int Internal
private static int Last
private String command
private int type
private boolean authorized
public RunDescriptor()
public RunDescriptor(String text) throws ParseException
text
- input StringParseException
- if the input text is malformedpublic RunDescriptor(String text, int startAt) throws ParseException
text
- String to parsestartAt
- the position in the string to start parsinglastPosition
- (update) the position in the string there parsing finishedParseException
- if the input text is malformedpublic RunDescriptor(RunDescriptor r)
r
- the RunDescriptor to be copiedpublic int parse(String text, int startAt) throws ParseException
ParseException
public void setCommandLine(String commandLine)
%port% | The port given in the run time command for the agent to listen at |
%lacPort% | The LAC port given in teh run time command for the agent to register to |
%path% | The path of the the agent. This is the concatonations of the %dir% and %file% |
%file% | The filename for the agent. This represents an individual agent name. Same as %name%. |
%name% | The name for the agent. This represents an individual agent name. Same as %file%. |
%dir% | The directory path, relative to the LAC's root, for the agent. Same as %type%. |
%type% | The type path specifying the agent type. Same as %dir%. |
commandLine
- The command line, possibly containing replacement tokens as specified above.public void setInternal(String internalClass)
internalClass
- The class specification (see setJavaClass()).public boolean setAuthorized(boolean newVal)
newVal
- the new value of authorizedpublic boolean isAuthorized()
public void setJavaClass(String javaClass)
fully-qualified-class-name { param-value:fully-qualified-class-name }*This specifies the values and types used to find and call the constructor for the new object. In the param-value position, you may use the following special tokens which will be substituted just before creating the object:
%port% | The port given in the run time command for the agent to listen at |
%lacPort% | The LAC port given in teh run time command for the agent to register to |
%path% | The path of the the agent. This is the concatonations of the %dir% and %file% |
%file% | The filename for the agent. This represents an individual agent name. Same as %name%. |
%name% | The name for the agent. This represents an individual agent name. Same as %file%. |
%dir% | The directory path, relative to the LAC's root, for the agent. Same as %type%. |
%type% | The type path specifying the agent type. Same as %dir%. |
javaClass
- the specification of the class as abovepublic int getType()
public String getCommandLine()
public String getInternal()
public String getJavaClass()
public int run(int port, int lac, String path, TransientAgent agent) throws IOException, ParseException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException
port
- The requested portlac
- The requested LAC port to register the agent topath
- The commplete path, including type and agent name, of the agentIOException
ParseException
ClassNotFoundException
NoSuchMethodException
InvocationTargetException
IllegalAccessException
InstantiationException
protected Class<?> getclass(String s) throws ClassNotFoundException
ClassNotFoundException
protected Object translateObjValue(String obj, int port, int lacPort, String path) throws ParseException
ParseException