+ /**\r
+ * select sources which are implemented by instances of the given class\r
+ * \r
+ * @param class that implements DbSourceProxy\r
+ * @return null or vector of source names for fetchers\r
+ */\r
+ public String[] getDbInstances(Class class1)\r
+ {\r
+ if (!jalview.ws.seqfetcher.DbSourceProxy.class.isAssignableFrom(class1))\r
+ {\r
+ throw new Error(\r
+ "Implmentation Error - getDbInstances must be given a class that implements jalview.ws.seqfetcher.DbSourceProxy (was given '"\r
+ + class1 + "')");\r
+ }\r
+ if (FETCHABLEDBS == null)\r
+ {\r
+ return null;\r
+ }\r
+ String[] sources = null;\r
+ Vector src = new Vector();\r
+ Enumeration dbs = FETCHABLEDBS.keys();\r
+ while (dbs.hasMoreElements())\r
+ {\r
+ String dbn = (String) dbs.nextElement();\r
+ for (DbSourceProxy dbp : FETCHABLEDBS.get(dbn).values())\r
+ {\r
+ if (class1.isAssignableFrom(dbp.getClass()))\r
+ {\r
+ src.addElement(dbn);\r
+ }\r
+ }\r
+ }\r
+ if (src.size() > 0)\r
+ {\r
+ src.copyInto(sources = new String[src.size()]);\r
+ }\r
+ return sources;\r
+ }\r
+ public DbSourceProxy[] getDbSourceProxyInstances(\r
+ Class class1)\r
+ {\r
+ ArrayList<DbSourceProxy> prlist=new ArrayList<DbSourceProxy>();\r
+ for (String fetchable:getSupportedDb())\r
+ for (DbSourceProxy pr:getSourceProxy(fetchable))\r
+ {\r
+ if (class1.isInstance(pr)) {prlist.add(pr);}\r
+ }\r
+ if (prlist.size()==0)\r
+ {\r
+ return null;\r
+ }\r
+ return prlist.toArray(new DbSourceProxy[0]);\r
+ }\r
+\r
+}\r