Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
153cde55
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,发现更多精彩内容 >>
提交
153cde55
编写于
9月 29, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Maven dependencies model
Former-commit-id:
d8db2561
上级
68e0dfb7
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
273 addition
and
150 deletion
+273
-150
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverClassLoader.java
...ore/src/org/jkiss/dbeaver/registry/DriverClassLoader.java
+3
-3
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverDescriptor.java
...core/src/org/jkiss/dbeaver/registry/DriverDescriptor.java
+28
-33
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverFileSource.java
...core/src/org/jkiss/dbeaver/registry/DriverFileSource.java
+1
-2
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverLibraryDescriptor.java
...c/org/jkiss/dbeaver/registry/DriverLibraryDescriptor.java
+15
-18
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactDependency.java
...jkiss/dbeaver/registry/maven/MavenArtifactDependency.java
+52
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactLicense.java
...rg/jkiss/dbeaver/registry/maven/MavenArtifactLicense.java
+46
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
...rg/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
+68
-20
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
...c/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
+0
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/project/ProjectExportWizard.java
.../org/jkiss/dbeaver/tools/project/ProjectExportWizard.java
+1
-1
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/project/ProjectImportWizard.java
.../org/jkiss/dbeaver/tools/project/ProjectImportWizard.java
+4
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
...iss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
+9
-16
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog.java
...jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog.java
+5
-5
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
...jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
+4
-4
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
...org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
+22
-22
plugins/org.jkiss.dbeaver.ext.import-config/src/org/jkiss/dbeaver/ext/import_config/wizards/ConfigImportWizard.java
...dbeaver/ext/import_config/wizards/ConfigImportWizard.java
+2
-2
plugins/org.jkiss.dbeaver.ext.wmi/src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
.../src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
+2
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriver.java
....dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriver.java
+1
-6
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriverLibrary.java
...r.model/src/org/jkiss/dbeaver/model/DBPDriverLibrary.java
+10
-11
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverClassLoader.java
浏览文件 @
153cde55
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
package
org.jkiss.dbeaver.registry
;
package
org.jkiss.dbeaver.registry
;
import
org.jkiss.dbeaver.model.DBPDriver
File
;
import
org.jkiss.dbeaver.model.DBPDriver
Library
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.File
;
import
java.io.File
;
...
@@ -43,8 +43,8 @@ public class DriverClassLoader extends URLClassLoader
...
@@ -43,8 +43,8 @@ public class DriverClassLoader extends URLClassLoader
protected
String
findLibrary
(
String
libname
)
protected
String
findLibrary
(
String
libname
)
{
{
String
nativeName
=
System
.
mapLibraryName
(
libname
);
String
nativeName
=
System
.
mapLibraryName
(
libname
);
for
(
Driver
FileDescriptor
driverFile
:
driver
.
getDriverFil
es
())
{
for
(
Driver
LibraryDescriptor
driverFile
:
driver
.
getDriverLibrari
es
())
{
if
(
driverFile
.
getType
()
==
DBPDriver
File
.
FileType
.
lib
&&
driverFile
.
matchesCurrentPlatform
())
{
if
(
driverFile
.
getType
()
==
DBPDriver
Library
.
FileType
.
lib
&&
driverFile
.
matchesCurrentPlatform
())
{
final
File
localFile
=
driverFile
.
getLocalFile
();
final
File
localFile
=
driverFile
.
getLocalFile
();
if
(
localFile
!=
null
&&
localFile
.
exists
())
{
if
(
localFile
!=
null
&&
localFile
.
exists
())
{
final
String
fileName
=
localFile
.
getName
();
final
String
fileName
=
localFile
.
getName
();
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverDescriptor.java
浏览文件 @
153cde55
...
@@ -102,8 +102,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -102,8 +102,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
private
boolean
disabled
;
private
boolean
disabled
;
private
final
List
<
String
>
clientHomeIds
=
new
ArrayList
<
String
>();
private
final
List
<
String
>
clientHomeIds
=
new
ArrayList
<
String
>();
private
final
List
<
DriverFileSource
>
fileSources
=
new
ArrayList
<
DriverFileSource
>();
private
final
List
<
DriverFileSource
>
fileSources
=
new
ArrayList
<
DriverFileSource
>();
private
final
List
<
Driver
FileDescriptor
>
files
=
new
ArrayList
<
DriverFile
Descriptor
>();
private
final
List
<
Driver
LibraryDescriptor
>
files
=
new
ArrayList
<
DriverLibrary
Descriptor
>();
private
final
List
<
Driver
FileDescriptor
>
origFiles
=
new
ArrayList
<
DriverFile
Descriptor
>();
private
final
List
<
Driver
LibraryDescriptor
>
origFiles
=
new
ArrayList
<
DriverLibrary
Descriptor
>();
private
final
List
<
DriverPathDescriptor
>
pathList
=
new
ArrayList
<
DriverPathDescriptor
>();
private
final
List
<
DriverPathDescriptor
>
pathList
=
new
ArrayList
<
DriverPathDescriptor
>();
private
final
List
<
DBPPropertyDescriptor
>
connectionPropertyDescriptors
=
new
ArrayList
<
DBPPropertyDescriptor
>();
private
final
List
<
DBPPropertyDescriptor
>
connectionPropertyDescriptors
=
new
ArrayList
<
DBPPropertyDescriptor
>();
private
final
List
<
OSDescriptor
>
supportedSystems
=
new
ArrayList
<
OSDescriptor
>();
private
final
List
<
OSDescriptor
>
supportedSystems
=
new
ArrayList
<
OSDescriptor
>();
...
@@ -170,7 +170,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -170,7 +170,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
this
.
isLoaded
=
false
;
this
.
isLoaded
=
false
;
for
(
IConfigurationElement
lib
:
config
.
getChildren
(
RegistryConstants
.
TAG_FILE
))
{
for
(
IConfigurationElement
lib
:
config
.
getChildren
(
RegistryConstants
.
TAG_FILE
))
{
this
.
files
.
add
(
new
Driver
File
Descriptor
(
this
,
lib
));
this
.
files
.
add
(
new
Driver
Library
Descriptor
(
this
,
lib
));
}
}
this
.
origFiles
.
addAll
(
this
.
files
);
this
.
origFiles
.
addAll
(
this
.
files
);
...
@@ -430,7 +430,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -430,7 +430,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
private
boolean
hasValidLibraries
()
private
boolean
hasValidLibraries
()
{
{
for
(
Driver
File
Descriptor
lib
:
files
)
{
for
(
Driver
Library
Descriptor
lib
:
files
)
{
File
file
=
lib
.
getLocalFile
();
File
file
=
lib
.
getLocalFile
();
if
(
file
!=
null
&&
file
.
exists
())
{
if
(
file
!=
null
&&
file
.
exists
())
{
return
true
;
return
true
;
...
@@ -635,14 +635,14 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -635,14 +635,14 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
@NotNull
@NotNull
@Override
@Override
public
Collection
<
Driver
FileDescriptor
>
getDriverFil
es
()
public
Collection
<
Driver
LibraryDescriptor
>
getDriverLibrari
es
()
{
{
return
files
;
return
files
;
}
}
public
Driver
File
Descriptor
getDriverFile
(
String
path
)
public
Driver
Library
Descriptor
getDriverFile
(
String
path
)
{
{
for
(
Driver
File
Descriptor
lib
:
files
)
{
for
(
Driver
Library
Descriptor
lib
:
files
)
{
if
(
lib
.
getPath
().
equals
(
path
))
{
if
(
lib
.
getPath
().
equals
(
path
))
{
return
lib
;
return
lib
;
}
}
...
@@ -650,19 +650,19 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -650,19 +650,19 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
return
null
;
return
null
;
}
}
public
Driver
FileDescriptor
addDriverFile
(
String
path
,
DBPDriverFile
.
FileType
fileType
)
public
Driver
LibraryDescriptor
addDriverFile
(
String
path
,
DBPDriverLibrary
.
FileType
fileType
)
{
{
for
(
Driver
File
Descriptor
lib
:
files
)
{
for
(
Driver
Library
Descriptor
lib
:
files
)
{
if
(
lib
.
getPath
().
equals
(
path
))
{
if
(
lib
.
getPath
().
equals
(
path
))
{
return
lib
;
return
lib
;
}
}
}
}
Driver
FileDescriptor
lib
=
new
DriverFile
Descriptor
(
this
,
fileType
,
path
);
Driver
LibraryDescriptor
lib
=
new
DriverLibrary
Descriptor
(
this
,
fileType
,
path
);
addDriverFile
(
lib
);
addDriverFile
(
lib
);
return
lib
;
return
lib
;
}
}
public
boolean
addDriverFile
(
Driver
File
Descriptor
descriptor
)
public
boolean
addDriverFile
(
Driver
Library
Descriptor
descriptor
)
{
{
resetDriverInstance
();
resetDriverInstance
();
if
(!
files
.
contains
(
descriptor
))
{
if
(!
files
.
contains
(
descriptor
))
{
...
@@ -672,7 +672,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -672,7 +672,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
return
false
;
return
false
;
}
}
public
boolean
removeDriverFile
(
Driver
File
Descriptor
lib
)
public
boolean
removeDriverFile
(
Driver
Library
Descriptor
lib
)
{
{
resetDriverInstance
();
resetDriverInstance
();
if
(!
lib
.
isCustom
())
{
if
(!
lib
.
isCustom
())
{
...
@@ -798,8 +798,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -798,8 +798,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
public
String
getLicense
()
public
String
getLicense
()
{
{
for
(
Driver
File
Descriptor
file
:
files
)
{
for
(
Driver
Library
Descriptor
file
:
files
)
{
if
(
file
.
getType
()
==
DBPDriver
File
.
FileType
.
license
)
{
if
(
file
.
getType
()
==
DBPDriver
Library
.
FileType
.
license
)
{
final
File
licenseFile
=
file
.
getLocalFile
();
final
File
licenseFile
=
file
.
getLocalFile
();
if
(
licenseFile
!=
null
&&
licenseFile
.
exists
())
{
if
(
licenseFile
!=
null
&&
licenseFile
.
exists
())
{
try
{
try
{
...
@@ -875,8 +875,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -875,8 +875,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
List
<
URL
>
libraryURLs
=
new
ArrayList
<
URL
>();
List
<
URL
>
libraryURLs
=
new
ArrayList
<
URL
>();
// Load libraries
// Load libraries
for
(
Driver
File
Descriptor
file
:
files
)
{
for
(
Driver
Library
Descriptor
file
:
files
)
{
if
(
file
.
isDisabled
()
||
file
.
getType
()
!=
DBPDriver
File
.
FileType
.
jar
)
{
if
(
file
.
isDisabled
()
||
file
.
getType
()
!=
DBPDriver
Library
.
FileType
.
jar
)
{
continue
;
continue
;
}
}
File
localFile
=
file
.
getLocalFile
();
File
localFile
=
file
.
getLocalFile
();
...
@@ -902,7 +902,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -902,7 +902,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
@Override
@Override
public
void
validateFilesPresence
(
final
DBRRunnableContext
runnableContext
)
public
void
validateFilesPresence
(
final
DBRRunnableContext
runnableContext
)
{
{
for
(
Driver
File
Descriptor
file
:
files
)
{
for
(
Driver
Library
Descriptor
file
:
files
)
{
if
(
file
.
isCustom
())
{
if
(
file
.
isCustom
())
{
File
localFile
=
file
.
getLocalFile
();
File
localFile
=
file
.
getLocalFile
();
if
(
localFile
!=
null
&&
localFile
.
exists
())
{
if
(
localFile
!=
null
&&
localFile
.
exists
())
{
...
@@ -912,8 +912,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -912,8 +912,8 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
}
}
}
}
final
List
<
Driver
FileDescriptor
>
downloadCandidates
=
new
ArrayList
<
DriverFile
Descriptor
>();
final
List
<
Driver
LibraryDescriptor
>
downloadCandidates
=
new
ArrayList
<
DriverLibrary
Descriptor
>();
for
(
Driver
File
Descriptor
file
:
files
)
{
for
(
Driver
Library
Descriptor
file
:
files
)
{
if
(
file
.
isDisabled
()
||
!
file
.
isDownloadable
())
{
if
(
file
.
isDisabled
()
||
!
file
.
isDownloadable
())
{
// Nothing we can do about it
// Nothing we can do about it
continue
;
continue
;
...
@@ -938,16 +938,11 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -938,16 +938,11 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
}
}
}
}
@Override
public
void
updateFiles
(
DBRRunnableContext
runnableContext
)
{
}
public
boolean
acceptDriverLicenses
(
DBRRunnableContext
runnableContext
)
public
boolean
acceptDriverLicenses
(
DBRRunnableContext
runnableContext
)
{
{
// User must accept all licenses before actual drivers download
// User must accept all licenses before actual drivers download
for
(
final
Driver
FileDescriptor
file
:
getDriverFil
es
())
{
for
(
final
Driver
LibraryDescriptor
file
:
getDriverLibrari
es
())
{
if
(
file
.
getType
()
==
DBPDriver
File
.
FileType
.
license
)
{
if
(
file
.
getType
()
==
DBPDriver
Library
.
FileType
.
license
)
{
final
File
libraryFile
=
file
.
getLocalFile
();
final
File
libraryFile
=
file
.
getLocalFile
();
if
(
libraryFile
==
null
||
!
libraryFile
.
exists
())
{
if
(
libraryFile
==
null
||
!
libraryFile
.
exists
())
{
try
{
try
{
...
@@ -1019,7 +1014,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -1019,7 +1014,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
return
origSampleURL
;
return
origSampleURL
;
}
}
public
List
<
Driver
File
Descriptor
>
getOrigFiles
()
public
List
<
Driver
Library
Descriptor
>
getOrigFiles
()
{
{
return
origFiles
;
return
origFiles
;
}
}
...
@@ -1059,7 +1054,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -1059,7 +1054,7 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
}
}
// Libraries
// Libraries
for
(
Driver
FileDescriptor
lib
:
this
.
getDriverFil
es
())
{
for
(
Driver
LibraryDescriptor
lib
:
this
.
getDriverLibrari
es
())
{
if
((
export
&&
!
lib
.
isDisabled
())
||
lib
.
isCustom
()
||
lib
.
isDisabled
())
{
if
((
export
&&
!
lib
.
isDisabled
())
||
lib
.
isCustom
()
||
lib
.
isDisabled
())
{
xml
.
startElement
(
RegistryConstants
.
TAG_LIBRARY
);
xml
.
startElement
(
RegistryConstants
.
TAG_LIBRARY
);
xml
.
addAttribute
(
RegistryConstants
.
ATTR_TYPE
,
lib
.
getType
().
name
());
xml
.
addAttribute
(
RegistryConstants
.
ATTR_TYPE
,
lib
.
getType
().
name
());
...
@@ -1231,20 +1226,20 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
...
@@ -1231,20 +1226,20 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
log
.
warn
(
"File outside of driver"
);
log
.
warn
(
"File outside of driver"
);
return
;
return
;
}
}
DBPDriver
File
.
FileType
type
;
DBPDriver
Library
.
FileType
type
;
String
typeStr
=
atts
.
getValue
(
RegistryConstants
.
ATTR_TYPE
);
String
typeStr
=
atts
.
getValue
(
RegistryConstants
.
ATTR_TYPE
);
if
(
CommonUtils
.
isEmpty
(
typeStr
))
{
if
(
CommonUtils
.
isEmpty
(
typeStr
))
{
type
=
DBPDriver
File
.
FileType
.
jar
;
type
=
DBPDriver
Library
.
FileType
.
jar
;
}
else
{
}
else
{
try
{
try
{
type
=
DBPDriver
File
.
FileType
.
valueOf
(
typeStr
);
type
=
DBPDriver
Library
.
FileType
.
valueOf
(
typeStr
);
}
catch
(
IllegalArgumentException
e
)
{
}
catch
(
IllegalArgumentException
e
)
{
log
.
warn
(
e
);
log
.
warn
(
e
);
type
=
DBPDriver
File
.
FileType
.
jar
;
type
=
DBPDriver
Library
.
FileType
.
jar
;
}
}
}
}
String
path
=
atts
.
getValue
(
RegistryConstants
.
ATTR_PATH
);
String
path
=
atts
.
getValue
(
RegistryConstants
.
ATTR_PATH
);
Driver
File
Descriptor
lib
=
curDriver
.
getDriverFile
(
path
);
Driver
Library
Descriptor
lib
=
curDriver
.
getDriverFile
(
path
);
String
disabledAttr
=
atts
.
getValue
(
RegistryConstants
.
ATTR_DISABLED
);
String
disabledAttr
=
atts
.
getValue
(
RegistryConstants
.
ATTR_DISABLED
);
if
(
lib
!=
null
&&
CommonUtils
.
getBoolean
(
disabledAttr
))
{
if
(
lib
!=
null
&&
CommonUtils
.
getBoolean
(
disabledAttr
))
{
lib
.
setDisabled
(
true
);
lib
.
setDisabled
(
true
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DriverFileSource.java
浏览文件 @
153cde55
...
@@ -19,7 +19,6 @@ package org.jkiss.dbeaver.registry;
...
@@ -19,7 +19,6 @@ package org.jkiss.dbeaver.registry;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -28,7 +27,7 @@ import java.util.List;
...
@@ -28,7 +27,7 @@ import java.util.List;
/**
/**
* DriverFileSource
* DriverFileSource
*/
*/
public
class
DriverFileSource
implements
DBPDriverFile
.
FileSource
public
class
DriverFileSource
{
{
static
final
Log
log
=
Log
.
getLog
(
DriverFileSource
.
class
);
static
final
Log
log
=
Log
.
getLog
(
DriverFileSource
.
class
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/Driver
File
Descriptor.java
→
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/Driver
Library
Descriptor.java
浏览文件 @
153cde55
...
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.Platform;
...
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.Platform;
import
org.jkiss.code.Nullable
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPDriver
File
;
import
org.jkiss.dbeaver.model.DBPDriver
Library
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.OSDescriptor
;
import
org.jkiss.dbeaver.model.runtime.OSDescriptor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
...
@@ -38,17 +38,19 @@ import java.io.*;
...
@@ -38,17 +38,19 @@ import java.io.*;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.net.URLConnection
;
import
java.text.NumberFormat
;
import
java.text.NumberFormat
;
import
java.util.Collection
;
/**
/**
* Driver
File
Descriptor
* Driver
Library
Descriptor
*/
*/
public
class
Driver
FileDescriptor
implements
DBPDriverFile
public
class
Driver
LibraryDescriptor
implements
DBPDriverLibrary
{
{
static
final
Log
log
=
Log
.
getLog
(
Driver
File
Descriptor
.
class
);
static
final
Log
log
=
Log
.
getLog
(
Driver
Library
Descriptor
.
class
);
public
static
final
String
FILE_SOURCE_MAVEN
=
"maven:/"
;
public
static
final
String
FILE_SOURCE_MAVEN
=
"maven:/"
;
public
static
final
String
FILE_SOURCE_REPO
=
"repo:/"
;
public
static
final
String
FILE_SOURCE_REPO
=
"repo:/"
;
public
static
final
String
FILE_SOURCE_PLATFORM
=
"platform:/"
;
public
static
final
String
FILE_SOURCE_PLATFORM
=
"platform:/"
;
public
static
final
String
FILE_SOURCE_LOCAL
=
"file:/"
;
private
final
DriverDescriptor
driver
;
private
final
DriverDescriptor
driver
;
private
final
FileType
type
;
private
final
FileType
type
;
...
@@ -59,7 +61,7 @@ public class DriverFileDescriptor implements DBPDriverFile
...
@@ -59,7 +61,7 @@ public class DriverFileDescriptor implements DBPDriverFile
private
boolean
custom
;
private
boolean
custom
;
private
boolean
disabled
;
private
boolean
disabled
;
public
Driver
File
Descriptor
(
DriverDescriptor
driver
,
FileType
type
,
String
path
)
public
Driver
Library
Descriptor
(
DriverDescriptor
driver
,
FileType
type
,
String
path
)
{
{
this
.
driver
=
driver
;
this
.
driver
=
driver
;
this
.
type
=
type
;
this
.
type
=
type
;
...
@@ -68,7 +70,7 @@ public class DriverFileDescriptor implements DBPDriverFile
...
@@ -68,7 +70,7 @@ public class DriverFileDescriptor implements DBPDriverFile
this
.
custom
=
true
;
this
.
custom
=
true
;
}
}
Driver
File
Descriptor
(
DriverDescriptor
driver
,
IConfigurationElement
config
)
Driver
Library
Descriptor
(
DriverDescriptor
driver
,
IConfigurationElement
config
)
{
{
this
.
driver
=
driver
;
this
.
driver
=
driver
;
this
.
type
=
FileType
.
valueOf
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_TYPE
));
this
.
type
=
FileType
.
valueOf
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_TYPE
));
...
@@ -94,23 +96,12 @@ public class DriverFileDescriptor implements DBPDriverFile
...
@@ -94,23 +96,12 @@ public class DriverFileDescriptor implements DBPDriverFile
return
type
;
return
type
;
}
}
@Override
public
OSDescriptor
getSystem
()
{
return
system
;
}
@Override
@Override
public
String
getPath
()
public
String
getPath
()
{
{
return
path
;
return
path
;
}
}
@Override
public
String
getFileType
()
{
return
null
;
}
@Override
@Override
public
String
getDescription
()
public
String
getDescription
()
{
{
...
@@ -145,7 +136,7 @@ public class DriverFileDescriptor implements DBPDriverFile
...
@@ -145,7 +136,7 @@ public class DriverFileDescriptor implements DBPDriverFile
return
isRepositoryArtifact
()
||
isMavenArtifact
();
return
isRepositoryArtifact
()
||
isMavenArtifact
();
}
}
p
ublic
boolean
isRepositoryArtifact
()
{
p
rivate
boolean
isRepositoryArtifact
()
{
return
path
.
startsWith
(
FILE_SOURCE_REPO
);
return
path
.
startsWith
(
FILE_SOURCE_REPO
);
}
}
...
@@ -289,6 +280,12 @@ public class DriverFileDescriptor implements DBPDriverFile
...
@@ -289,6 +280,12 @@ public class DriverFileDescriptor implements DBPDriverFile
return
system
==
null
||
system
.
matches
(
DBeaverCore
.
getInstance
().
getLocalSystem
());
return
system
==
null
||
system
.
matches
(
DBeaverCore
.
getInstance
().
getLocalSystem
());
}
}
@Nullable
@Override
public
Collection
<
DBPDriverLibrary
>
getDependencies
()
{
return
null
;
}
/*
/*
private String getMavenArtifactFileName() {
private String getMavenArtifactFileName() {
String artifactName = path.substring(FILE_SOURCE_MAVEN.length());
String artifactName = path.substring(FILE_SOURCE_MAVEN.length());
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactDependency.java
0 → 100644
浏览文件 @
153cde55
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 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.registry.maven
;
/**
* Maven artifact license references
*/
public
class
MavenArtifactDependency
{
private
MavenArtifactReference
artifactReference
;
private
String
type
;
private
boolean
optional
;
public
MavenArtifactDependency
(
MavenArtifactReference
artifactReference
,
String
type
,
boolean
optional
)
{
this
.
artifactReference
=
artifactReference
;
this
.
type
=
type
;
this
.
optional
=
optional
;
}
public
MavenArtifactReference
getArtifactReference
()
{
return
artifactReference
;
}
public
String
getType
()
{
return
type
;
}
public
boolean
isOptional
()
{
return
optional
;
}
@Override
public
String
toString
()
{
return
artifactReference
.
toString
()
+
";type="
+
type
+
"; optional="
+
optional
;
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactLicense.java
0 → 100644
浏览文件 @
153cde55
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 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.registry.maven
;
/**
* Maven artifact license references
*/
public
class
MavenArtifactLicense
{
private
String
name
;
private
String
url
;
public
MavenArtifactLicense
(
String
name
,
String
url
)
{
this
.
name
=
name
;
this
.
url
=
url
;
}
public
String
getName
()
{
return
name
;
}
public
String
getUrl
()
{
return
url
;
}
@Override
public
String
toString
()
{
return
name
;
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenArtifactVersion.java
浏览文件 @
153cde55
...
@@ -26,7 +26,9 @@ import org.xml.sax.Attributes;
...
@@ -26,7 +26,9 @@ import org.xml.sax.Attributes;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* Maven artifact version descriptor (POM).
* Maven artifact version descriptor (POM).
...
@@ -40,8 +42,8 @@ public class MavenArtifactVersion
...
@@ -40,8 +42,8 @@ public class MavenArtifactVersion
private
String
version
;
private
String
version
;
private
String
description
;
private
String
description
;
private
String
url
;
private
String
url
;
private
List
<
String
>
licenses
;
private
List
<
MavenArtifactLicense
>
licenses
;
private
List
<
MavenArtifact
Reference
>
dependencies
;
private
List
<
MavenArtifact
Dependency
>
dependencies
;
MavenArtifactVersion
(
MavenLocalVersion
localVersion
)
throws
IOException
{
MavenArtifactVersion
(
MavenLocalVersion
localVersion
)
throws
IOException
{
this
.
localVersion
=
localVersion
;
this
.
localVersion
=
localVersion
;
...
@@ -73,44 +75,95 @@ public class MavenArtifactVersion
...
@@ -73,44 +75,95 @@ public class MavenArtifactVersion
return
url
;
return
url
;
}
}
public
List
<
String
>
getLicenses
()
{
public
List
<
MavenArtifactLicense
>
getLicenses
()
{
return
licenses
;
return
licenses
;
}
}
public
List
<
MavenArtifact
Reference
>
getDependencies
()
{
public
List
<
MavenArtifact
Dependency
>
getDependencies
()
{
return
dependencies
;
return
dependencies
;
}
}
@Override
public
String
toString
()
{
return
localVersion
.
toString
();
}
private
enum
ParserState
{
ROOT
,
LICENSE
,
DEPENDENCIES
,
DEPENDENCY
}
private
void
loadPOM
()
throws
IOException
{
private
void
loadPOM
()
throws
IOException
{
String
pomURL
=
localVersion
.
getArtifact
().
getFileURL
(
localVersion
.
getVersion
(),
MavenArtifact
.
FILE_POM
);
String
pomURL
=
localVersion
.
getArtifact
().
getFileURL
(
localVersion
.
getVersion
(),
MavenArtifact
.
FILE_POM
);
InputStream
mdStream
=
RuntimeUtils
.
openConnectionStream
(
pomURL
);
InputStream
mdStream
=
RuntimeUtils
.
openConnectionStream
(
pomURL
);
try
{
try
{
SAXReader
reader
=
new
SAXReader
(
mdStream
);
SAXReader
reader
=
new
SAXReader
(
mdStream
);
reader
.
parse
(
new
SAXListener
()
{
reader
.
parse
(
new
SAXListener
()
{
private
boolean
inRoot
=
true
;
private
ParserState
state
=
ParserState
.
ROOT
;
private
String
lastTag
;
private
String
lastTag
;
private
Map
<
String
,
String
>
attributes
=
new
HashMap
<
String
,
String
>();
@Override
@Override
public
void
saxStartElement
(
SAXReader
reader
,
String
namespaceURI
,
String
localName
,
Attributes
atts
)
throws
XMLException
{
public
void
saxStartElement
(
SAXReader
reader
,
String
namespaceURI
,
String
localName
,
Attributes
atts
)
throws
XMLException
{
lastTag
=
localName
;
lastTag
=
localName
;
if
(
"license"
.
equals
(
localName
))
{
state
=
ParserState
.
LICENSE
;
}
else
if
(
"dependencies"
.
equals
(
localName
))
{
state
=
ParserState
.
DEPENDENCIES
;
}
else
if
(
"dependency"
.
equals
(
localName
)
&&
state
==
ParserState
.
DEPENDENCIES
)
{
state
=
ParserState
.
DEPENDENCY
;
}
}
}
@Override
@Override
public
void
saxText
(
SAXReader
reader
,
String
data
)
throws
XMLException
{
public
void
saxText
(
SAXReader
reader
,
String
data
)
throws
XMLException
{
if
(
inRoot
)
{
switch
(
state
)
{
if
(
"name"
.
equals
(
lastTag
))
{
case
ROOT:
name
=
data
;
if
(
"name"
.
equals
(
lastTag
))
{
}
else
if
(
"version"
.
equals
(
lastTag
))
{
name
=
data
;
version
=
data
;
}
else
if
(
"version"
.
equals
(
lastTag
))
{
}
else
if
(
"description"
.
equals
(
lastTag
))
{
version
=
data
;
description
=
data
;
}
else
if
(
"description"
.
equals
(
lastTag
))
{
}
else
if
(
"url"
.
equals
(
lastTag
))
{
description
=
data
;
url
=
data
;
}
else
if
(
"url"
.
equals
(
lastTag
))
{
}
url
=
data
;
}
break
;
case
LICENSE:
case
DEPENDENCY:
attributes
.
put
(
lastTag
,
data
);
break
;
}
}
}
}
@Override
@Override
public
void
saxEndElement
(
SAXReader
reader
,
String
namespaceURI
,
String
localName
)
throws
XMLException
{
public
void
saxEndElement
(
SAXReader
reader
,
String
namespaceURI
,
String
localName
)
throws
XMLException
{
lastTag
=
null
;
lastTag
=
null
;
if
(
"license"
.
equals
(
localName
)
&&
state
==
ParserState
.
LICENSE
)
{
state
=
ParserState
.
ROOT
;
licenses
.
add
(
new
MavenArtifactLicense
(
attributes
.
get
(
"name"
),
attributes
.
get
(
"url"
)
));
attributes
.
clear
();
}
else
if
(
"dependencies"
.
equals
(
localName
)
&&
state
==
ParserState
.
DEPENDENCIES
)
{
state
=
ParserState
.
ROOT
;
dependencies
.
add
(
new
MavenArtifactDependency
(
new
MavenArtifactReference
(
attributes
.
get
(
"groupId"
),
attributes
.
get
(
"artifactId"
),
attributes
.
get
(
"version"
)
),
attributes
.
get
(
"type"
),
Boolean
.
valueOf
(
attributes
.
get
(
"optional"
))
));
attributes
.
clear
();
}
else
if
(
"dependency"
.
equals
(
localName
)
&&
state
==
ParserState
.
DEPENDENCY
)
{
state
=
ParserState
.
DEPENDENCIES
;
attributes
.
clear
();
}
}
}
});
});
}
catch
(
XMLException
e
)
{
}
catch
(
XMLException
e
)
{
...
@@ -120,9 +173,4 @@ public class MavenArtifactVersion
...
@@ -120,9 +173,4 @@ public class MavenArtifactVersion
}
}
}
}
@Override
public
String
toString
()
{
return
localVersion
.
toString
();
}
}
}
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
浏览文件 @
153cde55
...
@@ -34,7 +34,6 @@ import java.util.Date;
...
@@ -34,7 +34,6 @@ import java.util.Date;
public
class
MavenLocalVersion
public
class
MavenLocalVersion
{
{
static
final
Log
log
=
Log
.
getLog
(
MavenLocalVersion
.
class
);
static
final
Log
log
=
Log
.
getLog
(
MavenLocalVersion
.
class
);
private
static
final
java
.
lang
.
String
FILE_PROTOCOL
=
"file:/"
;
private
MavenArtifact
artifact
;
private
MavenArtifact
artifact
;
private
String
version
;
private
String
version
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/project/ProjectExportWizard.java
浏览文件 @
153cde55
...
@@ -182,7 +182,7 @@ public class ProjectExportWizard extends Wizard implements IExportWizard {
...
@@ -182,7 +182,7 @@ public class ProjectExportWizard extends Wizard implements IExportWizard {
Set
<
File
>
libFiles
=
new
HashSet
<
File
>();
Set
<
File
>
libFiles
=
new
HashSet
<
File
>();
Map
<
String
,
File
>
libPathMap
=
new
HashMap
<
String
,
File
>();
Map
<
String
,
File
>
libPathMap
=
new
HashMap
<
String
,
File
>();
for
(
DriverDescriptor
driver
:
exportData
.
usedDrivers
)
{
for
(
DriverDescriptor
driver
:
exportData
.
usedDrivers
)
{
for
(
Driver
FileDescriptor
fileDescriptor
:
driver
.
getDriverFil
es
())
{
for
(
Driver
LibraryDescriptor
fileDescriptor
:
driver
.
getDriverLibrari
es
())
{
final
File
libraryFile
=
fileDescriptor
.
getLocalFile
();
final
File
libraryFile
=
fileDescriptor
.
getLocalFile
();
if
(
libraryFile
!=
null
&&
!
fileDescriptor
.
isDisabled
()
&&
libraryFile
.
exists
())
{
if
(
libraryFile
!=
null
&&
!
fileDescriptor
.
isDisabled
()
&&
libraryFile
.
exists
())
{
libFiles
.
add
(
libraryFile
);
libFiles
.
add
(
libraryFile
);
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/tools/project/ProjectImportWizard.java
浏览文件 @
153cde55
...
@@ -29,7 +29,7 @@ import org.eclipse.ui.IWorkbench;
...
@@ -29,7 +29,7 @@ import org.eclipse.ui.IWorkbench;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.CoreMessages
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPDriver
File
;
import
org.jkiss.dbeaver.model.DBPDriver
Library
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.registry.*
;
import
org.jkiss.dbeaver.registry.*
;
...
@@ -270,7 +270,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
...
@@ -270,7 +270,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
}
}
// Add libraries (only for managable drivers with empty library list)
// Add libraries (only for managable drivers with empty library list)
if
(
CommonUtils
.
isEmpty
(
driver
.
getDriver
Fil
es
()))
{
if
(
CommonUtils
.
isEmpty
(
driver
.
getDriver
Librari
es
()))
{
List
<
String
>
libraryList
=
new
ArrayList
<
String
>();
List
<
String
>
libraryList
=
new
ArrayList
<
String
>();
for
(
Element
libElement
:
XMLUtils
.
getChildElementList
(
driverElement
,
RegistryConstants
.
TAG_FILE
))
{
for
(
Element
libElement
:
XMLUtils
.
getChildElementList
(
driverElement
,
RegistryConstants
.
TAG_FILE
))
{
libraryList
.
add
(
libElement
.
getAttribute
(
RegistryConstants
.
ATTR_PATH
));
libraryList
.
add
(
libElement
.
getAttribute
(
RegistryConstants
.
ATTR_PATH
));
...
@@ -280,7 +280,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
...
@@ -280,7 +280,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
File
libFile
=
new
File
(
libPath
);
File
libFile
=
new
File
(
libPath
);
if
(
libFile
.
exists
())
{
if
(
libFile
.
exists
())
{
// Just use path as-is (may be it is local re-import or local environments equal to export environment)
// Just use path as-is (may be it is local re-import or local environments equal to export environment)
driver
.
addDriverFile
(
libPath
,
DBPDriver
File
.
FileType
.
jar
);
driver
.
addDriverFile
(
libPath
,
DBPDriver
Library
.
FileType
.
jar
);
}
else
{
}
else
{
// Get driver library from archive
// Get driver library from archive
String
archiveLibEntry
=
libMap
.
get
(
libPath
);
String
archiveLibEntry
=
libMap
.
get
(
libPath
);
...
@@ -312,7 +312,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
...
@@ -312,7 +312,7 @@ public class ProjectImportWizard extends Wizard implements IImportWizard {
while
(
relativePath
.
charAt
(
0
)
==
'/'
||
relativePath
.
charAt
(
0
)
==
'\\'
)
{
while
(
relativePath
.
charAt
(
0
)
==
'/'
||
relativePath
.
charAt
(
0
)
==
'\\'
)
{
relativePath
=
relativePath
.
substring
(
1
);
relativePath
=
relativePath
.
substring
(
1
);
}
}
driver
.
addDriverFile
(
relativePath
,
DBPDriver
File
.
FileType
.
jar
);
driver
.
addDriverFile
(
relativePath
,
DBPDriver
Library
.
FileType
.
jar
);
}
}
}
}
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadAutoPage.java
浏览文件 @
153cde55
...
@@ -21,24 +21,17 @@ import org.eclipse.core.runtime.IStatus;
...
@@ -21,24 +21,17 @@ import org.eclipse.core.runtime.IStatus;
import
org.eclipse.jface.dialogs.ErrorDialog
;
import
org.eclipse.jface.dialogs.ErrorDialog
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.jface.dialogs.IDialogConstants
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.*
;
import
org.eclipse.swt.widgets.*
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBPDriverLibrary
;
import
org.jkiss.dbeaver.model.DBPDriverFile
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableContext
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableContext
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.Driver
File
Descriptor
;
import
org.jkiss.dbeaver.registry.Driver
Library
Descriptor
;
import
org.jkiss.dbeaver.runtime.RunnableContextDelegate
;
import
org.jkiss.dbeaver.runtime.RunnableContextDelegate
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.preferences.PrefPageDrivers
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
...
@@ -75,7 +68,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
...
@@ -75,7 +68,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
filesTable
.
setHeaderVisible
(
true
);
filesTable
.
setHeaderVisible
(
true
);
filesTable
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
filesTable
.
setLayoutData
(
new
GridData
(
GridData
.
FILL_HORIZONTAL
));
UIUtils
.
createTableColumn
(
filesTable
,
SWT
.
LEFT
,
"File"
);
UIUtils
.
createTableColumn
(
filesTable
,
SWT
.
LEFT
,
"File"
);
for
(
Driver
File
Descriptor
file
:
wizard
.
getFiles
())
{
for
(
Driver
Library
Descriptor
file
:
wizard
.
getFiles
())
{
new
TableItem
(
filesTable
,
SWT
.
NONE
).
setText
(
file
.
getDisplayName
());
new
TableItem
(
filesTable
,
SWT
.
NONE
).
setText
(
file
.
getDisplayName
());
}
}
UIUtils
.
packColumns
(
filesTable
,
true
);
UIUtils
.
packColumns
(
filesTable
,
true
);
...
@@ -97,14 +90,14 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
...
@@ -97,14 +90,14 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
downloadLibraryFiles
(
new
RunnableContextDelegate
(
getContainer
()),
getWizard
().
getFiles
());
downloadLibraryFiles
(
new
RunnableContextDelegate
(
getContainer
()),
getWizard
().
getFiles
());
}
}
private
void
downloadLibraryFiles
(
DBRRunnableContext
runnableContext
,
final
List
<
Driver
File
Descriptor
>
files
)
private
void
downloadLibraryFiles
(
DBRRunnableContext
runnableContext
,
final
List
<
Driver
Library
Descriptor
>
files
)
{
{
if
(!
getWizard
().
getDriver
().
acceptDriverLicenses
(
runnableContext
))
{
if
(!
getWizard
().
getDriver
().
acceptDriverLicenses
(
runnableContext
))
{
return
;
return
;
}
}
for
(
int
i
=
0
,
filesSize
=
files
.
size
();
i
<
filesSize
;
)
{
for
(
int
i
=
0
,
filesSize
=
files
.
size
();
i
<
filesSize
;
)
{
Driver
File
Descriptor
lib
=
files
.
get
(
i
);
Driver
Library
Descriptor
lib
=
files
.
get
(
i
);
int
result
=
downloadLibraryFile
(
runnableContext
,
lib
);
int
result
=
downloadLibraryFile
(
runnableContext
,
lib
);
switch
(
result
)
{
switch
(
result
)
{
case
IDialogConstants
.
CANCEL_ID
:
case
IDialogConstants
.
CANCEL_ID
:
...
@@ -120,7 +113,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
...
@@ -120,7 +113,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
}
}
}
}
private
int
downloadLibraryFile
(
DBRRunnableContext
runnableContext
,
final
Driver
File
Descriptor
file
)
private
int
downloadLibraryFile
(
DBRRunnableContext
runnableContext
,
final
Driver
Library
Descriptor
file
)
{
{
try
{
try
{
runnableContext
.
run
(
true
,
true
,
new
DBRRunnableWithProgress
()
{
runnableContext
.
run
(
true
,
true
,
new
DBRRunnableWithProgress
()
{
...
@@ -138,7 +131,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
...
@@ -138,7 +131,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
// User just canceled download
// User just canceled download
return
IDialogConstants
.
CANCEL_ID
;
return
IDialogConstants
.
CANCEL_ID
;
}
catch
(
InvocationTargetException
e
)
{
}
catch
(
InvocationTargetException
e
)
{
if
(
file
.
getType
()
==
DBPDriver
File
.
FileType
.
license
)
{
if
(
file
.
getType
()
==
DBPDriver
Library
.
FileType
.
license
)
{
return
IDialogConstants
.
OK_ID
;
return
IDialogConstants
.
OK_ID
;
}
}
DownloadRetry
retryConfirm
=
new
DownloadRetry
(
file
,
e
.
getTargetException
());
DownloadRetry
retryConfirm
=
new
DownloadRetry
(
file
,
e
.
getTargetException
());
...
@@ -148,11 +141,11 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
...
@@ -148,11 +141,11 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
}
}
private
class
DownloadRetry
implements
Runnable
{
private
class
DownloadRetry
implements
Runnable
{
private
final
Driver
File
Descriptor
file
;
private
final
Driver
Library
Descriptor
file
;
private
final
Throwable
error
;
private
final
Throwable
error
;
private
int
result
;
private
int
result
;
public
DownloadRetry
(
Driver
File
Descriptor
file
,
Throwable
error
)
public
DownloadRetry
(
Driver
Library
Descriptor
file
,
Throwable
error
)
{
{
this
.
file
=
file
;
this
.
file
=
file
;
this
.
error
=
error
;
this
.
error
=
error
;
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadDialog.java
浏览文件 @
153cde55
...
@@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Control;
...
@@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Control;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.swt.widgets.Shell
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.Driver
File
Descriptor
;
import
org.jkiss.dbeaver.registry.Driver
Library
Descriptor
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.DBeaverIcons
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIIcon
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
...
@@ -41,7 +41,7 @@ public class DriverDownloadDialog extends WizardDialog
...
@@ -41,7 +41,7 @@ public class DriverDownloadDialog extends WizardDialog
private
boolean
doDownload
=
false
;
private
boolean
doDownload
=
false
;
DriverDownloadDialog
(
Shell
shell
,
DriverDescriptor
driver
,
List
<
Driver
File
Descriptor
>
files
,
boolean
updateVersion
,
boolean
forceDownload
)
DriverDownloadDialog
(
Shell
shell
,
DriverDescriptor
driver
,
List
<
Driver
Library
Descriptor
>
files
,
boolean
updateVersion
,
boolean
forceDownload
)
{
{
super
(
shell
,
new
DriverDownloadWizard
(
driver
,
files
,
updateVersion
,
forceDownload
));
super
(
shell
,
new
DriverDownloadWizard
(
driver
,
files
,
updateVersion
,
forceDownload
));
getWizard
().
init
(
DBeaverUI
.
getActiveWorkbenchWindow
().
getWorkbench
(),
null
);
getWizard
().
init
(
DBeaverUI
.
getActiveWorkbenchWindow
().
getWorkbench
(),
null
);
...
@@ -110,18 +110,18 @@ public class DriverDownloadDialog extends WizardDialog
...
@@ -110,18 +110,18 @@ public class DriverDownloadDialog extends WizardDialog
super
.
finishPressed
();
super
.
finishPressed
();
}
}
public
static
boolean
downloadDriverFiles
(
Shell
shell
,
DriverDescriptor
driver
,
List
<
Driver
File
Descriptor
>
files
)
{
public
static
boolean
downloadDriverFiles
(
Shell
shell
,
DriverDescriptor
driver
,
List
<
Driver
Library
Descriptor
>
files
)
{
return
downloadDriverFiles
(
shell
,
driver
,
files
,
false
);
return
downloadDriverFiles
(
shell
,
driver
,
files
,
false
);
}
}
public
static
boolean
downloadDriverFiles
(
Shell
shell
,
DriverDescriptor
driver
,
List
<
Driver
File
Descriptor
>
files
,
boolean
forceDownload
)
{
public
static
boolean
downloadDriverFiles
(
Shell
shell
,
DriverDescriptor
driver
,
List
<
Driver
Library
Descriptor
>
files
,
boolean
forceDownload
)
{
DriverDownloadDialog
dialog
=
new
DriverDownloadDialog
(
shell
,
driver
,
files
,
false
,
forceDownload
);
DriverDownloadDialog
dialog
=
new
DriverDownloadDialog
(
shell
,
driver
,
files
,
false
,
forceDownload
);
dialog
.
setMinimumPageSize
(
100
,
100
);
dialog
.
setMinimumPageSize
(
100
,
100
);
dialog
.
open
();
dialog
.
open
();
return
dialog
.
doDownload
;
return
dialog
.
doDownload
;
}
}
public
static
boolean
updateDriverFiles
(
Shell
shell
,
DriverDescriptor
driver
,
List
<
Driver
File
Descriptor
>
files
,
boolean
forceDownload
)
{
public
static
boolean
updateDriverFiles
(
Shell
shell
,
DriverDescriptor
driver
,
List
<
Driver
Library
Descriptor
>
files
,
boolean
forceDownload
)
{
DriverDownloadDialog
dialog
=
new
DriverDownloadDialog
(
shell
,
driver
,
files
,
true
,
forceDownload
);
DriverDownloadDialog
dialog
=
new
DriverDownloadDialog
(
shell
,
driver
,
files
,
true
,
forceDownload
);
dialog
.
setMinimumPageSize
(
100
,
100
);
dialog
.
setMinimumPageSize
(
100
,
100
);
dialog
.
open
();
dialog
.
open
();
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverDownloadWizard.java
浏览文件 @
153cde55
...
@@ -24,7 +24,7 @@ import org.eclipse.ui.IExportWizard;
...
@@ -24,7 +24,7 @@ import org.eclipse.ui.IExportWizard;
import
org.eclipse.ui.IWorkbench
;
import
org.eclipse.ui.IWorkbench
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.DriverDescriptor
;
import
org.jkiss.dbeaver.registry.Driver
File
Descriptor
;
import
org.jkiss.dbeaver.registry.Driver
Library
Descriptor
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.jkiss.utils.CommonUtils
;
...
@@ -35,12 +35,12 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
...
@@ -35,12 +35,12 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
private
static
final
String
DRIVER_DOWNLOAD_DIALOG_SETTINGS
=
"DriverDownload"
;
//$NON-NLS-1$
private
static
final
String
DRIVER_DOWNLOAD_DIALOG_SETTINGS
=
"DriverDownload"
;
//$NON-NLS-1$
private
DriverDescriptor
driver
;
private
DriverDescriptor
driver
;
private
List
<
Driver
File
Descriptor
>
files
;
private
List
<
Driver
Library
Descriptor
>
files
;
private
boolean
updateVersion
;
private
boolean
updateVersion
;
private
boolean
forceDownload
;
private
boolean
forceDownload
;
private
DriverDownloadPage
downloadPage
;
private
DriverDownloadPage
downloadPage
;
public
DriverDownloadWizard
(
@NotNull
DriverDescriptor
driver
,
List
<
Driver
File
Descriptor
>
files
,
boolean
updateVersion
,
boolean
forceDownload
)
{
public
DriverDownloadWizard
(
@NotNull
DriverDescriptor
driver
,
List
<
Driver
Library
Descriptor
>
files
,
boolean
updateVersion
,
boolean
forceDownload
)
{
this
.
driver
=
driver
;
this
.
driver
=
driver
;
this
.
files
=
files
;
this
.
files
=
files
;
this
.
updateVersion
=
updateVersion
;
this
.
updateVersion
=
updateVersion
;
...
@@ -54,7 +54,7 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
...
@@ -54,7 +54,7 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
return
driver
;
return
driver
;
}
}
List
<
Driver
File
Descriptor
>
getFiles
()
{
List
<
Driver
Library
Descriptor
>
getFiles
()
{
return
files
;
return
files
;
}
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/dialogs/driver/DriverEditDialog.java
浏览文件 @
153cde55
...
@@ -41,7 +41,7 @@ import org.jkiss.dbeaver.core.CoreMessages;
...
@@ -41,7 +41,7 @@ import org.jkiss.dbeaver.core.CoreMessages;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.core.DBeaverUI
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBIcon
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDriver
File
;
import
org.jkiss.dbeaver.model.DBPDriver
Library
;
import
org.jkiss.dbeaver.registry.*
;
import
org.jkiss.dbeaver.registry.*
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.runtime.RuntimeUtils
;
import
org.jkiss.dbeaver.runtime.properties.PropertySourceCustom
;
import
org.jkiss.dbeaver.runtime.properties.PropertySourceCustom
;
...
@@ -102,7 +102,7 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -102,7 +102,7 @@ public class DriverEditDialog extends HelpEnabledDialog
private
Text
driverPortText
;
private
Text
driverPortText
;
private
PropertyTreeViewer
parametersEditor
;
private
PropertyTreeViewer
parametersEditor
;
private
ConnectionPropertiesControl
connectionPropertiesEditor
;
private
ConnectionPropertiesControl
connectionPropertiesEditor
;
private
List
<
Driver
FileDescriptor
>
libList
=
new
ArrayList
<
DriverFile
Descriptor
>();
private
List
<
Driver
LibraryDescriptor
>
libList
=
new
ArrayList
<
DriverLibrary
Descriptor
>();
private
PropertySourceCustom
driverPropertySource
;
private
PropertySourceCustom
driverPropertySource
;
private
PropertySourceCustom
connectionPropertySource
;
private
PropertySourceCustom
connectionPropertySource
;
private
ClientHomesPanel
clientHomesPanel
;
private
ClientHomesPanel
clientHomesPanel
;
...
@@ -326,7 +326,7 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -326,7 +326,7 @@ public class DriverEditDialog extends HelpEnabledDialog
@Override
@Override
public
void
update
(
ViewerCell
cell
)
public
void
update
(
ViewerCell
cell
)
{
{
Driver
FileDescriptor
lib
=
(
DriverFile
Descriptor
)
cell
.
getElement
();
Driver
LibraryDescriptor
lib
=
(
DriverLibrary
Descriptor
)
cell
.
getElement
();
cell
.
setText
(
lib
.
getDisplayName
());
cell
.
setText
(
lib
.
getDisplayName
());
File
localFile
=
lib
.
getLocalFile
();
File
localFile
=
lib
.
getLocalFile
();
if
(
localFile
!=
null
&&
localFile
.
exists
())
{
if
(
localFile
!=
null
&&
localFile
.
exists
())
{
...
@@ -431,9 +431,9 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -431,9 +431,9 @@ public class DriverEditDialog extends HelpEnabledDialog
File
folderFile
=
new
File
(
curFolder
);
File
folderFile
=
new
File
(
curFolder
);
for
(
String
fileName
:
fileNames
)
{
for
(
String
fileName
:
fileNames
)
{
libList
.
add
(
libList
.
add
(
new
Driver
File
Descriptor
(
new
Driver
Library
Descriptor
(
driver
,
driver
,
fileName
.
endsWith
(
".jar"
)
||
fileName
.
endsWith
(
".zip"
)
?
DBPDriver
File
.
FileType
.
jar
:
DBPDriverFile
.
FileType
.
lib
,
fileName
.
endsWith
(
".jar"
)
||
fileName
.
endsWith
(
".zip"
)
?
DBPDriver
Library
.
FileType
.
jar
:
DBPDriverLibrary
.
FileType
.
lib
,
new
File
(
folderFile
,
fileName
).
getAbsolutePath
()));
new
File
(
folderFile
,
fileName
).
getAbsolutePath
()));
}
}
changeLibContent
();
changeLibContent
();
...
@@ -452,9 +452,9 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -452,9 +452,9 @@ public class DriverEditDialog extends HelpEnabledDialog
String
selected
=
fd
.
open
();
String
selected
=
fd
.
open
();
if
(
selected
!=
null
)
{
if
(
selected
!=
null
)
{
curFolder
=
fd
.
getFilterPath
();
curFolder
=
fd
.
getFilterPath
();
libList
.
add
(
new
Driver
File
Descriptor
(
libList
.
add
(
new
Driver
Library
Descriptor
(
driver
,
driver
,
DBPDriver
File
.
FileType
.
jar
,
DBPDriver
Library
.
FileType
.
jar
,
selected
));
selected
));
changeLibContent
();
changeLibContent
();
}
}
...
@@ -467,10 +467,10 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -467,10 +467,10 @@ public class DriverEditDialog extends HelpEnabledDialog
{
{
EditMavenArtifactDialog
fd
=
new
EditMavenArtifactDialog
(
getShell
(),
null
);
EditMavenArtifactDialog
fd
=
new
EditMavenArtifactDialog
(
getShell
(),
null
);
if
(
fd
.
open
()
==
IDialogConstants
.
OK_ID
)
{
if
(
fd
.
open
()
==
IDialogConstants
.
OK_ID
)
{
libList
.
add
(
new
Driver
File
Descriptor
(
libList
.
add
(
new
Driver
Library
Descriptor
(
driver
,
driver
,
DBPDriver
File
.
FileType
.
jar
,
DBPDriver
Library
.
FileType
.
jar
,
Driver
File
Descriptor
.
FILE_SOURCE_MAVEN
+
fd
.
getArtifact
().
getPath
()));
Driver
Library
Descriptor
.
FILE_SOURCE_MAVEN
+
fd
.
getArtifact
().
getPath
()));
changeLibContent
();
changeLibContent
();
}
}
}
}
...
@@ -498,7 +498,7 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -498,7 +498,7 @@ public class DriverEditDialog extends HelpEnabledDialog
@Override
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
public
void
widgetSelected
(
SelectionEvent
e
)
{
{
Driver
File
Descriptor
selectedLib
=
getSelectedLibrary
();
Driver
Library
Descriptor
selectedLib
=
getSelectedLibrary
();
int
selIndex
=
libList
.
indexOf
(
selectedLib
);
int
selIndex
=
libList
.
indexOf
(
selectedLib
);
Collections
.
swap
(
libList
,
selIndex
,
selIndex
-
1
);
Collections
.
swap
(
libList
,
selIndex
,
selIndex
-
1
);
changeLibContent
();
changeLibContent
();
...
@@ -511,7 +511,7 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -511,7 +511,7 @@ public class DriverEditDialog extends HelpEnabledDialog
@Override
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
public
void
widgetSelected
(
SelectionEvent
e
)
{
{
Driver
File
Descriptor
selectedLib
=
getSelectedLibrary
();
Driver
Library
Descriptor
selectedLib
=
getSelectedLibrary
();
int
selIndex
=
libList
.
indexOf
(
selectedLib
);
int
selIndex
=
libList
.
indexOf
(
selectedLib
);
Collections
.
swap
(
libList
,
selIndex
,
selIndex
+
1
);
Collections
.
swap
(
libList
,
selIndex
,
selIndex
+
1
);
changeLibContent
();
changeLibContent
();
...
@@ -615,10 +615,10 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -615,10 +615,10 @@ public class DriverEditDialog extends HelpEnabledDialog
createButton
(
parent
,
IDialogConstants
.
CANCEL_ID
,
IDialogConstants
.
CANCEL_LABEL
,
false
);
createButton
(
parent
,
IDialogConstants
.
CANCEL_ID
,
IDialogConstants
.
CANCEL_LABEL
,
false
);
}
}
private
Driver
File
Descriptor
getSelectedLibrary
()
private
Driver
Library
Descriptor
getSelectedLibrary
()
{
{
IStructuredSelection
selection
=
(
IStructuredSelection
)
libTable
.
getSelection
();
IStructuredSelection
selection
=
(
IStructuredSelection
)
libTable
.
getSelection
();
return
selection
==
null
||
selection
.
isEmpty
()
?
null
:
(
Driver
File
Descriptor
)
selection
.
getFirstElement
();
return
selection
==
null
||
selection
.
isEmpty
()
?
null
:
(
Driver
Library
Descriptor
)
selection
.
getFirstElement
();
}
}
private
void
changeLibContent
()
private
void
changeLibContent
()
...
@@ -630,7 +630,7 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -630,7 +630,7 @@ public class DriverEditDialog extends HelpEnabledDialog
private
void
changeLibSelection
()
private
void
changeLibSelection
()
{
{
Driver
File
Descriptor
selectedLib
=
getSelectedLibrary
();
Driver
Library
Descriptor
selectedLib
=
getSelectedLibrary
();
deleteButton
.
setEnabled
(
selectedLib
!=
null
);
deleteButton
.
setEnabled
(
selectedLib
!=
null
);
upButton
.
setEnabled
(
libList
.
indexOf
(
selectedLib
)
>
0
);
upButton
.
setEnabled
(
libList
.
indexOf
(
selectedLib
)
>
0
);
downButton
.
setEnabled
(
libList
.
indexOf
(
selectedLib
)
<
libList
.
size
()
-
1
);
downButton
.
setEnabled
(
libList
.
indexOf
(
selectedLib
)
<
libList
.
size
()
-
1
);
...
@@ -662,9 +662,9 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -662,9 +662,9 @@ public class DriverEditDialog extends HelpEnabledDialog
// anonymousCheck.setSelection(driver.isAnonymousAccess());
// anonymousCheck.setSelection(driver.isAnonymousAccess());
if
(
libTable
!=
null
)
{
if
(
libTable
!=
null
)
{
libList
=
new
ArrayList
<
Driver
File
Descriptor
>();
libList
=
new
ArrayList
<
Driver
Library
Descriptor
>();
for
(
Driver
FileDescriptor
lib
:
driver
.
getDriverFil
es
())
{
for
(
Driver
LibraryDescriptor
lib
:
driver
.
getDriverLibrari
es
())
{
if
(
lib
.
isDisabled
()
||
(
lib
.
getType
()
!=
DBPDriver
File
.
FileType
.
jar
&&
lib
.
getType
()
!=
DBPDriverFile
.
FileType
.
lib
)
||
!
lib
.
matchesCurrentPlatform
())
{
if
(
lib
.
isDisabled
()
||
(
lib
.
getType
()
!=
DBPDriver
Library
.
FileType
.
jar
&&
lib
.
getType
()
!=
DBPDriverLibrary
.
FileType
.
lib
)
||
!
lib
.
matchesCurrentPlatform
())
{
continue
;
continue
;
}
}
libList
.
add
(
lib
);
libList
.
add
(
lib
);
...
@@ -706,10 +706,10 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -706,10 +706,10 @@ public class DriverEditDialog extends HelpEnabledDialog
driver
.
setModified
(
true
);
driver
.
setModified
(
true
);
// Set libraries
// Set libraries
for
(
Driver
File
Descriptor
lib
:
CommonUtils
.
safeCollection
(
libList
))
{
for
(
Driver
Library
Descriptor
lib
:
CommonUtils
.
safeCollection
(
libList
))
{
driver
.
addDriverFile
(
lib
);
driver
.
addDriverFile
(
lib
);
}
}
for
(
Driver
FileDescriptor
lib
:
CommonUtils
.
copyList
(
driver
.
getDriverFil
es
()))
{
for
(
Driver
LibraryDescriptor
lib
:
CommonUtils
.
copyList
(
driver
.
getDriverLibrari
es
()))
{
if
(!
libList
.
contains
(
lib
))
{
if
(!
libList
.
contains
(
lib
))
{
driver
.
removeDriverFile
(
lib
);
driver
.
removeDriverFile
(
lib
);
}
}
...
@@ -781,9 +781,9 @@ public class DriverEditDialog extends HelpEnabledDialog
...
@@ -781,9 +781,9 @@ public class DriverEditDialog extends HelpEnabledDialog
{
{
java
.
util
.
List
<
File
>
libFiles
=
new
ArrayList
<
File
>();
java
.
util
.
List
<
File
>
libFiles
=
new
ArrayList
<
File
>();
java
.
util
.
List
<
URL
>
libURLs
=
new
ArrayList
<
URL
>();
java
.
util
.
List
<
URL
>
libURLs
=
new
ArrayList
<
URL
>();
for
(
Driver
File
Descriptor
lib
:
libList
)
{
for
(
Driver
Library
Descriptor
lib
:
libList
)
{
File
libFile
=
lib
.
getLocalFile
();
File
libFile
=
lib
.
getLocalFile
();
if
(
libFile
!=
null
&&
libFile
.
exists
()
&&
!
libFile
.
isDirectory
()
&&
lib
.
getType
()
==
DBPDriver
File
.
FileType
.
jar
)
{
if
(
libFile
!=
null
&&
libFile
.
exists
()
&&
!
libFile
.
isDirectory
()
&&
lib
.
getType
()
==
DBPDriver
Library
.
FileType
.
jar
)
{
libFiles
.
add
(
libFile
);
libFiles
.
add
(
libFile
);
try
{
try
{
libURLs
.
add
(
libFile
.
toURI
().
toURL
());
libURLs
.
add
(
libFile
.
toURI
().
toURL
());
...
...
plugins/org.jkiss.dbeaver.ext.import-config/src/org/jkiss/dbeaver/ext/import_config/wizards/ConfigImportWizard.java
浏览文件 @
153cde55
...
@@ -25,7 +25,7 @@ import org.eclipse.ui.IWorkbench;
...
@@ -25,7 +25,7 @@ import org.eclipse.ui.IWorkbench;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.dbeaver.model.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.model.DBPConnectionConfiguration
;
import
org.jkiss.dbeaver.model.DBPDriver
File
;
import
org.jkiss.dbeaver.model.DBPDriver
Library
;
import
org.jkiss.dbeaver.registry.*
;
import
org.jkiss.dbeaver.registry.*
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.dialogs.SelectObjectDialog
;
import
org.jkiss.dbeaver.ui.dialogs.SelectObjectDialog
;
...
@@ -122,7 +122,7 @@ public abstract class ConfigImportWizard extends Wizard implements IImportWizard
...
@@ -122,7 +122,7 @@ public abstract class ConfigImportWizard extends Wizard implements IImportWizard
driver
.
setDescription
(
driverInfo
.
getDescription
());
driver
.
setDescription
(
driverInfo
.
getDescription
());
driver
.
setDriverDefaultPort
(
driverInfo
.
getDefaultPort
());
driver
.
setDriverDefaultPort
(
driverInfo
.
getDefaultPort
());
for
(
String
path
:
driverInfo
.
getLibraries
())
{
for
(
String
path
:
driverInfo
.
getLibraries
())
{
driver
.
addDriverFile
(
path
,
DBPDriver
File
.
FileType
.
jar
);
driver
.
addDriverFile
(
path
,
DBPDriver
Library
.
FileType
.
jar
);
}
}
driver
.
setModified
(
true
);
driver
.
setModified
(
true
);
genericProvider
.
addDriver
(
driver
);
genericProvider
.
addDriver
(
driver
);
...
...
plugins/org.jkiss.dbeaver.ext.wmi/src/org/jkiss/dbeaver/ext/wmi/WMIDataSourceProvider.java
浏览文件 @
153cde55
...
@@ -79,8 +79,8 @@ public class WMIDataSourceProvider implements DBPDataSourceProvider {
...
@@ -79,8 +79,8 @@ public class WMIDataSourceProvider implements DBPDataSourceProvider {
private
void
loadNativeLib
(
DBPDriver
driver
)
throws
DBException
private
void
loadNativeLib
(
DBPDriver
driver
)
throws
DBException
{
{
for
(
DBPDriver
File
libFile
:
driver
.
getDriverFil
es
())
{
for
(
DBPDriver
Library
libFile
:
driver
.
getDriverLibrari
es
())
{
if
(
libFile
.
matchesCurrentPlatform
()
&&
libFile
.
getType
()
==
DBPDriver
File
.
FileType
.
lib
)
{
if
(
libFile
.
matchesCurrentPlatform
()
&&
libFile
.
getType
()
==
DBPDriver
Library
.
FileType
.
lib
)
{
File
localFile
=
libFile
.
getLocalFile
();
File
localFile
=
libFile
.
getLocalFile
();
if
(
localFile
!=
null
)
{
if
(
localFile
!=
null
)
{
try
{
try
{
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriver.java
浏览文件 @
153cde55
...
@@ -88,17 +88,12 @@ public interface DBPDriver extends DBPObject
...
@@ -88,17 +88,12 @@ public interface DBPDriver extends DBPObject
ClassLoader
getClassLoader
();
ClassLoader
getClassLoader
();
@NotNull
@NotNull
Collection
<?
extends
DBPDriverFile
>
getDriverFiles
();
Collection
<?
extends
DBPDriverLibrary
>
getDriverLibraries
();
@NotNull
Collection
<?
extends
DBPDriverFile
.
FileSource
>
getDriverFileSources
();
Object
getDriverInstance
(
DBRRunnableContext
runnableContext
)
throws
DBException
;
Object
getDriverInstance
(
DBRRunnableContext
runnableContext
)
throws
DBException
;
void
validateFilesPresence
(
DBRRunnableContext
runnableContext
);
void
validateFilesPresence
(
DBRRunnableContext
runnableContext
);
void
updateFiles
(
DBRRunnableContext
runnableContext
);
void
loadDriver
(
DBRRunnableContext
runnableContext
)
throws
DBException
;
void
loadDriver
(
DBRRunnableContext
runnableContext
)
throws
DBException
;
}
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriver
File
.java
→
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/DBPDriver
Library
.java
浏览文件 @
153cde55
...
@@ -18,15 +18,16 @@
...
@@ -18,15 +18,16 @@
package
org.jkiss.dbeaver.model
;
package
org.jkiss.dbeaver.model
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.model.runtime.OSDescriptor
;
import
java.io.File
;
import
java.io.File
;
import
java.util.Collection
;
/**
/**
* D
BPDriver local path
* D
river library
*/
*/
public
interface
DBPDriver
File
public
interface
DBPDriver
Library
{
{
/**
/**
* Driver file type
* Driver file type
...
@@ -39,18 +40,13 @@ public interface DBPDriverFile
...
@@ -39,18 +40,13 @@ public interface DBPDriverFile
license
license
}
}
interface
FileSource
{
@NotNull
}
FileType
getType
();
FileType
getType
();
OSDescriptor
getSystem
();
@NotNull
String
getPath
();
String
getPath
();
String
getFileType
();
@Nullable
String
getDescription
();
String
getDescription
();
boolean
isCustom
();
boolean
isCustom
();
...
@@ -64,4 +60,7 @@ public interface DBPDriverFile
...
@@ -64,4 +60,7 @@ public interface DBPDriverFile
boolean
matchesCurrentPlatform
();
boolean
matchesCurrentPlatform
();
@Nullable
Collection
<
DBPDriverLibrary
>
getDependencies
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录