Change the way to deal with Limits to simplify wrapper writing and enable couping...
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Mon, 14 Feb 2011 18:19:14 +0000 (18:19 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Mon, 14 Feb 2011 18:19:14 +0000 (18:19 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3751 e3abac25-378b-4346-85de-24260fe3988d

12 files changed:
datamodel/compbio/metadata/LimitsManager.java
engine/compbio/engine/client/SkeletalExecutable.java
runner/compbio/runner/Util.java
webservices/compbio/ws/server/AAConWS.java
webservices/compbio/ws/server/ClustalWS.java
webservices/compbio/ws/server/DisemblWS.java
webservices/compbio/ws/server/GlobPlotWS.java
webservices/compbio/ws/server/JronnWS.java
webservices/compbio/ws/server/MafftWS.java
webservices/compbio/ws/server/MuscleWS.java
webservices/compbio/ws/server/ProbconsWS.java
webservices/compbio/ws/server/TcoffeeWS.java

index 92fd237..9e8dfb4 100644 (file)
@@ -68,6 +68,9 @@ public class LimitsManager<T> {
         *         returned\r
         */\r
        public Limit<T> getLimitByName(String presetName) {\r
+               if (limit == null) {\r
+                       return null;\r
+               }\r
                if (Util.isEmpty(presetName)) {\r
                        // return default limit\r
                        return getDefaultLimit();\r
index b289f6c..19fde7e 100644 (file)
@@ -293,11 +293,16 @@ public abstract class SkeletalExecutable<T> implements Executable<T> {
        }\r
 \r
        @Override\r
-       public Limit<T> getLimit(String presetName) {\r
-\r
+       public synchronized Limit<T> getLimit(String presetName) {\r
+               // Assume this function is called for the first time and thus need\r
+               // initialization\r
                if (limits == null) {\r
                        limits = getLimits();\r
                }\r
+               // Either the initialization failed or limits were not configured.\r
+               if (limits == null) {\r
+                       return null;\r
+               }\r
 \r
                Limit<T> limit = null;\r
                if (limits != null) {\r
index 189ded7..bfced2a 100644 (file)
@@ -68,7 +68,7 @@ public final class Util {
         */\r
 \r
        public static <T> LimitsManager<T> getLimits(Class<Executable<T>> clazz) {\r
-               LimitsManager<T> limits = new LimitsManager<T>();\r
+               LimitsManager<T> limits = null;\r
                try {\r
                        limits = ConfExecutable.getRunnerLimits(clazz);\r
                } catch (FileNotFoundException e) {\r
@@ -80,7 +80,6 @@ public final class Util {
                        log.warn("IO exception while attempting to read limits for "\r
                                        + clazz + " executable! " + e.getLocalizedMessage(),\r
                                        e.getCause());\r
-                       return null;\r
                }\r
                return limits;\r
        }\r
index ac7435d..8637af1 100644 (file)
@@ -84,6 +84,10 @@ public class AAConWS implements SequenceAnnotation<AACon> {
 \r
        @Override\r
        public Limit<AACon> getLimit(String presetName) {\r
+               if (limitMan == null) {\r
+                       // Limit is not defined\r
+                       return null;\r
+               }\r
                return limitMan.getLimitByName(presetName);\r
        }\r
 \r
index f13136a..a5fc701 100644 (file)
@@ -155,10 +155,15 @@ public class ClustalWS implements MsaWS<ClustalW> {
        @Override\r
        public Limit<ClustalW> getLimit(String presetName) {\r
                Timer timer = Timer.getMilliSecondsTimer();\r
+               if (limitMan == null) {\r
+                       // No limit is configured\r
+                       return null;\r
+               }\r
                Limit<ClustalW> limit = limitMan.getLimitByName(presetName);\r
                getLogger().logAll(timer, "getLimit");\r
                return limit;\r
        }\r
+\r
        @Override\r
        public LimitsManager<ClustalW> getLimits() {\r
                return limitMan;\r
index 7970579..5c6bac5 100644 (file)
@@ -71,6 +71,10 @@ public class DisemblWS implements SequenceAnnotation<Disembl> {
 \r
        @Override\r
        public Limit<Disembl> getLimit(String presetName) {\r
+               if (limitMan == null) {\r
+                       // Limit is not defined\r
+                       return null;\r
+               }\r
                return limitMan.getLimitByName(presetName);\r
        }\r
 \r
index a77dfa2..b058882 100644 (file)
@@ -71,6 +71,10 @@ public class GlobPlotWS implements SequenceAnnotation<GlobPlot> {
 \r
        @Override\r
        public Limit<GlobPlot> getLimit(String presetName) {\r
+               if (limitMan == null) {\r
+                       // Limit is not defined\r
+                       return null;\r
+               }\r
                return limitMan.getLimitByName(presetName);\r
        }\r
 \r
index 5a4b136..b7a8f43 100644 (file)
@@ -73,6 +73,9 @@ public class JronnWS implements SequenceAnnotation<Jronn> {
 \r
        @Override\r
        public Limit<Jronn> getLimit(String presetName) {\r
+               if (limitMan == null) {\r
+                       return null;\r
+               }\r
                return limitMan.getLimitByName(presetName);\r
        }\r
 \r
index 0c8347d..83c5758 100644 (file)
@@ -127,6 +127,10 @@ public class MafftWS implements MsaWS<Mafft> {
 \r
        @Override\r
        public Limit<Mafft> getLimit(String presetName) {\r
+               if (limitMan == null) {\r
+                       // Limit is not defined\r
+                       return null;\r
+               }\r
                return limitMan.getLimitByName(presetName);\r
        }\r
 \r
index c0de308..5b694dc 100644 (file)
@@ -126,6 +126,10 @@ public class MuscleWS implements MsaWS<Muscle> {
 \r
        @Override\r
        public Limit<Muscle> getLimit(String presetName) {\r
+               if (limitMan == null) {\r
+                       // No limit is configured\r
+                       return null;\r
+               }\r
                return limitMan.getLimitByName(presetName);\r
        }\r
 \r
index 85e8a70..bfad95a 100644 (file)
@@ -123,6 +123,10 @@ public class ProbconsWS implements MsaWS<Probcons> {
 \r
        @Override\r
        public Limit<Probcons> getLimit(String presetName) {\r
+               if (limitMan == null) {\r
+                       // Limit is not defined\r
+                       return null;\r
+               }\r
                return limitMan.getLimitByName(presetName);\r
        }\r
 \r
index d8054b4..74c1723 100644 (file)
@@ -137,6 +137,10 @@ public class TcoffeeWS implements MsaWS<Tcoffee> {
 \r
        @Override\r
        public Limit<Tcoffee> getLimit(String presetName) {\r
+               if (limitMan == null) {\r
+                       // Limit is not defined\r
+                       return null;\r
+               }\r
                return limitMan.getLimitByName(presetName);\r
        }\r
 \r