X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FEBIFetchClient.java;h=2c829ffc1d9b76f2bdb69d107fe17c8060a81598;hb=3ca1aeccca8d3adfd55d1ff8bd447f8bf0d4ac2f;hp=5b21bfe092515f97283c01493969dcf18073d963;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/io/EBIFetchClient.java b/src/jalview/io/EBIFetchClient.java index 5b21bfe..2c829ff 100755 --- a/src/jalview/io/EBIFetchClient.java +++ b/src/jalview/io/EBIFetchClient.java @@ -32,83 +32,151 @@ import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; -public class EBIFetchClient { +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class EBIFetchClient +{ Call call; String format = "default"; String style = "raw"; - public EBIFetchClient() { - try { + /** + * Creates a new EBIFetchClient object. + */ + public EBIFetchClient() + { + try + { call = (Call) new Service().createCall(); call.setTargetEndpointAddress(new java.net.URL( "http://www.ebi.ac.uk/ws/services/Dbfetch")); - } catch (Exception ex) { + } + catch (Exception ex) + { } } - public String[] getSupportedDBs() { - try { + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedDBs() + { + try + { call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs")); call.setReturnType(XMLType.SOAP_ARRAY); return (String[]) call.invoke(new Object[] { }); - } catch (Exception ex) { + } + catch (Exception ex) + { return null; } } - public String[] getSupportedFormats() { - try { + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedFormats() + { + try + { call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats")); call.setReturnType(XMLType.SOAP_ARRAY); return (String[]) call.invoke(new Object[] { }); - } catch (Exception ex) { + } + catch (Exception ex) + { return null; } } - public String[] getSupportedStyles() { - try { + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] getSupportedStyles() + { + try + { call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles")); call.setReturnType(XMLType.SOAP_ARRAY); return (String[]) call.invoke(new Object[] { }); - } catch (Exception ex) { + } + catch (Exception ex) + { return null; } } - public String[] fetchData(String ids, String f, String s) { + /** + * DOCUMENT ME! + * + * @param ids DOCUMENT ME! + * @param f DOCUMENT ME! + * @param s DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String[] fetchData(String ids, String f, String s) + { // ids should be of the form uniprot:25KD_SARPE;ADHR_DROPS; // max 50 ids can be added at one time - try { + try + { call.setOperationName(new QName("urn:Dbfetch", "fetchData")); call.addParameter("query", XMLType.XSD_STRING, ParameterMode.IN); call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN); call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN); call.setReturnType(XMLType.SOAP_ARRAY); - if (f != null) { + if (f != null) + { format = f; } - if (s != null) { + if (s != null) + { style = s; } return (String[]) call.invoke(new Object[] { ids, format, style }); - } catch (Exception ex) { + } + catch (Exception ex) + { return null; } } - public String fetchDataFile(String arg, String f, String s) { - if (f != null) { + /** + * DOCUMENT ME! + * + * @param arg DOCUMENT ME! + * @param f DOCUMENT ME! + * @param s DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public String fetchDataFile(String arg, String f, String s) + { + if (f != null) + { format = f; } - if (s != null) { + if (s != null) + { style = s; } @@ -124,21 +192,25 @@ public class EBIFetchClient { call.setReturnType(qnameAttachment); - try { + try + { Object ret = call.invoke(new Object[] { arg, format, style }); - if (null == ret) { + if (null == ret) + { System.err.println("Received null "); throw new AxisFault("", "Received null", null, null); } - if (ret instanceof String) { + if (ret instanceof String) + { System.err.println("Received problem response from server: " + ret); throw new AxisFault("", (String) ret, null, null); } - if (!(ret instanceof DataHandler)) { + if (!(ret instanceof DataHandler)) + { //The wrong type of object that what was expected. System.err.println("Received problem response from server:" + ret.getClass().getName()); @@ -153,20 +225,28 @@ public class EBIFetchClient { //From here we'll just treat the data resource as file. String receivedfileName = rdh.getName(); //Get the filename. - if (receivedfileName == null) { + if (receivedfileName == null) + { System.err.println("Could not get the file name."); throw new AxisFault("", "Could not get the file name.", null, null); } - if (arg.equalsIgnoreCase("medline")) { + if (arg.equalsIgnoreCase("medline")) + { return receivedfileName; - } else if (arg.equalsIgnoreCase("interpro")) { + } + else if (arg.equalsIgnoreCase("interpro")) + { return receivedfileName; - } else { + } + else + { System.err.println(receivedfileName); } - } catch (Exception ex) { + } + catch (Exception ex) + { ex.printStackTrace(); }