package jalview.ws.rest;
import jalview.bin.Cache;
+import jalview.bin.Jalview;
import jalview.datamodel.AlignmentView;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
public class RestClient extends WSClient
implements WSClientI, WSMenuEntryProviderI
{
- RestServiceDescription service;
+ public static final String RSBS_SERVICES = "RSBS_SERVICES";
- public RestClient(RestServiceDescription rsd)
- {
- service = rsd;
- }
+ RestServiceDescription service;
/**
* parent alignframe for this job
*/
AlignViewport av;
+ boolean headless = false;
+
+ protected Vector<String> services = null;
+
/**
* get the alignFrame for the associated input data if it exists.
*
return jalview.gui.Desktop.getAlignFrameFor(av);
}
+ RestClient getInstance()
+ {
+ Jalview j = Jalview.getInstance();
+ return (j.restClient == null ? j.restClient = new RestClient()
+ : j.restClient);
+ }
+
+ private RestClient()
+ {
+
+ }
+
+ public RestClient(RestServiceDescription rsd)
+ {
+ service = rsd;
+ }
+
public RestClient(RestServiceDescription service2, AlignFrame alignFrame)
{
this(service2, alignFrame, false);
}
- boolean headless = false;
-
public RestClient(RestServiceDescription service2, AlignFrame alignFrame,
boolean nogui)
{
String action = "Analysis",
description = "Sequence Harmony and Multi-Relief (Brandt et al. 2010)",
name = MessageManager.getString("label.multiharmony");
- Hashtable<String, InputType> iparams = new Hashtable<String, InputType>();
- jalview.ws.rest.params.JobConstant toolp;
+ Hashtable<String, InputType> iparams = new Hashtable<>();
+ // jalview.ws.rest.params.JobConstant toolp;
// toolp = new jalview.ws.rest.JobConstant("tool","jalview");
// iparams.put(toolp.token, toolp);
// toolp = new jalview.ws.rest.params.JobConstant("mbjob[method]","shmr");
return true;
}
- protected static Vector<String> services = null;
-
- public static final String RSBS_SERVICES = "RSBS_SERVICES";
-
public static RestClient[] getRestClients()
{
- if (services == null)
+ RestClient c = Jalview.getInstance().restClient;
+
+ if (c.services == null)
{
- services = new Vector<String>();
+ c.services = new Vector<>();
try
{
for (RestServiceDescription descr : RestServiceDescription
jalview.bin.Cache.getDefault(RSBS_SERVICES,
makeShmmrRestClient().service.toString())))
{
- services.add(descr.toString());
+ c.services.add(descr.toString());
}
} catch (Exception ex)
{
}
}
- RestClient[] lst = new RestClient[services.size()];
+ RestClient[] lst = new RestClient[c.services.size()];
int i = 0;
- for (String svc : services)
+ for (String svc : c.services)
{
lst[i++] = new RestClient(new RestServiceDescription(svc));
}
public static Vector<String> getRsbsDescriptions()
{
- Vector<String> rsbsDescrs = new Vector<String>();
+ Vector<String> rsbsDescrs = new Vector<>();
for (RestClient rsbs : getRestClients())
{
rsbsDescrs.add(rsbs.getRestDescription().toString());
if (rsbsUrls != null)
{
// TODO: consider validating services ?
- services = new Vector<String>(rsbsUrls);
+ RestClient c = Jalview.getInstance().restClient;
+ c.services = new Vector<>(rsbsUrls);
StringBuffer sprop = new StringBuffer();
- for (String s : services)
+ for (String s : c.services)
{
sprop.append(s);
}