*/
package jalview.ws;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.ext.ensembl.EnsemblGene;
import jalview.ws.dbsources.EmblCdsSource;
import jalview.ws.dbsources.EmblSource;
* This implements the run-time discovery of sequence database clients.
*
*/
-public class SequenceFetcher extends ASequenceFetcher
+public class SequenceFetcher extends ASequenceFetcher implements ApplicationSingletonI
{
+ /*
+ * set a mock fetcher here for testing only - reset to null afterwards
+ */
+ private static SequenceFetcher mockFetcher;
+
+ /**
+ * Set the instance object to use (intended for unit testing with mock
+ * objects).
+ *
+ * Be sure to reset to null in the tearDown method of any tests!
+ *
+ * @param sf
+ */
+ public static void setMockFetcher(SequenceFetcher sf)
+ {
+ mockFetcher = sf;
+ }
+
+ /**
+ * Returns a new SequenceFetcher singleton, or a mock object if one has been
+ * set.
+ *
+ * @return
+ */
+ public static SequenceFetcher getInstance()
+ {
+ return mockFetcher != null ? mockFetcher
+ : ApplicationSingletonProvider.getInstance(SequenceFetcher.class);
+ }
+
/**
* Thread safe construction of database proxies TODO: extend to a configurable
* database plugin mechanism where classes are instantiated by reflection and
addDBRefSourceImpl(EmblSource.class);
addDBRefSourceImpl(EmblCdsSource.class);
addDBRefSourceImpl(Uniprot.class);
- addDBRefSourceImpl(TDBeacons.class);
+ // not a sequence source yet
+ // addDBRefSourceImpl(TDBeacons.class);
addDBRefSourceImpl(Pdb.class);
addDBRefSourceImpl(PfamFull.class);
addDBRefSourceImpl(PfamSeed.class);
}
/**
- * return an ordered list of database sources excluding alignment only databases
+ * return an ordered list of database sources excluding alignment only
+ * databases
*/
public String[] getNonAlignmentSources()
{