From: pvtroshin Date: Mon, 14 Feb 2011 18:19:14 +0000 (+0000) Subject: Change the way to deal with Limits to simplify wrapper writing and enable couping... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=24b1f578d0752ca4e3ee410031af5678b3ff1189;p=jabaws.git Change the way to deal with Limits to simplify wrapper writing and enable couping with null limits git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3751 e3abac25-378b-4346-85de-24260fe3988d --- diff --git a/datamodel/compbio/metadata/LimitsManager.java b/datamodel/compbio/metadata/LimitsManager.java index 92fd237..9e8dfb4 100644 --- a/datamodel/compbio/metadata/LimitsManager.java +++ b/datamodel/compbio/metadata/LimitsManager.java @@ -68,6 +68,9 @@ public class LimitsManager { * returned */ public Limit getLimitByName(String presetName) { + if (limit == null) { + return null; + } if (Util.isEmpty(presetName)) { // return default limit return getDefaultLimit(); diff --git a/engine/compbio/engine/client/SkeletalExecutable.java b/engine/compbio/engine/client/SkeletalExecutable.java index b289f6c..19fde7e 100644 --- a/engine/compbio/engine/client/SkeletalExecutable.java +++ b/engine/compbio/engine/client/SkeletalExecutable.java @@ -293,11 +293,16 @@ public abstract class SkeletalExecutable implements Executable { } @Override - public Limit getLimit(String presetName) { - + public synchronized Limit getLimit(String presetName) { + // Assume this function is called for the first time and thus need + // initialization if (limits == null) { limits = getLimits(); } + // Either the initialization failed or limits were not configured. + if (limits == null) { + return null; + } Limit limit = null; if (limits != null) { diff --git a/runner/compbio/runner/Util.java b/runner/compbio/runner/Util.java index 189ded7..bfced2a 100644 --- a/runner/compbio/runner/Util.java +++ b/runner/compbio/runner/Util.java @@ -68,7 +68,7 @@ public final class Util { */ public static LimitsManager getLimits(Class> clazz) { - LimitsManager limits = new LimitsManager(); + LimitsManager limits = null; try { limits = ConfExecutable.getRunnerLimits(clazz); } catch (FileNotFoundException e) { @@ -80,7 +80,6 @@ public final class Util { log.warn("IO exception while attempting to read limits for " + clazz + " executable! " + e.getLocalizedMessage(), e.getCause()); - return null; } return limits; } diff --git a/webservices/compbio/ws/server/AAConWS.java b/webservices/compbio/ws/server/AAConWS.java index ac7435d..8637af1 100644 --- a/webservices/compbio/ws/server/AAConWS.java +++ b/webservices/compbio/ws/server/AAConWS.java @@ -84,6 +84,10 @@ public class AAConWS implements SequenceAnnotation { @Override public Limit getLimit(String presetName) { + if (limitMan == null) { + // Limit is not defined + return null; + } return limitMan.getLimitByName(presetName); } diff --git a/webservices/compbio/ws/server/ClustalWS.java b/webservices/compbio/ws/server/ClustalWS.java index f13136a..a5fc701 100644 --- a/webservices/compbio/ws/server/ClustalWS.java +++ b/webservices/compbio/ws/server/ClustalWS.java @@ -155,10 +155,15 @@ public class ClustalWS implements MsaWS { @Override public Limit getLimit(String presetName) { Timer timer = Timer.getMilliSecondsTimer(); + if (limitMan == null) { + // No limit is configured + return null; + } Limit limit = limitMan.getLimitByName(presetName); getLogger().logAll(timer, "getLimit"); return limit; } + @Override public LimitsManager getLimits() { return limitMan; diff --git a/webservices/compbio/ws/server/DisemblWS.java b/webservices/compbio/ws/server/DisemblWS.java index 7970579..5c6bac5 100644 --- a/webservices/compbio/ws/server/DisemblWS.java +++ b/webservices/compbio/ws/server/DisemblWS.java @@ -71,6 +71,10 @@ public class DisemblWS implements SequenceAnnotation { @Override public Limit getLimit(String presetName) { + if (limitMan == null) { + // Limit is not defined + return null; + } return limitMan.getLimitByName(presetName); } diff --git a/webservices/compbio/ws/server/GlobPlotWS.java b/webservices/compbio/ws/server/GlobPlotWS.java index a77dfa2..b058882 100644 --- a/webservices/compbio/ws/server/GlobPlotWS.java +++ b/webservices/compbio/ws/server/GlobPlotWS.java @@ -71,6 +71,10 @@ public class GlobPlotWS implements SequenceAnnotation { @Override public Limit getLimit(String presetName) { + if (limitMan == null) { + // Limit is not defined + return null; + } return limitMan.getLimitByName(presetName); } diff --git a/webservices/compbio/ws/server/JronnWS.java b/webservices/compbio/ws/server/JronnWS.java index 5a4b136..b7a8f43 100644 --- a/webservices/compbio/ws/server/JronnWS.java +++ b/webservices/compbio/ws/server/JronnWS.java @@ -73,6 +73,9 @@ public class JronnWS implements SequenceAnnotation { @Override public Limit getLimit(String presetName) { + if (limitMan == null) { + return null; + } return limitMan.getLimitByName(presetName); } diff --git a/webservices/compbio/ws/server/MafftWS.java b/webservices/compbio/ws/server/MafftWS.java index 0c8347d..83c5758 100644 --- a/webservices/compbio/ws/server/MafftWS.java +++ b/webservices/compbio/ws/server/MafftWS.java @@ -127,6 +127,10 @@ public class MafftWS implements MsaWS { @Override public Limit getLimit(String presetName) { + if (limitMan == null) { + // Limit is not defined + return null; + } return limitMan.getLimitByName(presetName); } diff --git a/webservices/compbio/ws/server/MuscleWS.java b/webservices/compbio/ws/server/MuscleWS.java index c0de308..5b694dc 100644 --- a/webservices/compbio/ws/server/MuscleWS.java +++ b/webservices/compbio/ws/server/MuscleWS.java @@ -126,6 +126,10 @@ public class MuscleWS implements MsaWS { @Override public Limit getLimit(String presetName) { + if (limitMan == null) { + // No limit is configured + return null; + } return limitMan.getLimitByName(presetName); } diff --git a/webservices/compbio/ws/server/ProbconsWS.java b/webservices/compbio/ws/server/ProbconsWS.java index 85e8a70..bfad95a 100644 --- a/webservices/compbio/ws/server/ProbconsWS.java +++ b/webservices/compbio/ws/server/ProbconsWS.java @@ -123,6 +123,10 @@ public class ProbconsWS implements MsaWS { @Override public Limit getLimit(String presetName) { + if (limitMan == null) { + // Limit is not defined + return null; + } return limitMan.getLimitByName(presetName); } diff --git a/webservices/compbio/ws/server/TcoffeeWS.java b/webservices/compbio/ws/server/TcoffeeWS.java index d8054b4..74c1723 100644 --- a/webservices/compbio/ws/server/TcoffeeWS.java +++ b/webservices/compbio/ws/server/TcoffeeWS.java @@ -137,6 +137,10 @@ public class TcoffeeWS implements MsaWS { @Override public Limit getLimit(String presetName) { + if (limitMan == null) { + // Limit is not defined + return null; + } return limitMan.getLimitByName(presetName); }