Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
2105a4f7
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,发现更多精彩内容 >>
提交
2105a4f7
编写于
5月 14, 2019
作者:
R
RiedNyko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SQL Developer parse json #5654
Former-commit-id:
ad1b0410
上级
290ab44c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
70 deletion
+63
-70
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/tools/sqldeveloper/ConfigImportWizardPageSqlDeveloper.java
...ools/sqldeveloper/ConfigImportWizardPageSqlDeveloper.java
+63
-70
未找到文件。
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/tools/sqldeveloper/ConfigImportWizardPageSqlDeveloper.java
浏览文件 @
2105a4f7
...
...
@@ -21,6 +21,7 @@ import com.google.gson.*;
import
com.google.gson.annotations.Expose
;
import
com.google.gson.annotations.SerializedName
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ext.import_config.wizards.ConfigImportWizardPage
;
import
org.jkiss.dbeaver.ext.import_config.wizards.ImportConnectionInfo
;
import
org.jkiss.dbeaver.ext.import_config.wizards.ImportData
;
...
...
@@ -50,10 +51,11 @@ public class ConfigImportWizardPageSqlDeveloper extends ConfigImportWizardPage {
public
static
final
String
SQLD_SYSCONFIG_FOLDER
=
"system"
;
public
static
final
String
SQLD_CONNECTIONS_FOLDER
=
"o.jdeveloper.db.connection"
;
private
static
final
Log
log
=
Log
.
getLog
(
ConfigImportWizardPageSqlDeveloper
.
class
);
private
final
ImportDriverInfo
oraDriver
;
protected
ConfigImportWizardPageSqlDeveloper
()
{
protected
ConfigImportWizardPageSqlDeveloper
()
{
super
(
"SQLDeveloper"
);
setTitle
(
"SQL Developer"
);
setDescription
(
"Import Oracle SQL Developer connections"
);
...
...
@@ -109,181 +111,172 @@ public class ConfigImportWizardPageSqlDeveloper extends ConfigImportWizardPage {
}
}
public
class
ConnectionInfo
{
public
static
class
ConnectionDescription
{
@SerializedName
(
"name"
)
@Expose
private
String
name
;
@SerializedName
(
"type"
)
@Expose
private
String
type
;
@SerializedName
(
"info"
)
@Expose
private
String
info
;
private
ConnectionInfo
info
;
public
String
getName
()
{
return
name
;
}
public
String
getType
()
{
return
type
;
}
public
String
getInfo
()
{
return
info
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
void
setInfo
(
String
info
)
{
public
ConnectionInfo
getInfo
()
{
return
info
;
}
public
void
setInfo
(
ConnectionInfo
info
)
{
this
.
info
=
info
;
}
}
public
class
ConnectionList
{
public
static
class
ConnectionList
{
@SerializedName
(
"connections"
)
@Expose
private
List
<
ConnectionInfo
>
connections
=
new
ArrayList
<
ConnectionInfo
>();
private
List
<
ConnectionDescription
>
connections
=
new
ArrayList
();
public
List
<
Connection
Info
>
getConnections
()
{
public
List
<
Connection
Description
>
getConnections
()
{
return
connections
;
}
}
public
class
InfoList
{
@SerializedName
(
"info"
)
@Expose
private
List
<
Info
>
info
=
new
LinkedList
<
Info
>();
public
List
<
Info
>
getInfo
()
{
return
info
;
}
}
public
class
Info
{
public
class
ConnectionInfo
{
@SerializedName
(
"role"
)
@Expose
private
String
role
;
@SerializedName
(
"hostname"
)
@Expose
private
String
hostname
;
@SerializedName
(
"port"
)
@Expose
private
String
port
;
@SerializedName
(
"sid"
)
@Expose
private
String
sid
;
@SerializedName
(
"serviceName"
)
@Expose
private
String
serviceName
;
@SerializedName
(
"user"
)
@Expose
private
String
user
;
@SerializedName
(
"customUrl"
)
@Expose
private
String
customUrl
;
@SerializedName
(
"OS_AUTHENTICATION"
)
@Expose
private
String
OS_AUTHENTICATION
;
public
String
getRole
()
{
return
role
;
}
public
String
getHost
()
{
return
hostname
;
}
public
String
getPort
()
{
return
port
;
}
public
String
getSID
()
{
return
sid
;
}
public
String
getServiceName
()
{
return
serviceName
;
}
public
String
getUser
()
{
return
user
;
}
public
String
getUrl
()
{
return
customUrl
;
}
public
String
getOsAuth
()
{
return
OS_AUTHENTICATION
;
}
public
void
setRole
(
String
role
)
{
this
.
role
=
role
;
}
public
void
setHost
(
String
hostname
)
{
this
.
hostname
=
hostname
;
}
public
void
setPort
(
String
port
)
{
this
.
port
=
port
;
}
public
void
setSID
(
String
sid
)
{
this
.
sid
=
sid
;
}
public
void
setServiceName
(
String
serviceName
)
{
this
.
serviceName
=
serviceName
;
}
public
void
setUrl
(
String
customUrl
)
{
this
.
customUrl
=
customUrl
;
}
public
void
setOsAuth
(
String
OS_AUTHENTICATION
)
{
this
.
OS_AUTHENTICATION
=
OS_AUTHENTICATION
;
}
public
void
setUser
(
String
user
)
{
this
.
user
=
user
;
}
}
private
void
parseJsonConnections
(
File
connectionsFile
,
ImportData
importData
)
throws
DBException
{
Gson
gson
=
new
Gson
();
BufferedReader
br
=
null
;
private
void
parseJsonConnections
(
File
connectionsFile
,
ImportData
importData
)
throws
JsonSyntaxException
{
try
{
br
=
new
BufferedReader
(
new
FileReader
(
connectionsFile
)
);
ConnectionList
connResult
=
gson
.
fromJson
(
br
,
ConnectionList
.
class
);
if
(
connResult
!=
null
)
{
for
(
Connection
Info
conn
:
connResult
.
getConnections
())
{
Gson
gson
=
new
GsonBuilder
().
create
(
);
try
(
Reader
br
=
new
BufferedReader
(
new
FileReader
(
connectionsFile
)))
{
ConnectionList
connResult
=
gson
.
fromJson
(
br
,
ConnectionList
.
class
);
for
(
Connection
Description
conn
:
connResult
.
getConnections
())
{
if
(
CommonUtils
.
isEmpty
(
conn
.
getName
()))
{
continue
;
}
ConnectionInfo
info
=
conn
.
getInfo
();
InfoList
infoResult
=
gson
.
fromJson
(
br
,
InfoList
.
class
);
if
(
infoResult
!=
null
)
{
for
(
Info
info
:
infoResult
.
getInfo
())
{
if
(
CommonUtils
.
isEmpty
(
info
.
getHost
())
&&
CommonUtils
.
isEmpty
(
info
.
getUrl
()))
{
continue
;
}
String
dbName
=
CommonUtils
.
isEmpty
(
info
.
getSID
())
?
info
.
getServiceName
()
:
info
.
getSID
();
String
dbName
=
CommonUtils
.
isEmpty
(
info
.
getSID
())
?
info
.
getServiceName
()
:
info
.
getSID
();
ImportConnectionInfo
connectionInfo
=
new
ImportConnectionInfo
(
oraDriver
,
null
,
conn
.
getName
(),
info
.
getUrl
(),
info
.
getHost
(),
info
.
getPort
(),
dbName
,
info
.
getHost
(),
null
);
if
(!
CommonUtils
.
isEmpty
(
info
.
getSID
()))
{
connectionInfo
.
setProviderProperty
(
OracleConstants
.
PROP_SID_SERVICE
,
OracleConnectionType
.
SID
.
name
());
}
else
if
(!
CommonUtils
.
isEmpty
(
info
.
getServiceName
()))
{
connectionInfo
.
setProviderProperty
(
OracleConstants
.
PROP_SID_SERVICE
,
OracleConnectionType
.
SERVICE
.
name
());
}
if
(
CommonUtils
.
toBoolean
(
info
.
getOsAuth
()))
{
connectionInfo
.
setUser
(
OracleConstants
.
OS_AUTH_PROP
);
}
if
(!
CommonUtils
.
isEmpty
(
info
.
getRole
()))
{
connectionInfo
.
setProviderProperty
(
OracleConstants
.
PROP_INTERNAL_LOGON
,
info
.
getRole
());
}
if
(!
CommonUtils
.
isEmpty
(
conn
.
getType
()))
{
connectionInfo
.
setProviderProperty
(
OracleConstants
.
PROP_CONNECTION_TYPE
,
conn
.
getType
());
}
ImportConnectionInfo
connectionInfo
=
new
ImportConnectionInfo
(
oraDriver
,
null
,
conn
.
getName
(),
info
.
getUrl
(),
info
.
getHost
(),
info
.
getPort
(),
dbName
,
info
.
getHost
(),
null
);
if
(!
CommonUtils
.
isEmpty
(
info
.
getSID
()))
{
connectionInfo
.
setProviderProperty
(
OracleConstants
.
PROP_SID_SERVICE
,
OracleConnectionType
.
SID
.
name
());
}
else
if
(!
CommonUtils
.
isEmpty
(
info
.
getServiceName
()))
{
connectionInfo
.
setProviderProperty
(
OracleConstants
.
PROP_SID_SERVICE
,
OracleConnectionType
.
SERVICE
.
name
());
}
if
(
CommonUtils
.
toBoolean
(
info
.
getOsAuth
()))
{
connectionInfo
.
setUser
(
OracleConstants
.
OS_AUTH_PROP
);
}
if
(!
CommonUtils
.
isEmpty
(
info
.
getRole
()))
{
connectionInfo
.
setProviderProperty
(
OracleConstants
.
PROP_INTERNAL_LOGON
,
info
.
getRole
());
}
if
(!
CommonUtils
.
isEmpty
(
conn
.
getType
()))
{
connectionInfo
.
setProviderProperty
(
OracleConstants
.
PROP_CONNECTION_TYPE
,
conn
.
getType
());
}
importData
.
addConnection
(
connectionInfo
);
}
}
importData
.
addConnection
(
connectionInfo
);
}
}
}
catch
(
FileNotFoundException
ex
){
throw
new
DBException
(
"Configuration parse error: "
+
ex
.
getMessage
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"Configuration parse error: "
+
e
.
getMessage
());
}
}
private
void
parseConnections
(
File
connectionsFile
,
ImportData
importData
)
throws
DBException
{
try
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录