}
@Override
- public List<String> getUrls() {
+ public List<String> getUrls()
+ {
String surls = Cache.getDefault(SLIVKA_HOST_URLS, DEFAULT_URL);
String urls[] = surls.split(",");
ArrayList<String> valid = new ArrayList<>(urls.length);
{
new URL(url);
valid.add(url);
- }
- catch (MalformedURLException e)
+ } catch (MalformedURLException e)
{
- Cache.log.warn("Problem whilst trying to make a URL from '" +
- Objects.toString(url, "<null>") + "'. " +
- "This was probably due to malformed comma-separated-list " +
- "in the " + SLIVKA_HOST_URLS + " entry of ${HOME}/.jalview_properties");
+ Cache.log.warn("Problem whilst trying to make a URL from '"
+ + Objects.toString(url, "<null>") + "'. "
+ + "This was probably due to malformed comma-separated-list "
+ + "in the " + SLIVKA_HOST_URLS
+ + " entry of ${HOME}/.jalview_properties");
Cache.log.debug("Exception occurred while reading url list", e);
}
}
}
@Override
- public void setUrls(List<String> wsUrls) {
+ public void setUrls(List<String> wsUrls)
+ {
if (wsUrls != null && !wsUrls.isEmpty())
{
Cache.setProperty(SLIVKA_HOST_URLS, String.join(",", wsUrls));
}
- else {
+ else
+ {
Cache.removeProperty(SLIVKA_HOST_URLS);
}
}
@Override
- public boolean testUrl(URL url) {
+ public boolean testUrl(URL url)
+ {
return getStatusForUrl(url.toString()) == STATUS_OK;
}
@Override
- public int getStatusForUrl(String url) {
+ public int getStatusForUrl(String url)
+ {
try
{
List<?> services = new SlivkaClient(url).getServices();
return services.isEmpty() ? STATUS_NO_SERVICES : STATUS_OK;
- }
- catch (IOException e)
+ } catch (IOException e)
{
- Cache.log.error("Slivka could not retrieve services list from " + url, e);
+ Cache.log.error("Slivka could not retrieve services list from " + url,
+ e);
return STATUS_INVALID;
}
}
- public List<WebServiceI> getServices() {
+ public List<WebServiceI> getServices()
+ {
return Collections.unmodifiableList(services);
}
- public boolean hasServices() {
+ public boolean hasServices()
+ {
return !isRunning() && services.size() > 0;
}
- public boolean isRunning() {
- for (Future<?> task : discoveryTasks) {
- if (!task.isDone()) {
+ public boolean isRunning()
+ {
+ for (Future<?> task : discoveryTasks)
+ {
+ if (!task.isDone())
+ {
return false;
}
}
return true;
}
- public boolean isDone() {
+ public boolean isDone()
+ {
return !isRunning() && discoveryTasks.size() > 0;
}
Cache.log.info("Reloading Slivka services");
fireServicesChanged(Collections.emptyList());
ArrayList<WebServiceI> allServices = new ArrayList<>();
- for (String url : getUrls()) {
+ for (String url : getUrls())
+ {
SlivkaClient client = new SlivkaClient(url);
List<SlivkaService> services;
- try {
+ try
+ {
services = client.getServices();
- } catch (IOException e) {
+ } catch (IOException e)
+ {
Cache.log.error("Unable to fetch services from " + url, e);
continue;
}
- for (SlivkaService service : services) {
- SlivkaWebService instance = new SlivkaWebService(client, service, service.getName());
+ for (SlivkaService service : services)
+ {
+ SlivkaWebService instance = new SlivkaWebService(client, service,
+ service.getName());
for (String classifier : service.classifiers)
{
String[] path = classifier.split("\\s*::\\s*");
&& path[1].toLowerCase().equals("analysis"))
{
Operation op = null;
- switch (path[path.length - 1].toLowerCase()) {
+ switch (path[path.length - 1].toLowerCase())
+ {
case "multiple sequence alignment":
op = new AlignmentOperation(instance, instance::getAlignment);
}
instance.addOperation(op);
}
}
- if (instance.operations.size() > 0) {
+ if (instance.operations.size() > 0)
+ {
allServices.add(instance);
}
}
}
@Override
- public String getErrorMessages() {
+ public String getErrorMessages()
+ {
return "";
}