use of org.jkiss.dbeaver.model.DBPDataSourceContainer in project dbeaver by dbeaver.
the class DatabaseDebugConfigurationTab method performApply.
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
DBPDataSourceContainer dataSource = connectionCombo.getSelectedItem();
configuration.setAttribute(DBGConstants.ATTR_DATASOURCE_ID, dataSource == null ? null : dataSource.getId());
configuration.setAttribute(DBGConstants.ATTR_DEBUG_TYPE, selectedDebugType == null ? null : selectedDebugType.getId());
if (selectedDebugPanel != null) {
Map<String, Object> attrs = new HashMap<>();
selectedDebugPanel.saveConfiguration(dataSource, attrs);
DebugUtils.putContextInConfiguration(configuration, attrs);
}
}
use of org.jkiss.dbeaver.model.DBPDataSourceContainer in project dbeaver by dbeaver.
the class DBGSourcePathComputer method computeSourceContainers.
@Override
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
DBPDataSourceContainer dataSource = DebugUtils.getDataSourceContainer(configuration);
DatabaseNavigatorSourceContainer container = new DatabaseNavigatorSourceContainer(dataSource);
return new ISourceContainer[] { container };
}
use of org.jkiss.dbeaver.model.DBPDataSourceContainer in project dbeaver by dbeaver.
the class ERDDiagram method addEntity.
public void addEntity(ERDEntity entity, int i, boolean reflect) {
DBSEntity object = entity.getObject();
if (object == null) {
log.debug("Null object passed");
return;
} else if (object.getDataSource() == null) {
log.debug("Object " + object.getName() + " is not connected with datasource");
return;
}
synchronized (entities) {
if (i < 0) {
entities.add(entity);
} else {
entities.add(i, entity);
}
entityMap.put(object, entity);
DBPDataSourceContainer dataSource = object.getDataSource().getContainer();
DataSourceInfo dsInfo = dataSourceMap.computeIfAbsent(dataSource, dsc -> new DataSourceInfo(dataSourceMap.size()));
dsInfo.entities.add(entity);
DBSObjectContainer container = DBUtils.getParentOfType(DBSObjectContainer.class, entity.getObject());
if (container != null) {
dataSourceContainerMap.putIfAbsent(dataSource, new LinkedHashMap<>());
Map<DBSObjectContainer, Integer> containerMap = dataSourceContainerMap.get(dataSource);
containerMap.putIfAbsent(container, containerMap.size());
}
}
if (reflect) {
firePropertyChange(CHILD, null, entity);
/*
for (ERDAssociation rel : entity.getReferences()) {
entity.firePropertyChange(INPUT, null, rel);
}
for (ERDAssociation rel : entity.getAssociations()) {
entity.firePropertyChange(OUTPUT, null, rel);
}
*/
}
resolveRelations(reflect);
if (reflect) {
for (ERDAssociation rel : entity.getReferences()) {
rel.getSourceEntity().firePropertyChange(OUTPUT, null, rel);
}
for (ERDAssociation rel : entity.getAssociations()) {
rel.getTargetEntity().firePropertyChange(INPUT, null, rel);
}
}
}
use of org.jkiss.dbeaver.model.DBPDataSourceContainer in project dbeaver by dbeaver.
the class BasePlatformImpl method initialize.
protected void initialize() {
log.debug("Initialize base platform...");
DBPPreferenceStore prefsStore = getPreferenceStore();
// Global pref events forwarder
prefsStore.addPropertyChangeListener(event -> {
// Forward event to all data source preferences
for (DBPDataSourceContainer ds : DataSourceRegistry.getAllDataSources()) {
((AbstractPreferenceStore) ds.getPreferenceStore()).firePropertyChangeEvent(prefsStore, event.getProperty(), event.getOldValue(), event.getNewValue());
}
});
this.localSystem = new OSDescriptor(Platform.getOS(), Platform.getOSArch());
{
this.language = PlatformLanguageRegistry.getInstance().getLanguage(Locale.getDefault());
if (this.language == null) {
log.debug("Language for locale '" + Locale.getDefault() + "' not found. Use default.");
this.language = PlatformLanguageRegistry.getInstance().getLanguage(Locale.ENGLISH);
}
}
// Navigator model
this.navigatorModel = new DBNModel(this, null);
this.navigatorModel.initialize();
// Activate plugin services
for (IPluginService pluginService : PluginServiceRegistry.getInstance().getServices()) {
try {
pluginService.activateService();
activatedServices.add(pluginService);
} catch (Throwable e) {
log.error("Error activating plugin service", e);
}
}
// Keep-alive job
new KeepAliveListenerJob(this).scheduleMonitor();
}
use of org.jkiss.dbeaver.model.DBPDataSourceContainer in project dbeaver by dbeaver.
the class KeepAliveListenerJob method run.
@Override
protected IStatus run(DBRProgressMonitor monitor) {
if (platform.isShuttingDown()) {
return Status.OK_STATUS;
}
if (lastPingTime > 0 && System.currentTimeMillis() - lastPingTime > SYSTEM_SUSPEND_INTERVAL) {
log.debug("System suspend detected! Reinitialize all remote connections.");
}
lastPingTime = System.currentTimeMillis();
final DBPWorkspace workspace = platform.getWorkspace();
for (DBPProject project : workspace.getProjects()) {
if (project.isOpen() && project.isRegistryLoaded()) {
DBPDataSourceRegistry dataSourceRegistry = project.getDataSourceRegistry();
for (DBPDataSourceContainer ds : dataSourceRegistry.getDataSources()) {
checkDataSourceAlive(ds);
}
}
}
if (!platform.isShuttingDown()) {
scheduleMonitor();
}
return Status.OK_STATUS;
}
Aggregations