use of org.cytoscape.io.datasource.DataSource in project cytoscape-impl by cytoscape.
the class URLHandler method init.
private void init(final DataSourceManager dsManager) {
// creation of the GUI and layout
initGUI();
// Get the DataSources of the appropriate DataCategory from the tunable parameters.
final Collection<DataSource> dataSources = dsManager.getDataSources(DataCategory.valueOf(((String) getParams().get("fileCategory")).toUpperCase()));
final SortedSet<String> labelSet = new TreeSet<String>();
if (dataSources != null) {
for (DataSource ds : dataSources) {
String link = null;
link = ds.getLocation().toString();
final String sourceName = ds.getName();
final String provider = ds.getProvider();
final String sourceLabel = provider + ":" + sourceName;
dataSourceMap.put(sourceLabel, link);
labelSet.add(sourceLabel);
}
}
for (final String label : labelSet) networkFileComboBox.addItem(label);
}
use of org.cytoscape.io.datasource.DataSource in project cytoscape-impl by cytoscape.
the class CyActivator method start.
@Override
public void start(BundleContext bc) {
final CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
DataSourceManagerImpl dataSourceManager = new DataSourceManagerImpl();
registerService(bc, dataSourceManager, DataSourceManager.class, new Properties());
registerServiceListener(bc, dataSourceManager::addDataSource, dataSourceManager::removeDataSource, DataSource.class);
BookmarkDataSourceBuilder bkBuilder = new BookmarkDataSourceBuilder(serviceRegistrar);
final Set<DataSource> bkDataSources = bkBuilder.getDataSources();
for (final DataSource ds : bkDataSources) registerService(bc, ds, DataSource.class, new Properties());
}
use of org.cytoscape.io.datasource.DataSource in project cytoscape-impl by cytoscape.
the class DataSourceManagerImpl method getDataSources.
@Override
public Collection<DataSource> getDataSources(String providerName) {
final Set<DataSource> sources = new LinkedHashSet<>();
synchronized (lock) {
Iterator<DataCategory> it = this.dataSourceMap.keySet().iterator();
Map<String, DataSource> map;
while (it.hasNext()) {
map = this.dataSourceMap.get(it.next());
Iterator<DataSource> it_ds = map.values().iterator();
while (it_ds.hasNext()) {
DataSource ds = it_ds.next();
if (ds.getProvider().equals(providerName))
sources.add(ds);
}
}
return sources;
}
}
use of org.cytoscape.io.datasource.DataSource in project cytoscape-impl by cytoscape.
the class DataSourceManagerImpl method containsDataSource.
@Override
public boolean containsDataSource(DataSource pDataSource) {
synchronized (lock) {
Collection<DataSource> dataSourcesSet = this.getDataSources(pDataSource.getDataCategory());
if (dataSourcesSet == null || dataSourcesSet.size() == 0) {
return false;
}
Iterator<DataSource> it = dataSourcesSet.iterator();
while (it.hasNext()) {
DataSource ds = it.next();
if (ds.getName().equalsIgnoreCase(pDataSource.getName())) {
return true;
}
}
}
return false;
}
Aggregations