+/* Copyright (c) 2011 Peter Troshin\r
+ * \r
+ * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 \r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under the terms of the\r
+ * Apache License version 2 as published by the Apache Software Foundation\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
+ * License for more details.\r
+ * \r
+ * A copy of the license is in apache_license.txt. It is also available here:\r
+ * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
+ * \r
+ * Any republication or derived work distributed in source code form\r
+ * must include this copyright and license notice.\r
+ */\r
package compbio.ws.client;\r
\r
import static compbio.ws.client.Constraints.pseparator;\r
import java.util.ArrayList;\r
import java.util.Collections;\r
import java.util.List;\r
+import java.net.MalformedURLException;\r
+import java.net.URL;\r
\r
import compbio.data.msa.Metadata;\r
import compbio.metadata.Limit;\r
}\r
\r
/**\r
+ * Returns a list of options supported by web service\r
+ * \r
+ * @param <T>\r
+ * web service type\r
+ * @param msaws\r
+ * web service proxy\r
+ * @param host\r
+ * the server URL, as a string\r
+ * @return List of options supported by a web service\r
+ */\r
+ static <T> List<Option<T>> getParametersList(Metadata<T> msaws, String host) throws MalformedURLException {\r
+ assert msaws != null;\r
+ RunnerConfig<T> config = msaws.getRunnerOptions();\r
+ if (config == null) {\r
+ return Collections.emptyList();\r
+ }\r
+ List<Option<T>> opts = config.getArguments();\r
+ for (Option<T> o : opts) {\r
+ o.setBasicURL(new URL(host + "/"));\r
+ }\r
+ return opts;\r
+ }\r
+\r
+ /**\r
* Returns an objects from which the list of presets supported by web\r
* service <T> can be obtained\r
* \r
assert presetName != null;\r
PresetManager<T> presets = MetadataHelper.getPresetList(msaws);\r
if (presets == null) {\r
- System.out\r
- .println("No presets are supported by the service! Ignoring -r directive!");\r
+ System.out.println("No presets are supported by the service! Ignoring -r directive!");\r
return null;\r
}\r
Preset<T> pre = presets.getPresetByName(presetName);\r
if (pre == null) {\r
- System.out.println("Cannot find preset: " + presetName\r
- + " WARN: ignoring -r directive!");\r
+ System.out.println("Cannot find preset: " + presetName + " WARN: ignoring -r directive!");\r
}\r
return pre;\r
}\r
}\r
Option<T> o = options.getArgumentByOptionName(oname);\r
if (o == null) {\r
- System.out.println("WARN ignoring unsuppoted parameter: "\r
- + oname);\r
+ System.out.println("WARN ignoring unsuppoted parameter: " + oname);\r
continue;\r
}\r
if (isParameter(param)) {\r
try {\r
o.setValue(getParamValue(param));\r
} catch (WrongParameterException e) {\r
- System.out\r
- .println("Problem setting value for the parameter: "\r
- + param);\r
+ System.out.println("Problem setting value for the parameter: " + param);\r
e.printStackTrace();\r
}\r
}\r