Further work to enable stat collection and display
[jabaws.git] / webservices / compbio / stat / collector / ExecutionStatCollector.java
index 140de7c..bf3130a 100644 (file)
@@ -15,10 +15,8 @@ import java.util.Set;
 \r
 import org.apache.log4j.Logger;\r
 \r
-import compbio.engine.client.ConfExecutable;\r
 import compbio.engine.client.Executable;\r
 import compbio.metadata.JobStatus;\r
-import compbio.runner.msa.ClustalW;\r
 import compbio.util.FileUtil;\r
 import compbio.ws.client.Services;\r
 \r
@@ -239,26 +237,8 @@ public class ExecutionStatCollector implements Runnable {
                        return ftime;\r
                }\r
 \r
-               @SuppressWarnings("unchecked")\r
-               Class<Executable<?>> getWSRunnerName() {\r
-                       String name = jobdir.getName().split("#")[0];\r
-                       try {\r
-                               if (name.startsWith(ConfExecutable.CLUSTER_TASK_ID_PREFIX)) {\r
-                                       assert ConfExecutable.CLUSTER_TASK_ID_PREFIX.length() == 1;\r
-                                       name = name.substring(1);\r
-                               }\r
-                               name = ClustalW.class.getPackage().getName() + "." + name;\r
-                               return (Class<Executable<?>>) Class.forName(name);\r
-                       } catch (ClassNotFoundException e) {\r
-                               e.printStackTrace();\r
-                               throw new RuntimeException(\r
-                                               "Cannot match the directory name to the executable! Executable name is "\r
-                                                               + name);\r
-                       }\r
-               }\r
-\r
                private Services getService() {\r
-                       return Services.getService(getWSRunnerName());\r
+                       return Services.getServiceByJobDirectory(jobdir);\r
                }\r
 \r
                // Mafft, Muscle, Tcoffee, Clustal task:fasta.in result:fasta.out\r
@@ -267,7 +247,9 @@ public class ExecutionStatCollector implements Runnable {
                 * TODO replace with Universal names for WS!\r
                 */\r
                long getResultSize() {\r
-                       Class<Executable<?>> name = getWSRunnerName();\r
+                       Class<? extends Executable<?>> name = Services\r
+                                       .getRunnerByJobDirectory(jobdir);\r
+\r
                        File f = null;\r
                        if (name.getSimpleName().equalsIgnoreCase("Probcons")) {\r
                                f = files.get("alignment.out");\r