Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
76578739
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,发现更多精彩内容 >>
提交
76578739
编写于
4月 30, 2020
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Driver model small refactoring
上级
1255e0e0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
19 deletion
+36
-19
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
+1
-2
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/DataSourceProviderRegistry.java
...rg/jkiss/dbeaver/registry/DataSourceProviderRegistry.java
+31
-13
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
...c/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
+3
-3
未找到文件。
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/connection/DBPDriver.java
浏览文件 @
76578739
...
...
@@ -147,7 +147,7 @@ public interface DBPDriver extends DBPNamedObject
List
<?
extends
DBPDriverFileSource
>
getDriverFileSources
();
@NotNull
Object
getDriverInstance
(
@NotNull
DBRProgressMonitor
monitor
)
throws
DBException
;
<
T
>
T
getDriverInstance
(
@NotNull
DBRProgressMonitor
monitor
)
throws
DBException
;
void
loadDriver
(
DBRProgressMonitor
monitor
)
throws
DBException
;
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCDataSource.java
浏览文件 @
76578739
...
...
@@ -667,8 +667,7 @@ public abstract class JDBCDataSource
protected
Driver
getDriverInstance
(
@NotNull
DBRProgressMonitor
monitor
)
throws
DBException
{
return
Driver
.
class
.
cast
(
container
.
getDriver
().
getDriverInstance
(
monitor
));
return
container
.
getDriver
().
getDriverInstance
(
monitor
);
}
/**
...
...
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/DataSourceProviderRegistry.java
浏览文件 @
76578739
...
...
@@ -299,25 +299,43 @@ public class DataSourceProviderRegistry implements DBPDataSourceProviderRegistry
@Nullable
public
DriverDescriptor
findDriver
(
@NotNull
String
driverIdOrName
)
{
// Try to find by ID
for
(
DataSourceProviderDescriptor
pd
:
dataSourceProviders
)
{
DriverDescriptor
driver
=
pd
.
getDriver
(
driverIdOrName
);
if
(
driver
!=
null
)
{
return
driver
;
DriverDescriptor
driver
=
null
;
if
(
driverIdOrName
.
contains
(
":"
))
{
String
[]
driverPath
=
driverIdOrName
.
split
(
":"
);
if
(
driverPath
.
length
==
2
)
{
DataSourceProviderDescriptor
dsProvider
=
getDataSourceProvider
(
driverPath
[
0
]);
if
(
dsProvider
!=
null
)
{
driver
=
dsProvider
.
getDriver
(
driverPath
[
1
]);
}
}
}
// Try to find by name
for
(
DataSourceProviderDescriptor
pd
:
dataSourceProviders
)
{
for
(
DriverDescriptor
driver
:
pd
.
getDrivers
())
{
if
(
driver
.
getName
().
equalsIgnoreCase
(
driverIdOrName
))
{
while
(
driver
.
getReplacedBy
()
!=
null
)
{
driver
=
driver
.
getReplacedBy
();
if
(
driver
==
null
)
{
// Try to find by ID
for
(
DataSourceProviderDescriptor
pd
:
dataSourceProviders
)
{
driver
=
pd
.
getDriver
(
driverIdOrName
);
if
(
driver
!=
null
)
{
break
;
}
}
}
if
(
driver
==
null
)
{
// Try to find by name
for
(
DataSourceProviderDescriptor
pd
:
dataSourceProviders
)
{
for
(
DriverDescriptor
d
:
pd
.
getDrivers
())
{
if
(
d
.
getName
().
equalsIgnoreCase
(
driverIdOrName
))
{
driver
=
d
;
}
return
driver
;
}
}
}
return
null
;
// Find replacement
if
(
driver
!=
null
)
{
while
(
driver
.
getReplacedBy
()
!=
null
)
{
driver
=
driver
.
getReplacedBy
();
}
}
return
driver
;
}
//////////////////////////////////////////////
...
...
plugins/org.jkiss.dbeaver.registry/src/org/jkiss/dbeaver/registry/driver/DriverDescriptor.java
浏览文件 @
76578739
...
...
@@ -555,15 +555,15 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver {
@NotNull
@Override
public
Object
getDriverInstance
(
@NotNull
DBRProgressMonitor
monitor
)
public
<
T
>
T
getDriverInstance
(
@NotNull
DBRProgressMonitor
monitor
)
throws
DBException
{
if
(
driverInstance
==
null
)
{
loadDriver
(
monitor
);
}
if
(
isInternalDriver
()
&&
driverInstance
==
null
)
{
return
createDriverInstance
();
return
(
T
)
createDriverInstance
();
}
return
driverInstance
;
return
(
T
)
driverInstance
;
}
private
void
resetDriverInstance
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录