* Date December 2009\r
* @param <T>\r
* executable type\r
- */\r
+*/\r
public interface Argument<T> {\r
\r
- URL getFurtherDetails();\r
+ String getFurtherDetails();\r
\r
- String getDefaultValue();\r
+ String getDefaultValue();\r
\r
- String getDescription();\r
+ String getDescription();\r
\r
- String getName();\r
+ String getName();\r
\r
- /**\r
- * \r
- * @return List of values allowed for an Argument\r
- */\r
- List<String> getPossibleValues();\r
+ /**\r
+ *\r
+ * @return List of values allowed for an Argument\r
+ */\r
+ List<String> getPossibleValues();\r
\r
- /**\r
- * Set default values for the parameter or an option\r
- * \r
- * @param defaultValue\r
- * the value to be set\r
- * @throws WrongParameterException\r
- * - when the value to be set is illegal. Wrong value for\r
- * numeric parameter is the value defined outside it , for\r
- * string type parameter, wrong value is the one which is not\r
- * listed in possible values list\r
- * @see ValueConstrain\r
- */\r
- void setValue(String defaultValue) throws WrongParameterException;\r
+ /**\r
+ * Set default values for the parameter or an option\r
+ * \r
+ * @param defaultValue\r
+ * the value to be set\r
+ * @throws WrongParameterException\r
+ * - when the value to be set is illegal. Wrong value for\r
+ * numeric parameter is the value defined outside it , for\r
+ * string type parameter, wrong value is the one which is not\r
+ * listed in possible values list\r
+ * @see ValueConstrain\r
+ */\r
+ void setValue(String defaultValue) throws WrongParameterException;\r
\r
}\r
public String toString() {\r
String value = "";\r
if (isDefault) {\r
- value = "Default Limit" + SysPrefs.newlinechar;\r
+ value = "Default Limits:" + SysPrefs.newlinechar;\r
} else {\r
- value = "Limit for Preset '" + preset + "'" + SysPrefs.newlinechar;\r
+ value = "Limits for Preset '" + preset + "'" + SysPrefs.newlinechar;\r
}\r
value += "Maximum sequence number=" + seqNumber + SysPrefs.newlinechar;\r
value += "Average sequence length=" + seqLength + SysPrefs.newlinechar;\r
- value += SysPrefs.newlinechar;\r
return value;\r
}\r
\r
\r
@Override\r
public String toString() {\r
- if (limit == null) {\r
- return "";\r
- }\r
String value = "";\r
- for (Limit<T> lim : limit) {\r
- value += lim.toString();\r
+ if (null != limit) {\r
+ for (Limit<T> lim : limit) {\r
+ value += lim.toString();\r
+ }\r
}\r
return value;\r
}\r
\r
package compbio.metadata;\r
\r
+import java.net.MalformedURLException;\r
import java.net.URL;\r
import java.util.ArrayList;\r
import java.util.HashSet;\r
import javax.xml.bind.annotation.XmlAccessorType;\r
import javax.xml.bind.annotation.XmlAttribute;\r
import javax.xml.bind.annotation.XmlElement;\r
+import javax.xml.bind.annotation.XmlTransient;\r
\r
import compbio.util.SysPrefs;\r
import compbio.util.Util;\r
@XmlAttribute\r
protected boolean isRequired;\r
@XmlElement\r
- protected URL furtherDetails;\r
+ protected String furtherDetails;\r
@XmlElement\r
protected String defaultValue;\r
+ @XmlTransient\r
+ private URL basicURL;\r
\r
Option() {\r
// Has to have no arg constructor for JAXB\r
}\r
\r
- public Option(String name, String description) {\r
+ public Option(String name, String description) throws MalformedURLException {\r
this.name = name;\r
this.description = description;\r
}\r
this.name = name;\r
}\r
\r
+ public void setBasicURL(URL url) {\r
+ this.basicURL = url;\r
+ }\r
+ public URL getBasicURL() throws MalformedURLException {\r
+ URL out = new URL ("http://unknown.jabaws.server.ac.uk");\r
+ if (null != basicURL) {\r
+ out = basicURL;\r
+ }\r
+ return out;\r
+ } \r
/**\r
* A long description of the Option\r
*/\r
\r
/**\r
* The URL where further details about the option can be found\r
+ * @throws MalformedURLException \r
*/\r
- public URL getFurtherDetails() {\r
+ public String getFurtherDetails() {\r
return furtherDetails;\r
}\r
\r
- public void setFurtherDetails(URL furtherDetails) {\r
+ public void setFurtherDetails(String furtherDetails) {\r
this.furtherDetails = furtherDetails;\r
}\r
\r
String value = "Option name: " + this.name + SysPrefs.newlinechar;\r
value += "Description: " + this.description + SysPrefs.newlinechar;\r
if (!Util.isEmpty(defaultValue)) {\r
- value += "Default value: " + this.defaultValue\r
- + SysPrefs.newlinechar;\r
+ value += "Default value: " + this.defaultValue + SysPrefs.newlinechar;\r
+ }\r
+ if (null != this.furtherDetails) {\r
+ value += "URL: " + this.basicURL + this.furtherDetails + SysPrefs.newlinechar;\r
+ } else {\r
+ value += "URL: unknown URL" + SysPrefs.newlinechar;\r
}\r
- value += "URL: " + this.furtherDetails + SysPrefs.newlinechar;\r
value += "Is required: " + this.isRequired + SysPrefs.newlinechar;\r
if (!this.optionNames.isEmpty()) {\r
Set<String> sortedPosval = new TreeSet<String>(this.optionNames);\r
- value += "Option Names: " + SysPrefs.newlinechar;\r
+ value += "Option(s): ";\r
+ String delim = "";\r
for (String val : sortedPosval) {\r
- value += val + SysPrefs.newlinechar;\r
+ value += delim + val;\r
+ delim = ", ";\r
}\r
+ value += SysPrefs.newlinechar;\r
}\r
return value;\r
}\r
\r
package compbio.metadata;\r
\r
+import java.net.MalformedURLException;\r
import java.util.ArrayList;\r
import java.util.Collections;\r
import java.util.HashSet;\r
// JAXB noargs const\r
}\r
\r
- public Parameter(String name, String description) {\r
+ public Parameter(String name, String description) throws MalformedURLException {\r
super(name, description);\r
}\r
\r
value += val + SysPrefs.newlinechar;\r
}\r
}\r
- value += SysPrefs.newlinechar;\r
return value;\r
}\r
\r
public String toString() {\r
String value = "Preset name: '" + name + "'" + SysPrefs.newlinechar;\r
value += "Description: " + description + SysPrefs.newlinechar;\r
- value += "Options: " + SysPrefs.newlinechar;\r
+ value += "Options used: " + SysPrefs.newlinechar;\r
for (String oname : this.option) {\r
value += oname + SysPrefs.newlinechar;\r
}\r
- value += SysPrefs.newlinechar;\r
return value;\r
}\r
\r
\r
@Override\r
public String toString() {\r
- String value = "Runner: " + this.runnerClassName;\r
+ String value = "Runner: " + this.runnerClassName + "\n";\r
for (Preset<T> p : preset) {\r
- value += p.toString() + "\n";\r
+ value += "##############################################################################\n" + p.toString() + "\n";\r
}\r
return value;\r
}\r
public String toString() {\r
String value = "Type: " + this.type + "\n";\r
if (this.min != null) {\r
- value += "Min: " + this.min + "\n";\r
+ value += "Minimal value: " + this.min + "\n";\r
}\r
if (this.max != null) {\r
- value += "Max: " + this.max + "\n";\r
+ value += "Maximal value: " + this.max + "\n";\r
}\r
return value;\r
}\r
try {\r
return ConfExecutable.getRunnerOptions(clazz);\r
} catch (FileNotFoundException e) {\r
- log.error(\r
- "Could not load " + clazz + " Parameters !"\r
- + e.getMessage(), e.getCause());\r
+ log.error("Could not load " + clazz + " parameters !" + e.getMessage(), e.getCause());\r
} catch (IOException e) {\r
- log.error("IO exception while reading " + clazz + " Parameters !"\r
- + e.getMessage(), e.getCause());\r
+ log.error("IO exception while reading " + clazz + " parameters !" + e.getMessage(), e.getCause());\r
}\r
return null;\r
}\r
try {\r
return ConfExecutable.getRunnerPresets(clazz);\r
} catch (FileNotFoundException e) {\r
- log.warn(\r
- "No presets are found for " + clazz + " executable! "\r
- + e.getLocalizedMessage(), e.getCause());\r
+ log.warn("No presets are found for " + clazz + "! " + e.getLocalizedMessage(), e.getCause());\r
} catch (IOException e) {\r
- log.warn("IO exception while reading presents! for " + clazz\r
- + " executable! " + e.getLocalizedMessage(), e.getCause());\r
+ log.warn("IO exception while reading presets for " + clazz + "! " + e.getLocalizedMessage(), e.getCause());\r
}\r
return null;\r
}\r
\r
- public static final Alignment readClustalFile(String workDirectory,\r
- String clustFile) throws UnknownFileFormatException, IOException,\r
- FileNotFoundException, NullPointerException {\r
+ public static final Alignment readClustalFile(String workDirectory, String clustFile) \r
+ throws UnknownFileFormatException, IOException, FileNotFoundException, NullPointerException {\r
assert !compbio.util.Util.isEmpty(workDirectory);\r
assert !compbio.util.Util.isEmpty(clustFile);\r
- File cfile = new File(compbio.engine.client.Util.getFullPath(\r
- workDirectory, clustFile));\r
+ File cfile = new File(compbio.engine.client.Util.getFullPath(workDirectory, clustFile));\r
log.trace("CLUSTAL OUTPUT FILE PATH: " + cfile.getAbsolutePath());\r
if (!(cfile.exists() && cfile.length() > 0)) {\r
- throw new FileNotFoundException("Result for the jobId "\r
- + workDirectory + " with file name " + clustFile\r
- + " is not found!");\r
+ throw new FileNotFoundException("Result for the jobId " + workDirectory + " with file name " + clustFile + " is not found!");\r
}\r
return ClustalAlignmentUtil.readClustalFile(cfile);\r
}\r
workDirectory, clustFile));\r
log.trace("Jronn OUTPUT FILE PATH: " + cfile.getAbsolutePath());\r
if (!(cfile.exists() && cfile.length() > 0)) {\r
- throw new FileNotFoundException("Result for the jobId "\r
- + workDirectory + " with file name " + clustFile\r
- + " is not found!");\r
+ throw new FileNotFoundException("Result for the jobId " + workDirectory + " with file name " + clustFile + " is not found!");\r
}\r
return SequenceUtil.readJRonn(cfile);\r
}\r
SequenceUtil.writeFasta(fout, sequences);\r
fout.close();\r
} catch (IOException e) {\r
- log.error("IOException while writing input file into the disk: "\r
- + e.getLocalizedMessage(), e);\r
- throw new JobSubmissionException(\r
- "We are sorry by JABAWS server seems to have a problem! "\r
- + e.getLocalizedMessage(), e);\r
+ log.error("IOException while writing input file into the disk: " + e.getLocalizedMessage(), e);\r
+ throw new JobSubmissionException("We are sorry by JABAWS server seems to have a problem! " + e.getLocalizedMessage(), e);\r
}\r
}\r
\r
public static void writeClustalInput(List<FastaSequence> sequences,\r
ConfiguredExecutable<?> exec, char gapChar) throws JobSubmissionException {\r
- \r
try {\r
File filein = new File(exec.getInput());\r
FileOutputStream fout = new FileOutputStream(filein);\r
SequenceUtil.writeClustal(fout, sequences, gapChar);\r
fout.close();\r
} catch (IOException e) {\r
- log.error("IOException while writing input file into the disk: "\r
- + e.getLocalizedMessage(), e);\r
- throw new JobSubmissionException(\r
- "We are sorry but JABAWS server seems to have a problem! "\r
- + e.getLocalizedMessage(), e);\r
+ log.error("IOException while writing input file into the disk: " + e.getLocalizedMessage(), e);\r
+ throw new JobSubmissionException("We are sorry but JABAWS server seems to have a problem! " + e.getLocalizedMessage(), e);\r
}\r
}\r
\r
assert !compbio.util.Util.isEmpty(workDirectory);\r
assert !compbio.util.Util.isEmpty(structFile);\r
// The stdout from RNAalifold\r
- File sFile = new File(compbio.engine.client.Util.getFullPath(\r
- workDirectory, structFile));\r
+ File sFile = new File(compbio.engine.client.Util.getFullPath( workDirectory, structFile));\r
// Base pair probability matrix (-p option)\r
- File aliFile = new File(compbio.engine.client.Util.getFullPath(\r
- workDirectory, "alifold.out"));\r
+ File aliFile = new File(compbio.engine.client.Util.getFullPath( workDirectory, "alifold.out"));\r
// Check that stdout file exists\r
if(!(sFile.exists() && sFile.length() > 0)) {\r
- throw new FileNotFoundException("Result for the jobId "\r
- + workDirectory + "with file name " + structFile\r
- + " is not found!");\r
+ throw new FileNotFoundException("Result for the jobId " + workDirectory + "with file name " + structFile + " is not found!");\r
}\r
// Check that base pair probability file exists\r
if(!aliFile.exists()) {\r
import compbio.data.sequence.UnknownFileFormatException;\r
import compbio.metadata.JobSubmissionException;\r
import compbio.metadata.Option;\r
+import compbio.metadata.Limit;\r
import compbio.metadata.Preset;\r
+import compbio.metadata.PresetManager;\r
import compbio.metadata.ResultNotAvailableException;\r
import compbio.metadata.WrongParameterException;\r
import compbio.util.FileUtil;\r
}\r
\r
if (CmdHelper.listParameters(cmd)) {\r
- System.out.println(MetadataHelper.getParametersList(thews));\r
+ List<Option<T>> opts = MetadataHelper.getParametersList(thews, hostname);\r
+ for (Option<T> o : opts) {\r
+ System.out.println("##############################################################################\n" + o.toString());\r
+ }\r
}\r
if (CmdHelper.listPresets(cmd)) {\r
- System.out.println(MetadataHelper.getPresetList(thews));\r
+ PresetManager<T> psm = MetadataHelper.getPresetList(thews);\r
+ if (null != psm) {\r
+ System.out.print(psm);\r
+ } else {\r
+ System.out.println("No presets are defined for the Web service");\r
+ }\r
}\r
if (CmdHelper.listLimits(cmd)) {\r
- System.out.println(MetadataHelper.getLimits(thews));\r
+ List<Limit<T>> lims = MetadataHelper.getLimits(thews);\r
+ for (Limit<T> l : lims) {\r
+ System.out.println("##############################################################################\n" + l.toString());\r
+ }\r
}\r
log.fine("Disconnecting...");\r
((Closeable) thews).close();\r
\r
private static void listAllServices(String hostname) throws WebServiceException, IOException {\r
RegistryWS registry = connectToRegistry(hostname);\r
- Set<Services> func_services = Collections.EMPTY_SET;\r
- Set<Services> nonfunc_services = Collections.EMPTY_SET;\r
+ Set<Services> func_services = Collections.emptySet();\r
+ Set<Services> nonfunc_services = Collections.emptySet();\r
if (registry != null) {\r
func_services = registry.getSupportedServices();\r
nonfunc_services = registry.getNonoperatedServices();\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
* @param msaws\r
* web service proxy\r
* @return List of options supported by a web service\r
+ * @throws MalformedURLException \r
*/\r
- static <T> List<Option<T>> getParametersList(Metadata<T> msaws) {\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
- return config.getArguments();\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
+ static <T> List<Option<T>> getParametersList(Metadata<T> msaws) throws MalformedURLException {\r
+ return getParametersList (msaws, "http://unknown.jabaws.server.ac.uk");\r
+ }\r
+ \r
+ \r
/**\r
* Returns an objects from which the list of presets supported by web\r
* service <T> can be obtained\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