import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
-import net.miginfocom.swing.MigLayout;
-
import compbio.metadata.Argument;
import compbio.metadata.Option;
import compbio.metadata.Parameter;
import compbio.metadata.Preset;
import compbio.metadata.PresetManager;
import compbio.metadata.RunnerConfig;
+import net.miginfocom.swing.MigLayout;
/**
* job parameter editing/browsing dialog box. User can browse existing settings
int p = 0;
if (args.length > 0)
{
- Vector<String> services = new Vector<String>();
+ Vector<String> services = new Vector<>();
services.addElement(args[p++]);
Jws2Discoverer.getDiscoverer().setServiceUrls(services);
}
for (Jws2Instance service : disc.getServices())
{
lastserv = service;
- if (p >= args.length || service.serviceType.equalsIgnoreCase(args[p]))
+ if (p >= args.length || service.getName().equalsIgnoreCase(args[p]))
{
if (lastserv != null)
{
private String ServiceType;
public UIinfo(String serviceType, String action, String name,
- String description)
+ String description, String hosturl)
{
this.setServiceType(serviceType == null ? "" : serviceType);
this.Action = action == null ? "" : action;
this.description = description == null ? "" : description;
this.Name = name == null ? "" : name;
+ this.hostURL = hosturl;
}
/**
return (ServiceType == null && other.getServiceType() == null
|| ServiceType != null && other.getServiceType() != null
&& ServiceType.equals(other.getServiceType()))
+ && (hostURL == null && other.getHostURL() == null
+ || hostURL != null && other.getHostURL() != null
+ && hostURL.equals(other.getHostURL()))
&& (Name == null && other.getName() == null
|| Name != null && other.getName() != null
&& Name.equals(other.getName()))
&& description.equals(other.getDescription()));
}
+ /**
+ * @return short description of what the service will do
+ */
+ public String getActionText()
+ {
+ return getAction() + " with " + getName();
+ }
+
String Action;
String Name;
String description;
+
+ String hostURL;
+
+ public String getHostURL()
+ {
+ return hostURL;
+ }
}
\ No newline at end of file
import jalview.gui.WebserviceInfo;
import jalview.gui.WsJobParameters;
import jalview.util.MessageManager;
+import jalview.ws.api.UIinfo;
import jalview.ws.jws2.dm.AAConSettings;
import jalview.ws.jws2.dm.JabaWsParamSet;
import jalview.ws.jws2.jabaws2.Jws2Instance;
// anonymous constructor - used for headless method calls only
}
- protected WebserviceInfo setWebService(Jws2Instance serv, boolean b)
+ protected WebserviceInfo setWebService(UIinfo serv, boolean b)
{
+ // TODO pullup
WebServiceName = serv.getName();
WebServiceJobTitle = serv.getActionText();
- WsURL = serv.hosturl;
+ WsURL = serv.getHostURL();
if (!b)
{
return new WebserviceInfo(WebServiceJobTitle,
WebServiceJobTitle + " using service hosted at "
- + serv.hosturl + "\n"
+ + WsURL + "\n"
+ (serv.getDescription() != null
? serv.getDescription()
: ""),
abstract void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service,
final AlignFrame alignFrame);
- protected boolean registerAAConWSInstance(final JMenu wsmenu,
+ static boolean registerAAConWSInstance(final JMenu wsmenu,
final Jws2Instance service, final AlignFrame alignFrame)
{
final AlignAnalysisUIText aaui = service.getAlignAnalysisUI(); // null ; //
{
AbstractJabaCalcWorker worker = (AbstractJabaCalcWorker) aaconClient
.get(0);
- if (!worker.service.hosturl.equals(service.hosturl))
+ if (!worker.service.getHostURL().equals(service.getHostURL()))
{
// javax.swing.SwingUtilities.invokeLater(new Runnable()
{
else
{
if (service != null
- && !fave.getService().hosturl.equals(service.hosturl))
+ && !fave.getService().getHostURL()
+ .equals(service.getHostURL()))
{
- Cache.log.debug("Changing AACon service to " + service.hosturl
- + " from " + fave.getService().hosturl);
+ Cache.log.debug("Changing AACon service to " + service.getHostURL()
+ + " from " + fave.getService().getHostURL());
fave.setService(service);
}
}
for (Jws2Instance svc : services)
{
svcs[ipos] = svc;
- spos[ipos++] = 1000 * svcUrls.indexOf(svc.getHost()) + 1
+ spos[ipos++] = 1000 * svcUrls.indexOf(svc.getHostURL()) + 1
+ svctypes.indexOf(svc.getName());
}
jalview.util.QuickSort.sort(spos, svcs);
// previous service of this type already present
atpoint.addSeparator();
}
- atpoint.add(hitm = new JMenuItem(service.getHost()));
+ atpoint.add(hitm = new JMenuItem(service.getHostURL()));
hitm.setForeground(Color.blue);
hitm.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- Desktop.showUrl(service.getHost());
+ Desktop.showUrl(service.getHostURL());
}
});
hitm.setToolTipText(JvSwingUtils.wrapTooltip(false,
for (final Jws2Instance sv : alternates.get(service.getName()))
{
JMenuItem itm;
- hitm.add(itm = new JMenuItem(sv.getHost()));
+ hitm.add(itm = new JMenuItem(sv.getHostURL()));
itm.setForeground(Color.blue);
itm.addActionListener(new ActionListener()
{
ArrayList<String> hostlist = new ArrayList<>();
for (Jws2Instance service : enumerableServices)
{
- ArrayList<Jws2Instance> hostservices = hosts.get(service.getHost());
+ ArrayList<Jws2Instance> hostservices = hosts
+ .get(service.getHostURL());
if (hostservices == null)
{
- hosts.put(service.getHost(),
+ hosts.put(service.getHostURL(),
hostservices = new ArrayList<>());
- hostlist.add(service.getHost());
+ hostlist.add(service.getHostURL());
}
hostservices.add(service);
}
@Override
public void actionPerformed(ActionEvent e)
{
- Desktop.showUrl(service.getHost());
+ Desktop.showUrl(service.getHostURL());
}
});
hitm.setToolTipText(
for (Jws2Instance instance : getDiscoverer().services)
{
System.out.println("Service " + i++ + " "
- + instance.getClass() + "@" + instance.getHost()
+ + instance.getClass() + "@"
+ + instance.getHostURL()
+ ": " + instance.getActionText());
}
{
if (svc.getName().equals(serviceName))
{
- if (serviceurl == null || serviceurl.equals(svc.getHost()))
+ if (serviceurl == null || serviceurl.equals(svc.getHostURL()))
{
response = svc;
break;
prefmap = new HashMap<>();
preferredServiceMap.put(afid, prefmap);
}
- prefmap.put(serviceName, selectedServer.getHost());
- prefmap.put(serviceAction, selectedServer.getHost());
+ prefmap.put(serviceName, selectedServer.getHostURL());
+ prefmap.put(serviceAction, selectedServer.getHostURL());
}
public void setPreferredServiceFor(String serviceType,
public class Jws2Instance extends UIinfo
{
- public String hosturl;
public JABAService service;
public Jws2Instance(String hosturl, String serviceType, String action,
String description, JABAService service)
{
- super(action, action, serviceType, description);
- this.hosturl = hosturl;
+ super(action, action, serviceType, description, hosturl);
this.service = service;
int p = description.indexOf("MORE INFORMATION:");
if (p > -1)
} catch (Exception ex)
{
System.err.println("Exception when retrieving presets for service "
- + getServiceType() + " at " + hosturl);
+ + getServiceType() + " at " + getHostURL());
}
}
return presets;
}
- public String getHost()
- {
- return hosturl;
- /*
- * try { URL serviceurl = new URL(hosturl); if (serviceurl.getPort()!=80) {
- * return serviceurl.getHost()+":"+serviceurl.getPort(); } return
- * serviceurl.getHost(); } catch (Exception e) {
- * System.err.println("Failed to parse service URL '" + hosturl +
- * "' as a valid URL!"); } return null;
- */
- }
-
- /**
- * @return short description of what the service will do
- */
- public String getActionText()
- {
- return getAction() + " with " + getServiceType();
- }
-
/**
* non-thread safe - blocks whilst accessing service to get complete set of
* available options and parameters
public String getUri()
{
+ // TODO verify that service parameter sets in projects are consistent with
+ // Jalview 2.10.4
// this is only valid for Jaba 1.0 - this formula might have to change!
- return hosturl
- + (hosturl.lastIndexOf("/") == (hosturl.length() - 1) ? ""
+ return getHostURL()
+ + (getHostURL().lastIndexOf("/") == (getHostURL().length() - 1)
+ ? ""
: "/")
- + getServiceType();
+ + getName();
}
private boolean hasParams = false, lookedForParams = false;
boolean vseparable, char gapCharacter)
{
super();
- this.details = new UIinfo(action, action, name, description);
+ this.details = new UIinfo(action, action, name, description, postUrl);
this.postUrl = postUrl == null ? "" : postUrl;
this.urlSuffix = urlSuffix == null ? "" : urlSuffix;
if (inputParams != null)
{
p++;
}
- details = new UIinfo(list[p + 1], list[p + 1], list[p], list[p + 2]);
+ details = new UIinfo(list[p + 1], list[p + 1], list[p], list[p + 2],
+ postUrl);
invalid |= !configureFromServiceInputProperties(list[p + 3], warnings);
if (list.length - p > 5 && list[p + 5] != null
&& list[p + 5].trim().length() > 5)
import jalview.bin.Cache;
import jalview.gui.JvOptionPane;
+import jalview.ws.api.UIinfo;
import jalview.ws.jabaws.JalviewJabawsTestUtils;
import jalview.ws.jws2.jabaws2.Jws2Instance;
* @param service
* @return
*/
- public boolean isForTesting(Jws2Instance service)
+ public boolean isForTesting(UIinfo service)
{
return serviceTests.size() == 0
|| serviceTests.contains(service.serviceType.toLowerCase());