package simgrid.msg;
import java.util.Vector;
+import java.util.Hashtable;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
* of the process object.
*/
public Vector args;
+
+ public Hashtable properties;
/**
* The name of the host of the process.
* The function of the process.
*/
private String function;
+
/**
* Default constructor.
*/
public ProcessFactory() {
this.args = new Vector();
+ this.properties = new Hashtable();
this.hostName = null;
this.function = null;
}
this.hostName = hostName;
this.function = function;
- if (!args.isEmpty())
- args.clear();
+ if (!this.args.isEmpty())
+ this.args.clear();
+
+ if(!this.properties.isEmpty())
+ this.properties.clear();
}
/**
* This method is called by the startElement() handler.
*/ public void registerProcessArg(String arg) {
this.args.add(arg);
}
+
+ public void setProperty(String id, String value)
+ {
+ this.properties.put(id,value);
+ }
+
+ public String getHostName()
+ {
+ return this.hostName;
+ }
public void createProcess() {
try {
Class cls = Class.forName(this.function);
simgrid.msg.Process process = (simgrid.msg.Process) cls.newInstance();
- process.name = process.getName(); //this.function;
+ process.name = /*process.getName();*/ this.function;
process.id = simgrid.msg.Process.nextProcessId++;
Host host = Host.getByName(this.hostName);
for (int index = 0; index < size; index++)
process.args.add(args.get(index));
+
+ process.properties = this.properties;
+ this.properties = new Hashtable();
} catch(JniException e) {
System.out.println(e.toString());
Attributes attr) {
if (localName.equals("process"))
onProcessIdentity(attr);
+ else if(localName.equals("prop"))
+ onProperty(attr);
else if (localName.equals("argument"))
onProcessArg(attr);
}
public void onProcessIdentity(Attributes attr) {
processFactory.setProcessIdentity(attr.getValue(0), attr.getValue(1));
}
+
+ public void onProperty(Attributes attr) {
+ processFactory.setProperty(attr.getValue(0), attr.getValue(1));
+ }
/**
* process arguments handler.