boolean running = false, aborted = false;
/**
+ * @return the aborted
+ */
+ public boolean isAborted()
+ {
+ return aborted;
+ }
+
+ /**
* @param aborted
* the aborted to set
*/
} catch (ClassNotFoundException e)
{
System.err
- .println("Not enabling Jalview Webservices version 2: client jar is not available."
+ .println("Not enabling JABA Webservices : client jar is not available."
+ "\nPlease check that your webstart JNLP file is up to date!");
running = false;
return;
}
+ // reinitialise records of good and bad service URLs
if (services != null)
{
services.removeAllElements();
}
+ if (urlsWithoutServices != null)
+ {
+ urlsWithoutServices.removeAllElements();
+ }
+ if (invalidServiceUrls != null)
+ {
+ invalidServiceUrls.removeAllElements();
+ }
+
List<JabaWsServerQuery> qrys = new ArrayList<JabaWsServerQuery>();
for (final String jwsservers : getServiceUrls())
{
public static void main(String[] args)
{
- Thread runner = getDiscoverer().startDiscoverer(new PropertyChangeListener()
+ Thread runner = getDiscoverer().startDiscoverer(
+ new PropertyChangeListener()
{
public void propertyChange(PropertyChangeEvent evt)
{
if (getDiscoverer().services!=null)
- {System.out.println("Changesupport: There are now "
+ {
+ System.out.println("Changesupport: There are now "
+ getDiscoverer().services.size() + " services");
}
{ "-h=" + foo.toString() });
} catch (Exception e)
{
+ e.printStackTrace();
return false;
} catch (OutOfMemoryError e)
{
+ e.printStackTrace();
return false;
} catch (Error e)
{
+ e.printStackTrace();
return false;
}
return true;
}
/**
- * Start a fresh discovery thread and notify the given object when we're finished. Any known existing threads will be killed before this one is started.
+ * Start a fresh discovery thread and notify the given object when we're
+ * finished. Any known existing threads will be killed before this one is
+ * started.
+ *
* @param changeSupport2
* @return new thread
*/
return thr;
}
+ Vector<String> invalidServiceUrls = null, urlsWithoutServices = null;
+
+ /**
+ * @return the invalidServiceUrls
+ */
+ public Vector<String> getInvalidServiceUrls()
+ {
+ return invalidServiceUrls;
+ }
+
+ /**
+ * @return the urlsWithoutServices
+ */
+ public Vector<String> getUrlsWithoutServices()
+ {
+ return urlsWithoutServices;
+ }
+
+ /**
+ * add an 'empty' JABA server to the list
+ *
+ * @param jwsservers
+ */
+ public synchronized void addUrlwithnoservices(String jwsservers)
+ {
+ if (urlsWithoutServices == null)
+ {
+ urlsWithoutServices = new Vector<String>();
+ }
+ if (!urlsWithoutServices.contains(jwsservers))
+ {
+ urlsWithoutServices.add(jwsservers);
+ }
+ }
+
+ /**
+ * add a bad URL to the list
+ *
+ * @param jwsservers
+ */
+ public synchronized void addInvalidServiceUrl(String jwsservers)
+ {
+ if (invalidServiceUrls == null)
+ {
+ invalidServiceUrls = new Vector<String>();
+ }
+ if (!invalidServiceUrls.contains(jwsservers))
+ {
+ invalidServiceUrls.add(jwsservers);
+ }
+ }
+
+ /**
+ *
+ * @return a human readable report of any problems with the service URLs used
+ * for discovery
+ */
+ public String getErrorMessages()
+ {
+ if (!isRunning() && !isAborted())
+ {
+ StringBuffer ermsg = new StringBuffer();
+ boolean list = false;
+ if (getInvalidServiceUrls() != null
+ && getInvalidServiceUrls().size() > 0)
+ {
+ ermsg.append("Invalid Service URLS: \n");
+ for (String svcurl : getInvalidServiceUrls())
+ {
+ if (list)
+ {
+ ermsg.append(", ");
+ }
+ list = true;
+ ermsg.append(svcurl);
+ }
+ ermsg.append("\n\n");
+ }
+ list = false;
+ if (getUrlsWithoutServices() != null
+ && getUrlsWithoutServices().size() > 0)
+ {
+ ermsg.append("URLs without any JABA Services : \n");
+ for (String svcurl : getUrlsWithoutServices())
+ {
+ if (list)
+ {
+ ermsg.append(", ");
+ }
+ list = true;
+ ermsg.append(svcurl);
+ }
+ ermsg.append("\n");
+ }
+ if (ermsg.length() > 1)
+ {
+ return ermsg.toString();
+ }
+
+ }
+ return null;
+ }
+
}