Services class refactored to get rid of engines and runners dependencies.
[jabaws.git] / webservices / compbio / ws / client / Services.java
index 6626a5c..893117f 100644 (file)
@@ -18,7 +18,6 @@
 \r
 package compbio.ws.client;\r
 \r
-import java.io.File;\r
 import java.net.URL;\r
 import java.util.Set;\r
 \r
@@ -28,25 +27,16 @@ import javax.xml.ws.Service;
 import compbio.data.msa.JABAService;\r
 import compbio.data.msa.MsaWS;\r
 import compbio.data.msa.SequenceAnnotation;\r
-import compbio.engine.client.ConfExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.runner.conservation.AACon;\r
-import compbio.runner.disorder.Disembl;\r
-import compbio.runner.disorder.GlobPlot;\r
-import compbio.runner.disorder.IUPred;\r
-import compbio.runner.disorder.Jronn;\r
-import compbio.runner.msa.ClustalO;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.runner.msa.Mafft;\r
-import compbio.runner.msa.Muscle;\r
-import compbio.runner.msa.Probcons;\r
-import compbio.runner.msa.Tcoffee;\r
 \r
 /**\r
  * List of web services currently supported by JABAWS version 2\r
  * \r
  */\r
 public enum Services {\r
+       /*\r
+        * Make sure this class has NO references to runners or engines as it is a\r
+        * part of minimal client package. Such things should go into ServicesUtil\r
+        */\r
        MafftWS, MuscleWS, ClustalWS, ClustalOWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS;\r
 \r
        public static Services getService(String servName) {\r
@@ -59,81 +49,6 @@ public enum Services {
                return null;\r
        }\r
 \r
-       public static Services getServiceByRunner(\r
-                       Class<Executable<?>> runnerClassName) {\r
-               assert runnerClassName != null;\r
-               String sname = runnerClassName.getSimpleName().toLowerCase();\r
-               for (Services service : Services.values()) {\r
-                       if (service.toString().toLowerCase().contains(sname)) {\r
-                               return service;\r
-                       }\r
-               }\r
-               return null;\r
-       }\r
-\r
-       public Class<? extends Executable<?>> getServiceImpl() {\r
-               switch (this) {\r
-                       case AAConWS :\r
-                               return AACon.class;\r
-                       case ClustalOWS :\r
-                               return ClustalO.class;\r
-                       case ClustalWS :\r
-                               return ClustalW.class;\r
-                       case MafftWS :\r
-                               return Mafft.class;\r
-                       case MuscleWS :\r
-                               return Muscle.class;\r
-                       case TcoffeeWS :\r
-                               return Tcoffee.class;\r
-                       case ProbconsWS :\r
-                               return Probcons.class;\r
-                       case DisemblWS :\r
-                               return Disembl.class;\r
-                       case GlobPlotWS :\r
-                               return GlobPlot.class;\r
-                       case JronnWS :\r
-                               return Jronn.class;\r
-                       case IUPredWS :\r
-                               return IUPred.class;\r
-                       default :\r
-                               throw new RuntimeException(\r
-                                               "Unknown web service implementation class for service: "\r
-                                                               + this);\r
-               }\r
-       }\r
-\r
-       public static Class<? extends Executable<?>> getRunnerByJobDirectory(\r
-                       File jobdir) {\r
-               Services service = getServiceByRunnerName(getRunnerNameByJobDirectory(jobdir));\r
-               return service.getServiceImpl();\r
-       }\r
-\r
-       private static String getRunnerNameByJobDirectory(File jobdir) {\r
-               String name = jobdir.getName().split("#")[0];\r
-\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
-               return name;\r
-       }\r
-\r
-       public static Services getServiceByJobDirectory(File jobdir) {\r
-               return getServiceByRunnerName(getRunnerNameByJobDirectory(jobdir));\r
-       }\r
-\r
-       private static Services getServiceByRunnerName(String name) {\r
-               for (Services service : Services.values()) {\r
-                       String runnerName = service.getServiceImpl().getSimpleName()\r
-                                       .toLowerCase();\r
-                       name = name.trim().toLowerCase();\r
-                       if (name.startsWith(runnerName)) {\r
-                               return service;\r
-                       }\r
-               }\r
-               return null;\r
-       }\r
-\r
        Service getService(URL url, String sqname) {\r
                QName qname = new QName(sqname, this.toString());\r
                return Service.create(url, qname);\r