2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.ws.jws2.dm;
20 import java.io.BufferedReader;
21 import java.io.IOException;
22 import java.io.Reader;
23 import java.io.Writer;
24 import java.util.ArrayList;
25 import java.util.List;
27 import compbio.metadata.Argument;
28 import compbio.metadata.Option;
30 import jalview.ws.jws2.JabaParamStore;
31 import jalview.ws.jws2.ParameterUtils;
32 import jalview.ws.params.ArgumentI;
33 import jalview.ws.params.ParamDatastoreI;
34 import jalview.ws.params.WsParamSetI;
36 public class JabaWsParamSet implements WsParamSetI
41 List<Option> jabaArguments;
43 String name, description, applicableUrls[], sourceFile;
45 public JabaWsParamSet(String storeSetName, String descr, List jobParams)
47 if (jobParams.size() > 0)
49 if (jobParams.get(0) instanceof Option)
51 jabaArguments = new ArrayList<Option>();
52 // if classCastExceptions are raised then there has been an
53 // implementation error.
54 jabaArguments.addAll((List<Option>) jobParams);
58 if (!allJaba(jobParams))
61 "Cannot create a JabaWSParamSet from non-JabaWS parameters");
65 jabaArguments = JabaParamStore.getJabafromJwsArgs(jobParams);
72 applicableUrls = null;
75 public JabaWsParamSet()
80 private boolean allJaba(List jobParams)
83 boolean allJaba = true;
84 for (Object jp : jobParams)
86 if (jp instanceof JabaParameter || jp instanceof JabaOption)
100 public String getName()
106 public String getDescription()
115 public void setName(String name)
122 * the description to set
124 public void setDescription(String description)
126 this.description = description;
130 * @param applicableUrls
131 * the applicableUrls to set
133 public void setApplicableUrls(String[] applicableUrls)
135 this.applicableUrls = applicableUrls;
140 * the modifiable to set
142 public void setModifiable(boolean modifiable)
144 this.modifiable = modifiable;
148 public String[] getApplicableUrls()
150 return applicableUrls;
154 public String getSourceFile()
160 public void setSourceFile(String newfile)
162 sourceFile = newfile;
165 boolean modifiable = true;
168 public boolean isModifiable()
174 public List<ArgumentI> getArguments()
176 return JabaParamStore.getJwsArgsfromJaba(jabaArguments);
180 public void setArguments(List<ArgumentI> args)
185 "Cannot set arguments to a JabaWSParamSet that are not JabaWS arguments");
187 jabaArguments = new ArrayList<Option>();
188 for (ArgumentI rg : args)
190 jabaArguments.add(((JabaOption) rg).opt);
194 public List<Option> getjabaArguments()
196 return jabaArguments;
199 public void setjabaArguments(List<Option> args)
201 jabaArguments = args;