Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
e5c9be86
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5c9be86
编写于
12月 02, 2016
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Application model refactoring
上级
39f8a01d
变更
35
隐藏空白更改
内联
并排
Showing
35 changed file
with
166 addition
and
168 deletion
+166
-168
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
....dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
.../src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
+3
-5
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceRegistry.java
...re/src/org/jkiss/dbeaver/registry/DataSourceRegistry.java
+5
-5
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetFilterPanel.java
...s/dbeaver/ui/controls/resultset/ResultSetFilterPanel.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
.../jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
+3
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/TransformerSettingsDialog.java
...aver/ui/controls/resultset/TransformerSettingsDialog.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/tools/AbstractToolWizard.java
...rg/jkiss/dbeaver/ui/dialogs/tools/AbstractToolWizard.java
+1
-1
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/model/MySQLDataSource.java
...rc/org/jkiss/dbeaver/ext/mysql/model/MySQLDataSource.java
+1
-1
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/data/OracleContentBFILE.java
...org/jkiss/dbeaver/ext/oracle/data/OracleContentBFILE.java
+6
-6
plugins/org.jkiss.dbeaver.ext.wmi/src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
.../src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDataSourceContainer.java
...l/src/org/jkiss/dbeaver/model/DBPDataSourceContainer.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDataSourceProvider.java
...el/src/org/jkiss/dbeaver/model/DBPDataSourceProvider.java
+2
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDataSourceRegistry.java
...el/src/org/jkiss/dbeaver/model/DBPDataSourceRegistry.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPPlatform.java
...beaver.model/src/org/jkiss/dbeaver/model/DBPPlatform.java
+70
-70
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBUtils.java
...ss.dbeaver.model/src/org/jkiss/dbeaver/model/DBUtils.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/ExternalContentStorage.java
.../org/jkiss/dbeaver/model/impl/ExternalContentStorage.java
+8
-8
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/TemporaryContentStorage.java
...org/jkiss/dbeaver/model/impl/TemporaryContentStorage.java
+6
-6
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/edit/AbstractCommandContext.java
...jkiss/dbeaver/model/impl/edit/AbstractCommandContext.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCDataSourceProvider.java
...jkiss/dbeaver/model/impl/jdbc/JDBCDataSourceProvider.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCUtils.java
...odel/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCUtils.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentBLOB.java
...g/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentBLOB.java
+6
-6
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentCLOB.java
...g/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentCLOB.java
+5
-5
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/net/HTTPTunnelImpl.java
.../src/org/jkiss/dbeaver/model/impl/net/HTTPTunnelImpl.java
+2
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/net/SSHTunnelImpl.java
...l/src/org/jkiss/dbeaver/model/impl/net/SSHTunnelImpl.java
+5
-5
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/SQLStructEditor.java
...rg/jkiss/dbeaver/model/impl/sql/edit/SQLStructEditor.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLTableManager.java
...s/dbeaver/model/impl/sql/edit/struct/SQLTableManager.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNModel.java
...model/src/org/jkiss/dbeaver/model/navigator/DBNModel.java
+13
-13
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNProject.java
...del/src/org/jkiss/dbeaver/model/navigator/DBNProject.java
+4
-4
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNResource.java
...el/src/org/jkiss/dbeaver/model/navigator/DBNResource.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNRoot.java
....model/src/org/jkiss/dbeaver/model/navigator/DBNRoot.java
+3
-3
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/net/DBWTunnel.java
...aver.model/src/org/jkiss/dbeaver/model/net/DBWTunnel.java
+2
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMUtils.java
...dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMUtils.java
+3
-3
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVModel.java
...r.model/src/org/jkiss/dbeaver/model/virtual/DBVModel.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVUtils.java
...r.model/src/org/jkiss/dbeaver/model/virtual/DBVUtils.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
...eaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
+3
-3
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
浏览文件 @
e5c9be86
...
...
@@ -65,7 +65,7 @@ import java.util.List;
/**
* DBeaverCore
*/
public
class
DBeaverCore
implements
DBP
Application
{
public
class
DBeaverCore
implements
DBP
Platform
{
// The plug-in ID
public
static
final
String
PLUGIN_ID
=
"org.jkiss.dbeaver.core"
;
//$NON-NLS-1$
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java
浏览文件 @
e5c9be86
...
...
@@ -17,7 +17,6 @@
*/
package
org.jkiss.dbeaver.registry
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.core.runtime.jobs.Job
;
import
org.eclipse.equinox.security.storage.ISecurePreferences
;
...
...
@@ -25,7 +24,6 @@ import org.jkiss.code.NotNull;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.*
;
import
org.jkiss.dbeaver.model.connection.DBPClientHome
;
import
org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration
;
...
...
@@ -196,8 +194,8 @@ public class DataSourceDescriptor
@NotNull
@Override
public
DBP
Application
getApplication
()
{
return
registry
.
get
Application
();
public
DBP
Platform
getPlatform
()
{
return
registry
.
get
Platform
();
}
public
void
setDriver
(
@NotNull
DriverDescriptor
driver
)
...
...
@@ -639,7 +637,7 @@ public class DataSourceDescriptor
monitor
.
subTask
(
"Initialize tunnel"
);
tunnel
=
tunnelConfiguration
.
createHandler
(
DBWTunnel
.
class
);
try
{
tunnelConnectionInfo
=
tunnel
.
initializeTunnel
(
monitor
,
registry
.
get
Application
(),
tunnelConfiguration
,
connectionInfo
);
tunnelConnectionInfo
=
tunnel
.
initializeTunnel
(
monitor
,
registry
.
get
Platform
(),
tunnelConfiguration
,
connectionInfo
);
}
catch
(
Exception
e
)
{
throw
new
DBCException
(
"Can't initialize tunnel"
,
e
);
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceRegistry.java
浏览文件 @
e5c9be86
...
...
@@ -79,16 +79,16 @@ public class DataSourceRegistry implements DBPDataSourceRegistry
private
static
PasswordEncrypter
ENCRYPTOR
=
new
SimpleStringEncrypter
();
private
final
DBP
Application
application
;
private
final
DBP
Platform
platform
;
private
final
IProject
project
;
private
final
List
<
DataSourceDescriptor
>
dataSources
=
new
ArrayList
<>();
private
final
List
<
DBPEventListener
>
dataSourceListeners
=
new
ArrayList
<>();
private
volatile
boolean
saveInProgress
=
false
;
public
DataSourceRegistry
(
DBP
Application
application
,
IProject
project
)
public
DataSourceRegistry
(
DBP
Platform
platform
,
IProject
project
)
{
this
.
application
=
application
;
this
.
platform
=
platform
;
this
.
project
=
project
;
loadDataSources
(
false
);
DataSourceProviderRegistry
.
getInstance
().
fireRegistryChange
(
this
,
true
);
...
...
@@ -141,8 +141,8 @@ public class DataSourceRegistry implements DBPDataSourceRegistry
}
@NotNull
public
DBP
Application
getApplication
()
{
return
application
;
public
DBP
Platform
getPlatform
()
{
return
platform
;
}
////////////////////////////////////////////////////
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetFilterPanel.java
浏览文件 @
e5c9be86
...
...
@@ -329,7 +329,7 @@ class ResultSetFilterPanel extends Composite implements IContentProposalProvider
private
DBPImage
getActiveObjectImage
()
{
DBSDataContainer
dataContainer
=
viewer
.
getDataContainer
();
if
(
dataContainer
instanceof
DBSEntity
)
{
DBNDatabaseNode
dcNode
=
viewer
.
getDataContainer
().
getDataSource
().
getContainer
().
get
Application
().
getNavigatorModel
().
findNode
(
dataContainer
);
DBNDatabaseNode
dcNode
=
viewer
.
getDataContainer
().
getDataSource
().
getContainer
().
get
Platform
().
getNavigatorModel
().
findNode
(
dataContainer
);
if
(
dcNode
!=
null
)
{
return
dcNode
.
getNodeIcon
();
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
浏览文件 @
e5c9be86
...
...
@@ -1520,7 +1520,7 @@ public class ResultSetViewer extends Viewer
"view"
);
//$NON-NLS-1$
List
<?
extends
DBDAttributeTransformerDescriptor
>
transformers
=
dataSource
.
getContainer
().
get
Application
().
getValueHandlerRegistry
().
findTransformers
(
dataSource
.
getContainer
().
get
Platform
().
getValueHandlerRegistry
().
findTransformers
(
dataSource
,
attr
,
null
);
if
(!
CommonUtils
.
isEmpty
(
transformers
))
{
MenuManager
transformersMenu
=
new
MenuManager
(
"View as"
);
...
...
@@ -1660,7 +1660,7 @@ public class ResultSetViewer extends Viewer
return
;
}
final
DBPDataSource
dataSource
=
dataContainer
.
getDataSource
();
final
DBDRegistry
registry
=
dataSource
.
getContainer
().
get
Application
().
getValueHandlerRegistry
();
final
DBDRegistry
registry
=
dataSource
.
getContainer
().
get
Platform
().
getValueHandlerRegistry
();
final
DBVTransformSettings
transformSettings
=
DBVUtils
.
getTransformSettings
(
attr
,
false
);
DBDAttributeTransformerDescriptor
customTransformer
=
null
;
if
(
transformSettings
!=
null
&&
transformSettings
.
getCustomTransformer
()
!=
null
)
{
...
...
@@ -1876,7 +1876,7 @@ public class ResultSetViewer extends Viewer
if
(
dataSource
==
null
)
{
return
;
}
final
DBNDatabaseNode
targetNode
=
dataSource
.
getContainer
().
get
Application
().
getNavigatorModel
().
getNodeByObject
(
monitor
,
targetEntity
,
false
);
final
DBNDatabaseNode
targetNode
=
dataSource
.
getContainer
().
get
Platform
().
getNavigatorModel
().
getNodeByObject
(
monitor
,
targetEntity
,
false
);
if
(
targetNode
==
null
)
{
UIUtils
.
showMessageBox
(
null
,
"Open link"
,
"Can't navigate to '"
+
DBUtils
.
getObjectFullName
(
targetEntity
,
DBPEvaluationContext
.
UI
)
+
"' - navigator node not found"
,
SWT
.
ICON_ERROR
);
return
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/TransformerSettingsDialog.java
浏览文件 @
e5c9be86
...
...
@@ -67,7 +67,7 @@ class TransformerSettingsDialog extends BaseDialog {
Collection
<?
extends
DBPPropertyDescriptor
>
properties
=
Collections
.
emptyList
();
final
DBDAttributeTransformerDescriptor
transformer
;
if
(
dataSource
!=
null
&&
!
CommonUtils
.
isEmpty
(
settings
.
getCustomTransformer
()))
{
transformer
=
dataSource
.
getContainer
().
get
Application
().
getValueHandlerRegistry
().
getTransformer
(
settings
.
getCustomTransformer
());
transformer
=
dataSource
.
getContainer
().
get
Platform
().
getValueHandlerRegistry
().
getTransformer
(
settings
.
getCustomTransformer
());
if
(
transformer
!=
null
)
{
properties
=
transformer
.
getProperties
();
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/tools/AbstractToolWizard.java
浏览文件 @
e5c9be86
...
...
@@ -193,7 +193,7 @@ public abstract class AbstractToolWizard<BASE_OBJECT extends DBSObject, PROCESS_
}
// Refresh navigator node (script execution can change everything inside)
for
(
BASE_OBJECT
object
:
databaseObjects
)
{
final
DBNDatabaseNode
node
=
dataSourceContainer
.
get
Application
().
getNavigatorModel
().
findNode
(
object
);
final
DBNDatabaseNode
node
=
dataSourceContainer
.
get
Platform
().
getNavigatorModel
().
findNode
(
object
);
if
(
node
!=
null
)
{
node
.
refreshNode
(
monitor
,
AbstractToolWizard
.
this
);
}
...
...
plugins/org.jkiss.dbeaver.ext.mysql/src/org/jkiss/dbeaver/ext/mysql/model/MySQLDataSource.java
浏览文件 @
e5c9be86
...
...
@@ -110,7 +110,7 @@ public class MySQLDataSource extends JDBCDataSource implements DBSObjectSelector
private
void
initSSL
(
DBRProgressMonitor
monitor
,
Map
<
String
,
String
>
props
,
DBWHandlerConfiguration
sslConfig
)
throws
Exception
{
monitor
.
subTask
(
"Install SSL certificates"
);
final
DBACertificateStorage
securityManager
=
getContainer
().
get
Application
().
getCertificateStorage
();
final
DBACertificateStorage
securityManager
=
getContainer
().
get
Platform
().
getCertificateStorage
();
props
.
put
(
"useSSL"
,
"true"
);
props
.
put
(
"verifyServerCertificate"
,
String
.
valueOf
(
CommonUtils
.
toBoolean
(
sslConfig
.
getProperties
().
get
(
MySQLConstants
.
PROP_VERIFY_SERVER_SERT
))));
...
...
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/data/OracleContentBFILE.java
浏览文件 @
e5c9be86
...
...
@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.ext.oracle.data;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.data.DBDContentStorage
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
...
...
@@ -137,14 +137,14 @@ public class OracleContentBFILE extends JDBCContentLOB {
try
{
openFile
();
long
contentLength
=
getContentLength
();
DBP
Application
application
=
dataSource
.
getContainer
().
getApplication
();
if
(
contentLength
<
application
.
getPreferenceStore
().
getInt
(
ModelPreferences
.
MEMORY_CONTENT_MAX_SIZE
))
{
DBP
Platform
platform
=
dataSource
.
getContainer
().
getPlatform
();
if
(
contentLength
<
platform
.
getPreferenceStore
().
getInt
(
ModelPreferences
.
MEMORY_CONTENT_MAX_SIZE
))
{
try
{
try
(
InputStream
bs
=
getInputStream
())
{
storage
=
BytesContentStorage
.
createFromStream
(
bs
,
contentLength
,
application
.
getPreferenceStore
().
getString
(
ModelPreferences
.
CONTENT_HEX_ENCODING
));
platform
.
getPreferenceStore
().
getString
(
ModelPreferences
.
CONTENT_HEX_ENCODING
));
}
}
catch
(
IOException
e
)
{
throw
new
DBCException
(
"IO error while reading content"
,
e
);
...
...
@@ -153,7 +153,7 @@ public class OracleContentBFILE extends JDBCContentLOB {
// Create new local storage
File
tempFile
;
try
{
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
application
,
"blob"
+
bfile
.
hashCode
());
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
platform
,
"blob"
+
bfile
.
hashCode
());
}
catch
(
IOException
e
)
{
throw
new
DBCException
(
"Can't create temporary file"
,
e
);
}
...
...
@@ -168,7 +168,7 @@ public class OracleContentBFILE extends JDBCContentLOB {
ContentUtils
.
deleteTempFile
(
tempFile
);
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
releaseBlob
();
...
...
plugins/org.jkiss.dbeaver.ext.wmi/src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
浏览文件 @
e5c9be86
...
...
@@ -35,7 +35,7 @@ public class WMIDataSourceProvider implements DBPDataSourceProvider {
private
boolean
libLoaded
=
false
;
@Override
public
void
init
(
@NotNull
DBP
Application
application
)
public
void
init
(
@NotNull
DBP
Platform
platform
)
{
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDataSourceContainer.java
浏览文件 @
e5c9be86
...
...
@@ -54,7 +54,7 @@ public interface DBPDataSourceContainer extends DBSObject, DBDPreferences, DBPNa
DBPDriver
getDriver
();
@NotNull
DBP
Application
getApplication
();
DBP
Platform
getPlatform
();
/**
* Connection configuration.
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDataSourceProvider.java
浏览文件 @
e5c9be86
...
...
@@ -33,9 +33,9 @@ public interface DBPDataSourceProvider extends DBPObject
/**
* Initializes data source provider
* @param
application
application
* @param
platform
application
*/
void
init
(
@NotNull
DBP
Application
application
);
void
init
(
@NotNull
DBP
Platform
platform
);
/**
* Supported features
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDataSourceRegistry.java
浏览文件 @
e5c9be86
...
...
@@ -35,7 +35,7 @@ public interface DBPDataSourceRegistry {
String
CONFIG_FILE_NAME
=
CONFIG_FILE_PREFIX
+
CONFIG_FILE_EXT
;
@NotNull
DBP
Application
getApplication
();
DBP
Platform
getPlatform
();
/**
* Owner project.
*/
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBP
Application
.java
→
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBP
Platform
.java
浏览文件 @
e5c9be86
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.model
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IWorkspace
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.admin.DBACertificateStorage
;
import
org.jkiss.dbeaver.model.data.DBDRegistry
;
import
org.jkiss.dbeaver.model.edit.DBERegistry
;
import
org.jkiss.dbeaver.model.navigator.DBNModel
;
import
org.jkiss.dbeaver.model.qm.QMController
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.
Collection
;
/**
* DBP
Application
*/
public
interface
DBP
Application
{
@NotNull
DBNModel
getNavigatorModel
();
@NotNull
IWorkspace
getWorkspace
();
@NotNull
DBPProjectManager
getProjectManager
();
@NotNull
Collection
<
IProject
>
getLiveProjects
();
@NotNull
QMController
getQueryManager
();
@NotNull
DBDRegistry
getValueHandlerRegistry
();
@NotNull
DBERegistry
getEditorsRegistry
();
@NotNull
DBPPreferenceStore
getPreferenceStore
();
@NotNull
DBACertificateStorage
getCertificateStorage
();
@NotNull
File
getTempFolder
(
DBRProgressMonitor
monitor
,
String
name
)
throws
IOException
;
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package
org.jkiss.dbeaver.model
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IWorkspace
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.admin.DBACertificateStorage
;
import
org.jkiss.dbeaver.model.data.DBDRegistry
;
import
org.jkiss.dbeaver.model.edit.DBERegistry
;
import
org.jkiss.dbeaver.model.navigator.DBNModel
;
import
org.jkiss.dbeaver.model.qm.QMController
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.
List
;
/**
* DBP
Platform
*/
public
interface
DBP
Platform
{
@NotNull
DBNModel
getNavigatorModel
();
@NotNull
IWorkspace
getWorkspace
();
@NotNull
DBPProjectManager
getProjectManager
();
@NotNull
List
<
IProject
>
getLiveProjects
();
@NotNull
QMController
getQueryManager
();
@NotNull
DBDRegistry
getValueHandlerRegistry
();
@NotNull
DBERegistry
getEditorsRegistry
();
@NotNull
DBPPreferenceStore
getPreferenceStore
();
@NotNull
DBACertificateStorage
getCertificateStorage
();
@NotNull
File
getTempFolder
(
DBRProgressMonitor
monitor
,
String
name
)
throws
IOException
;
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBUtils.java
浏览文件 @
e5c9be86
...
...
@@ -504,7 +504,7 @@ public final class DBUtils {
{
DBDValueHandler
typeHandler
=
null
;
DBDValueHandlerProvider
typeProvider
=
dataSource
.
getContainer
().
get
Application
().
getValueHandlerRegistry
().
getDataTypeProvider
(
DBDValueHandlerProvider
typeProvider
=
dataSource
.
getContainer
().
get
Platform
().
getValueHandlerRegistry
().
getDataTypeProvider
(
dataSource
,
column
);
if
(
typeProvider
!=
null
)
{
typeHandler
=
typeProvider
.
getHandler
(
dataSource
,
preferences
,
column
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/ExternalContentStorage.java
浏览文件 @
e5c9be86
...
...
@@ -17,7 +17,7 @@
*/
package
org.jkiss.dbeaver.model.impl
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.data.DBDContentStorage
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
...
...
@@ -29,18 +29,18 @@ import java.io.*;
*/
public
class
ExternalContentStorage
implements
DBDContentStorage
{
private
final
DBP
Application
application
;
private
final
DBP
Platform
platform
;
private
File
file
;
private
String
charset
;
public
ExternalContentStorage
(
DBP
Application
application
,
File
file
)
public
ExternalContentStorage
(
DBP
Platform
platform
,
File
file
)
{
this
(
application
,
file
,
null
);
this
(
platform
,
file
,
null
);
}
public
ExternalContentStorage
(
DBP
Application
application
,
File
file
,
String
charset
)
public
ExternalContentStorage
(
DBP
Platform
platform
,
File
file
,
String
charset
)
{
this
.
application
=
application
;
this
.
platform
=
platform
;
this
.
file
=
file
;
this
.
charset
=
charset
;
}
...
...
@@ -76,7 +76,7 @@ public class ExternalContentStorage implements DBDContentStorage {
throws
IOException
{
// Create new local storage
File
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
application
,
"copy"
+
this
.
hashCode
());
File
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
platform
,
"copy"
+
this
.
hashCode
());
try
{
try
(
InputStream
is
=
new
FileInputStream
(
file
))
{
try
(
OutputStream
os
=
new
FileOutputStream
(
tempFile
))
{
...
...
@@ -87,7 +87,7 @@ public class ExternalContentStorage implements DBDContentStorage {
ContentUtils
.
deleteTempFile
(
tempFile
);
throw
new
IOException
(
e
);
}
return
new
TemporaryContentStorage
(
application
,
tempFile
);
return
new
TemporaryContentStorage
(
platform
,
tempFile
);
}
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/TemporaryContentStorage.java
浏览文件 @
e5c9be86
...
...
@@ -17,7 +17,7 @@
*/
package
org.jkiss.dbeaver.model.impl
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.data.DBDContentStorage
;
import
org.jkiss.dbeaver.model.data.DBDContentStorageLocal
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
...
...
@@ -31,12 +31,12 @@ import java.io.*;
*/
public
class
TemporaryContentStorage
implements
DBDContentStorageLocal
{
private
final
DBP
Application
application
;
private
final
DBP
Platform
platform
;
private
File
file
;
public
TemporaryContentStorage
(
DBP
Application
application
,
File
file
)
public
TemporaryContentStorage
(
DBP
Platform
platform
,
File
file
)
{
this
.
application
=
application
;
this
.
platform
=
platform
;
this
.
file
=
file
;
}
...
...
@@ -71,7 +71,7 @@ public class TemporaryContentStorage implements DBDContentStorageLocal {
throws
IOException
{
// Create new local storage
File
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
application
,
"copy"
+
this
.
hashCode
());
File
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
platform
,
"copy"
+
this
.
hashCode
());
try
{
try
(
InputStream
is
=
new
FileInputStream
(
file
))
{
try
(
OutputStream
os
=
new
FileOutputStream
(
tempFile
))
{
...
...
@@ -82,7 +82,7 @@ public class TemporaryContentStorage implements DBDContentStorageLocal {
ContentUtils
.
deleteTempFile
(
tempFile
);
throw
new
IOException
(
e
);
}
return
new
TemporaryContentStorage
(
application
,
tempFile
);
return
new
TemporaryContentStorage
(
platform
,
tempFile
);
}
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/edit/AbstractCommandContext.java
浏览文件 @
e5c9be86
...
...
@@ -542,7 +542,7 @@ public abstract class AbstractCommandContext implements DBECommandContext {
}
}
if
(
queue
==
null
)
{
DBEObjectManager
<?>
objectManager
=
executionContext
.
getDataSource
().
getContainer
().
get
Application
().
getEditorsRegistry
().
getObjectManager
(
object
.
getClass
());
DBEObjectManager
<?>
objectManager
=
executionContext
.
getDataSource
().
getContainer
().
get
Platform
().
getEditorsRegistry
().
getObjectManager
(
object
.
getClass
());
if
(
objectManager
==
null
)
{
throw
new
IllegalStateException
(
"Can't find object manager for '"
+
object
.
getClass
().
getName
()
+
"'"
);
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCDataSourceProvider.java
浏览文件 @
e5c9be86
...
...
@@ -41,7 +41,7 @@ public abstract class JDBCDataSourceProvider implements DBPDataSourceProvider {
static
final
protected
Log
log
=
Log
.
getLog
(
JDBCDataSourceProvider
.
class
);
@Override
public
void
init
(
@NotNull
DBP
Application
application
)
{
public
void
init
(
@NotNull
DBP
Platform
platform
)
{
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCUtils.java
浏览文件 @
e5c9be86
...
...
@@ -761,7 +761,7 @@ public class JDBCUtils {
}
public
static
String
generateTableDDL
(
@NotNull
DBRProgressMonitor
monitor
,
@NotNull
JDBCTable
table
,
boolean
addComments
)
throws
DBException
{
final
DBERegistry
editorsRegistry
=
table
.
getDataSource
().
getContainer
().
get
Application
().
getEditorsRegistry
();
final
DBERegistry
editorsRegistry
=
table
.
getDataSource
().
getContainer
().
get
Platform
().
getEditorsRegistry
();
final
SQLObjectEditor
entityEditor
=
editorsRegistry
.
getObjectManager
(
table
.
getClass
(),
SQLObjectEditor
.
class
);
if
(
entityEditor
instanceof
SQLTableManager
)
{
DBEPersistAction
[]
ddlActions
=
((
SQLTableManager
)
entityEditor
).
getTableDDL
(
monitor
,
table
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentBLOB.java
浏览文件 @
e5c9be86
...
...
@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.model.impl.jdbc.data;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.data.DBDContentStorage
;
import
org.jkiss.dbeaver.model.data.DBDDisplayFormat
;
...
...
@@ -81,14 +81,14 @@ public class JDBCContentBLOB extends JDBCContentLOB {
{
if
(
storage
==
null
&&
blob
!=
null
)
{
long
contentLength
=
getContentLength
();
DBP
Application
application
=
dataSource
.
getContainer
().
getApplication
();
if
(
contentLength
<
application
.
getPreferenceStore
().
getInt
(
ModelPreferences
.
MEMORY_CONTENT_MAX_SIZE
))
{
DBP
Platform
platform
=
dataSource
.
getContainer
().
getPlatform
();
if
(
contentLength
<
platform
.
getPreferenceStore
().
getInt
(
ModelPreferences
.
MEMORY_CONTENT_MAX_SIZE
))
{
try
{
try
(
InputStream
bs
=
blob
.
getBinaryStream
())
{
storage
=
BytesContentStorage
.
createFromStream
(
bs
,
contentLength
,
application
.
getPreferenceStore
().
getString
(
ModelPreferences
.
CONTENT_HEX_ENCODING
));
platform
.
getPreferenceStore
().
getString
(
ModelPreferences
.
CONTENT_HEX_ENCODING
));
}
}
catch
(
SQLException
e
)
{
...
...
@@ -100,7 +100,7 @@ public class JDBCContentBLOB extends JDBCContentLOB {
// Create new local storage
File
tempFile
;
try
{
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
application
,
"blob"
+
blob
.
hashCode
());
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
platform
,
"blob"
+
blob
.
hashCode
());
}
catch
(
IOException
e
)
{
throw
new
DBCException
(
"Can't create temporary file"
,
e
);
...
...
@@ -116,7 +116,7 @@ public class JDBCContentBLOB extends JDBCContentLOB {
ContentUtils
.
deleteTempFile
(
tempFile
);
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
releaseBlob
();
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCContentCLOB.java
浏览文件 @
e5c9be86
...
...
@@ -20,7 +20,7 @@ package org.jkiss.dbeaver.model.impl.jdbc.data;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.data.DBDContent
;
import
org.jkiss.dbeaver.model.data.DBDContentCached
;
...
...
@@ -85,8 +85,8 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent {
{
if
(
storage
==
null
&&
clob
!=
null
)
{
long
contentLength
=
getContentLength
();
DBP
Application
application
=
dataSource
.
getContainer
().
getApplication
();
if
(
contentLength
<
application
.
getPreferenceStore
().
getInt
(
ModelPreferences
.
MEMORY_CONTENT_MAX_SIZE
))
{
DBP
Platform
platform
=
dataSource
.
getContainer
().
getPlatform
();
if
(
contentLength
<
platform
.
getPreferenceStore
().
getInt
(
ModelPreferences
.
MEMORY_CONTENT_MAX_SIZE
))
{
try
{
storage
=
StringContentStorage
.
createFromReader
(
clob
.
getCharacterStream
(),
contentLength
);
}
...
...
@@ -99,7 +99,7 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent {
// Create new local storage
File
tempFile
;
try
{
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
application
,
"clob"
+
clob
.
hashCode
());
tempFile
=
ContentUtils
.
createTempContentFile
(
monitor
,
platform
,
"clob"
+
clob
.
hashCode
());
}
catch
(
IOException
e
)
{
throw
new
DBCException
(
"Can't create temp file"
,
e
);
...
...
@@ -113,7 +113,7 @@ public class JDBCContentCLOB extends JDBCContentLOB implements DBDContent {
ContentUtils
.
deleteTempFile
(
tempFile
);
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
releaseClob
();
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/net/HTTPTunnelImpl.java
浏览文件 @
e5c9be86
...
...
@@ -18,7 +18,7 @@
package
org.jkiss.dbeaver.model.impl.net
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.model.net.DBWHandlerConfiguration
;
import
org.jkiss.dbeaver.model.net.DBWTunnel
;
...
...
@@ -32,7 +32,7 @@ import java.io.IOException;
public
class
HTTPTunnelImpl
implements
DBWTunnel
{
@Override
public
DBPConnectionConfiguration
initializeTunnel
(
DBRProgressMonitor
monitor
,
DBP
Application
application
,
DBWHandlerConfiguration
configuration
,
DBPConnectionConfiguration
connectionInfo
)
public
DBPConnectionConfiguration
initializeTunnel
(
DBRProgressMonitor
monitor
,
DBP
Platform
platform
,
DBWHandlerConfiguration
configuration
,
DBPConnectionConfiguration
connectionInfo
)
throws
DBException
,
IOException
{
return
connectionInfo
;
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/net/SSHTunnelImpl.java
浏览文件 @
e5c9be86
...
...
@@ -21,7 +21,7 @@ import com.jcraft.jsch.*;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ModelPreferences
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.model.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.net.DBWHandlerConfiguration
;
...
...
@@ -47,7 +47,7 @@ public class SSHTunnelImpl implements DBWTunnel {
private
transient
Session
session
;
@Override
public
DBPConnectionConfiguration
initializeTunnel
(
DBRProgressMonitor
monitor
,
DBP
Application
application
,
DBWHandlerConfiguration
configuration
,
DBPConnectionConfiguration
connectionInfo
)
public
DBPConnectionConfiguration
initializeTunnel
(
DBRProgressMonitor
monitor
,
DBP
Platform
platform
,
DBWHandlerConfiguration
configuration
,
DBPConnectionConfiguration
connectionInfo
)
throws
DBException
,
IOException
{
String
dbPortString
=
connectionInfo
.
getHostPort
();
...
...
@@ -114,7 +114,7 @@ public class SSHTunnelImpl implements DBWTunnel {
}
catch
(
NumberFormatException
e
)
{
throw
new
DBException
(
"Bad database port number: "
+
dbPortString
);
}
int
localPort
=
findFreePort
(
application
);
int
localPort
=
findFreePort
(
platform
);
try
{
if
(
jsch
==
null
)
{
jsch
=
new
JSch
();
...
...
@@ -162,9 +162,9 @@ public class SSHTunnelImpl implements DBWTunnel {
return
connectionInfo
;
}
private
int
findFreePort
(
DBP
Application
application
)
private
int
findFreePort
(
DBP
Platform
platform
)
{
DBPPreferenceStore
store
=
application
.
getPreferenceStore
();
DBPPreferenceStore
store
=
platform
.
getPreferenceStore
();
int
minPort
=
store
.
getInt
(
ModelPreferences
.
NET_TUNNEL_PORT_MIN
);
int
maxPort
=
store
.
getInt
(
ModelPreferences
.
NET_TUNNEL_PORT_MAX
);
return
IOUtils
.
findFreePort
(
minPort
,
maxPort
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/SQLStructEditor.java
浏览文件 @
e5c9be86
...
...
@@ -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
{
OBJECT_TYPE
object
=
createCommand
.
getObject
();
final
DBERegistry
editorsRegistry
=
object
.
getDataSource
().
getContainer
().
get
Application
().
getEditorsRegistry
();
final
DBERegistry
editorsRegistry
=
object
.
getDataSource
().
getContainer
().
get
Platform
().
getEditorsRegistry
();
for
(
Class
childType
:
getChildTypes
())
{
Collection
<?
extends
DBSObject
>
children
=
getChildObjects
(
monitor
,
object
,
childType
);
if
(!
CommonUtils
.
isEmpty
(
children
))
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/edit/struct/SQLTableManager.java
浏览文件 @
e5c9be86
...
...
@@ -141,7 +141,7 @@ public abstract class SQLTableManager<OBJECT_TYPE extends JDBCTable, CONTAINER_T
public
DBEPersistAction
[]
getTableDDL
(
DBRProgressMonitor
monitor
,
OBJECT_TYPE
table
)
throws
DBException
{
final
DBERegistry
editorsRegistry
=
table
.
getDataSource
().
getContainer
().
get
Application
().
getEditorsRegistry
();
final
DBERegistry
editorsRegistry
=
table
.
getDataSource
().
getContainer
().
get
Platform
().
getEditorsRegistry
();
SQLObjectEditor
<
DBSEntityAttribute
,
OBJECT_TYPE
>
tcm
=
getObjectEditor
(
editorsRegistry
,
DBSEntityAttribute
.
class
);
SQLObjectEditor
<
DBSTableConstraint
,
OBJECT_TYPE
>
pkm
=
getObjectEditor
(
editorsRegistry
,
DBSTableConstraint
.
class
);
SQLObjectEditor
<
DBSTableForeignKey
,
OBJECT_TYPE
>
fkm
=
getObjectEditor
(
editorsRegistry
,
DBSTableForeignKey
.
class
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNModel.java
浏览文件 @
e5c9be86
...
...
@@ -27,7 +27,7 @@ import org.jkiss.code.Nullable;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBIconComposite
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.DBPImage
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.navigator.meta.DBXTreeFolder
;
...
...
@@ -54,18 +54,18 @@ import java.util.Map;
public
class
DBNModel
implements
IResourceChangeListener
{
private
static
final
Log
log
=
Log
.
getLog
(
DBNModel
.
class
);
private
final
DBP
Application
application
;
private
final
DBP
Platform
platform
;
private
DBNRoot
root
;
private
final
List
<
INavigatorListener
>
listeners
=
new
ArrayList
<>();
private
transient
INavigatorListener
[]
listenersCopy
=
null
;
private
final
Map
<
DBSObject
,
Object
>
nodeMap
=
new
HashMap
<>();
public
DBNModel
(
DBP
Application
application
)
{
this
.
application
=
application
;
public
DBNModel
(
DBP
Platform
platform
)
{
this
.
platform
=
platform
;
}
public
DBP
Application
getApplication
()
{
return
application
;
public
DBP
Platform
getPlatform
()
{
return
platform
;
}
public
void
initialize
()
...
...
@@ -76,16 +76,16 @@ public class DBNModel implements IResourceChangeListener {
this
.
root
=
new
DBNRoot
(
this
);
// Add all existing projects to root node
for
(
IProject
project
:
application
.
getLiveProjects
())
{
for
(
IProject
project
:
platform
.
getLiveProjects
())
{
root
.
addProject
(
project
,
false
);
}
application
.
getWorkspace
().
addResourceChangeListener
(
this
);
platform
.
getWorkspace
().
addResourceChangeListener
(
this
);
}
public
void
dispose
()
{
application
.
getWorkspace
().
removeResourceChangeListener
(
this
);
platform
.
getWorkspace
().
removeResourceChangeListener
(
this
);
this
.
root
.
dispose
(
false
);
synchronized
(
nodeMap
)
{
this
.
nodeMap
.
clear
();
...
...
@@ -484,8 +484,8 @@ public class DBNModel implements IResourceChangeListener {
// New projectNode
getRoot
().
addProject
(
project
,
true
);
if
(
application
.
getProjectManager
().
getActiveProject
()
==
null
)
{
application
.
getProjectManager
().
setActiveProject
(
project
);
if
(
platform
.
getProjectManager
().
getActiveProject
()
==
null
)
{
platform
.
getProjectManager
().
setActiveProject
(
project
);
}
}
else
{
// Project not found - report an error
...
...
@@ -495,8 +495,8 @@ public class DBNModel implements IResourceChangeListener {
if
(
childDelta
.
getKind
()
==
IResourceDelta
.
REMOVED
)
{
// Project deleted
getRoot
().
removeProject
(
project
);
if
(
project
==
application
.
getProjectManager
().
getActiveProject
())
{
application
.
getProjectManager
().
setActiveProject
(
null
);
if
(
project
==
platform
.
getProjectManager
().
getActiveProject
())
{
platform
.
getProjectManager
().
setActiveProject
(
null
);
}
}
else
{
if
(
childDelta
.
getFlags
()
==
IResourceDelta
.
OPEN
)
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNProject.java
浏览文件 @
e5c9be86
...
...
@@ -42,7 +42,7 @@ public class DBNProject extends DBNResource
public
DBNProject
(
DBNNode
parentNode
,
IProject
project
,
DBPResourceHandler
handler
)
{
super
(
parentNode
,
project
,
handler
);
getModel
().
get
Application
().
getProjectManager
().
addProject
(
project
);
getModel
().
get
Platform
().
getProjectManager
().
addProject
(
project
);
}
@Override
...
...
@@ -50,7 +50,7 @@ public class DBNProject extends DBNResource
{
IProject
project
=
getProject
();
super
.
dispose
(
reflect
);
getModel
().
get
Application
().
getProjectManager
().
removeProject
(
project
);
getModel
().
get
Platform
().
getProjectManager
().
removeProject
(
project
);
}
public
IProject
getProject
()
...
...
@@ -108,7 +108,7 @@ public class DBNProject extends DBNResource
public
boolean
supportsRename
()
{
// Do not rename active projects
return
getModel
().
get
Application
().
getProjectManager
().
getActiveProject
()
!=
getProject
();
return
getModel
().
get
Platform
().
getProjectManager
().
getActiveProject
()
!=
getProject
();
}
@Override
...
...
@@ -135,7 +135,7 @@ public class DBNProject extends DBNResource
throw
new
DBException
(
"Can't open project '"
+
project
.
getName
()
+
"'"
,
e
);
}
}
DBPDataSourceRegistry
dataSourceRegistry
=
getModel
().
get
Application
().
getProjectManager
().
getDataSourceRegistry
(
project
);
DBPDataSourceRegistry
dataSourceRegistry
=
getModel
().
get
Platform
().
getProjectManager
().
getDataSourceRegistry
(
project
);
DBNNode
[]
children
=
super
.
readChildNodes
(
monitor
);
if
(
dataSourceRegistry
!=
null
)
{
children
=
ArrayUtils
.
insertArea
(
DBNNode
.
class
,
children
,
0
,
new
Object
[]
{
new
DBNProjectDatabases
(
this
,
dataSourceRegistry
)});
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNResource.java
浏览文件 @
e5c9be86
...
...
@@ -201,7 +201,7 @@ public class DBNResource extends DBNNode// implements IContributorResourceAdapte
// Sub folder
return
handler
.
makeNavigatorNode
(
this
,
resource
);
}
DBPResourceHandler
resourceHandler
=
getModel
().
get
Application
().
getProjectManager
().
getResourceHandler
(
resource
);
DBPResourceHandler
resourceHandler
=
getModel
().
get
Platform
().
getProjectManager
().
getResourceHandler
(
resource
);
if
(
resourceHandler
==
null
)
{
log
.
debug
(
"Skip resource '"
+
resource
.
getName
()
+
"'"
);
return
null
;
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNRoot.java
浏览文件 @
e5c9be86
...
...
@@ -38,7 +38,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener
{
super
();
this
.
model
=
model
;
model
.
get
Application
().
getProjectManager
().
addProjectListener
(
this
);
model
.
get
Platform
().
getProjectManager
().
addProjectListener
(
this
);
}
@Override
...
...
@@ -48,7 +48,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener
project
.
dispose
(
reflect
);
}
projects
=
new
DBNProject
[
0
];
model
.
get
Application
().
getProjectManager
().
removeProjectListener
(
this
);
model
.
get
Platform
().
getProjectManager
().
removeProjectListener
(
this
);
}
@Override
...
...
@@ -141,7 +141,7 @@ public class DBNRoot extends DBNNode implements DBNContainer, DBPProjectListener
DBNProject
projectNode
=
new
DBNProject
(
this
,
project
,
model
.
get
Application
().
getProjectManager
().
getResourceHandler
(
project
));
model
.
get
Platform
().
getProjectManager
().
getResourceHandler
(
project
));
projects
=
ArrayUtils
.
add
(
DBNProject
.
class
,
projects
,
projectNode
);
Arrays
.
sort
(
projects
,
new
Comparator
<
DBNProject
>()
{
@Override
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/net/DBWTunnel.java
浏览文件 @
e5c9be86
...
...
@@ -18,7 +18,7 @@
package
org.jkiss.dbeaver.model.net
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
...
...
@@ -29,7 +29,7 @@ import java.io.IOException;
*/
public
interface
DBWTunnel
extends
DBWNetworkHandler
{
DBPConnectionConfiguration
initializeTunnel
(
DBRProgressMonitor
monitor
,
DBP
Application
application
,
DBWHandlerConfiguration
configuration
,
DBPConnectionConfiguration
connectionInfo
)
DBPConnectionConfiguration
initializeTunnel
(
DBRProgressMonitor
monitor
,
DBP
Platform
platform
,
DBWHandlerConfiguration
configuration
,
DBPConnectionConfiguration
connectionInfo
)
throws
DBException
,
IOException
;
void
closeTunnel
(
DBRProgressMonitor
monitor
,
DBPConnectionConfiguration
connectionInfo
)
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/qm/QMUtils.java
浏览文件 @
e5c9be86
...
...
@@ -18,7 +18,7 @@
package
org.jkiss.dbeaver.model.qm
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -28,10 +28,10 @@ import java.util.List;
*/
public
class
QMUtils
{
private
static
DBP
Application
application
;
private
static
DBP
Platform
application
;
private
static
QMExecutionHandler
defaultHandler
;
public
static
void
initApplication
(
DBP
Application
application
)
{
public
static
void
initApplication
(
DBP
Platform
application
)
{
QMUtils
.
application
=
application
;
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVModel.java
浏览文件 @
e5c9be86
...
...
@@ -321,7 +321,7 @@ public class DBVModel extends DBVContainer {
case
TAG_EXCLUDE:
String
transformerId
=
atts
.
getValue
(
ATTR_ID
);
if
(
curTransformSettings
!=
null
&&
!
CommonUtils
.
isEmpty
(
transformerId
))
{
final
DBDAttributeTransformerDescriptor
transformer
=
dataSourceContainer
.
get
Application
().
getValueHandlerRegistry
().
getTransformer
(
transformerId
);
final
DBDAttributeTransformerDescriptor
transformer
=
dataSourceContainer
.
get
Platform
().
getValueHandlerRegistry
().
getTransformer
(
transformerId
);
if
(
transformer
==
null
)
{
log
.
warn
(
"Transformer '"
+
transformerId
+
"' not found"
);
}
else
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/virtual/DBVUtils.java
浏览文件 @
e5c9be86
...
...
@@ -98,7 +98,7 @@ public abstract class DBVUtils {
DBPDataSource
dataSource
=
binding
.
getDataSource
();
DBPDataSourceContainer
container
=
dataSource
.
getContainer
();
List
<?
extends
DBDAttributeTransformerDescriptor
>
tdList
=
container
.
get
Application
().
getValueHandlerRegistry
().
findTransformers
(
dataSource
,
binding
.
getAttribute
(),
custom
);
container
.
get
Platform
().
getValueHandlerRegistry
().
findTransformers
(
dataSource
,
binding
.
getAttribute
(),
custom
);
if
(
tdList
==
null
||
tdList
.
isEmpty
())
{
return
null
;
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/utils/ContentUtils.java
浏览文件 @
e5c9be86
...
...
@@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IPath;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBP
Application
;
import
org.jkiss.dbeaver.model.DBP
Platform
;
import
org.jkiss.dbeaver.model.data.DBDContent
;
import
org.jkiss.dbeaver.model.data.DBDContentCached
;
import
org.jkiss.dbeaver.model.data.DBDContentStorage
;
...
...
@@ -61,13 +61,13 @@ public class ContentUtils {
}
public
static
File
getLobFolder
(
DBRProgressMonitor
monitor
,
DBP
Application
application
)
public
static
File
getLobFolder
(
DBRProgressMonitor
monitor
,
DBP
Platform
application
)
throws
IOException
{
return
application
.
getTempFolder
(
monitor
,
LOB_DIR
);
}
public
static
File
createTempContentFile
(
DBRProgressMonitor
monitor
,
DBP
Application
application
,
String
fileName
)
public
static
File
createTempContentFile
(
DBRProgressMonitor
monitor
,
DBP
Platform
application
,
String
fileName
)
throws
IOException
{
return
makeTempFile
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录