Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
1aa42785
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,发现更多精彩内容 >>
提交
1aa42785
编写于
4月 26, 2020
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#8557 Anonymous access + "empty password" settings save/load fix
Former-commit-id:
55151af0
上级
3545e43d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
49 addition
and
13 deletion
+49
-13
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/connection/DBPDriver.java
...del/src/org/jkiss/dbeaver/model/connection/DBPDriver.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCDataSource.java
...src/org/jkiss/dbeaver/model/impl/jdbc/JDBCDataSource.java
+11
-1
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/RegistryConstants.java
...try/src/org/jkiss/dbeaver/registry/RegistryConstants.java
+1
-0
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
...c/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
+9
-1
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/driver/DriverDescriptorSerializerLegacy.java
...ver/registry/driver/DriverDescriptorSerializerLegacy.java
+16
-2
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/driver/DriverDescriptorSerializerModern.java
...ver/registry/driver/DriverDescriptorSerializerModern.java
+1
-0
plugins/org.jkiss.dbeaver.ui.editors.connection/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
...org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
+10
-8
未找到文件。
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/connection/DBPDriver.java
浏览文件 @
1aa42785
...
...
@@ -98,7 +98,7 @@ public interface DBPDriver extends DBPNamedObject
boolean
isUseURL
();
// Can be created
boolean
isInstantiable
();
// Driver shipped along with JDK/DBeaver, doesn't need any additional libraries
// Driver shipped along with JDK/DBeaver, doesn't need any additional libraries
. Basically it is ODBC driver.
boolean
isInternalDriver
();
// Custom driver: created by user
boolean
isCustom
();
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCDataSource.java
浏览文件 @
1aa42785
...
...
@@ -115,12 +115,22 @@ public abstract class JDBCDataSource
{
// It MUST be a JDBC driver
Driver
driverInstance
=
null
;
if
(
getContainer
().
getDriver
().
isInstantiable
())
{
DBPDriver
driver
=
getContainer
().
getDriver
();
if
(
driver
.
isInstantiable
())
{
try
{
driverInstance
=
getDriverInstance
(
monitor
);
}
catch
(
DBException
e
)
{
throw
new
DBCConnectException
(
"Can't create driver instance"
,
e
,
this
);
}
}
else
{
if
(!
CommonUtils
.
isEmpty
(
driver
.
getDriverClassName
()))
{
try
{
driver
.
loadDriver
(
monitor
);
Class
.
forName
(
driver
.
getDriverClassName
(),
true
,
driver
.
getClassLoader
());
}
catch
(
Exception
e
)
{
throw
new
DBCException
(
"Driver class '"
+
driver
.
getDriverClassName
()
+
"' not found"
,
e
);
}
}
}
DBPConnectionConfiguration
connectionInfo
=
new
DBPConnectionConfiguration
(
container
.
getActualConnectionConfiguration
());
...
...
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/RegistryConstants.java
浏览文件 @
1aa42785
...
...
@@ -86,6 +86,7 @@ public class RegistryConstants {
public
static
final
String
ATTR_EMBEDDED
=
"embedded"
;
//$NON-NLS-1$
public
static
final
String
ATTR_CUSTOM_DRIVER_LOADER
=
"customDriverLoader"
;
//$NON-NLS-1$
public
static
final
String
ATTR_USE_URL_TEMPLATE
=
"useURL"
;
//$NON-NLS-1$
public
static
final
String
ATTR_INSTANTIABLE
=
"instantiable"
;
//$NON-NLS-1$
public
static
final
String
ATTR_PROMOTED
=
"promoted"
;
//$NON-NLS-1$
public
static
final
String
ATTR_ICON
=
"icon"
;
//$NON-NLS-1$
...
...
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
浏览文件 @
1aa42785
...
...
@@ -127,6 +127,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver {
private
boolean
licenseRequired
;
private
boolean
customDriverLoader
;
private
boolean
useURLTemplate
;
private
boolean
instantiable
;
private
boolean
custom
;
private
boolean
modified
;
private
boolean
disabled
;
...
...
@@ -173,6 +174,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver {
this
.
id
=
id
;
this
.
custom
=
true
;
this
.
useURLTemplate
=
true
;
this
.
instantiable
=
true
;
this
.
promoted
=
0
;
this
.
origName
=
null
;
...
...
@@ -208,6 +210,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver {
this
.
licenseRequired
=
copyFrom
.
licenseRequired
;
this
.
customDriverLoader
=
copyFrom
.
customDriverLoader
;
this
.
useURLTemplate
=
copyFrom
.
useURLTemplate
;
this
.
instantiable
=
copyFrom
.
instantiable
;
this
.
promoted
=
copyFrom
.
promoted
;
this
.
nativeClientHomes
.
addAll
(
copyFrom
.
nativeClientHomes
);
for
(
DriverFileSource
fs
:
copyFrom
.
fileSources
)
{
...
...
@@ -254,6 +257,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver {
this
.
clientRequired
=
CommonUtils
.
getBoolean
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_CLIENT_REQUIRED
),
false
);
this
.
customDriverLoader
=
CommonUtils
.
getBoolean
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_CUSTOM_DRIVER_LOADER
),
false
);
this
.
useURLTemplate
=
CommonUtils
.
getBoolean
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_USE_URL_TEMPLATE
),
true
);
this
.
instantiable
=
CommonUtils
.
getBoolean
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_INSTANTIABLE
),
true
);
this
.
promoted
=
CommonUtils
.
toInt
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_PROMOTED
),
0
);
this
.
supportsDriverProperties
=
CommonUtils
.
getBoolean
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_SUPPORTS_DRIVER_PROPERTIES
),
true
);
this
.
embedded
=
CommonUtils
.
getBoolean
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_EMBEDDED
));
...
...
@@ -690,7 +694,11 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver {
@Override
public
boolean
isInstantiable
()
{
return
!
CommonUtils
.
isEmpty
(
driverClassName
);
return
instantiable
&&
!
CommonUtils
.
isEmpty
(
driverClassName
);
}
public
void
setInstantiable
(
boolean
instantiable
)
{
this
.
instantiable
=
instantiable
;
}
@Override
...
...
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/driver/DriverDescriptorSerializerLegacy.java
浏览文件 @
1aa42785
...
...
@@ -65,8 +65,7 @@ public class DriverDescriptorSerializerLegacy extends DriverDescriptorSerializer
xml
.
addAttribute
(
RegistryConstants
.
ATTR_CATEGORY
,
driver
.
getCategory
());
}
xml
.
addAttribute
(
RegistryConstants
.
ATTR_CATEGORIES
,
String
.
join
(
","
,
driver
.
getCategories
()));
xml
.
addAttribute
(
RegistryConstants
.
ATTR_CUSTOM
,
driver
.
isCustom
());
xml
.
addAttribute
(
RegistryConstants
.
ATTR_EMBEDDED
,
driver
.
isEmbedded
());
xml
.
addAttribute
(
RegistryConstants
.
ATTR_NAME
,
driver
.
getName
());
xml
.
addAttribute
(
RegistryConstants
.
ATTR_CLASS
,
driver
.
getDriverClassName
());
if
(!
CommonUtils
.
isEmpty
(
driver
.
getSampleURL
()))
{
...
...
@@ -79,6 +78,19 @@ public class DriverDescriptorSerializerLegacy extends DriverDescriptorSerializer
if
(
driver
.
isCustomDriverLoader
())
{
xml
.
addAttribute
(
RegistryConstants
.
ATTR_CUSTOM_DRIVER_LOADER
,
driver
.
isCustomDriverLoader
());
}
xml
.
addAttribute
(
RegistryConstants
.
ATTR_CUSTOM
,
driver
.
isCustom
());
if
(
driver
.
isEmbedded
())
{
xml
.
addAttribute
(
RegistryConstants
.
ATTR_EMBEDDED
,
driver
.
isEmbedded
());
}
if
(
driver
.
isAnonymousAccess
())
{
xml
.
addAttribute
(
RegistryConstants
.
ATTR_ANONYMOUS
,
driver
.
isAnonymousAccess
());
}
if
(
driver
.
isAllowsEmptyPassword
())
{
xml
.
addAttribute
(
"allowsEmptyPassword"
,
driver
.
isAllowsEmptyPassword
());
}
if
(!
driver
.
isInstantiable
())
{
xml
.
addAttribute
(
RegistryConstants
.
ATTR_INSTANTIABLE
,
driver
.
isInstantiable
());
}
// Libraries
for
(
DBPDriverLibrary
lib
:
driver
.
getDriverLibraries
())
{
...
...
@@ -209,7 +221,9 @@ public class DriverDescriptorSerializerLegacy extends DriverDescriptorSerializer
curDriver
.
setSampleURL
(
CommonUtils
.
toString
(
atts
.
getValue
(
RegistryConstants
.
ATTR_URL
),
curDriver
.
getSampleURL
()));
curDriver
.
setDriverDefaultPort
(
CommonUtils
.
toString
(
atts
.
getValue
(
RegistryConstants
.
ATTR_PORT
),
curDriver
.
getDefaultPort
()));
curDriver
.
setEmbedded
(
CommonUtils
.
getBoolean
(
atts
.
getValue
(
RegistryConstants
.
ATTR_EMBEDDED
),
curDriver
.
isEmbedded
()));
curDriver
.
setAnonymousAccess
(
CommonUtils
.
getBoolean
(
atts
.
getValue
(
RegistryConstants
.
ATTR_ANONYMOUS
),
curDriver
.
isAnonymousAccess
()));
curDriver
.
setAllowsEmptyPassword
(
CommonUtils
.
getBoolean
(
atts
.
getValue
(
"allowsEmptyPassword"
),
curDriver
.
isAllowsEmptyPassword
()));
curDriver
.
setInstantiable
(
CommonUtils
.
getBoolean
(
atts
.
getValue
(
RegistryConstants
.
ATTR_INSTANTIABLE
),
curDriver
.
isInstantiable
()));
}
if
(
atts
.
getValue
(
RegistryConstants
.
ATTR_CUSTOM_DRIVER_LOADER
)
!=
null
)
{
curDriver
.
setCustomDriverLoader
((
...
...
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/driver/DriverDescriptorSerializerModern.java
浏览文件 @
1aa42785
...
...
@@ -63,6 +63,7 @@ public class DriverDescriptorSerializerModern extends DriverDescriptorSerializer
JSONUtils
.
field
(
json
,
RegistryConstants
.
ATTR_EMBEDDED
,
driver
.
isEmbedded
());
JSONUtils
.
field
(
json
,
RegistryConstants
.
ATTR_ANONYMOUS
,
driver
.
isAnonymousAccess
());
JSONUtils
.
field
(
json
,
"allowsEmptyPassword"
,
driver
.
isAnonymousAccess
());
JSONUtils
.
field
(
json
,
RegistryConstants
.
ATTR_INSTANTIABLE
,
driver
.
isInstantiable
());
if
(
driver
.
isCustomDriverLoader
())
{
JSONUtils
.
field
(
json
,
RegistryConstants
.
ATTR_CUSTOM_DRIVER_LOADER
,
driver
.
isCustomDriverLoader
());
}
...
...
plugins/org.jkiss.dbeaver.ui.editors.connection/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
浏览文件 @
1aa42785
...
...
@@ -26,6 +26,7 @@ import org.eclipse.swt.events.SelectionEvent;
import
org.eclipse.swt.graphics.Image
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.layout.RowLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
...
...
@@ -98,6 +99,7 @@ public class DriverEditDialog extends HelpEnabledDialog {
private
Button
embeddedDriverCheck
;
private
Button
anonymousDriverCheck
;
private
Button
allowsEmptyPasswordCheck
;
private
Button
nonInstantiableCheck
;
private
boolean
showAddFiles
=
false
;
...
...
@@ -164,7 +166,7 @@ public class DriverEditDialog extends HelpEnabledDialog {
@Override
protected
IDialogSettings
getDialogBoundsSettings
()
{
return
UIUtils
.
getDialogSettings
(
DIALOG_ID
);
return
null
;
//
UIUtils.getDialogSettings(DIALOG_ID);
}
@Override
...
...
@@ -243,28 +245,26 @@ public class DriverEditDialog extends HelpEnabledDialog {
driverURLText
.
addModifyListener
(
e
->
onChangeProperty
());
driverURLText
.
setEnabled
(
driver
==
null
||
driver
.
isUseURL
());
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
|
GridData
.
VERTICAL_ALIGN_BEGINNING
);
driverPortText
=
UIUtils
.
createLabelText
(
propsGroup
,
UIConnectionMessages
.
dialog_edit_driver_label_default_port
,
driver
.
getDefaultPort
()
==
null
?
""
:
driver
.
getDefaultPort
(),
SWT
.
BORDER
|
advStyle
,
gd
);
driverPortText
.
setLayoutData
(
new
GridData
(
SWT
.
NONE
));
driverPortText
.
addModifyListener
(
e
->
onChangeProperty
());
Composite
optionsPanel
=
UIUtils
.
createComposite
(
propsGroup
,
3
);
Composite
optionsPanel
=
new
Composite
(
propsGroup
,
SWT
.
NONE
);
gd
=
new
GridData
(
GridData
.
FILL_HORIZONTAL
);
gd
.
horizontalSpan
=
2
;
optionsPanel
.
setLayoutData
(
gd
);
optionsPanel
.
setLayout
(
new
RowLayout
());
embeddedDriverCheck
=
UIUtils
.
createCheckbox
(
optionsPanel
,
UIConnectionMessages
.
dialog_edit_driver_embedded_label
,
UIConnectionMessages
.
dialog_edit_driver_embedded_tip
,
driver
.
isEmbedded
(),
1
);
embeddedDriverCheck
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
anonymousDriverCheck
=
UIUtils
.
createCheckbox
(
optionsPanel
,
UIConnectionMessages
.
dialog_edit_driver_anonymous_label
,
UIConnectionMessages
.
dialog_edit_driver_anonymous_tip
,
driver
.
isAnonymousAccess
(),
1
);
anonymousDriverCheck
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
allowsEmptyPasswordCheck
=
UIUtils
.
createCheckbox
(
optionsPanel
,
UIConnectionMessages
.
dialog_edit_driver_aloows_empty_password_label
,
UIConnectionMessages
.
dialog_edit_driver_aloows_empty_password_tip
,
driver
.
isAnonymousAccess
(),
1
);
allowsEmptyPasswordCheck
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
)
);
nonInstantiableCheck
=
UIUtils
.
createCheckbox
(
optionsPanel
,
"Use legacy JDBC instantiation"
,
"Do not instantiate driver directly, use DriverManager always."
,
!
driver
.
isInstantiable
(),
1
);
if
(
isReadOnly
)
{
embeddedDriverCheck
.
setEnabled
(
false
);
anonymousDriverCheck
.
setEnabled
(
false
);
allowsEmptyPasswordCheck
.
setEnabled
(
false
);
nonInstantiableCheck
.
setEnabled
(
false
);
}
}
...
...
@@ -726,6 +726,7 @@ public class DriverEditDialog extends HelpEnabledDialog {
embeddedDriverCheck
.
setSelection
(
driver
.
isEmbedded
());
anonymousDriverCheck
.
setSelection
(
driver
.
isAnonymousAccess
());
allowsEmptyPasswordCheck
.
setSelection
(
driver
.
isAllowsEmptyPassword
());
nonInstantiableCheck
.
setSelection
(!
driver
.
isInstantiable
());
if
(
original
)
{
resetLibraries
(
true
);
...
...
@@ -783,6 +784,7 @@ public class DriverEditDialog extends HelpEnabledDialog {
driver
.
setEmbedded
(
embeddedDriverCheck
.
getSelection
());
driver
.
setAnonymousAccess
(
anonymousDriverCheck
.
getSelection
());
driver
.
setAllowsEmptyPassword
(
allowsEmptyPasswordCheck
.
getSelection
());
driver
.
setInstantiable
(!
nonInstantiableCheck
.
getSelection
());
// driver.setAnonymousAccess(anonymousCheck.getSelection());
driver
.
setModified
(
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录