Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
be984402
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
be984402
编写于
6月 24, 2017
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Net utils moved to model. Redundant icon ref removed.
Former-commit-id:
f9ad66a0
上级
d8ceac9f
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
255 addition
and
267 deletion
+255
-267
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
....dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
+0
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/GlobalProxyAuthenticator.java
.../src/org/jkiss/dbeaver/core/GlobalProxyAuthenticator.java
+143
-143
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/jobs/DataSourceJob.java
...ore/src/org/jkiss/dbeaver/runtime/jobs/DataSourceJob.java
+1
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/jobs/InvalidateJob.java
...ore/src/org/jkiss/dbeaver/runtime/jobs/InvalidateJob.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/sql/SQLQueryJob.java
...r.core/src/org/jkiss/dbeaver/runtime/sql/SQLQueryJob.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetJobAbstract.java
...s/dbeaver/ui/controls/resultset/ResultSetJobAbstract.java
+1
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetPersister.java
...iss/dbeaver/ui/controls/resultset/ResultSetPersister.java
+2
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ReferenceValueEditor.java
...g/jkiss/dbeaver/ui/data/editors/ReferenceValueEditor.java
+1
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/sql/GenerateMultiSQLDialog.java
.../jkiss/dbeaver/ui/dialogs/sql/GenerateMultiSQLDialog.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/sql/GenerateSQLDialog.java
...c/org/jkiss/dbeaver/ui/dialogs/sql/GenerateSQLDialog.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/syntax/SQLContextInformer.java
...iss/dbeaver/ui/editors/sql/syntax/SQLContextInformer.java
+1
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/perspective/DataSourceManagementToolbar.java
...s/dbeaver/ui/perspective/DataSourceManagementToolbar.java
+1
-1
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/tools/maintenance/ExasolBaseTableToolDialog.java
...t/exasol/tools/maintenance/ExasolBaseTableToolDialog.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/runtime/net/DefaultCallbackHandler.java
...org/jkiss/dbeaver/runtime/net/DefaultCallbackHandler.java
+0
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/runtime/net/GlobalProxySelector.java
...rc/org/jkiss/dbeaver/runtime/net/GlobalProxySelector.java
+100
-100
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/core/DBeaverCore.java
浏览文件 @
be984402
...
...
@@ -47,7 +47,6 @@ import org.jkiss.dbeaver.registry.datatype.DataTypeProviderRegistry;
import
org.jkiss.dbeaver.registry.editor.EntityEditorsRegistry
;
import
org.jkiss.dbeaver.runtime.IPluginService
;
import
org.jkiss.dbeaver.runtime.jobs.KeepAliveJob
;
import
org.jkiss.dbeaver.runtime.net.GlobalProxyAuthenticator
;
import
org.jkiss.dbeaver.runtime.net.GlobalProxySelector
;
import
org.jkiss.dbeaver.runtime.qm.QMControllerImpl
;
import
org.jkiss.dbeaver.runtime.qm.QMLogFileWriter
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/
runtime/net
/GlobalProxyAuthenticator.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/
core
/GlobalProxyAuthenticator.java
浏览文件 @
be984402
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.
runtime.net
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.access.DBAAuthInfo
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.exec.DBExecUtils
;
import
org.jkiss.dbeaver.model.impl.net.SocksConstants
;
import
org.jkiss.dbeaver.model.net.DBWHandlerConfiguration
;
import
org.jkiss.dbeaver.model.net.DBWHandlerType
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.registry.encode.EncryptionException
;
import
org.jkiss.dbeaver.registry.encode.SecuredPasswordEncrypter
;
import
org.jkiss.dbeaver.runtime.ui.DBUserInterface
;
import
org.jkiss.utils.CommonUtils
;
import
java.net.Authenticator
;
import
java.net.PasswordAuthentication
;
/**
* Global authenticator
*/
public
class
GlobalProxyAuthenticator
extends
Authenticator
{
private
SecuredPasswordEncrypter
encrypter
;
@Nullable
@Override
protected
PasswordAuthentication
getPasswordAuthentication
()
{
{
DBPPreferenceStore
store
=
DBeaverCore
.
getGlobalPreferenceStore
();
// 1. Check for drivers download proxy
final
String
proxyHost
=
store
.
getString
(
DBeaverPreferences
.
UI_PROXY_HOST
);
if
(!
CommonUtils
.
isEmpty
(
proxyHost
)
&&
proxyHost
.
equalsIgnoreCase
(
getRequestingHost
())
&&
store
.
getInt
(
DBeaverPreferences
.
UI_PROXY_PORT
)
==
getRequestingPort
())
{
String
userName
=
store
.
getString
(
DBeaverPreferences
.
UI_PROXY_USER
);
String
userPassword
=
decryptPassword
(
store
.
getString
(
DBeaverPreferences
.
UI_PROXY_PASSWORD
));
if
(
CommonUtils
.
isEmpty
(
userName
)
||
CommonUtils
.
isEmpty
(
userPassword
))
{
DBAAuthInfo
authInfo
=
readCredentialsInUI
(
"Auth proxy '"
+
proxyHost
+
"'"
,
userName
,
userPassword
);
if
(
authInfo
!=
null
)
{
userName
=
authInfo
.
getUserName
();
userPassword
=
authInfo
.
getUserPassword
();
if
(
authInfo
.
isSavePassword
())
{
// Save in preferences
store
.
setValue
(
DBeaverPreferences
.
UI_PROXY_USER
,
userName
);
store
.
setValue
(
DBeaverPreferences
.
UI_PROXY_PASSWORD
,
encryptPassword
(
userPassword
));
}
}
}
if
(!
CommonUtils
.
isEmpty
(
userName
)
&&
!
CommonUtils
.
isEmpty
(
userPassword
))
{
return
new
PasswordAuthentication
(
userName
,
userPassword
.
toCharArray
());
}
}
}
{
// 2. Check for connections' proxies
String
requestingProtocol
=
getRequestingProtocol
();
if
(
SocksConstants
.
PROTOCOL_SOCKS5
.
equals
(
requestingProtocol
)
||
SocksConstants
.
PROTOCOL_SOCKS4
.
equals
(
requestingProtocol
))
{
DBCExecutionContext
activeContext
=
DBExecUtils
.
findConnectionContext
(
getRequestingHost
(),
getRequestingPort
(),
getRequestingScheme
());
if
(
activeContext
!=
null
)
{
DBPDataSourceContainer
container
=
activeContext
.
getDataSource
().
getContainer
();
for
(
DBWHandlerConfiguration
networkHandler
:
container
.
getConnectionConfiguration
().
getDeclaredHandlers
())
{
if
(
networkHandler
.
isEnabled
()
&&
networkHandler
.
getType
()
==
DBWHandlerType
.
PROXY
)
{
String
userName
=
networkHandler
.
getUserName
();
String
userPassword
=
networkHandler
.
getPassword
();
if
(
CommonUtils
.
isEmpty
(
userName
)
||
CommonUtils
.
isEmpty
(
userPassword
))
{
DBAAuthInfo
authInfo
=
readCredentialsInUI
(
getRequestingPrompt
(),
userName
,
userPassword
);
if
(
authInfo
!=
null
)
{
userName
=
authInfo
.
getUserName
();
userPassword
=
authInfo
.
getUserPassword
();
if
(
authInfo
.
isSavePassword
())
{
// Save DS config
networkHandler
.
setUserName
(
userName
);
networkHandler
.
setPassword
(
userPassword
);
networkHandler
.
setSavePassword
(
true
);
container
.
getRegistry
().
flushConfig
();
}
}
}
if
(!
CommonUtils
.
isEmpty
(
userName
)
&&
!
CommonUtils
.
isEmpty
(
userPassword
))
{
return
new
PasswordAuthentication
(
userName
,
userPassword
.
toCharArray
());
}
}
}
}
}
}
return
null
;
}
private
String
encryptPassword
(
String
password
)
{
try
{
if
(
encrypter
==
null
)
{
encrypter
=
new
SecuredPasswordEncrypter
();
}
return
encrypter
.
encrypt
(
password
);
}
catch
(
EncryptionException
e
)
{
return
password
;
}
}
private
String
decryptPassword
(
String
password
)
{
if
(
CommonUtils
.
isEmpty
(
password
))
{
return
password
;
}
try
{
if
(
encrypter
==
null
)
{
encrypter
=
new
SecuredPasswordEncrypter
();
}
return
encrypter
.
decrypt
(
password
);
}
catch
(
EncryptionException
e
)
{
return
password
;
}
}
private
DBAAuthInfo
readCredentialsInUI
(
String
prompt
,
String
userName
,
String
userPassword
)
{
return
DBUserInterface
.
getInstance
().
promptUserCredentials
(
prompt
,
userName
,
userPassword
,
false
);
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.
core
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.access.DBAAuthInfo
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.exec.DBExecUtils
;
import
org.jkiss.dbeaver.model.impl.net.SocksConstants
;
import
org.jkiss.dbeaver.model.net.DBWHandlerConfiguration
;
import
org.jkiss.dbeaver.model.net.DBWHandlerType
;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.registry.encode.EncryptionException
;
import
org.jkiss.dbeaver.registry.encode.SecuredPasswordEncrypter
;
import
org.jkiss.dbeaver.runtime.ui.DBUserInterface
;
import
org.jkiss.utils.CommonUtils
;
import
java.net.Authenticator
;
import
java.net.PasswordAuthentication
;
/**
* Global authenticator
*/
public
class
GlobalProxyAuthenticator
extends
Authenticator
{
private
SecuredPasswordEncrypter
encrypter
;
@Nullable
@Override
protected
PasswordAuthentication
getPasswordAuthentication
()
{
{
DBPPreferenceStore
store
=
DBeaverCore
.
getGlobalPreferenceStore
();
// 1. Check for drivers download proxy
final
String
proxyHost
=
store
.
getString
(
DBeaverPreferences
.
UI_PROXY_HOST
);
if
(!
CommonUtils
.
isEmpty
(
proxyHost
)
&&
proxyHost
.
equalsIgnoreCase
(
getRequestingHost
())
&&
store
.
getInt
(
DBeaverPreferences
.
UI_PROXY_PORT
)
==
getRequestingPort
())
{
String
userName
=
store
.
getString
(
DBeaverPreferences
.
UI_PROXY_USER
);
String
userPassword
=
decryptPassword
(
store
.
getString
(
DBeaverPreferences
.
UI_PROXY_PASSWORD
));
if
(
CommonUtils
.
isEmpty
(
userName
)
||
CommonUtils
.
isEmpty
(
userPassword
))
{
DBAAuthInfo
authInfo
=
readCredentialsInUI
(
"Auth proxy '"
+
proxyHost
+
"'"
,
userName
,
userPassword
);
if
(
authInfo
!=
null
)
{
userName
=
authInfo
.
getUserName
();
userPassword
=
authInfo
.
getUserPassword
();
if
(
authInfo
.
isSavePassword
())
{
// Save in preferences
store
.
setValue
(
DBeaverPreferences
.
UI_PROXY_USER
,
userName
);
store
.
setValue
(
DBeaverPreferences
.
UI_PROXY_PASSWORD
,
encryptPassword
(
userPassword
));
}
}
}
if
(!
CommonUtils
.
isEmpty
(
userName
)
&&
!
CommonUtils
.
isEmpty
(
userPassword
))
{
return
new
PasswordAuthentication
(
userName
,
userPassword
.
toCharArray
());
}
}
}
{
// 2. Check for connections' proxies
String
requestingProtocol
=
getRequestingProtocol
();
if
(
SocksConstants
.
PROTOCOL_SOCKS5
.
equals
(
requestingProtocol
)
||
SocksConstants
.
PROTOCOL_SOCKS4
.
equals
(
requestingProtocol
))
{
DBCExecutionContext
activeContext
=
DBExecUtils
.
findConnectionContext
(
getRequestingHost
(),
getRequestingPort
(),
getRequestingScheme
());
if
(
activeContext
!=
null
)
{
DBPDataSourceContainer
container
=
activeContext
.
getDataSource
().
getContainer
();
for
(
DBWHandlerConfiguration
networkHandler
:
container
.
getConnectionConfiguration
().
getDeclaredHandlers
())
{
if
(
networkHandler
.
isEnabled
()
&&
networkHandler
.
getType
()
==
DBWHandlerType
.
PROXY
)
{
String
userName
=
networkHandler
.
getUserName
();
String
userPassword
=
networkHandler
.
getPassword
();
if
(
CommonUtils
.
isEmpty
(
userName
)
||
CommonUtils
.
isEmpty
(
userPassword
))
{
DBAAuthInfo
authInfo
=
readCredentialsInUI
(
getRequestingPrompt
(),
userName
,
userPassword
);
if
(
authInfo
!=
null
)
{
userName
=
authInfo
.
getUserName
();
userPassword
=
authInfo
.
getUserPassword
();
if
(
authInfo
.
isSavePassword
())
{
// Save DS config
networkHandler
.
setUserName
(
userName
);
networkHandler
.
setPassword
(
userPassword
);
networkHandler
.
setSavePassword
(
true
);
container
.
getRegistry
().
flushConfig
();
}
}
}
if
(!
CommonUtils
.
isEmpty
(
userName
)
&&
!
CommonUtils
.
isEmpty
(
userPassword
))
{
return
new
PasswordAuthentication
(
userName
,
userPassword
.
toCharArray
());
}
}
}
}
}
}
return
null
;
}
private
String
encryptPassword
(
String
password
)
{
try
{
if
(
encrypter
==
null
)
{
encrypter
=
new
SecuredPasswordEncrypter
();
}
return
encrypter
.
encrypt
(
password
);
}
catch
(
EncryptionException
e
)
{
return
password
;
}
}
private
String
decryptPassword
(
String
password
)
{
if
(
CommonUtils
.
isEmpty
(
password
))
{
return
password
;
}
try
{
if
(
encrypter
==
null
)
{
encrypter
=
new
SecuredPasswordEncrypter
();
}
return
encrypter
.
decrypt
(
password
);
}
catch
(
EncryptionException
e
)
{
return
password
;
}
}
private
DBAAuthInfo
readCredentialsInUI
(
String
prompt
,
String
userName
,
String
userPassword
)
{
return
DBUserInterface
.
getInstance
().
promptUserCredentials
(
prompt
,
userName
,
userPassword
,
false
);
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/jobs/DataSourceJob.java
浏览文件 @
be984402
...
...
@@ -18,9 +18,7 @@ package org.jkiss.dbeaver.runtime.jobs;
import
org.eclipse.core.runtime.jobs.IJobChangeEvent
;
import
org.eclipse.core.runtime.jobs.JobChangeAdapter
;
import
org.eclipse.jface.resource.ImageDescriptor
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.DBPDataSourceUser
;
...
...
@@ -35,7 +33,7 @@ public abstract class DataSourceJob extends AbstractJob implements DBPDataSource
{
private
final
DBCExecutionContext
executionContext
;
protected
DataSourceJob
(
String
name
,
@N
ullable
ImageDescriptor
image
,
@N
otNull
DBCExecutionContext
executionContext
)
protected
DataSourceJob
(
String
name
,
@NotNull
DBCExecutionContext
executionContext
)
{
super
(
CommonUtils
.
truncateString
(
name
,
1000
));
// Trunkate just in case
this
.
executionContext
=
executionContext
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/jobs/InvalidateJob.java
浏览文件 @
be984402
...
...
@@ -59,7 +59,7 @@ public class InvalidateJob extends DataSourceJob
DBCExecutionContext
context
/*,
boolean reconnect*/
)
{
super
(
"Invalidate "
+
context
.
getDataSource
().
getContainer
().
getName
(),
null
,
context
);
super
(
"Invalidate "
+
context
.
getDataSource
().
getContainer
().
getName
(),
context
);
// this.reconnect = reconnect;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/runtime/sql/SQLQueryJob.java
浏览文件 @
be984402
...
...
@@ -114,7 +114,7 @@ public class SQLQueryJob extends DataSourceJob implements Closeable
@NotNull
SQLResultsConsumer
resultsConsumer
,
@Nullable
SQLQueryListener
listener
)
{
super
(
name
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
SQL_SCRIPT_EXECUTE
),
executionContext
);
super
(
name
,
executionContext
);
this
.
dataContainer
=
dataContainer
;
this
.
partSite
=
partSite
;
this
.
queries
=
queries
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetJobAbstract.java
浏览文件 @
be984402
...
...
@@ -23,8 +23,6 @@ import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import
org.jkiss.dbeaver.model.exec.DBCExecutionSource
;
import
org.jkiss.dbeaver.model.struct.DBSDataContainer
;
import
org.jkiss.dbeaver.runtime.jobs.DataSourceJob
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIIcon
;
abstract
class
ResultSetJobAbstract
extends
DataSourceJob
implements
DBCExecutionSource
{
...
...
@@ -32,7 +30,7 @@ abstract class ResultSetJobAbstract extends DataSourceJob implements DBCExecutio
protected
final
ResultSetViewer
controller
;
protected
ResultSetJobAbstract
(
String
name
,
DBSDataContainer
dataContainer
,
ResultSetViewer
controller
,
DBCExecutionContext
executionContext
)
{
super
(
name
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
SQL_EXECUTE
),
executionContext
);
super
(
name
,
executionContext
);
this
.
dataContainer
=
dataContainer
;
this
.
controller
=
controller
;
setUser
(
false
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetPersister.java
浏览文件 @
be984402
...
...
@@ -38,8 +38,6 @@ import org.jkiss.dbeaver.model.struct.DBSDataManipulator;
import
org.jkiss.dbeaver.model.struct.DBSEntity
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSManipulationType
;
import
org.jkiss.dbeaver.runtime.jobs.DataSourceJob
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -391,7 +389,7 @@ class ResultSetPersister {
protected
DataUpdaterJob
(
boolean
generateScript
,
@Nullable
DataUpdateListener
listener
,
@NotNull
DBCExecutionContext
executionContext
)
{
super
(
CoreMessages
.
controls_resultset_viewer_job_update
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
SQL_EXECUTE
),
executionContext
);
super
(
CoreMessages
.
controls_resultset_viewer_job_update
,
executionContext
);
this
.
generateScript
=
generateScript
;
this
.
listener
=
listener
;
}
...
...
@@ -782,7 +780,7 @@ class ResultSetPersister {
private
List
<
ResultSetRow
>
rows
;
public
RowRefreshJob
(
DBCExecutionContext
context
,
DBSDataContainer
dataContainer
,
DBDRowIdentifier
rowIdentifier
,
List
<
ResultSetRow
>
rows
)
{
super
(
"Refresh rows"
,
null
,
context
);
super
(
"Refresh rows"
,
context
);
this
.
dataContainer
=
dataContainer
;
this
.
rowIdentifier
=
rowIdentifier
;
this
.
rows
=
new
ArrayList
<>(
rows
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/data/editors/ReferenceValueEditor.java
浏览文件 @
be984402
...
...
@@ -45,8 +45,6 @@ import org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.runtime.jobs.DataSourceJob
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.actions.navigator.NavigatorHandlerObjectOpen
;
import
org.jkiss.dbeaver.ui.data.IAttributeController
;
...
...
@@ -314,8 +312,7 @@ public class ReferenceValueEditor {
{
super
(
CoreMessages
.
dialog_value_view_job_selector_name
+
valueController
.
getValueName
()
+
" possible values"
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
SQL_EXECUTE
),
valueController
.
getExecutionContext
());
valueController
.
getExecutionContext
());
setUser
(
false
);
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/sql/GenerateMultiSQLDialog.java
浏览文件 @
be984402
...
...
@@ -156,7 +156,7 @@ public abstract class GenerateMultiSQLDialog<T extends DBSObject> extends Genera
generateObjectCommand
(
lines
,
object
);
objectsSQL
.
put
(
object
,
lines
);
}
final
DataSourceJob
job
=
new
DataSourceJob
(
jobName
,
null
,
getExecutionContext
())
{
final
DataSourceJob
job
=
new
DataSourceJob
(
jobName
,
getExecutionContext
())
{
public
Exception
objectProcessingError
;
@Override
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/sql/GenerateSQLDialog.java
浏览文件 @
be984402
...
...
@@ -112,7 +112,7 @@ public abstract class GenerateSQLDialog extends BaseSQLDialog {
{
final
String
jobName
=
getShell
().
getText
();
final
String
[]
scriptLines
=
generateSQLScript
();
DataSourceJob
job
=
new
DataSourceJob
(
jobName
,
null
,
executionContext
)
{
DataSourceJob
job
=
new
DataSourceJob
(
jobName
,
executionContext
)
{
@Override
protected
IStatus
run
(
DBRProgressMonitor
monitor
)
{
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/editors/sql/syntax/SQLContextInformer.java
浏览文件 @
be984402
...
...
@@ -43,8 +43,6 @@ import org.jkiss.dbeaver.model.sql.SQLSyntaxManager;
import
org.jkiss.dbeaver.model.struct.*
;
import
org.jkiss.dbeaver.runtime.jobs.DataSourceJob
;
import
org.jkiss.dbeaver.runtime.properties.PropertyCollector
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase
;
import
org.jkiss.utils.ArrayUtils
;
...
...
@@ -398,7 +396,7 @@ public class SQLContextInformer
protected
TablesFinderJob
(
@NotNull
DBCExecutionContext
executionContext
,
@NotNull
DBSStructureAssistant
structureAssistant
,
@Nullable
String
[]
containerNames
,
@NotNull
String
objectName
,
boolean
caseSensitive
,
@NotNull
ObjectLookupCache
cache
)
{
super
(
"Find object '"
+
objectName
+
"'"
,
DBeaverIcons
.
getImageDescriptor
(
UIIcon
.
SQL_EXECUTE
),
executionContext
);
super
(
"Find object '"
+
objectName
+
"'"
,
executionContext
);
this
.
structureAssistant
=
structureAssistant
;
// Transform container name case
this
.
containerNames
=
containerNames
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/perspective/DataSourceManagementToolbar.java
浏览文件 @
be984402
...
...
@@ -108,7 +108,7 @@ public class DataSourceManagementToolbar implements DBPRegistryListener, DBPEven
private
boolean
enabled
;
public
DatabaseListReader
(
@NotNull
DBCExecutionContext
context
)
{
super
(
CoreMessages
.
toolbar_datasource_selector_action_read_databases
,
null
,
context
);
super
(
CoreMessages
.
toolbar_datasource_selector_action_read_databases
,
context
);
setSystem
(
true
);
this
.
enabled
=
false
;
}
...
...
plugins/org.jkiss.dbeaver.ext.exasol/src/org/jkiss/dbeaver/ext/exasol/tools/maintenance/ExasolBaseTableToolDialog.java
浏览文件 @
be984402
...
...
@@ -183,7 +183,7 @@ public abstract class ExasolBaseTableToolDialog
generateObjectCommand
(
lines
,
object
);
objectsSQL
.
put
(
object
,
lines
);
}
final
DataSourceJob
job
=
new
DataSourceJob
(
jobName
,
null
,
getExecutionContext
())
{
final
DataSourceJob
job
=
new
DataSourceJob
(
jobName
,
getExecutionContext
())
{
public
Exception
objectProcessingError
;
@SuppressWarnings
(
"rawtypes"
)
...
...
plugins/org.jkiss.dbeaver.
core
/src/org/jkiss/dbeaver/runtime/net/DefaultCallbackHandler.java
→
plugins/org.jkiss.dbeaver.
model
/src/org/jkiss/dbeaver/runtime/net/DefaultCallbackHandler.java
浏览文件 @
be984402
文件已移动
plugins/org.jkiss.dbeaver.
core
/src/org/jkiss/dbeaver/runtime/net/GlobalProxySelector.java
→
plugins/org.jkiss.dbeaver.
model
/src/org/jkiss/dbeaver/runtime/net/GlobalProxySelector.java
浏览文件 @
be984402
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.runtime.net
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.exec.DBExecUtils
;
import
org.jkiss.dbeaver.model.impl.net.SocksConstants
;
import
org.jkiss.dbeaver.model.net.DBWHandlerConfiguration
;
import
org.jkiss.dbeaver.model.net.DBWHandlerType
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.IOException
;
import
java.net.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* Global proxy selector
*/
public
class
GlobalProxySelector
extends
ProxySelector
{
private
static
final
Log
log
=
Log
.
getLog
(
GlobalProxySelector
.
class
);
private
final
ProxySelector
parent
;
public
GlobalProxySelector
(
ProxySelector
parent
)
{
this
.
parent
=
parent
;
}
@Override
public
List
<
Proxy
>
select
(
URI
uri
)
{
String
scheme
=
uri
.
getScheme
();
if
(
CommonUtils
.
isEmpty
(
scheme
))
{
return
parent
.
select
(
uri
);
}
if
(
scheme
.
startsWith
(
"http"
))
{
// 1. Check for drivers download proxy
}
if
(
SocksConstants
.
SOCKET_SCHEME
.
equals
(
scheme
))
{
// 2. Check for connections' proxy config
DBCExecutionContext
activeContext
=
DBExecUtils
.
findConnectionContext
(
uri
.
getHost
(),
uri
.
getPort
(),
uri
.
getPath
());
if
(
activeContext
!=
null
)
{
List
<
Proxy
>
proxies
=
null
;
DBPDataSourceContainer
container
=
activeContext
.
getDataSource
().
getContainer
();
for
(
DBWHandlerConfiguration
networkHandler
:
container
.
getConnectionConfiguration
().
getDeclaredHandlers
())
{
if
(
networkHandler
.
isEnabled
()
&&
networkHandler
.
getType
()
==
DBWHandlerType
.
PROXY
)
{
Map
<
String
,
String
>
proxyProps
=
networkHandler
.
getProperties
();
String
proxyHost
=
proxyProps
.
get
(
SocksConstants
.
PROP_HOST
);
String
proxyPort
=
proxyProps
.
get
(
SocksConstants
.
PROP_PORT
);
if
(!
CommonUtils
.
isEmpty
(
proxyHost
))
{
int
portNumber
=
SocksConstants
.
DEFAULT_SOCKS_PORT
;
if
(!
CommonUtils
.
isEmpty
(
proxyPort
))
{
try
{
portNumber
=
Integer
.
parseInt
(
proxyPort
);
}
catch
(
NumberFormatException
e
)
{
log
.
warn
(
"Bad proxy port number"
,
e
);
}
}
InetSocketAddress
proxyAddr
=
new
InetSocketAddress
(
proxyHost
,
portNumber
);
Proxy
proxy
=
new
Proxy
(
Proxy
.
Type
.
SOCKS
,
proxyAddr
);
if
(
proxies
==
null
)
{
proxies
=
new
ArrayList
<>();
}
proxies
.
add
(
proxy
);
log
.
debug
(
"Use SOCKS proxy ["
+
proxyAddr
+
"]"
);
}
}
}
if
(
proxies
!=
null
)
{
return
proxies
;
}
}
}
return
parent
.
select
(
uri
);
}
@Override
public
void
connectFailed
(
URI
uri
,
SocketAddress
sa
,
IOException
ioe
)
{
parent
.
connectFailed
(
uri
,
sa
,
ioe
);
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.runtime.net
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.exec.DBExecUtils
;
import
org.jkiss.dbeaver.model.impl.net.SocksConstants
;
import
org.jkiss.dbeaver.model.net.DBWHandlerConfiguration
;
import
org.jkiss.dbeaver.model.net.DBWHandlerType
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.IOException
;
import
java.net.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* Global proxy selector
*/
public
class
GlobalProxySelector
extends
ProxySelector
{
private
static
final
Log
log
=
Log
.
getLog
(
GlobalProxySelector
.
class
);
private
final
ProxySelector
parent
;
public
GlobalProxySelector
(
ProxySelector
parent
)
{
this
.
parent
=
parent
;
}
@Override
public
List
<
Proxy
>
select
(
URI
uri
)
{
String
scheme
=
uri
.
getScheme
();
if
(
CommonUtils
.
isEmpty
(
scheme
))
{
return
parent
.
select
(
uri
);
}
if
(
scheme
.
startsWith
(
"http"
))
{
// 1. Check for drivers download proxy
}
if
(
SocksConstants
.
SOCKET_SCHEME
.
equals
(
scheme
))
{
// 2. Check for connections' proxy config
DBCExecutionContext
activeContext
=
DBExecUtils
.
findConnectionContext
(
uri
.
getHost
(),
uri
.
getPort
(),
uri
.
getPath
());
if
(
activeContext
!=
null
)
{
List
<
Proxy
>
proxies
=
null
;
DBPDataSourceContainer
container
=
activeContext
.
getDataSource
().
getContainer
();
for
(
DBWHandlerConfiguration
networkHandler
:
container
.
getConnectionConfiguration
().
getDeclaredHandlers
())
{
if
(
networkHandler
.
isEnabled
()
&&
networkHandler
.
getType
()
==
DBWHandlerType
.
PROXY
)
{
Map
<
String
,
String
>
proxyProps
=
networkHandler
.
getProperties
();
String
proxyHost
=
proxyProps
.
get
(
SocksConstants
.
PROP_HOST
);
String
proxyPort
=
proxyProps
.
get
(
SocksConstants
.
PROP_PORT
);
if
(!
CommonUtils
.
isEmpty
(
proxyHost
))
{
int
portNumber
=
SocksConstants
.
DEFAULT_SOCKS_PORT
;
if
(!
CommonUtils
.
isEmpty
(
proxyPort
))
{
try
{
portNumber
=
Integer
.
parseInt
(
proxyPort
);
}
catch
(
NumberFormatException
e
)
{
log
.
warn
(
"Bad proxy port number"
,
e
);
}
}
InetSocketAddress
proxyAddr
=
new
InetSocketAddress
(
proxyHost
,
portNumber
);
Proxy
proxy
=
new
Proxy
(
Proxy
.
Type
.
SOCKS
,
proxyAddr
);
if
(
proxies
==
null
)
{
proxies
=
new
ArrayList
<>();
}
proxies
.
add
(
proxy
);
log
.
debug
(
"Use SOCKS proxy ["
+
proxyAddr
+
"]"
);
}
}
}
if
(
proxies
!=
null
)
{
return
proxies
;
}
}
}
return
parent
.
select
(
uri
);
}
@Override
public
void
connectFailed
(
URI
uri
,
SocketAddress
sa
,
IOException
ioe
)
{
parent
.
connectFailed
(
uri
,
sa
,
ioe
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录