import jalview.ws.dbsources.das.api.jalviewSourceI;\r
\r
import java.util.ArrayList;\r
+import java.util.Arrays;\r
import java.util.Enumeration;\r
import java.util.HashMap;\r
import java.util.HashSet;\r
\r
import javax.swing.JOptionPane;\r
\r
+import org.biodas.jdas.client.FeaturesClient;\r
import org.biodas.jdas.client.adapters.features.DasGFFAdapter;\r
import org.biodas.jdas.client.adapters.features.DasGFFAdapter.GFFAdapter;\r
import org.biodas.jdas.client.threads.FeaturesClientMultipleSources;\r
long startTime;\r
\r
private DasSourceRegistryI sourceRegistry;\r
-\r
+ private boolean useJDASMultiThread=true;\r
/**\r
* Creates a new SequenceFeatureFetcher object. Uses default\r
* \r
public DasSequenceFeatureFetcher(SequenceI[] sequences,\r
FeatureSettings fsettings, Vector selectedSources)\r
{\r
- this(sequences, fsettings, selectedSources, true, true);\r
+ this(sequences, fsettings, selectedSources, true, true, true);\r
}\r
\r
public DasSequenceFeatureFetcher(SequenceI[] oursequences,\r
FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,\r
boolean checkDbrefs, boolean promptFetchDbrefs)\r
{\r
+ this(oursequences,fsettings,selectedSources2,checkDbrefs,promptFetchDbrefs,true);\r
+ }\r
+ public DasSequenceFeatureFetcher(SequenceI[] oursequences,\r
+ FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,\r
+ boolean checkDbrefs, boolean promptFetchDbrefs, boolean useJDasMultiThread)\r
+ {\r
+ this.useJDASMultiThread=useJDasMultiThread;\r
this.selectedSources = new ArrayList<jalviewSourceI>();\r
// filter both sequences and sources to eliminate duplicates\r
for (jalviewSourceI src : selectedSources2)\r
}\r
Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();\r
Map<String, Map<List<String>, DasGFFAdapter>> results = new HashMap<String, Map<List<String>, DasGFFAdapter>>();\r
+ if (!useJDASMultiThread)\r
+ {\r
+ Iterator<String> sources=src.iterator();\r
+ // iterate over each query for each source and do each one individually\r
+ for (List<String> idl:ids)\r
+ {\r
+ String source=sources.next();\r
+ FeaturesClient featuresc=new FeaturesClient(sourceRegistry.getSessionHandler().getConnectionPropertyProviderFor(source));\r
+ for (String id:idl)\r
+ {\r
+ List<String> qid=Arrays.asList(new String[] { id});\r
+ try {\r
+ DasGFFAdapter dga=featuresc.fetchData(source, qid);\r
+ Map<List<String>,DasGFFAdapter> ers=results.get(source);\r
+ if (ers==null)\r
+ {\r
+ results.put(source, ers=new HashMap<List<String>,DasGFFAdapter>());\r
+ }\r
+ ers.put(qid, dga);\r
+ } catch (Exception ex)\r
+ {\r
+ Map<List<String>,Exception> ers=errors.get(source);\r
+ if (ers==null)\r
+ {\r
+ errors.put(source, ers=new HashMap<List<String>,Exception>());\r
+ }\r
+ ers.put(qid, ex);\r
+ }\r
+ }\r
+ }\r
+ } else {\r
+ // pass them all at once\r
fc.fetchData(src, ids, false, results, errors);\r
fc.shutDown();\r
while (!fc.isTerminated())\r
\r
}\r
}\r
+ }\r
Iterator<List<String>> idset = ids.iterator();\r
Iterator<List<DBRefEntry>> idobjset = idobj.iterator();\r
Iterator<Map<String, SequenceI>> seqset = sqset.iterator();\r