X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=webservices%2Fcompbio%2Fws%2Fserver%2FRegistryWS.java;h=c54fc56b373e9ddd5777aebe5ab4402b3a6289a8;hb=d92ac5284d2c918deda443f89e60cab6f0f8667e;hp=0ff42945cd1c2145ae0e82194999bc813c390327;hpb=bcb2c33dfed7ffefa3566af8af9383d08a9022ef;p=jabaws.git diff --git a/webservices/compbio/ws/server/RegistryWS.java b/webservices/compbio/ws/server/RegistryWS.java index 0ff4294..c54fc56 100644 --- a/webservices/compbio/ws/server/RegistryWS.java +++ b/webservices/compbio/ws/server/RegistryWS.java @@ -1,3 +1,20 @@ +/* Copyright (c) 2011 Peter Troshin + * + * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 + * + * This library is free software; you can redistribute it and/or modify it under the terms of the + * Apache License version 2 as published by the Apache Software Foundation + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache + * License for more details. + * + * A copy of the license is in apache_license.txt. It is also available here: + * @see: http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Any republication or derived work distributed in source code form + * must include this copyright and license notice. + */ package compbio.ws.server; import java.io.PrintWriter; @@ -16,6 +33,7 @@ import javax.xml.ws.handler.MessageContext; import org.apache.log4j.Logger; +import compbio.data.msa.Category; import compbio.data.msa.JABAService; import compbio.ws.client.Services; import compbio.ws.client.WSTester; @@ -26,7 +44,7 @@ import compbio.ws.client.WSTester; * @author pvtroshin * */ -@WebService(endpointInterface = "compbio.data.msa.RegistryWS", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "RegistryWS") +@WebService(endpointInterface = "compbio.data.msa.RegistryWS", targetNamespace = JABAService.V2_SERVICE_NAMESPACE, serviceName = "RegistryWS") public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService { // Ask for resource injection @@ -123,8 +141,16 @@ public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService { // the server synchronized (operating) { for (Services service : Services.values()) { - if (tester.checkService(service)) { - operating.put(service, new Date()); + try { + if (tester.checkService(service)) { + operating.put(service, new Date()); + } + } catch (Exception e) { + log.info(e, e.getCause()); + writer.println("Fails to connect to a web service: " + + service + " With " + e.getLocalizedMessage() + + "\nDetails: "); + e.printStackTrace(writer); } } } @@ -156,16 +182,30 @@ public class RegistryWS implements compbio.data.msa.RegistryWS, JABAService { operating.put(service, new Date()); } } + } catch (Exception e) { + log.info(e, e.getCause()); + writer.println("Fails to connect to a web service: " + service + + " With " + e.getLocalizedMessage() + "\nDetails: "); + e.printStackTrace(writer); } finally { writer.close(); } return testlog.toString(); } - @Override public boolean isOperating(Services service) { init(); return operating.containsKey(service); } + @Override + public String getServiceDescription(Services service) { + return service.getServiceInfo(); + } + + @Override + public Set getServiceCategories() { + return Category.getCategories(); + } + }