X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws2%2FJws2Client.java;h=984c004438b131e8306ed6aa848b60e85d62b186;hb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;hp=d44be01c46fe6d05aa12f5ba5e2d6e3307715c2c;hpb=39c0b5e5d2ff4352d36bb6705121dc5ed14ba81b;p=jalview.git
diff --git a/src/jalview/ws/jws2/Jws2Client.java b/src/jalview/ws/jws2/Jws2Client.java
index d44be01..984c004 100644
--- a/src/jalview/ws/jws2/Jws2Client.java
+++ b/src/jalview/ws/jws2/Jws2Client.java
@@ -1,54 +1,164 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
+ * Copyright (C) 2014 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.
+ *
+ * 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 .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.jws2;
+import java.util.List;
+
import javax.swing.JMenu;
+import compbio.metadata.Argument;
+
import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
import jalview.gui.WebserviceInfo;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.gui.WsJobParameters;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
/**
- * provides metadata for a jws2 service instance - resolves names, etc.
+ * provides metadata for a jabaws2 service instance - resolves names, etc.
*
* @author JimP
*
*/
public abstract class Jws2Client extends jalview.ws.WSClient
{
+ protected AlignFrame alignFrame;
+
+ protected WsParamSetI preset;
+
+ protected List paramset;
+
+ public Jws2Client(AlignFrame _alignFrame, WsParamSetI preset,
+ List arguments)
+ {
+ alignFrame = _alignFrame;
+ this.preset = preset;
+ if (preset != null)
+ {
+ if (!((preset instanceof JabaPreset) || preset instanceof JabaWsParamSet))
+ {
+ /*
+ * { this.preset = ((JabaPreset) preset).p; } else if (preset instanceof
+ * JabaWsParamSet) { List newargs = new ArrayList();
+ * JabaWsParamSet pset = ((JabaWsParamSet) preset); for (Option opt :
+ * pset.getjabaArguments()) { newargs.add(opt); } if (arguments != null
+ * && arguments.size() > 0) { // merge arguments with preset's own
+ * arguments. for (Argument opt : arguments) { newargs.add(opt); } }
+ * paramset = newargs; } else {
+ */
+ throw new Error(
+ "Implementation error: Can only instantiate Jaba parameter sets.");
+ }
+ }
+ else
+ {
+ // just provided with a bunch of arguments
+ this.paramset = arguments;
+ }
+ }
+
+ 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(null, sh, null, paramset)
+ : new WsJobParameters(sh, preset);
+ if (adjustingExisting)
+ {
+ jobParams.setName("Adjusting parameters for existing Calculation");
+ }
+ if (!jobParams.showRunDialog())
+ {
+ return false;
+ }
+ 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
+ }
+
protected WebserviceInfo setWebService(Jws2Instance serv, boolean b)
{
// serviceHandle = serv;
- String serviceInstance = serv.service.getClass().getName();
+ String serviceInstance = serv.action; // serv.service.getClass().getName();
WebServiceName = serv.serviceType;
- WebServiceJobTitle = serv.serviceType;
+ WebServiceJobTitle = serv.getActionText();
WsURL = serv.hosturl;
if (!b)
{
return new WebserviceInfo(WebServiceJobTitle, WebServiceJobTitle
- + " using service hosted at " + serv.hosturl);
+ + " using service hosted at " + serv.hosturl + "\n"
+ + (serv.description != null ? serv.description : ""));
}
return null;
}
+
/*
- Jws2Instance serviceHandle;
- * (non-Javadoc)
- * @see jalview.ws.WSMenuEntryProviderI#attachWSMenuEntry(javax.swing.JMenu, jalview.gui.AlignFrame)
- *
- @Override
- public void attachWSMenuEntry(JMenu wsmenu, AlignFrame alignFrame)
- {
- if (serviceHandle==null)
- {
- throw new Error("Implementation error: No service handle for this Jws2 service.");
- }
- attachWSMenuEntry(wsmenu, serviceHandle, alignFrame);
- }*/
+ * Jws2Instance serviceHandle; (non-Javadoc)
+ *
+ * @see jalview.ws.WSMenuEntryProviderI#attachWSMenuEntry(javax.swing.JMenu,
+ * jalview.gui.AlignFrame)
+ *
+ * @Override public void attachWSMenuEntry(JMenu wsmenu, AlignFrame
+ * alignFrame) { if (serviceHandle==null) { throw new
+ * Error("Implementation error: No service handle for this Jws2 service."); }
+ * attachWSMenuEntry(wsmenu, serviceHandle, alignFrame); }
+ */
/**
* add the menu item for a particular jws2 service instance
+ *
* @param wsmenu
* @param service
* @param alignFrame
*/
- abstract void attachWSMenuEntry(JMenu wsmenu,
- final Jws2Instance service, final AlignFrame alignFrame);
+ abstract void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service,
+ final AlignFrame alignFrame);
}