X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fws%2Fseqfetcher%2FASequenceFetcher.java;h=a8a390465c4b6466ca20ac1052f44ba890541f40;hb=73d2eb017ebcaff4453d676c0d728f61015d102c;hp=afdb516bde4372d6a2e90165867ecd27d28816cf;hpb=7ab5d6b0ba5fec1ea4a4239e79c476d841622485;p=jalview.git diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java index afdb516..a8a3904 100644 --- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java +++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -20,11 +20,6 @@ */ package jalview.ws.seqfetcher; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.DBRefEntry; -import jalview.datamodel.SequenceI; -import jalview.util.DBRefUtils; - import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; @@ -35,6 +30,12 @@ import java.util.Map; import java.util.Stack; import java.util.Vector; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.SequenceI; +import jalview.util.DBRefUtils; +import jalview.util.MessageManager; + public class ASequenceFetcher { @@ -57,7 +58,9 @@ public class ASequenceFetcher public String[] getSupportedDb() { if (FETCHABLEDBS == null) + { return null; + } String[] sf = new String[FETCHABLEDBS.size()]; Enumeration e = FETCHABLEDBS.keys(); int i = 0; @@ -76,7 +79,9 @@ public class ASequenceFetcher { String db = (String) e.nextElement(); if (source.compareToIgnoreCase(db) == 0) + { return true; + } } jalview.bin.Cache.log.warn("isFetchable doesn't know about '" + source + "'"); @@ -197,7 +202,9 @@ public class ASequenceFetcher */ System.out.println(hdr); if (rrb != null) + { System.out.println(rrb); + } System.out.println("# end of " + hdr); } @@ -302,31 +309,23 @@ public class ASequenceFetcher * @param dbSourceProxy * reference for class implementing * jalview.ws.seqfetcher.DbSourceProxy - * @throws java.lang.IllegalArgumentException - * if class does not implement jalview.ws.seqfetcher.DbSourceProxy */ - protected void addDBRefSourceImpl(Class dbSourceProxy) + protected void addDBRefSourceImpl( + Class dbSourceProxy) throws java.lang.IllegalArgumentException { DbSourceProxy proxy = null; try { - Object proxyObj = dbSourceProxy.getConstructor(null) - .newInstance(null); - if (!DbSourceProxy.class.isInstance(proxyObj)) - { - throw new IllegalArgumentException( - dbSourceProxy.toString() - + " does not implement the jalview.ws.seqfetcher.DbSourceProxy"); - } - proxy = (DbSourceProxy) proxyObj; + DbSourceProxy proxyObj = dbSourceProxy.getConstructor().newInstance(); + proxy = proxyObj; } catch (IllegalArgumentException e) { throw e; } catch (Exception e) { // Serious problems if this happens. - throw new Error("DBRefSource Implementation Exception", e); + throw new Error(MessageManager.getString("error.dbrefsource_implementation_exception"), e); } addDbRefSourceImpl(proxy); } @@ -394,9 +393,7 @@ public class ASequenceFetcher { if (!jalview.ws.seqfetcher.DbSourceProxy.class.isAssignableFrom(class1)) { - throw new Error( - "Implmentation Error - getDbInstances must be given a class that implements jalview.ws.seqfetcher.DbSourceProxy (was given '" - + class1 + "')"); + throw new Error(MessageManager.formatMessage("error.implementation_error_dbinstance_must_implement_interface", new String[]{class1.toString()})); } if (FETCHABLEDBS == null) { @@ -427,6 +424,7 @@ public class ASequenceFetcher { ArrayList prlist = new ArrayList(); for (String fetchable : getSupportedDb()) + { for (DbSourceProxy pr : getSourceProxy(fetchable)) { if (class1.isInstance(pr)) @@ -434,6 +432,7 @@ public class ASequenceFetcher prlist.add(pr); } } + } if (prlist.size() == 0) { return null;