From: jprocter Date: Tue, 20 Jul 2010 09:05:46 +0000 (+0000) Subject: update to Jaba_r1 minimal client distribution, and resolve issues JAL-602 X-Git-Tag: Release_2_6~145 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c87eef1308fd65818277b1857fa258ad25473d68;p=jalview.git update to Jaba_r1 minimal client distribution, and resolve issues JAL-602 --- diff --git a/.classpath b/.classpath index d29d712..7ec0109 100644 --- a/.classpath +++ b/.classpath @@ -18,7 +18,7 @@ - + diff --git a/lib/min-jws2-client-1.0.jar b/lib/min-jaba-client.jar similarity index 64% rename from lib/min-jws2-client-1.0.jar rename to lib/min-jaba-client.jar index fcd8443..82c33dc 100644 Binary files a/lib/min-jws2-client-1.0.jar and b/lib/min-jaba-client.jar differ diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index 95100e0..2230d11 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -5,6 +5,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.io.Closeable; import java.net.ConnectException; import java.net.URL; import java.util.HashSet; @@ -26,8 +27,8 @@ import compbio.metadata.Option; import compbio.metadata.Preset; import compbio.metadata.PresetManager; import compbio.metadata.RunnerConfig; -import compbio.ws.client.Jws2Base; -import compbio.ws.client.Jws2Base.Services; +import compbio.ws.client.Jws2Client; +import compbio.ws.client.Services; /** * discoverer for jws2 services. Follows the lightweight service discoverer @@ -81,7 +82,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI try { Class foo = getClass().getClassLoader().loadClass( - "compbio.ws.client.Jws2Base"); + "compbio.ws.client.Jws2Client"); } catch (ClassNotFoundException e) { System.err @@ -98,15 +99,15 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI { try { - if (Jws2Base.validURL(jwsservers)) + if (Jws2Client.validURL(jwsservers)) { // look for services - for (Services srv : Jws2Base.Services.values()) + for (Services srv : Services.values()) { MsaWS service = null; try { - service = Jws2Base.connect(jwsservers, srv); + service = Jws2Client.connect(jwsservers, srv); } catch (Exception e) { System.err.println("Jws2 Discoverer: Problem on " @@ -205,37 +206,51 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI 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; */ + /* + * 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 "Align with " - + serviceType; + public String getActionText() + { + return "Align with " + serviceType; } /** - * non-thread safe - blocks whilst accessing service to get complete set of available options and parameters + * non-thread safe - blocks whilst accessing service to get complete set of + * available options and parameters + * * @return */ public RunnerConfig getRunnerConfig() { return service.getRunnerOptions(); } + + @Override + protected void finalize() throws Throwable + { + if (service != null) + { + try + { + Closeable svc = (Closeable) service; + service = null; + svc.close(); + } catch (Exception e) + { + } + ; + } + super.finalize(); + } }; /** @@ -245,6 +260,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI /** * find or add a submenu with the given title in the given menu + * * @param menu * @param submenu * @return the new or existing submenu @@ -252,22 +268,24 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI private JMenu findOrCreateMenu(JMenu menu, String submenu) { JMenu submenuinstance = null; - for (int i=0,iSize=menu.getMenuComponentCount(); i getServices() { - return (services==null) ? new Vector(): new Vector(services); + return (services == null) ? new Vector() + : new Vector(services); } }