Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
doc improvement
[simgrid.git] / src / java / simgrid / msg / ApplicationHandler.java
index 47c29ee..34803da 100644 (file)
@@ -1,12 +1,13 @@
 /*
- * simgrid.msg.ApplicationHandler.java 1.00 07/05/01
  *
  * Copyright 2006,2007 Martin Quinson, Malek Cherier           
  * All right reserved. 
  *
  * This program is free software; you can redistribute 
  * it and/or modify it under the terms of the license 
- *(GNU LGPL) which comes with this package. 
+ * (GNU LGPL) which comes with this package.
+ *
+ * These are the upcalls used by the FleXML parser for application files
  */
 
 package simgrid.msg;
@@ -30,16 +31,16 @@ import java.util.Hashtable;
 public final class ApplicationHandler {
 
        /* 
-        * This class is used to create the processes descibed in the deployment file.
+        * This class is used to create the processes described in the deployment file.
         */
        static class ProcessFactory {
                /**
                 * The vector which contains the arguments of the main function 
                 * of the process object.
                 */
-               public Vector args;
+               public Vector<String> args;
 
-               public Hashtable properties;
+               public Hashtable<String,String> properties;
 
                /**
                 * The name of the host of the process.
@@ -56,8 +57,8 @@ public final class ApplicationHandler {
                 * Default constructor.
                 */
                public ProcessFactory() {
-                       this.args = new Vector();
-                       this.properties = new Hashtable();
+                       this.args = new Vector<String>();
+                       this.properties = new Hashtable<String,String>();
                        this.hostName = null;
                        this.function = null;
                }
@@ -102,12 +103,12 @@ public final class ApplicationHandler {
                         return hostName;
                 }
 
+                @SuppressWarnings("unchecked")
                 public void createProcess() {
                         try {
+                                Class<simgrid.msg.Process> cls = (Class<Process>) Class.forName(this.function);
 
-                                Class cls = Class.forName(this.function);
-
-                                simgrid.msg.Process process = (simgrid.msg.Process) cls.newInstance();
+                                simgrid.msg.Process process = cls.newInstance();
                                 process.name = this.function;
                                 process.id = simgrid.msg.Process.nextProcessId++;
                                 Host host = Host.getByName(this.hostName);
@@ -136,7 +137,7 @@ public final class ApplicationHandler {
 
                         } catch(ClassNotFoundException e) {
                                 System.out.println(this.function +
-                                                " class not found\n The attribut function of the element process  of your deployment file\n must correspond to the name of a Msg Proces class)");
+                                " class not found\n The attribut function of the element process  of your deployment file\n must correspond to the name of a Msg Proces class)");
                                 e.printStackTrace();
 
                         } catch(InstantiationException e) {