提交 e5c9be86 编写于 作者: S Serge Rider

Application model refactoring

上级 39f8a01d
...@@ -65,7 +65,7 @@ import java.util.List; ...@@ -65,7 +65,7 @@ import java.util.List;
/** /**
* DBeaverCore * DBeaverCore
*/ */
public class DBeaverCore implements DBPApplication { public class DBeaverCore implements DBPPlatform {
// The plug-in ID // The plug-in ID
public static final String PLUGIN_ID = "org.jkiss.dbeaver.core"; //$NON-NLS-1$ public static final String PLUGIN_ID = "org.jkiss.dbeaver.core"; //$NON-NLS-1$
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
*/ */
package org.jkiss.dbeaver.registry; package org.jkiss.dbeaver.registry;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.equinox.security.storage.ISecurePreferences; import org.eclipse.equinox.security.storage.ISecurePreferences;
...@@ -25,7 +24,6 @@ import org.jkiss.code.NotNull; ...@@ -25,7 +24,6 @@ import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable; import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.model.*; import org.jkiss.dbeaver.model.*;
import org.jkiss.dbeaver.model.connection.DBPClientHome; import org.jkiss.dbeaver.model.connection.DBPClientHome;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration; import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
...@@ -196,8 +194,8 @@ public class DataSourceDescriptor ...@@ -196,8 +194,8 @@ public class DataSourceDescriptor
@NotNull @NotNull
@Override @Override
public DBPApplication getApplication() { public DBPPlatform getPlatform() {
return registry.getApplication(); return registry.getPlatform();
} }
public void setDriver(@NotNull DriverDescriptor driver) public void setDriver(@NotNull DriverDescriptor driver)
...@@ -639,7 +637,7 @@ public class DataSourceDescriptor ...@@ -639,7 +637,7 @@ public class DataSourceDescriptor
monitor.subTask("Initialize tunnel"); monitor.subTask("Initialize tunnel");
tunnel = tunnelConfiguration.createHandler(DBWTunnel.class); tunnel = tunnelConfiguration.createHandler(DBWTunnel.class);
try { try {
tunnelConnectionInfo = tunnel.initializeTunnel(monitor, registry.getApplication(), tunnelConfiguration, connectionInfo); tunnelConnectionInfo = tunnel.initializeTunnel(monitor, registry.getPlatform(), tunnelConfiguration, connectionInfo);
} catch (Exception e) { } catch (Exception e) {
throw new DBCException("Can't initialize tunnel", e); throw new DBCException("Can't initialize tunnel", e);
} }
......
...@@ -79,16 +79,16 @@ public class DataSourceRegistry implements DBPDataSourceRegistry ...@@ -79,16 +79,16 @@ public class DataSourceRegistry implements DBPDataSourceRegistry
private static PasswordEncrypter ENCRYPTOR = new SimpleStringEncrypter(); private static PasswordEncrypter ENCRYPTOR = new SimpleStringEncrypter();
private final DBPApplication application; private final DBPPlatform platform;
private final IProject project; private final IProject project;
private final List<DataSourceDescriptor> dataSources = new ArrayList<>(); private final List<DataSourceDescriptor> dataSources = new ArrayList<>();
private final List<DBPEventListener> dataSourceListeners = new ArrayList<>(); private final List<DBPEventListener> dataSourceListeners = new ArrayList<>();
private volatile boolean saveInProgress = false; private volatile boolean saveInProgress = false;
public DataSourceRegistry(DBPApplication application, IProject project) public DataSourceRegistry(DBPPlatform platform, IProject project)
{ {
this.application = application; this.platform = platform;
this.project = project; this.project = project;
loadDataSources(false); loadDataSources(false);
DataSourceProviderRegistry.getInstance().fireRegistryChange(this, true); DataSourceProviderRegistry.getInstance().fireRegistryChange(this, true);
...@@ -141,8 +141,8 @@ public class DataSourceRegistry implements DBPDataSourceRegistry ...@@ -141,8 +141,8 @@ public class DataSourceRegistry implements DBPDataSourceRegistry
} }
@NotNull @NotNull
public DBPApplication getApplication() { public DBPPlatform getPlatform() {
return application; return platform;
} }
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
......
...@@ -329,7 +329,7 @@ class ResultSetFilterPanel extends Composite implements IContentProposalProvider ...@@ -329,7 +329,7 @@ class ResultSetFilterPanel extends Composite implements IContentProposalProvider
private DBPImage getActiveObjectImage() { private DBPImage getActiveObjectImage() {
DBSDataContainer dataContainer = viewer.getDataContainer(); DBSDataContainer dataContainer = viewer.getDataContainer();
if (dataContainer instanceof DBSEntity) { if (dataContainer instanceof DBSEntity) {
DBNDatabaseNode dcNode = viewer.getDataContainer().getDataSource().getContainer().getApplication().getNavigatorModel().findNode(dataContainer); DBNDatabaseNode dcNode = viewer.getDataContainer().getDataSource().getContainer().getPlatform().getNavigatorModel().findNode(dataContainer);
if (dcNode != null) { if (dcNode != null) {
return dcNode.getNodeIcon(); return dcNode.getNodeIcon();
} }
......
...@@ -1520,7 +1520,7 @@ public class ResultSetViewer extends Viewer ...@@ -1520,7 +1520,7 @@ public class ResultSetViewer extends Viewer
"view"); //$NON-NLS-1$ "view"); //$NON-NLS-1$
List<? extends DBDAttributeTransformerDescriptor> transformers = List<? extends DBDAttributeTransformerDescriptor> transformers =
dataSource.getContainer().getApplication().getValueHandlerRegistry().findTransformers( dataSource.getContainer().getPlatform().getValueHandlerRegistry().findTransformers(
dataSource, attr, null); dataSource, attr, null);
if (!CommonUtils.isEmpty(transformers)) { if (!CommonUtils.isEmpty(transformers)) {
MenuManager transformersMenu = new MenuManager("View as"); MenuManager transformersMenu = new MenuManager("View as");
...@@ -1660,7 +1660,7 @@ public class ResultSetViewer extends Viewer ...@@ -1660,7 +1660,7 @@ public class ResultSetViewer extends Viewer
return; return;
} }
final DBPDataSource dataSource = dataContainer.getDataSource(); final DBPDataSource dataSource = dataContainer.getDataSource();
final DBDRegistry registry = dataSource.getContainer().getApplication().getValueHandlerRegistry(); final DBDRegistry registry = dataSource.getContainer().getPlatform().getValueHandlerRegistry();
final DBVTransformSettings transformSettings = DBVUtils.getTransformSettings(attr, false); final DBVTransformSettings transformSettings = DBVUtils.getTransformSettings(attr, false);
DBDAttributeTransformerDescriptor customTransformer = null; DBDAttributeTransformerDescriptor customTransformer = null;
if (transformSettings != null && transformSettings.getCustomTransformer() != null) { if (transformSettings != null && transformSettings.getCustomTransformer() != null) {
...@@ -1876,7 +1876,7 @@ public class ResultSetViewer extends Viewer ...@@ -1876,7 +1876,7 @@ public class ResultSetViewer extends Viewer
if (dataSource == null) { if (dataSource == null) {
return; return;
} }
final DBNDatabaseNode targetNode = dataSource.getContainer().getApplication().getNavigatorModel().getNodeByObject(monitor, targetEntity, false); final DBNDatabaseNode targetNode = dataSource.getContainer().getPlatform().getNavigatorModel().getNodeByObject(monitor, targetEntity, false);
if (targetNode == null) { if (targetNode == null) {
UIUtils.showMessageBox(null, "Open link", "Can't navigate to '" + DBUtils.getObjectFullName(targetEntity, DBPEvaluationContext.UI) + "' - navigator node not found", SWT.ICON_ERROR); UIUtils.showMessageBox(null, "Open link", "Can't navigate to '" + DBUtils.getObjectFullName(targetEntity, DBPEvaluationContext.UI) + "' - navigator node not found", SWT.ICON_ERROR);
return; return;
......
...@@ -67,7 +67,7 @@ class TransformerSettingsDialog extends BaseDialog { ...@@ -67,7 +67,7 @@ class TransformerSettingsDialog extends BaseDialog {
Collection<? extends DBPPropertyDescriptor> properties = Collections.emptyList(); Collection<? extends DBPPropertyDescriptor> properties = Collections.emptyList();
final DBDAttributeTransformerDescriptor transformer; final DBDAttributeTransformerDescriptor transformer;
if (dataSource != null && !CommonUtils.isEmpty(settings.getCustomTransformer())) { if (dataSource != null && !CommonUtils.isEmpty(settings.getCustomTransformer())) {
transformer = dataSource.getContainer().getApplication().getValueHandlerRegistry().getTransformer(settings.getCustomTransformer()); transformer = dataSource.getContainer().getPlatform().getValueHandlerRegistry().getTransformer(settings.getCustomTransformer());
if (transformer != null) { if (transformer != null) {
properties = transformer.getProperties(); properties = transformer.getProperties();
} }
......
...@@ -193,7 +193,7 @@ public abstract class AbstractToolWizard<BASE_OBJECT extends DBSObject, PROCESS_ ...@@ -193,7 +193,7 @@ public abstract class AbstractToolWizard<BASE_OBJECT extends DBSObject, PROCESS_
} }
// Refresh navigator node (script execution can change everything inside) // Refresh navigator node (script execution can change everything inside)
for (BASE_OBJECT object : databaseObjects) { for (BASE_OBJECT object : databaseObjects) {
final DBNDatabaseNode node = dataSourceContainer.getApplication().getNavigatorModel().findNode(object); final DBNDatabaseNode node = dataSourceContainer.getPlatform().getNavigatorModel().findNode(object);
if (node != null) { if (node != null) {
node.refreshNode(monitor, AbstractToolWizard.this); node.refreshNode(monitor, AbstractToolWizard.this);
} }
......
...@@ -110,7 +110,7 @@ public class MySQLDataSource extends JDBCDataSource implements DBSObjectSelector ...@@ -110,7 +110,7 @@ public class MySQLDataSource extends JDBCDataSource implements DBSObjectSelector
private void initSSL(DBRProgressMonitor monitor, Map<String, String> props, DBWHandlerConfiguration sslConfig) throws Exception { private void initSSL(DBRProgressMonitor monitor, Map<String, String> props, DBWHandlerConfiguration sslConfig) throws Exception {
monitor.subTask("Install SSL certificates"); monitor.subTask("Install SSL certificates");
final DBACertificateStorage securityManager = getContainer().getApplication().getCertificateStorage(); final DBACertificateStorage securityManager = getContainer().getPlatform().getCertificateStorage();
props.put("useSSL", "true"); props.put("useSSL", "true");
props.put("verifyServerCertificate", String.valueOf(CommonUtils.toBoolean(sslConfig.getProperties().get(MySQLConstants.PROP_VERIFY_SERVER_SERT)))); props.put("verifyServerCertificate", String.valueOf(CommonUtils.toBoolean(sslConfig.getProperties().get(MySQLConstants.PROP_VERIFY_SERVER_SERT))));
......
...@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.ext.oracle.data; ...@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.ext.oracle.data;
import org.jkiss.code.NotNull; import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ModelPreferences; import org.jkiss.dbeaver.ModelPreferences;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.DBPDataSource; import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.data.DBDContentStorage; import org.jkiss.dbeaver.model.data.DBDContentStorage;
import org.jkiss.dbeaver.model.data.DBDDisplayFormat; import org.jkiss.dbeaver.model.data.DBDDisplayFormat;
...@@ -137,14 +137,14 @@ public class OracleContentBFILE extends JDBCContentLOB { ...@@ -137,14 +137,14 @@ public class OracleContentBFILE extends JDBCContentLOB {
try { try {
openFile(); openFile();
long contentLength = getContentLength(); long contentLength = getContentLength();
DBPApplication application = dataSource.getContainer().getApplication(); DBPPlatform platform = dataSource.getContainer().getPlatform();
if (contentLength < application.getPreferenceStore().getInt(ModelPreferences.MEMORY_CONTENT_MAX_SIZE)) { if (contentLength < platform.getPreferenceStore().getInt(ModelPreferences.MEMORY_CONTENT_MAX_SIZE)) {
try { try {
try (InputStream bs = getInputStream()) { try (InputStream bs = getInputStream()) {
storage = BytesContentStorage.createFromStream( storage = BytesContentStorage.createFromStream(
bs, bs,
contentLength, contentLength,
application.getPreferenceStore().getString(ModelPreferences.CONTENT_HEX_ENCODING)); platform.getPreferenceStore().getString(ModelPreferences.CONTENT_HEX_ENCODING));
} }
} catch (IOException e) { } catch (IOException e) {
throw new DBCException("IO error while reading content", e); throw new DBCException("IO error while reading content", e);
...@@ -153,7 +153,7 @@ public class OracleContentBFILE extends JDBCContentLOB { ...@@ -153,7 +153,7 @@ public class OracleContentBFILE extends JDBCContentLOB {
// Create new local storage // Create new local storage
File tempFile; File tempFile;
try { try {
tempFile = ContentUtils.createTempContentFile(monitor, application, "blob" + bfile.hashCode()); tempFile = ContentUtils.createTempContentFile(monitor, platform, "blob" + bfile.hashCode());
} catch (IOException e) { } catch (IOException e) {
throw new DBCException("Can't create temporary file", e); throw new DBCException("Can't create temporary file", e);
} }
...@@ -168,7 +168,7 @@ public class OracleContentBFILE extends JDBCContentLOB { ...@@ -168,7 +168,7 @@ public class OracleContentBFILE extends JDBCContentLOB {
ContentUtils.deleteTempFile(tempFile); ContentUtils.deleteTempFile(tempFile);
throw new DBCException(e, dataSource); throw new DBCException(e, dataSource);
} }
this.storage = new TemporaryContentStorage(application, tempFile); this.storage = new TemporaryContentStorage(platform, tempFile);
} }
// Free blob - we don't need it anymore // Free blob - we don't need it anymore
releaseBlob(); releaseBlob();
......
...@@ -35,7 +35,7 @@ public class WMIDataSourceProvider implements DBPDataSourceProvider { ...@@ -35,7 +35,7 @@ public class WMIDataSourceProvider implements DBPDataSourceProvider {
private boolean libLoaded = false; private boolean libLoaded = false;
@Override @Override
public void init(@NotNull DBPApplication application) public void init(@NotNull DBPPlatform platform)
{ {
} }
......
...@@ -54,7 +54,7 @@ public interface DBPDataSourceContainer extends DBSObject, DBDPreferences, DBPNa ...@@ -54,7 +54,7 @@ public interface DBPDataSourceContainer extends DBSObject, DBDPreferences, DBPNa
DBPDriver getDriver(); DBPDriver getDriver();
@NotNull @NotNull
DBPApplication getApplication(); DBPPlatform getPlatform();
/** /**
* Connection configuration. * Connection configuration.
......
...@@ -33,9 +33,9 @@ public interface DBPDataSourceProvider extends DBPObject ...@@ -33,9 +33,9 @@ public interface DBPDataSourceProvider extends DBPObject
/** /**
* Initializes data source provider * Initializes data source provider
* @param application application * @param platform application
*/ */
void init(@NotNull DBPApplication application); void init(@NotNull DBPPlatform platform);
/** /**
* Supported features * Supported features
......
...@@ -35,7 +35,7 @@ public interface DBPDataSourceRegistry { ...@@ -35,7 +35,7 @@ public interface DBPDataSourceRegistry {
String CONFIG_FILE_NAME = CONFIG_FILE_PREFIX + CONFIG_FILE_EXT; String CONFIG_FILE_NAME = CONFIG_FILE_PREFIX + CONFIG_FILE_EXT;
@NotNull @NotNull
DBPApplication getApplication(); DBPPlatform getPlatform();
/** /**
* Owner project. * Owner project.
*/ */
......
/* /*
* DBeaver - Universal Database Manager * DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org) * Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2) * it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
package org.jkiss.dbeaver.model; package org.jkiss.dbeaver.model;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspace;
import org.jkiss.code.NotNull; import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.admin.DBACertificateStorage; import org.jkiss.dbeaver.model.admin.DBACertificateStorage;
import org.jkiss.dbeaver.model.data.DBDRegistry; import org.jkiss.dbeaver.model.data.DBDRegistry;
import org.jkiss.dbeaver.model.edit.DBERegistry; import org.jkiss.dbeaver.model.edit.DBERegistry;
import org.jkiss.dbeaver.model.navigator.DBNModel; import org.jkiss.dbeaver.model.navigator.DBNModel;
import org.jkiss.dbeaver.model.qm.QMController; import org.jkiss.dbeaver.model.qm.QMController;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.List;
/** /**
* DBPApplication * DBPPlatform
*/ */
public interface DBPApplication public interface DBPPlatform
{ {
@NotNull @NotNull
DBNModel getNavigatorModel(); DBNModel getNavigatorModel();
@NotNull @NotNull
IWorkspace getWorkspace(); IWorkspace getWorkspace();
@NotNull @NotNull
DBPProjectManager getProjectManager(); DBPProjectManager getProjectManager();
@NotNull @NotNull
Collection<IProject> getLiveProjects(); List<IProject> getLiveProjects();
@NotNull @NotNull
QMController getQueryManager(); QMController getQueryManager();
@NotNull @NotNull
DBDRegistry getValueHandlerRegistry(); DBDRegistry getValueHandlerRegistry();
@NotNull @NotNull
DBERegistry getEditorsRegistry(); DBERegistry getEditorsRegistry();
@NotNull @NotNull
DBPPreferenceStore getPreferenceStore(); DBPPreferenceStore getPreferenceStore();
@NotNull @NotNull
DBACertificateStorage getCertificateStorage(); DBACertificateStorage getCertificateStorage();
@NotNull @NotNull
File getTempFolder(DBRProgressMonitor monitor, String name) throws IOException; File getTempFolder(DBRProgressMonitor monitor, String name) throws IOException;
} }
...@@ -504,7 +504,7 @@ public final class DBUtils { ...@@ -504,7 +504,7 @@ public final class DBUtils {
{ {
DBDValueHandler typeHandler = null; DBDValueHandler typeHandler = null;
DBDValueHandlerProvider typeProvider = dataSource.getContainer().getApplication().getValueHandlerRegistry().getDataTypeProvider( DBDValueHandlerProvider typeProvider = dataSource.getContainer().getPlatform().getValueHandlerRegistry().getDataTypeProvider(
dataSource, column); dataSource, column);
if (typeProvider != null) { if (typeProvider != null) {
typeHandler = typeProvider.getHandler(dataSource, preferences, column); typeHandler = typeProvider.getHandler(dataSource, preferences, column);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
*/ */
package org.jkiss.dbeaver.model.impl; package org.jkiss.dbeaver.model.impl;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.data.DBDContentStorage; import org.jkiss.dbeaver.model.data.DBDContentStorage;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.utils.ContentUtils; import org.jkiss.dbeaver.utils.ContentUtils;
...@@ -29,18 +29,18 @@ import java.io.*; ...@@ -29,18 +29,18 @@ import java.io.*;
*/ */
public class ExternalContentStorage implements DBDContentStorage { public class ExternalContentStorage implements DBDContentStorage {
private final DBPApplication application; private final DBPPlatform platform;
private File file; private File file;
private String charset; private String charset;
public ExternalContentStorage(DBPApplication application, File file) public ExternalContentStorage(DBPPlatform platform, File file)
{ {
this(application, file, null); this(platform, file, null);
} }
public ExternalContentStorage(DBPApplication application, File file, String charset) public ExternalContentStorage(DBPPlatform platform, File file, String charset)
{ {
this.application = application; this.platform = platform;
this.file = file; this.file = file;
this.charset = charset; this.charset = charset;
} }
...@@ -76,7 +76,7 @@ public class ExternalContentStorage implements DBDContentStorage { ...@@ -76,7 +76,7 @@ public class ExternalContentStorage implements DBDContentStorage {
throws IOException throws IOException
{ {
// Create new local storage // Create new local storage
File tempFile = ContentUtils.createTempContentFile(monitor, application, "copy" + this.hashCode()); File tempFile = ContentUtils.createTempContentFile(monitor, platform, "copy" + this.hashCode());
try { try {
try (InputStream is = new FileInputStream(file)) { try (InputStream is = new FileInputStream(file)) {
try (OutputStream os = new FileOutputStream(tempFile)) { try (OutputStream os = new FileOutputStream(tempFile)) {
...@@ -87,7 +87,7 @@ public class ExternalContentStorage implements DBDContentStorage { ...@@ -87,7 +87,7 @@ public class ExternalContentStorage implements DBDContentStorage {
ContentUtils.deleteTempFile(tempFile); ContentUtils.deleteTempFile(tempFile);
throw new IOException(e); throw new IOException(e);
} }
return new TemporaryContentStorage(application, tempFile); return new TemporaryContentStorage(platform, tempFile);
} }
@Override @Override
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
*/ */
package org.jkiss.dbeaver.model.impl; package org.jkiss.dbeaver.model.impl;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.data.DBDContentStorage; import org.jkiss.dbeaver.model.data.DBDContentStorage;
import org.jkiss.dbeaver.model.data.DBDContentStorageLocal; import org.jkiss.dbeaver.model.data.DBDContentStorageLocal;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
...@@ -31,12 +31,12 @@ import java.io.*; ...@@ -31,12 +31,12 @@ import java.io.*;
*/ */
public class TemporaryContentStorage implements DBDContentStorageLocal { public class TemporaryContentStorage implements DBDContentStorageLocal {
private final DBPApplication application; private final DBPPlatform platform;
private File file; private File file;
public TemporaryContentStorage(DBPApplication application, File file) public TemporaryContentStorage(DBPPlatform platform, File file)
{ {
this.application = application; this.platform = platform;
this.file = file; this.file = file;
} }
...@@ -71,7 +71,7 @@ public class TemporaryContentStorage implements DBDContentStorageLocal { ...@@ -71,7 +71,7 @@ public class TemporaryContentStorage implements DBDContentStorageLocal {
throws IOException throws IOException
{ {
// Create new local storage // Create new local storage
File tempFile = ContentUtils.createTempContentFile(monitor, application, "copy" + this.hashCode()); File tempFile = ContentUtils.createTempContentFile(monitor, platform, "copy" + this.hashCode());
try { try {
try (InputStream is = new FileInputStream(file)) { try (InputStream is = new FileInputStream(file)) {
try (OutputStream os = new FileOutputStream(tempFile)) { try (OutputStream os = new FileOutputStream(tempFile)) {
...@@ -82,7 +82,7 @@ public class TemporaryContentStorage implements DBDContentStorageLocal { ...@@ -82,7 +82,7 @@ public class TemporaryContentStorage implements DBDContentStorageLocal {
ContentUtils.deleteTempFile(tempFile); ContentUtils.deleteTempFile(tempFile);
throw new IOException(e); throw new IOException(e);
} }
return new TemporaryContentStorage(application, tempFile); return new TemporaryContentStorage(platform, tempFile);
} }
@Override @Override
......
...@@ -542,7 +542,7 @@ public abstract class AbstractCommandContext implements DBECommandContext { ...@@ -542,7 +542,7 @@ public abstract class AbstractCommandContext implements DBECommandContext {
} }
} }
if (queue == null) { if (queue == null) {
DBEObjectManager<?> objectManager = executionContext.getDataSource().getContainer().getApplication().getEditorsRegistry().getObjectManager(object.getClass()); DBEObjectManager<?> objectManager = executionContext.getDataSource().getContainer().getPlatform().getEditorsRegistry().getObjectManager(object.getClass());
if (objectManager == null) { if (objectManager == null) {
throw new IllegalStateException("Can't find object manager for '" + object.getClass().getName() + "'"); throw new IllegalStateException("Can't find object manager for '" + object.getClass().getName() + "'");
} }
......
...@@ -41,7 +41,7 @@ public abstract class JDBCDataSourceProvider implements DBPDataSourceProvider { ...@@ -41,7 +41,7 @@ public abstract class JDBCDataSourceProvider implements DBPDataSourceProvider {
static final protected Log log = Log.getLog(JDBCDataSourceProvider.class); static final protected Log log = Log.getLog(JDBCDataSourceProvider.class);
@Override @Override
public void init(@NotNull DBPApplication application) { public void init(@NotNull DBPPlatform platform) {
} }
......
...@@ -761,7 +761,7 @@ public class JDBCUtils { ...@@ -761,7 +761,7 @@ public class JDBCUtils {
} }
public static String generateTableDDL(@NotNull DBRProgressMonitor monitor, @NotNull JDBCTable table, boolean addComments) throws DBException { public static String generateTableDDL(@NotNull DBRProgressMonitor monitor, @NotNull JDBCTable table, boolean addComments) throws DBException {
final DBERegistry editorsRegistry = table.getDataSource().getContainer().getApplication().getEditorsRegistry(); final DBERegistry editorsRegistry = table.getDataSource().getContainer().getPlatform().getEditorsRegistry();
final SQLObjectEditor entityEditor = editorsRegistry.getObjectManager(table.getClass(), SQLObjectEditor.class); final SQLObjectEditor entityEditor = editorsRegistry.getObjectManager(table.getClass(), SQLObjectEditor.class);
if (entityEditor instanceof SQLTableManager) { if (entityEditor instanceof SQLTableManager) {
DBEPersistAction[] ddlActions = ((SQLTableManager) entityEditor).getTableDDL(monitor, table); DBEPersistAction[] ddlActions = ((SQLTableManager) entityEditor).getTableDDL(monitor, table);
......
...@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.model.impl.jdbc.data; ...@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.model.impl.jdbc.data;
import org.jkiss.code.NotNull; import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ModelPreferences; import org.jkiss.dbeaver.ModelPreferences;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.DBPDataSource; import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.data.DBDContentStorage; import org.jkiss.dbeaver.model.data.DBDContentStorage;
import org.jkiss.dbeaver.model.data.DBDDisplayFormat; import org.jkiss.dbeaver.model.data.DBDDisplayFormat;
...@@ -81,14 +81,14 @@ public class JDBCContentBLOB extends JDBCContentLOB { ...@@ -81,14 +81,14 @@ public class JDBCContentBLOB extends JDBCContentLOB {
{ {
if (storage == null && blob != null) { if (storage == null && blob != null) {
long contentLength = getContentLength(); long contentLength = getContentLength();
DBPApplication application = dataSource.getContainer().getApplication(); DBPPlatform platform = dataSource.getContainer().getPlatform();
if (contentLength < application.getPreferenceStore().getInt(ModelPreferences.MEMORY_CONTENT_MAX_SIZE)) { if (contentLength < platform.getPreferenceStore().getInt(ModelPreferences.MEMORY_CONTENT_MAX_SIZE)) {
try { try {
try (InputStream bs = blob.getBinaryStream()) { try (InputStream bs = blob.getBinaryStream()) {
storage = BytesContentStorage.createFromStream( storage = BytesContentStorage.createFromStream(
bs, bs,
contentLength, contentLength,
application.getPreferenceStore().getString(ModelPreferences.CONTENT_HEX_ENCODING)); platform.getPreferenceStore().getString(ModelPreferences.CONTENT_HEX_ENCODING));
} }
} }
catch (SQLException e) { catch (SQLException e) {
...@@ -100,7 +100,7 @@ public class JDBCContentBLOB extends JDBCContentLOB { ...@@ -100,7 +100,7 @@ public class JDBCContentBLOB extends JDBCContentLOB {
// Create new local storage // Create new local storage
File tempFile; File tempFile;
try { try {
tempFile = ContentUtils.createTempContentFile(monitor, application, "blob" + blob.hashCode()); tempFile = ContentUtils.createTempContentFile(monitor, platform, "blob" + blob.hashCode());
} }
catch (IOException e) { catch (IOException e) {
throw new DBCException("Can't create temporary file", e); throw new DBCException("Can't create temporary file", e);
...@@ -116,7 +116,7 @@ public class JDBCContentBLOB extends JDBCContentLOB { ...@@ -116,7 +116,7 @@ public class JDBCContentBLOB extends JDBCContentLOB {
ContentUtils.deleteTempFile(tempFile); ContentUtils.deleteTempFile(tempFile);
throw new DBCException(e, dataSource); throw new DBCException(e, dataSource);
} }
this.storage = new TemporaryContentStorage(application, tempFile); this.storage = new TemporaryContentStorage(platform, tempFile);
} }
// Free blob - we don't need it anymore // Free blob - we don't need it anymore
releaseBlob(); releaseBlob();
......
...@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.model.impl.jdbc.data; ...@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.model.impl.jdbc.data;
import org.jkiss.code.NotNull; import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ModelPreferences; import org.jkiss.dbeaver.ModelPreferences;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.DBPDataSource; import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.data.DBDContent; import org.jkiss.dbeaver.model.data.DBDContent;
import org.jkiss.dbeaver.model.data.DBDContentCached; import org.jkiss.dbeaver.model.data.DBDContentCached;
...@@ -85,8 +85,8 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent { ...@@ -85,8 +85,8 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent {
{ {
if (storage == null && clob != null) { if (storage == null && clob != null) {
long contentLength = getContentLength(); long contentLength = getContentLength();
DBPApplication application = dataSource.getContainer().getApplication(); DBPPlatform platform = dataSource.getContainer().getPlatform();
if (contentLength < application.getPreferenceStore().getInt(ModelPreferences.MEMORY_CONTENT_MAX_SIZE)) { if (contentLength < platform.getPreferenceStore().getInt(ModelPreferences.MEMORY_CONTENT_MAX_SIZE)) {
try { try {
storage = StringContentStorage.createFromReader(clob.getCharacterStream(), contentLength); storage = StringContentStorage.createFromReader(clob.getCharacterStream(), contentLength);
} }
...@@ -99,7 +99,7 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent { ...@@ -99,7 +99,7 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent {
// Create new local storage // Create new local storage
File tempFile; File tempFile;
try { try {
tempFile = ContentUtils.createTempContentFile(monitor, application, "clob" + clob.hashCode()); tempFile = ContentUtils.createTempContentFile(monitor, platform, "clob" + clob.hashCode());
} }
catch (IOException e) { catch (IOException e) {
throw new DBCException("Can't create temp file", e); throw new DBCException("Can't create temp file", e);
...@@ -113,7 +113,7 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent { ...@@ -113,7 +113,7 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent {
ContentUtils.deleteTempFile(tempFile); ContentUtils.deleteTempFile(tempFile);
throw new DBCException(e, dataSource); throw new DBCException(e, dataSource);
} }
this.storage = new TemporaryContentStorage(application, tempFile); this.storage = new TemporaryContentStorage(platform, tempFile);
} }
// Free lob - we don't need it anymore // Free lob - we don't need it anymore
releaseClob(); releaseClob();
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.model.impl.net; package org.jkiss.dbeaver.model.impl.net;
import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration; import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration; import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration;
import org.jkiss.dbeaver.model.net.DBWTunnel; import org.jkiss.dbeaver.model.net.DBWTunnel;
...@@ -32,7 +32,7 @@ import java.io.IOException; ...@@ -32,7 +32,7 @@ import java.io.IOException;
public class HTTPTunnelImpl implements DBWTunnel { public class HTTPTunnelImpl implements DBWTunnel {
@Override @Override
public DBPConnectionConfiguration initializeTunnel(DBRProgressMonitor monitor, DBPApplication application, DBWHandlerConfiguration configuration, DBPConnectionConfiguration connectionInfo) public DBPConnectionConfiguration initializeTunnel(DBRProgressMonitor monitor, DBPPlatform platform, DBWHandlerConfiguration configuration, DBPConnectionConfiguration connectionInfo)
throws DBException, IOException throws DBException, IOException
{ {
return connectionInfo; return connectionInfo;
......
...@@ -21,7 +21,7 @@ import com.jcraft.jsch.*; ...@@ -21,7 +21,7 @@ import com.jcraft.jsch.*;
import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ModelPreferences; import org.jkiss.dbeaver.ModelPreferences;
import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration; import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.DBPPreferenceStore; import org.jkiss.dbeaver.model.DBPPreferenceStore;
import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration; import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration;
...@@ -47,7 +47,7 @@ public class SSHTunnelImpl implements DBWTunnel { ...@@ -47,7 +47,7 @@ public class SSHTunnelImpl implements DBWTunnel {
private transient Session session; private transient Session session;
@Override @Override
public DBPConnectionConfiguration initializeTunnel(DBRProgressMonitor monitor, DBPApplication application, DBWHandlerConfiguration configuration, DBPConnectionConfiguration connectionInfo) public DBPConnectionConfiguration initializeTunnel(DBRProgressMonitor monitor, DBPPlatform platform, DBWHandlerConfiguration configuration, DBPConnectionConfiguration connectionInfo)
throws DBException, IOException throws DBException, IOException
{ {
String dbPortString = connectionInfo.getHostPort(); String dbPortString = connectionInfo.getHostPort();
...@@ -114,7 +114,7 @@ public class SSHTunnelImpl implements DBWTunnel { ...@@ -114,7 +114,7 @@ public class SSHTunnelImpl implements DBWTunnel {
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new DBException("Bad database port number: " + dbPortString); throw new DBException("Bad database port number: " + dbPortString);
} }
int localPort = findFreePort(application); int localPort = findFreePort(platform);
try { try {
if (jsch == null) { if (jsch == null) {
jsch = new JSch(); jsch = new JSch();
...@@ -162,9 +162,9 @@ public class SSHTunnelImpl implements DBWTunnel { ...@@ -162,9 +162,9 @@ public class SSHTunnelImpl implements DBWTunnel {
return connectionInfo; return connectionInfo;
} }
private int findFreePort(DBPApplication application) private int findFreePort(DBPPlatform platform)
{ {
DBPPreferenceStore store = application.getPreferenceStore(); DBPPreferenceStore store = platform.getPreferenceStore();
int minPort = store.getInt(ModelPreferences.NET_TUNNEL_PORT_MIN); int minPort = store.getInt(ModelPreferences.NET_TUNNEL_PORT_MIN);
int maxPort = store.getInt(ModelPreferences.NET_TUNNEL_PORT_MAX); int maxPort = store.getInt(ModelPreferences.NET_TUNNEL_PORT_MAX);
return IOUtils.findFreePort(minPort, maxPort); return IOUtils.findFreePort(minPort, maxPort);
......
...@@ -78,7 +78,7 @@ public abstract class SQLStructEditor<OBJECT_TYPE extends DBSObject, CONTAINER_T ...@@ -78,7 +78,7 @@ public abstract class SQLStructEditor<OBJECT_TYPE extends DBSObject, CONTAINER_T
protected void createObjectReferences(DBRProgressMonitor monitor, DBECommandContext commandContext, ObjectCreateCommand createCommand) throws DBException { protected void createObjectReferences(DBRProgressMonitor monitor, DBECommandContext commandContext, ObjectCreateCommand createCommand) throws DBException {
OBJECT_TYPE object = createCommand.getObject(); OBJECT_TYPE object = createCommand.getObject();
final DBERegistry editorsRegistry = object.getDataSource().getContainer().getApplication().getEditorsRegistry(); final DBERegistry editorsRegistry = object.getDataSource().getContainer().getPlatform().getEditorsRegistry();
for (Class childType : getChildTypes()) { for (Class childType : getChildTypes()) {
Collection<? extends DBSObject> children = getChildObjects(monitor, object, childType); Collection<? extends DBSObject> children = getChildObjects(monitor, object, childType);
if (!CommonUtils.isEmpty(children)) { if (!CommonUtils.isEmpty(children)) {
......
...@@ -141,7 +141,7 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T ...@@ -141,7 +141,7 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T
public DBEPersistAction[] getTableDDL(DBRProgressMonitor monitor, OBJECT_TYPE table) throws DBException public DBEPersistAction[] getTableDDL(DBRProgressMonitor monitor, OBJECT_TYPE table) throws DBException
{ {
final DBERegistry editorsRegistry = table.getDataSource().getContainer().getApplication().getEditorsRegistry(); final DBERegistry editorsRegistry = table.getDataSource().getContainer().getPlatform().getEditorsRegistry();
SQLObjectEditor<DBSEntityAttribute, OBJECT_TYPE> tcm = getObjectEditor(editorsRegistry, DBSEntityAttribute.class); SQLObjectEditor<DBSEntityAttribute, OBJECT_TYPE> tcm = getObjectEditor(editorsRegistry, DBSEntityAttribute.class);
SQLObjectEditor<DBSTableConstraint, OBJECT_TYPE> pkm = getObjectEditor(editorsRegistry, DBSTableConstraint.class); SQLObjectEditor<DBSTableConstraint, OBJECT_TYPE> pkm = getObjectEditor(editorsRegistry, DBSTableConstraint.class);
SQLObjectEditor<DBSTableForeignKey, OBJECT_TYPE> fkm = getObjectEditor(editorsRegistry, DBSTableForeignKey.class); SQLObjectEditor<DBSTableForeignKey, OBJECT_TYPE> fkm = getObjectEditor(editorsRegistry, DBSTableForeignKey.class);
......
...@@ -27,7 +27,7 @@ import org.jkiss.code.Nullable; ...@@ -27,7 +27,7 @@ import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBIconComposite; import org.jkiss.dbeaver.model.DBIconComposite;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.DBPImage; import org.jkiss.dbeaver.model.DBPImage;
import org.jkiss.dbeaver.model.DBUtils; import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.navigator.meta.DBXTreeFolder; import org.jkiss.dbeaver.model.navigator.meta.DBXTreeFolder;
...@@ -54,18 +54,18 @@ import java.util.Map; ...@@ -54,18 +54,18 @@ import java.util.Map;
public class DBNModel implements IResourceChangeListener { public class DBNModel implements IResourceChangeListener {
private static final Log log = Log.getLog(DBNModel.class); private static final Log log = Log.getLog(DBNModel.class);
private final DBPApplication application; private final DBPPlatform platform;
private DBNRoot root; private DBNRoot root;
private final List<INavigatorListener> listeners = new ArrayList<>(); private final List<INavigatorListener> listeners = new ArrayList<>();
private transient INavigatorListener[] listenersCopy = null; private transient INavigatorListener[] listenersCopy = null;
private final Map<DBSObject, Object> nodeMap = new HashMap<>(); private final Map<DBSObject, Object> nodeMap = new HashMap<>();
public DBNModel(DBPApplication application) { public DBNModel(DBPPlatform platform) {
this.application = application; this.platform = platform;
} }
public DBPApplication getApplication() { public DBPPlatform getPlatform() {
return application; return platform;
} }
public void initialize() public void initialize()
...@@ -76,16 +76,16 @@ public class DBNModel implements IResourceChangeListener { ...@@ -76,16 +76,16 @@ public class DBNModel implements IResourceChangeListener {
this.root = new DBNRoot(this); this.root = new DBNRoot(this);
// Add all existing projects to root node // Add all existing projects to root node
for (IProject project : application.getLiveProjects()) { for (IProject project : platform.getLiveProjects()) {
root.addProject(project, false); root.addProject(project, false);
} }
application.getWorkspace().addResourceChangeListener(this); platform.getWorkspace().addResourceChangeListener(this);
} }
public void dispose() public void dispose()
{ {
application.getWorkspace().removeResourceChangeListener(this); platform.getWorkspace().removeResourceChangeListener(this);
this.root.dispose(false); this.root.dispose(false);
synchronized (nodeMap) { synchronized (nodeMap) {
this.nodeMap.clear(); this.nodeMap.clear();
...@@ -484,8 +484,8 @@ public class DBNModel implements IResourceChangeListener { ...@@ -484,8 +484,8 @@ public class DBNModel implements IResourceChangeListener {
// New projectNode // New projectNode
getRoot().addProject(project, true); getRoot().addProject(project, true);
if (application.getProjectManager().getActiveProject() == null) { if (platform.getProjectManager().getActiveProject() == null) {
application.getProjectManager().setActiveProject(project); platform.getProjectManager().setActiveProject(project);
} }
} else { } else {
// Project not found - report an error // Project not found - report an error
...@@ -495,8 +495,8 @@ public class DBNModel implements IResourceChangeListener { ...@@ -495,8 +495,8 @@ public class DBNModel implements IResourceChangeListener {
if (childDelta.getKind() == IResourceDelta.REMOVED) { if (childDelta.getKind() == IResourceDelta.REMOVED) {
// Project deleted // Project deleted
getRoot().removeProject(project); getRoot().removeProject(project);
if (project == application.getProjectManager().getActiveProject()) { if (project == platform.getProjectManager().getActiveProject()) {
application.getProjectManager().setActiveProject(null); platform.getProjectManager().setActiveProject(null);
} }
} else { } else {
if (childDelta.getFlags() == IResourceDelta.OPEN) { if (childDelta.getFlags() == IResourceDelta.OPEN) {
......
...@@ -42,7 +42,7 @@ public class DBNProject extends DBNResource ...@@ -42,7 +42,7 @@ public class DBNProject extends DBNResource
public DBNProject(DBNNode parentNode, IProject project, DBPResourceHandler handler) public DBNProject(DBNNode parentNode, IProject project, DBPResourceHandler handler)
{ {
super(parentNode, project, handler); super(parentNode, project, handler);
getModel().getApplication().getProjectManager().addProject(project); getModel().getPlatform().getProjectManager().addProject(project);
} }
@Override @Override
...@@ -50,7 +50,7 @@ public class DBNProject extends DBNResource ...@@ -50,7 +50,7 @@ public class DBNProject extends DBNResource
{ {
IProject project = getProject(); IProject project = getProject();
super.dispose(reflect); super.dispose(reflect);
getModel().getApplication().getProjectManager().removeProject(project); getModel().getPlatform().getProjectManager().removeProject(project);
} }
public IProject getProject() public IProject getProject()
...@@ -108,7 +108,7 @@ public class DBNProject extends DBNResource ...@@ -108,7 +108,7 @@ public class DBNProject extends DBNResource
public boolean supportsRename() public boolean supportsRename()
{ {
// Do not rename active projects // Do not rename active projects
return getModel().getApplication().getProjectManager().getActiveProject() != getProject(); return getModel().getPlatform().getProjectManager().getActiveProject() != getProject();
} }
@Override @Override
...@@ -135,7 +135,7 @@ public class DBNProject extends DBNResource ...@@ -135,7 +135,7 @@ public class DBNProject extends DBNResource
throw new DBException("Can't open project '" + project.getName() + "'", e); throw new DBException("Can't open project '" + project.getName() + "'", e);
} }
} }
DBPDataSourceRegistry dataSourceRegistry = getModel().getApplication().getProjectManager().getDataSourceRegistry(project); DBPDataSourceRegistry dataSourceRegistry = getModel().getPlatform().getProjectManager().getDataSourceRegistry(project);
DBNNode[] children = super.readChildNodes(monitor); DBNNode[] children = super.readChildNodes(monitor);
if (dataSourceRegistry != null) { if (dataSourceRegistry != null) {
children = ArrayUtils.insertArea(DBNNode.class, children, 0, new Object[] {new DBNProjectDatabases(this, dataSourceRegistry)}); children = ArrayUtils.insertArea(DBNNode.class, children, 0, new Object[] {new DBNProjectDatabases(this, dataSourceRegistry)});
......
...@@ -201,7 +201,7 @@ public class DBNResource extends DBNNode// implements IContributorResourceAdapte ...@@ -201,7 +201,7 @@ public class DBNResource extends DBNNode// implements IContributorResourceAdapte
// Sub folder // Sub folder
return handler.makeNavigatorNode(this, resource); return handler.makeNavigatorNode(this, resource);
} }
DBPResourceHandler resourceHandler = getModel().getApplication().getProjectManager().getResourceHandler(resource); DBPResourceHandler resourceHandler = getModel().getPlatform().getProjectManager().getResourceHandler(resource);
if (resourceHandler == null) { if (resourceHandler == null) {
log.debug("Skip resource '" + resource.getName() + "'"); log.debug("Skip resource '" + resource.getName() + "'");
return null; return null;
......
...@@ -38,7 +38,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener ...@@ -38,7 +38,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener
{ {
super(); super();
this.model = model; this.model = model;
model.getApplication().getProjectManager().addProjectListener(this); model.getPlatform().getProjectManager().addProjectListener(this);
} }
@Override @Override
...@@ -48,7 +48,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener ...@@ -48,7 +48,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener
project.dispose(reflect); project.dispose(reflect);
} }
projects = new DBNProject[0]; projects = new DBNProject[0];
model.getApplication().getProjectManager().removeProjectListener(this); model.getPlatform().getProjectManager().removeProjectListener(this);
} }
@Override @Override
...@@ -141,7 +141,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener ...@@ -141,7 +141,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener
DBNProject projectNode = new DBNProject( DBNProject projectNode = new DBNProject(
this, this,
project, project,
model.getApplication().getProjectManager().getResourceHandler(project)); model.getPlatform().getProjectManager().getResourceHandler(project));
projects = ArrayUtils.add(DBNProject.class, projects, projectNode); projects = ArrayUtils.add(DBNProject.class, projects, projectNode);
Arrays.sort(projects, new Comparator<DBNProject>() { Arrays.sort(projects, new Comparator<DBNProject>() {
@Override @Override
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.model.net; package org.jkiss.dbeaver.model.net;
import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration; import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
...@@ -29,7 +29,7 @@ import java.io.IOException; ...@@ -29,7 +29,7 @@ import java.io.IOException;
*/ */
public interface DBWTunnel extends DBWNetworkHandler { public interface DBWTunnel extends DBWNetworkHandler {
DBPConnectionConfiguration initializeTunnel(DBRProgressMonitor monitor, DBPApplication application, DBWHandlerConfiguration configuration, DBPConnectionConfiguration connectionInfo) DBPConnectionConfiguration initializeTunnel(DBRProgressMonitor monitor, DBPPlatform platform, DBWHandlerConfiguration configuration, DBPConnectionConfiguration connectionInfo)
throws DBException, IOException; throws DBException, IOException;
void closeTunnel(DBRProgressMonitor monitor, DBPConnectionConfiguration connectionInfo) void closeTunnel(DBRProgressMonitor monitor, DBPConnectionConfiguration connectionInfo)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.model.qm; package org.jkiss.dbeaver.model.qm;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -28,10 +28,10 @@ import java.util.List; ...@@ -28,10 +28,10 @@ import java.util.List;
*/ */
public class QMUtils { public class QMUtils {
private static DBPApplication application; private static DBPPlatform application;
private static QMExecutionHandler defaultHandler; private static QMExecutionHandler defaultHandler;
public static void initApplication(DBPApplication application) { public static void initApplication(DBPPlatform application) {
QMUtils.application = application; QMUtils.application = application;
} }
......
...@@ -321,7 +321,7 @@ public class DBVModel extends DBVContainer { ...@@ -321,7 +321,7 @@ public class DBVModel extends DBVContainer {
case TAG_EXCLUDE: case TAG_EXCLUDE:
String transformerId = atts.getValue(ATTR_ID); String transformerId = atts.getValue(ATTR_ID);
if (curTransformSettings != null && !CommonUtils.isEmpty(transformerId)) { if (curTransformSettings != null && !CommonUtils.isEmpty(transformerId)) {
final DBDAttributeTransformerDescriptor transformer = dataSourceContainer.getApplication().getValueHandlerRegistry().getTransformer(transformerId); final DBDAttributeTransformerDescriptor transformer = dataSourceContainer.getPlatform().getValueHandlerRegistry().getTransformer(transformerId);
if (transformer == null) { if (transformer == null) {
log.warn("Transformer '" + transformerId + "' not found"); log.warn("Transformer '" + transformerId + "' not found");
} else { } else {
......
...@@ -98,7 +98,7 @@ public abstract class DBVUtils { ...@@ -98,7 +98,7 @@ public abstract class DBVUtils {
DBPDataSource dataSource = binding.getDataSource(); DBPDataSource dataSource = binding.getDataSource();
DBPDataSourceContainer container = dataSource.getContainer(); DBPDataSourceContainer container = dataSource.getContainer();
List<? extends DBDAttributeTransformerDescriptor> tdList = List<? extends DBDAttributeTransformerDescriptor> tdList =
container.getApplication().getValueHandlerRegistry().findTransformers(dataSource, binding.getAttribute(), custom); container.getPlatform().getValueHandlerRegistry().findTransformers(dataSource, binding.getAttribute(), custom);
if (tdList == null || tdList.isEmpty()) { if (tdList == null || tdList.isEmpty()) {
return null; return null;
} }
......
...@@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IPath; ...@@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IPath;
import org.jkiss.code.NotNull; import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable; import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPApplication; import org.jkiss.dbeaver.model.DBPPlatform;
import org.jkiss.dbeaver.model.data.DBDContent; import org.jkiss.dbeaver.model.data.DBDContent;
import org.jkiss.dbeaver.model.data.DBDContentCached; import org.jkiss.dbeaver.model.data.DBDContentCached;
import org.jkiss.dbeaver.model.data.DBDContentStorage; import org.jkiss.dbeaver.model.data.DBDContentStorage;
...@@ -61,13 +61,13 @@ public class ContentUtils { ...@@ -61,13 +61,13 @@ public class ContentUtils {
} }
public static File getLobFolder(DBRProgressMonitor monitor, DBPApplication application) public static File getLobFolder(DBRProgressMonitor monitor, DBPPlatform application)
throws IOException throws IOException
{ {
return application.getTempFolder(monitor, LOB_DIR); return application.getTempFolder(monitor, LOB_DIR);
} }
public static File createTempContentFile(DBRProgressMonitor monitor, DBPApplication application, String fileName) public static File createTempContentFile(DBRProgressMonitor monitor, DBPPlatform application, String fileName)
throws IOException throws IOException
{ {
return makeTempFile( return makeTempFile(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册