interface XmlServer:BeanContextChild

this module maintain a conversionational state. As long as the module is alive, its state is preserved. Hence, it is enough to open an XML file once, and manipulate DOM during subsequent calls.
probably it make sense to rename this module from a generic XmlServer to AADserver

List of Methods

parsing and reparsing of XML files

boolean instantiateParser(in string filename);
reads specified xml file (given by filename argument), parses it, and creates DOM
boolean SaveAsXml(in string outputFile);
creates an xml document from DOM and writes to file outputFile
do we need close XML file?

generic methods

collection of methods that are dtd independent
boolean newAAD(in string filename, in string dtdFile);
creates a new, blank ADD.xml file. Since dtdFile is passed as an argument, any xml document can be created, not necessirily AAD.xml
private Vector getAllTags(Node node, String tag);
returns an array of all childern nodes of the node node named tag
private Node findFirstTag(Node node, String tag);
searches childs of the node element and returns the node object corresponding to the first encountered child named tag.
private String getAttributeValue(Node node, String tag, String name);
searches childs of the node element and returns value of the atribute name of the first encountered child named tag.
private Node findTagWithAttribute(Node node, String tag, String attr, String value);
searches childs of the node element and returns the node object corresponding to the the first encountered child named tag with attribute name set to value.
Examples:
  <host id="osprey4.npac.syr.edu">
    <status installed="Yes" />
    <installed>
      ...
    </installed>
  </host>  

 getAttributeValue(host_node,"status","installed") --> "Yes"
 findTagWithAttribute(host_node,"status,"installed","Yes") --> status_node
 findFirstTag(host_node,installed) --> installed_node  

AAD related methods

collection of methods to manipulate DOM defined by ApplDescV3.dtd

application

stringArray getApplications();
returns array of all applications defined in AAD.xml
boolean isApplicationInstallable(in string Application);
returns true, if the application can be installed in-the-fly (move source code, run make). No real use at this time. In the future may be important for user customizations and community contributions
void addApplication(in string Application, in boolean instalable);
add a new application to AAD.xml (administrator only)
void deleteApplication(in string application);
remove selected application from AAD.xml (administrator only)

host

stringArray getInstalledHosts(in string ApplicationName);
returns arrays of host where the application is installed
boolean isApplicationInstalled(in string Application, in string hostname);
returns true if the application is installed on the specified host
void addApplicationHost(in string Application, in string host);
adds new host tag for selected application (administrator only)
void changeInstalledStatus(in string Application, in string host, in string newStatus);
changes attribute of the installed tag for given host
void deleteInstalledHost(in string application, in string host);
deletes selected host tag and all its children (administrator only)
void deleteHost(in string application, in string host);
deletes selected host tag and all its children (the same as deleteInstalledHost, redundant) (administrator only)

executable

string getExec(in string Application, in string host);
returns command line to run the selected application on given host
Note: The tag <Command> has attribute exec and optional attribute path. If path is defined, this method returns concatenation of path and exec. Otherwise it returns value of exec only.
void addCommand(in string Application, in string host, in string path, in string exec);
adds new Command (and installed, CmdLine if necessary) tag(s) (administrator only)
Note: If the <Command> tag exists, it is overwritten by this method. There is no deleteCommand method.

switches and arguments

stringArray getArguments(in string Application, in string host);
returns array of all command line arguments
Note 1: if there is no argument defined, this method returns array of length 1, with the first element set to String "none" (to avoid exception raised by ORB)
Note 2: tag <arg> has two optional attributes: type and m; if defined they are appended to the argument name following the syntax: argument_name [m m_value] [t type_value]
stringArray getNameValue(in string Application, in string host);
not used at this time
stringArray getSwitches(in string Application, in string host);
returns array of all command line switches
Note 1: if there is no switch defined, this method returns array of length 1, with the first element set to String "none" (to avoid exception raised by ORB)
Note 2: tag <switch> has five optional attributes: ms, separator, value , type, and m; if defined they are appended to the argument name following the syntax: switch_name [ms ms_value] [s s_value] [v v_value] [t type_value] [m m_value]
void addArgument(in string Application, in string host, in string arg, in string type, in string m);
add new arg (and Parameters, if necessary) tag(s) (administrator only)
void addSwitch(in string Application, in string host, in string name, in string ms, in string separator, in string value, in string type, in string m);
add new switch (and Parameters, if necessary) tag(s) (administrator only)
void deleteSwitch(in string application, in string host, in string sw);
removes specified switch tag from AAD.xml (administrator only)
void deleteArgument(in string application, in string host, in string arg);
removes specified argument tag from AAD.xml (administrator only)

input and output files

stringArray getIPFiles(in string Application, in string hname);
returns array of input files defined in AAD.xml
Note: input files are defined by two parameters: name and path. Consequently, getIPFiles returns array of the size twice as large as number of files. Odd elements contain filename, and even elements path.
stringArray getOPFiles(in string Application, in string hname);
returns array of output files defined in AAD.xml
Note: output files are defined by two parameters: name and path. Consequently, getOPFiles returns array of the size twice as large as number of files. Odd elements contain filename, and even elements path.
void addIPSource(in string Application, in string host, in string f, in stringArray s);
adds new source tag matching selected inFile tag
void addOPSource(in string Application, in string host, in string f, in stringArray s);
adds new dest tag matching selected outFile tag
getSource(inputFile);
get source file corresponding to the inputFile (missing)
getDest(outputFile);
get destination file corresponding to the outputFile (missing)
void addInFile(in string Application, in string host, in string path, in string name);
add new inFile (and input, if necessary) tag(s) (administrator only)
void addOutFile(in string Application, in string host, in string path, in string name);
add new outFile (and output, if necessary) tag(s) (administrator only)
void deleteInFile(in string application, in string host, in string inp);
removes InFile tag from AAD.xml (administrator only)
void deleteOutFile(in string application, in string host, in string outp);
removes OutFile tag from AAD.xml (administrator only)
void replaceInFile(in string Application, in string host, in string path, in string name, in string old);
changes attributes of inFile tag (administrator only)
void replaceOutFile(in string Application, in string host, in string path, in string name, in string old);
changes attributes of outFile tag (administrator only)

AD descriptors

boolean createAD (in string Application, in string hostname);
creates a new AD descriptor (DOM) by extracting information on selected application installed on selected host. createAD should be followed by adding source and dest tags to match inFile and outFile tags.

auxilliary methods

private Node[] getApplicationNodes();
private Node selectApplicationNode(String ApplicationName);
private Node getInstalledNode(String Application, String hostname);
private static void printAllTags(Node node);
void printXML();
void testDOM();
void test();
public void processJobRequest(WebFlow.xml.jobRequestEvent jrEvent);
does not work!

deprecated

string getRSL(in string hostname); //to be phased out
string getCommandLine(in string Application, in string host); //tb phased out
string getRunCommand(in string Application, in string host);
returns command line to run the selected application on given host
void addRunCommand(in string Application, in string host, in string cmd);
void execCmdLine(in string Application, in string host, in string method);
extracts the command line and delegates execution of the code to the submitJob module. method=local|rsh|globus

Usage

Creation and modification of the AAD file

The following set of methods allows adding, removing and modyfing elements of the Abstract Task Descriptor, and are used by an administrative tool (an alternative to manual editing of the XML file). This is the mechanism of adding and removing applications and hosts to the Gateway system.

boolean newAAD(in string filename, in string dtdFile);
boolean SaveAsXml(in string outputFile);
void addApplication(in string Application, in boolean instalable);
void addApplicationHost(in string Application, in string host);
void addArgument(in string Application, in string host, in string arg, in string type, in string m);
void addCommand(in string Application, in string host, in string path, in string exec);
void addInFile(in string Application, in string host, in string path, in string name);
void addIPSource(in string Application, in string host, in string f, in stringArray s);
void addSwitch(in string Application, in string host, in string name, in string ms, in string separator, in string value, in string type, in string m);
void changeInstalledStatus(in string Application, in string host, in string newStatus);
void deleteApplication(in string application);
void deleteArgument(in string application, in string host, in string arg);
void deleteHost(in string application, in string host);
void deleteInFile(in string application, in string host, in string inp);
void deleteInstalledHost(in string application, in string host);
void deleteOutFile(in string application, in string host, in string outp);
void deleteSwitch(in string application, in string host, in string sw);
void replaceInFile(in string Application, in string host, in string path, in string name, in string old);
void replaceOutFile(in string Application, in string host, in string path, in string name, in string old);

Querying for applications and hosts where they are installed

stringArray getApplications();
returns array of all applications defined in AAD.xml
boolean isApplicationInstallable(in string Application);
returns true, if the application can be installed in-the-fly (move source code, run make). No real use at this time. In the future may be important for user customizations and community contributions
stringArray getInstalledHosts(in string ApplicationName);
returns arrays of host where the application is installed
boolean isApplicationInstalled(in string Application, in string hostname);
returns true if the application is installed on the specified host

Extracting information how to run codes

The model of submitting a job is as follows.
  1. Creation of the task descriptor
  2. execute ATD

Alphabetic list of public methods

boolean createAD (in string Application, in string hostname);
void addApplication(in string Application, in boolean instalable);
void addApplicationHost(in string Application, in string host);
void addArgument(in string Application, in string host, in string arg, in string type, in string m);
void addCommand(in string Application, in string host, in string path, in string exec);
void addInFile(in string Application, in string host, in string path, in string name);
void addIPSource(in string Application, in string host, in string f, in stringArray s);
void addOPSource(in string Application, in string host, in string f, in stringArray s);
void addOutFile(in string Application, in string host, in string path, in string name);
void addRunCommand(in string Application, in string host, in string cmd);
void addSwitch(in string Application, in string host, in string name, in string ms, in string separator, in string value, in string type, in string m);
void changeInstalledStatus(in string Application, in string host, in string newStatus);
void deleteApplication(in string application);
void deleteArgument(in string application, in string host, in string arg);
void deleteHost(in string application, in string host);
void deleteInFile(in string application, in string host, in string inp);
void deleteInstalledHost(in string application, in string host);
void deleteOutFile(in string application, in string host, in string outp);
void deleteSwitch(in string application, in string host, in string sw);
void execCmdLine(in string Application, in string host, in string method);
stringArray getApplications();
stringArray getArguments(in string Application, in string host);
stringArray getInstalledHosts(in string ApplicationName);
string getCommandLine(in string Application, in string host);//tb f-out
string getExec(in string Application, in string host);
stringArray getIPFiles(in string Application, in string hname);
stringArray getNameValue(in string Application, in string host);
stringArray getOPFiles(in string Application, in string hname);
string getRSL(in string hostname); //to be phased out
string getRunCommand(in string Application, in string host);
stringArray getSwitches(in string Application, in string host);
boolean instantiateParser(in string filename);
boolean isApplicationInstallable(in string Application);
boolean isApplicationInstalled(in string Application, in string hostname);
boolean newAAD(in string filename, in string dtdFile);
void printXML();
void replaceInFile(in string Application, in string host, in string path, in string name, in string old);
void replaceOutFile(in string Application, in string host, in string path, in string name, in string old);
boolean SaveAsXml(in string outputFile);
void test();
void testDOM();