X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fws%2Fjws2%2FJabaParamStore.java;h=5e034cd544c8b3dfdba517c135b39645e1726f24;hb=e71f64687c21da78cc64ebc3e1f05d0c10dd5580;hp=ec504ddb97cfb99e2a326eb6e1bb194c13c67d2c;hpb=3737b35aa75cf9ba9203a244de45008fb0794bc4;p=jalview.git
diff --git a/src/jalview/ws/jws2/JabaParamStore.java b/src/jalview/ws/jws2/JabaParamStore.java
index ec504dd..5e034cd 100644
--- a/src/jalview/ws/jws2/JabaParamStore.java
+++ b/src/jalview/ws/jws2/JabaParamStore.java
@@ -1,22 +1,35 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
+import jalview.util.MessageManager;
+import jalview.ws.jws2.dm.JabaOption;
+import jalview.ws.jws2.dm.JabaParameter;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.ParamDatastoreI;
+import jalview.ws.params.ParamManager;
+import jalview.ws.params.WsParamSetI;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -24,7 +37,6 @@ import java.util.Hashtable;
import java.util.List;
import java.util.StringTokenizer;
-import org.jmol.util.ArrayUtil;
import compbio.metadata.Argument;
import compbio.metadata.Option;
import compbio.metadata.Parameter;
@@ -32,15 +44,6 @@ import compbio.metadata.Preset;
import compbio.metadata.PresetManager;
import compbio.metadata.RunnerConfig;
-import jalview.ws.jws2.dm.JabaOption;
-import jalview.ws.jws2.dm.JabaParameter;
-import jalview.ws.jws2.dm.JabaWsParamSet;
-import jalview.ws.jws2.jabaws2.Jws2Instance;
-import jalview.ws.params.ArgumentI;
-import jalview.ws.params.ParamDatastoreI;
-import jalview.ws.params.ParamManager;
-import jalview.ws.params.WsParamSetI;
-
public class JabaParamStore implements ParamDatastoreI
{
@@ -81,8 +84,8 @@ public class JabaParamStore implements ParamDatastoreI
}
else
{
- System.err
- .println("Warning: Ignoring parameter set instance of type "
+ System.err.println(
+ "Warning: Ignoring parameter set instance of type "
+ paramset.getClass()
+ " : Bound but not applicable for service at "
+ service.getUri());
@@ -95,7 +98,7 @@ public class JabaParamStore implements ParamDatastoreI
@Override
public List getPresets()
{
- List prefs = new ArrayList();
+ List prefs = new ArrayList<>();
if (servicePresets == null)
{
servicePresets = new Hashtable();
@@ -163,9 +166,10 @@ public class JabaParamStore implements ParamDatastoreI
}
if (narg == null)
{
- throw new Error(
- "Implementation Error: Cannot handle Jaba parameter object "
- + rg.getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_cannot_handle_jaba_param",
+ new String[]
+ { rg.getClass().toString() }));
}
else
{
@@ -180,6 +184,14 @@ public class JabaParamStore implements ParamDatastoreI
ArgumentI[] rgssort = rgs.toArray(new ArgumentI[rgs.size()]);
String[] rgssorton = rgnames.toArray(new String[rgs.size()]);
jalview.util.QuickSort.sort(rgssorton, rgssort);
+ ArgumentI tmp1;
+ int i = 0;
+ while (rgssort.length - i > i)
+ {
+ tmp1 = rgssort[rgssort.length - i - 1];
+ rgssort[rgssort.length - i - 1] = rgssort[i];
+ rgssort[i++] = tmp1;
+ }
return Arrays.asList(rgssort);
}
@@ -188,13 +200,15 @@ public class JabaParamStore implements ParamDatastoreI
List rgs = new ArrayList();
for (ArgumentI rg : jwsargs)
{
- Argument narg = (rg instanceof JabaOption) ? ((JabaOption) rg)
- .getOption() : null;
+ Argument narg = (rg instanceof JabaOption)
+ ? ((JabaOption) rg).getOption()
+ : null;
if (narg == null)
{
- throw new Error(
- "Implementation Error: Cannot handle Jaba parameter object "
- + rg.getClass());
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_cannot_handle_jaba_param",
+ new String[]
+ { rg.getClass().toString() }));
}
else
{
@@ -213,8 +227,8 @@ public class JabaParamStore implements ParamDatastoreI
@Override
public boolean presetExists(String name)
{
- return (editedParams.containsKey(name) || servicePresets
- .containsKey(name));
+ return (editedParams.containsKey(name)
+ || servicePresets.containsKey(name));
}
@Override
@@ -232,8 +246,8 @@ public class JabaParamStore implements ParamDatastoreI
}
if (servicePresets.containsKey(name))
{
- throw new Error(
- "Implementation error: Attempt to delete a service preset!");
+ throw new Error(MessageManager.getString(
+ "error.implementation_error_attempt_to_delete_service_preset"));
}
}
@@ -242,8 +256,7 @@ public class JabaParamStore implements ParamDatastoreI
List jobParams)
{
JabaWsParamSet jps = new JabaWsParamSet(presetName, text, jobParams);
- jps.setApplicableUrls(new String[]
- { service.getUri() });
+ jps.setApplicableUrls(new String[] { service.getUri() });
editedParams.put(jps.getName(), jps);
if (manager != null)
{
@@ -255,19 +268,20 @@ public class JabaParamStore implements ParamDatastoreI
public void updatePreset(String oldName, String presetName, String text,
List jobParams)
{
- JabaWsParamSet jps = (JabaWsParamSet) ((oldName != null) ? getPreset(oldName)
+ JabaWsParamSet jps = (JabaWsParamSet) ((oldName != null)
+ ? getPreset(oldName)
: getPreset(presetName));
if (jps == null)
{
- throw new Error("Implementation error: Can't locate either oldname ("
- + oldName + ") or presetName (" + presetName
- + "in the datastore!");
+ throw new Error(MessageManager.formatMessage(
+ "error.implementation_error_cannot_locate_oldname_presetname",
+ new String[]
+ { oldName, presetName }));
}
jps.setName(presetName);
jps.setDescription(text);
jps.setArguments(jobParams);
- jps.setApplicableUrls(new String[]
- { service.getUri() });
+ jps.setApplicableUrls(new String[] { service.getUri() });
if (oldName != null && !oldName.equals(jps.getName()))
{
editedParams.remove(oldName);
@@ -311,8 +325,8 @@ public class JabaParamStore implements ParamDatastoreI
{
if (!involves(urls))
{
- throw new IOException(
- "Implementation error: Cannot find service url in the given url set!");
+ throw new IOException(MessageManager.getString(
+ "error.implementation_error_cannot_find_service_url_in_given_set"));
}
JabaWsParamSet wsp = new JabaWsParamSet();
@@ -326,8 +340,8 @@ public class JabaParamStore implements ParamDatastoreI
{
lines.add(st.nextToken());
}
- wsp.setjabaArguments(ParameterUtils.processParameters(lines,
- serviceOptions, " "));
+ wsp.setjabaArguments(
+ ParameterUtils.processParameters(lines, serviceOptions, " "));
return wsp;
}
@@ -337,15 +351,15 @@ public class JabaParamStore implements ParamDatastoreI
{
if (!involves(pset.getApplicableUrls()))
{
- throw new IOException(
- "Implementation error: Cannot find service url in the given url set for this service parameter store ("
- + service.getUri() + ") !");
-
+ throw new IOException(MessageManager.formatMessage(
+ "error.implementation_error_cannot_find_service_url_in_given_set_param_store",
+ new String[]
+ { service.getUri() }));
}
if (!(pset instanceof JabaWsParamSet))
{
- throw new Error(
- "Implementation error: JabaWsParamSets can only be handled by JabaParamStore");
+ throw new Error(MessageManager.getString(
+ "error.implementation_error_jabaws_param_set_only_handled_by"));
}
StringBuffer rslt = new StringBuffer();