Services class refactored to get rid of engines and runners dependencies.
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Fri, 12 Aug 2011 12:32:00 +0000 (12:32 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Fri, 12 Aug 2011 12:32:00 +0000 (12:32 +0000)
Build script has new task to pack client sources

git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4500 e3abac25-378b-4346-85de-24260fe3988d

.settings/net.sf.jautodoc.prefs
TODO.txt
build.xml
webservices/compbio/stat/collector/ExecutionStatCollector.java
webservices/compbio/ws/client/Services.java
webservices/compbio/ws/client/ServicesUtil.java [new file with mode: 0644]

index f9f3e1b..4c1e231 100644 (file)
@@ -1,7 +1,7 @@
-#Fri Jul 16 12:02:13 BST 2010\r
+#Thu Aug 11 15:56:45 BST 2011\r
 add_header=true\r
 eclipse.preferences.version=1\r
-header_text=/* Copyright (c) 2009 Peter Troshin\r\n *  \r\n *  JAva Bioinformatics Analysis Web Services (JABAWS) @version\: 1.0     \r\n * \r\n *  This library is free software; you can redistribute it and/or modify it under the terms of the\r\n *  Apache License version 2 as published by the Apache Software Foundation\r\n * \r\n *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r\n *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r\n *  License for more details.\r\n * \r\n *  A copy of the license is in apache_license.txt. It is also available here\:\r\n * @see\: http\://www.apache.org/licenses/LICENSE-2.0.txt\r\n * \r\n * Any republication or derived work distributed in source code form\r\n * must include this copyright and license notice.\r\n */\r
+header_text=/* Copyright (c) 2011 Peter Troshin\r\n *  \r\n *  JAva Bioinformatics Analysis Web Services (JABAWS) @version\: 2.0     \r\n * \r\n *  This library is free software; you can redistribute it and/or modify it under the terms of the\r\n *  Apache License version 2 as published by the Apache Software Foundation\r\n * \r\n *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r\n *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r\n *  License for more details.\r\n * \r\n *  A copy of the license is in apache_license.txt. It is also available here\:\r\n * @see\: http\://www.apache.org/licenses/LICENSE-2.0.txt\r\n * \r\n * Any republication or derived work distributed in source code form\r\n * must include this copyright and license notice.\r\n */\r
 project_specific_settings=true\r
 replace_header=true\r
 replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n\r
index 4ad000b..03ad987 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,3 +1,4 @@
+server war - obtaining command line binaries \r
 \r
 Write help on \r
  + execution stats\r
index de21ce4..4a38ff3 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -23,6 +23,8 @@
        <property name="datamodel" value="${distdir}/datamodel-${jaba_version}.jar"/>\r
        <property name="datamodel-src" value="${distdir}/datamodel-src-${jaba_version}.jar"/>\r
        <property name="min-jaba-client" value="${distdir}/min-jaba-client-${jaba_version}.jar"/>\r
+       <property name="jaba-client-src" value="${distdir}/jaba-client-src-${jaba_version}.jar"/>\r
+       \r
        <property name="aacon-ws-client" value="${distdir}/aacon-ws-client.jar"/>\r
        <property name="full-jaba-client" value="${distdir}/full-jaba-client-${jaba_version}.jar"/>\r
        <property name="jaba-source-jar" value="${distdir}/jabaws-src-${jaba_version}.jar"/>\r
                </jar>\r
        </target>\r
 \r
-\r
+       <target name="jaba-client-src-jar" description="Pack metadata, data model, WS interfaces, a simple ws client class" depends="datamodel-source-jar">\r
+               <echo>Jar file: JABAWS client source</echo>\r
+               <delete file="${jaba-client-src}">\r
+               </delete>\r
+               <jar jarfile="${jaba-client-src}">\r
+                       <zipgroupfileset  excludes="META-INF/*.MF" file="${datamodel-src}"/>\r
+                               <fileset dir="${basedir}/webservices">\r
+                                       <!-- This will include JAXWS artifacts. Alternatively they can be generated on the fly. -->\r
+                                       <include name="compbio/data/msa/**"/>\r
+                                       <exclude name="compbio/ws/client/ServicesUtil**"/>\r
+                                       <exclude name="compbio/ws/client/AAConClient**"/>\r
+                                       <include name="compbio/ws/client/**"/>\r
+                               </fileset>\r
+                               <manifest>\r
+                                       <attribute name="Built-By" value="${author}" />\r
+                                       <attribute name="Implementation-Title" value="${product} Client Source Code" />\r
+                                       <attribute name="Implementation-Vendor" value="${author}" />\r
+                                       <attribute name="Implementation-URL" value="${project.url}" />\r
+                               </manifest>\r
+                       </jar>\r
+       </target>\r
+       \r
        <target name="minimal-jaba-client-jar" description="Pack metadata, data model, WS interfaces, a simple ws client class" depends="compile, datamodel-jar">\r
                <echo>Jar file: Minimal WS client jar</echo>\r
                <delete file="${basedir}/${min-jaba-client}">\r
index cd97f4a..ad89058 100644 (file)
@@ -38,6 +38,7 @@ import compbio.engine.client.SkeletalExecutable;
 import compbio.metadata.JobStatus;\r
 import compbio.util.FileUtil;\r
 import compbio.ws.client.Services;\r
+import compbio.ws.client.ServicesUtil;\r
 \r
 /**\r
  * Number of runs of each WS = number of folders with name\r
@@ -277,11 +278,11 @@ public class ExecutionStatCollector implements Runnable {
                }\r
 \r
                private Services getService() {\r
-                       return Services.getServiceByJobDirectory(jobdir);\r
+                       return ServicesUtil.getServiceByJobDirectory(jobdir);\r
                }\r
 \r
                long getResultSize() {\r
-                       Class<? extends Executable<?>> name = Services\r
+                       Class<? extends Executable<?>> name = ServicesUtil\r
                                        .getRunnerByJobDirectory(jobdir);\r
 \r
                        File f = null;\r
@@ -301,7 +302,7 @@ public class ExecutionStatCollector implements Runnable {
                }\r
 \r
                long getInputSize() {\r
-                       Class<? extends Executable<?>> name = Services\r
+                       Class<? extends Executable<?>> name = ServicesUtil\r
                                        .getRunnerByJobDirectory(jobdir);\r
 \r
                        File input = files.get(SkeletalExecutable.INPUT);\r
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
diff --git a/webservices/compbio/ws/client/ServicesUtil.java b/webservices/compbio/ws/client/ServicesUtil.java
new file mode 100644 (file)
index 0000000..2646a09
--- /dev/null
@@ -0,0 +1,96 @@
+package compbio.ws.client;\r
+\r
+import java.io.File;\r
+\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
+public class ServicesUtil {\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 static Class<? extends Executable<?>> getServiceImpl(Services service) {\r
+               switch (service) {\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
+                                                               + service);\r
+               }\r
+       }\r
+\r
+       public static Class<? extends Executable<?>> getRunnerByJobDirectory(\r
+                       File jobdir) {\r
+               Services service = getServiceByRunnerName(getRunnerNameByJobDirectory(jobdir));\r
+               return getServiceImpl(service);\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 = getServiceImpl(service).getSimpleName()\r
+                                       .toLowerCase();\r
+                       name = name.trim().toLowerCase();\r
+                       if (name.startsWith(runnerName)) {\r
+                               return service;\r
+                       }\r
+               }\r
+               return null;\r
+       }\r
+\r
+}\r