package jalview.ws.api;
+import jalview.bin.Cache;
+import jalview.gui.AlignFrame;
+import jalview.ws.jws2.MsaWSClient;
+import jalview.ws.jws2.SequenceAnnotationWSClient;
import jalview.ws.params.ParamManager;
+import javax.swing.JMenu;
+
public abstract class ServiceWithParameters extends UIinfo
{
+ getName();
}
+ protected enum ServiceClient
+ {
+ MSAWSCLIENT, SEQUENCEANNOTATIONWSCLIENT;
+ };
+
+ protected ServiceClient style = null;
+
+ public void attachWSMenuEntry(JMenu atpoint, AlignFrame alignFrame)
+ {
+ switch (style)
+ {
+ case MSAWSCLIENT:
+ new MsaWSClient().attachWSMenuEntry(atpoint, this, alignFrame);
+ break;
+ case SEQUENCEANNOTATIONWSCLIENT:
+ new SequenceAnnotationWSClient().attachWSMenuEntry(atpoint, this,
+ alignFrame);
+ break;
+ default:
+ Cache.log.warn("Implementation error ? Service " + getName()
+ + " has Unknown service style " + style);
+ }
+ }
}
import jalview.gui.WsJobParameters;
import jalview.util.MessageManager;
+import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.jabaws2.Jws2Instance;
import java.awt.BorderLayout;
return;
}
Jws2Instance lastserv = null;
- for (Jws2Instance service : disc.getServices())
+ for (ServiceWithParameters service : disc.getServices())
{
- lastserv = service;
+ // this will fail for non-JABAWS services !
+ lastserv = (Jws2Instance) service;
if (p >= args.length || service.getName().equalsIgnoreCase(args[p]))
{
if (lastserv != null)
JMenu atpoint;
List<Jws2Instance> enumerableServices = new ArrayList<>();
// jws2al.removeAll();
- Map<String, Jws2Instance> preferredHosts = new HashMap<>();
- Map<String, List<Jws2Instance>> alternates = new HashMap<>();
+ Map<String, ServiceWithParameters> preferredHosts = new HashMap<>();
+ Map<String, List<ServiceWithParameters>> alternates = new HashMap<>();
for (Jws2Instance service : services.toArray(new Jws2Instance[0]))
{
// TODO: check this behaves with refactored serviceType to getName
{
if (!preferredHosts.containsKey(service.getName()))
{
- Jws2Instance preferredInstance = getPreferredServiceFor(
+ ServiceWithParameters preferredInstance = getPreferredServiceFor(
alignFrame, service.getName());
if (preferredInstance != null)
{
preferredHosts.put(service.getName(), service);
}
}
- List<Jws2Instance> ph = alternates.get(service.getName());
+ List<ServiceWithParameters> ph = alternates.get(service.getName());
if (preferredHosts.get(service.getName()) != service)
{
if (ph == null)
// create GUI element for classic services
addEnumeratedServices(jws2al, alignFrame, enumerableServices);
// and the instantaneous services
- for (final Jws2Instance service : preferredHosts.values())
+ for (final ServiceWithParameters service : preferredHosts.values())
{
atpoint = JvSwingUtils.findOrCreateMenu(jws2al,
service.getServiceType());
return urls;
}
- public Vector<Jws2Instance> getServices()
+ public Vector<ServiceWithParameters> getServices()
{
return (services == null) ? new Vector<>()
: new Vector<>(services);
HashSet<String> urls = new HashSet<>();
urls.addAll(Arrays.asList(serviceURLs));
ServiceWithParameters match = null;
- if (services != null)
+ List<ServiceWithParameters> ourServices = getServices();
+
+ if (ourServices != null)
{
for (ServiceWithParameters svc : services)
{
return match;
}
- Map<String, Map<String, String>> preferredServiceMap = new HashMap<>();;
+ Map<String, Map<String, String>> preferredServiceMap = new HashMap<>();
/**
* get current preferred endpoint of the given Jabaws service, or global
* @return null if no service of this type is available, the preferred service
* for the serviceType and af if specified and if defined.
*/
- public Jws2Instance getPreferredServiceFor(AlignFrame af,
+ public ServiceWithParameters getPreferredServiceFor(AlignFrame af,
String serviceName)
{
String serviceurl = null;
import jalview.ws.api.MultipleSequenceAlignmentI;
import jalview.ws.api.ServiceWithParameters;
import jalview.ws.gui.MsaWSThread;
-import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.WsParamSetI;
public void attachWSMenuEntry(JMenu rmsawsmenu,
final ServiceWithParameters service, final AlignFrame alignFrame)
{
- if (service instanceof Jws2Instance
- && Jws2ClientFactory.registerAAConWSInstance(rmsawsmenu, (Jws2Instance) service, alignFrame))
+ if (Jws2ClientFactory.registerAAConWSInstance(rmsawsmenu,
+ service, alignFrame))
{
// Alignment dependent analysis calculation WS gui
return;
*/
package jalview.ws.jws2.jabaws2;
-import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.util.MessageManager;
import jalview.ws.api.JalviewServiceEndpointProviderI;
import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.JabaParamStore;
-import jalview.ws.jws2.MsaWSClient;
-import jalview.ws.jws2.SequenceAnnotationWSClient;
import jalview.ws.params.ParamDatastoreI;
import jalview.ws.params.ParamManager;
import java.io.Closeable;
import java.net.URL;
-import javax.swing.JMenu;
-
import compbio.data.msa.JABAService;
import compbio.data.msa.MsaWS;
import compbio.data.msa.SequenceAnnotation;
{
super(action, action, serviceType, description, hosturl);
this.service = service;
+ if (service instanceof MsaWS<?>)
+ {
+ style = ServiceClient.MSAWSCLIENT;
+ }
+ else if (service instanceof SequenceAnnotation<?>)
+ {
+ style = ServiceClient.SEQUENCEANNOTATIONWSCLIENT;
+ }
+
int p = description.indexOf("MORE INFORMATION:");
if (p > -1)
{
return hasParams;
}
- public void attachWSMenuEntry(JMenu atpoint, AlignFrame alignFrame)
- {
- if (service instanceof MsaWS<?>)
- {
- new MsaWSClient().attachWSMenuEntry(atpoint, this, alignFrame);
- }
- else if (service instanceof SequenceAnnotation<?>)
- {
- new SequenceAnnotationWSClient().attachWSMenuEntry(atpoint, this,
- alignFrame);
- }
- }
-
/**
* initialise a parameter store for this service
*
MessageManager.getString("label.aacon_settings"),
MessageManager.getString("tooltip.aacon_settings")));
}
+ style = ServiceClient.SEQUENCEANNOTATIONWSCLIENT;
}
@Override
{
SlivkaMsaServiceInstance(SlivkaClient client, SlivkaService service) {
super(client, service, "Alignment");
+ style = ServiceClient.MSAWSCLIENT;
}
@Override
import jalview.gui.JvOptionPane;
import jalview.gui.WsJobParameters;
import jalview.util.MessageManager;
+import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jabaws.JalviewJabawsTestUtils;
import jalview.ws.jws2.JabaPreset;
import jalview.ws.jws2.Jws2Discoverer;
public void testJws2Gui()
{
Iterator<String> presetEnum = presetTests.iterator();
- for (Jws2Instance service : disc.getServices())
+ for (ServiceWithParameters _service : disc.getServices())
{
+ // This will fail for non-jabaws services
+ Jws2Instance service = (Jws2Instance) _service;
if (serviceTests.size() == 0
|| serviceTests.contains(service.getName().toLowerCase()))
{
import jalview.io.FileFormat;
import jalview.io.FormatAdapter;
import jalview.io.StockholmFileTest;
-import jalview.ws.jws2.SeqAnnotationServiceCalcWorker;
+import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.Jws2Discoverer;
-import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.jws2.SeqAnnotationServiceCalcWorker;
import java.util.ArrayList;
import java.util.List;
public static Jws2Discoverer disc;
- public static List<Jws2Instance> iupreds;
+ public static List<ServiceWithParameters> iupreds;
jalview.ws.jws2.SeqAnnotationServiceCalcWorker disorderClient;
}
iupreds = new ArrayList<>();
- for (Jws2Instance svc : disc.getServices())
+ for (ServiceWithParameters svc : disc.getServices())
{
if (svc.getNameURI().toLowerCase().contains("iupredws"))
{
import jalview.io.FormatAdapter;
import jalview.io.StockholmFileTest;
import jalview.project.Jalview2XML;
-import jalview.ws.jws2.SeqAnnotationServiceCalcWorker;
+import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.JabaParamStore;
import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.jws2.SeqAnnotationServiceCalcWorker;
import jalview.ws.jws2.SequenceAnnotationWSClient;
import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.AutoCalcSetting;
Thread.sleep(100);
}
- for (Jws2Instance svc : disc.getServices())
+ for (ServiceWithParameters svc : disc.getServices())
{
if (svc.getNameURI().toLowerCase().contains("rnaalifoldws"))
{
- rnaalifoldws = svc;
+ rnaalifoldws = (Jws2Instance) svc;
}
}
import jalview.bin.Cache;
import jalview.gui.JvOptionPane;
+import jalview.ws.api.ServiceWithParameters;
import jalview.ws.api.UIinfo;
import jalview.ws.jabaws.JalviewJabawsTestUtils;
import jalview.ws.jws2.jabaws2.Jws2Instance;
@Test(groups = { "Network" })
public void testWriteParameterSet() throws WrongParameterException
{
- for (Jws2Instance service : disc.getServices())
+ for (ServiceWithParameters _service : disc.getServices())
{
- if (isForTesting(service))
+ if (isForTesting(_service))
{
+ Jws2Instance service = (Jws2Instance) _service;
List<Preset> prl = null;
PresetManager prman = service.getPresets();
@Test(groups = { "Network" })
public void testCopyOption()
{
- for (Jws2Instance service : disc.getServices())
+ for (ServiceWithParameters _service : disc.getServices())
{
- if (isForTesting(service))
+ if (isForTesting(_service))
{
+ Jws2Instance service = (Jws2Instance) _service;
List<Option<?>> options = service.getRunnerConfig().getOptions();
for (Option<?> o : options)
{
@Test(groups = { "Network" })
public void testCopyParameter()
{
- for (Jws2Instance service : disc.getServices())
+ for (ServiceWithParameters _service : disc.getServices())
{
- if (isForTesting(service))
+ if (isForTesting(_service))
{
+ Jws2Instance service = (Jws2Instance) _service;
List<Parameter> parameters = service.getRunnerConfig()
.getParameters();
for (Parameter o : parameters)