package jalview.ws;
import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
import jalview.gui.WebserviceInfo;
+import jalview.gui.WsJobParameters;
+import jalview.util.MessageManager;
+import jalview.ws.api.ServiceWithParameters;
import jalview.ws.api.UIinfo;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.ParamDatastoreI;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.List;
public abstract class WSClient // implements WSMenuEntryProviderI
{
ServiceActions.put("SecStrPred", "Secondary Structure Prediction");
};
+ /**
+ * The preset for the job executed by this client (may be null)
+ */
+ protected WsParamSetI preset;
+
+ /**
+ * The parameters for the job executed by this client (may be null)
+ */
+ protected List<ArgumentI> paramset;
+
public WSClient()
{
}
+ /**
+ * base constructor for a web service with parameters. Extending classes
+ * should implement this constructor with additional logic to verify that
+ * preset and arguments are compatible with the service being configured.
+ *
+ * @param _alignFrame
+ * @param preset
+ * @param arguments
+ */
+ public WSClient(AlignFrame _alignFrame, WsParamSetI preset,
+ List<ArgumentI> arguments)
+ {
+ alignFrame = _alignFrame;
+ this.preset = preset;
+ this.paramset = arguments;
+ }
+
protected WebserviceInfo setWebService(UIinfo serv, boolean b)
{
WebServiceName = serv.getName();
}
return null;
}
+
+ /**
+ * called to open a parameter editing dialog for parameterised services
+ *
+ * @param sh
+ * @param editParams
+ * @return
+ */
+ protected boolean processParams(ServiceWithParameters sh,
+ boolean editParams)
+ {
+ return processParams(sh, editParams, false);
+ }
+
+ protected boolean processParams(ServiceWithParameters sh,
+ boolean editParams,
+ boolean adjustingExisting)
+ {
+
+ if (editParams)
+ {
+ // always do this
+ sh.initParamStore(Desktop.getUserParameterStore());
+
+ WsJobParameters jobParams = (preset == null && paramset != null
+ && paramset.size() > 0)
+ ? new WsJobParameters((ParamDatastoreI) null, sh,
+ (WsParamSetI) null, paramset)
+ : new WsJobParameters((ParamDatastoreI) null, sh,
+ preset, (List<ArgumentI>) null);
+ if (adjustingExisting)
+ {
+ jobParams.setName(MessageManager
+ .getString("label.adjusting_parameters_for_calculation"));
+ }
+ if (!jobParams.showRunDialog())
+ {
+ return false; // dialog cancelled
+ }
+
+ WsParamSetI prset = jobParams.getPreset();
+ if (prset == null)
+ {
+ paramset = jobParams.isServiceDefaults() ? null
+ : jobParams.getJobParams();
+ this.preset = null;
+ }
+ else
+ {
+ this.preset = prset; // ((JabaPreset) prset).p;
+ paramset = null; // no user supplied parameters.
+ }
+ }
+ return true;
+ }
+
}
import jalview.api.AlignCalcWorkerI;
import jalview.bin.Cache;
import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
import jalview.gui.JvSwingUtils;
-import jalview.gui.WsJobParameters;
import jalview.util.MessageManager;
import jalview.ws.jws2.dm.AAConSettings;
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.WsParamSetI;
import jalview.ws.uimodel.AlignAnalysisUIText;
*/
public abstract class Jws2Client extends jalview.ws.WSClient
{
- protected WsParamSetI preset;
-
- protected List<ArgumentI> paramset;
-
public Jws2Client(AlignFrame _alignFrame, WsParamSetI preset,
List<ArgumentI> arguments)
{
- alignFrame = _alignFrame;
- this.preset = preset;
+ super(_alignFrame, preset, arguments);
if (preset != null)
{
if (!((preset instanceof JabaPreset)
}
else
{
- // just provided with a bunch of arguments
- this.paramset = arguments;
+ // TODO: verify that paramset is compatible with the service being
+ // contacted
}
}
- boolean processParams(Jws2Instance sh, boolean editParams)
- {
- return processParams(sh, editParams, false);
- }
-
- protected boolean processParams(Jws2Instance sh, boolean editParams,
- boolean adjustingExisting)
- {
-
- if (editParams)
- {
- if (sh.paramStore == null)
- {
- sh.paramStore = new JabaParamStore(sh,
- Desktop.getUserParameterStore());
- }
- WsJobParameters jobParams = (preset == null && paramset != null
- && paramset.size() > 0)
- ? new WsJobParameters((ParamDatastoreI) null, sh,
- (WsParamSetI) null,
- JabaParamStore.getJwsArgsfromJaba(paramset))
- : new WsJobParameters((ParamDatastoreI) null, sh,
- preset,
- (List<ArgumentI>) null);
- if (adjustingExisting)
- {
- jobParams.setName(MessageManager
- .getString("label.adjusting_parameters_for_calculation"));
- }
- if (!jobParams.showRunDialog())
- {
- return false; // dialog cancelled
- }
-
- WsParamSetI prset = jobParams.getPreset();
- if (prset == null)
- {
- paramset = jobParams.isServiceDefaults() ? null
- : JabaParamStore
- .getJabafromJwsArgs(jobParams.getJobParams());
- this.preset = null;
- }
- else
- {
- this.preset = prset; // ((JabaPreset) prset).p;
- paramset = null; // no user supplied parameters.
- }
- }
- return true;
-
- }
-
public Jws2Client()
{
// anonymous constructor - used for headless method calls only