use of org.jkiss.dbeaver.runtime.IPluginService in project dbeaver by dbeaver.
the class DBeaverCore method dispose.
public synchronized void dispose() {
long startTime = System.currentTimeMillis();
log.debug("Shutdown Core...");
DBeaverCore.setClosing(true);
// Deactivate plugin services
for (IPluginService pluginService : activatedServices) {
try {
pluginService.deactivateService();
} catch (Exception e) {
log.error("Error deactivating plugin service", e);
}
}
activatedServices.clear();
// It is a part of UI
if (this.navigatorModel != null) {
this.navigatorModel.dispose();
// this.navigatorModel = null;
}
// It will close all open connections
if (this.projectRegistry != null) {
this.projectRegistry.dispose();
this.projectRegistry = null;
}
if (this.qmLogWriter != null) {
this.queryManager.unregisterMetaListener(qmLogWriter);
this.qmLogWriter.dispose();
this.qmLogWriter = null;
}
if (this.queryManager != null) {
this.queryManager.dispose();
// queryManager = null;
}
DataSourceProviderRegistry.getInstance().dispose();
if (isStandalone() && workspace != null) {
try {
IProgressMonitor monitor = new NullProgressMonitor();
workspace.save(true, monitor);
} catch (CoreException ex) {
// $NON-NLS-1$
log.error("Can't save workspace", ex);
}
}
// Remove temp folder
if (tempFolder != null) {
if (!ContentUtils.deleteFileRecursive(tempFolder)) {
log.warn("Can't delete temp folder '" + tempFolder.getAbsolutePath() + "'");
}
tempFolder = null;
}
DBeaverCore.application = DEFAULT_APPLICATION;
DBeaverCore.instance = null;
DBeaverCore.disposed = true;
System.gc();
log.debug("Shutdown completed in " + (System.currentTimeMillis() - startTime) + "ms");
}
use of org.jkiss.dbeaver.runtime.IPluginService in project dbeaver by dbeaver.
the class DBeaverCore method initialize.
private void initialize() {
long startTime = System.currentTimeMillis();
log.debug("Initialize Core...");
DBPPreferenceStore prefsStore = getGlobalPreferenceStore();
// ' Global pref events forwarder
prefsStore.addPropertyChangeListener(new DBPPreferenceListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
// Forward event to all data source preferences
for (DataSourceDescriptor ds : DataSourceRegistry.getAllDataSources()) {
ds.getPreferenceStore().firePropertyChangeEvent(event.getProperty(), event.getOldValue(), event.getNewValue());
}
}
});
// Register properties adapter
this.workspace = ResourcesPlugin.getWorkspace();
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);
}
}
QMUtils.initApplication(this);
this.queryManager = new QMControllerImpl();
this.qmLogWriter = new QMLogFileWriter();
this.queryManager.registerMetaListener(qmLogWriter);
// Init default network settings
Authenticator.setDefault(new GlobalProxyAuthenticator());
ProxySelector.setDefault(new GlobalProxySelector(ProxySelector.getDefault()));
this.certificateStorage = new DefaultCertificateStorage(new File(DBeaverActivator.getInstance().getStateLocation().toFile(), "security"));
// Init project registry
this.projectRegistry = new ProjectRegistry(workspace);
// Projects registry
initializeProjects();
// Navigator model
this.navigatorModel = new DBNModel(this);
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 KeepAliveJob(this).scheduleMonitor();
log.debug("Core initialized (" + (System.currentTimeMillis() - startTime) + "ms)");
}
use of org.jkiss.dbeaver.runtime.IPluginService in project dbeaver by serge-rider.
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();
}
Aggregations