Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
淡淡忧伤的程序员
DolphinScheduler
提交
6a2ef44a
DolphinScheduler
项目概览
淡淡忧伤的程序员
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
48
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6a2ef44a
编写于
7月 09, 2019
作者:
L
lgcareer
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'remotes/upstream/dev-1.1.0' into dev-1.1.0
上级
fcd9b661
f449bd66
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
13 deletion
+36
-13
escheduler-api/src/main/java/cn/escheduler/api/service/DataSourceService.java
...ain/java/cn/escheduler/api/service/DataSourceService.java
+34
-13
escheduler-common/src/main/java/cn/escheduler/common/Constants.java
...-common/src/main/java/cn/escheduler/common/Constants.java
+2
-0
未找到文件。
escheduler-api/src/main/java/cn/escheduler/api/service/DataSourceService.java
浏览文件 @
6a2ef44a
...
...
@@ -17,16 +17,14 @@
package
cn.escheduler.api.service
;
import
cn.escheduler.api.enums.Status
;
import
cn.escheduler.api.utils.CheckUtils
;
import
cn.escheduler.api.utils.Constants
;
import
cn.escheduler.api.utils.PageInfo
;
import
cn.escheduler.api.utils.Result
;
import
cn.escheduler.common.enums.DbType
;
import
cn.escheduler.common.enums.ResUploadType
;
import
cn.escheduler.common.enums.UserType
;
import
cn.escheduler.common.job.db.*
;
import
cn.escheduler.common.utils.CommonUtils
;
import
cn.escheduler.common.utils.
Property
Utils
;
import
cn.escheduler.common.utils.
JSON
Utils
;
import
cn.escheduler.dao.mapper.DataSourceMapper
;
import
cn.escheduler.dao.mapper.DatasourceUserMapper
;
import
cn.escheduler.dao.mapper.ProjectMapper
;
...
...
@@ -48,7 +46,6 @@ import java.sql.DriverManager;
import
java.sql.SQLException
;
import
java.util.*
;
import
static
cn
.
escheduler
.
common
.
utils
.
PropertyUtils
.
getBoolean
;
import
static
cn
.
escheduler
.
common
.
utils
.
PropertyUtils
.
getString
;
/**
...
...
@@ -67,7 +64,7 @@ public class DataSourceService extends BaseService{
public
static
final
String
PRINCIPAL
=
"principal"
;
public
static
final
String
DATABASE
=
"database"
;
public
static
final
String
USER_NAME
=
"userName"
;
public
static
final
String
PASSWORD
=
"password"
;
public
static
final
String
PASSWORD
=
cn
.
escheduler
.
common
.
Constants
.
PASSWORD
;
public
static
final
String
OTHER
=
"other"
;
@Autowired
...
...
@@ -296,13 +293,37 @@ public class DataSourceService extends BaseService{
* @return
*/
private
List
<
DataSource
>
getDataSources
(
User
loginUser
,
String
searchVal
,
Integer
pageSize
,
PageInfo
pageInfo
)
{
List
<
DataSource
>
dataSourceList
=
null
;
if
(
isAdmin
(
loginUser
))
{
return
dataSourceMapper
.
queryAllDataSourcePaging
(
searchVal
,
pageInfo
.
getStart
(),
pageSize
);
dataSourceList
=
dataSourceMapper
.
queryAllDataSourcePaging
(
searchVal
,
pageInfo
.
getStart
(),
pageSize
);
}
else
{
dataSourceList
=
dataSourceMapper
.
queryDataSourcePaging
(
loginUser
.
getId
(),
searchVal
,
pageInfo
.
getStart
(),
pageSize
);
}
return
dataSourceMapper
.
queryDataSourcePaging
(
loginUser
.
getId
(),
searchVal
,
pageInfo
.
getStart
(),
pageSize
);
handlePasswd
(
dataSourceList
);
return
dataSourceList
;
}
/**
* handle datasource connection password for safety
* @param dataSourceList
*/
private
void
handlePasswd
(
List
<
DataSource
>
dataSourceList
)
{
for
(
DataSource
dataSource
:
dataSourceList
)
{
String
connectionParams
=
dataSource
.
getConnectionParams
();
JSONObject
object
=
JSONObject
.
parseObject
(
connectionParams
);
object
.
put
(
cn
.
escheduler
.
common
.
Constants
.
PASSWORD
,
cn
.
escheduler
.
common
.
Constants
.
XXXXXX
);
dataSource
.
setConnectionParams
(
JSONUtils
.
toJson
(
object
));
}
}
/**
* get datasource total num
*
...
...
@@ -660,13 +681,13 @@ public class DataSourceService extends BaseService{
*/
private
String
[]
getHostsAndPort
(
String
address
)
{
String
[]
result
=
new
String
[
2
];
String
[]
tmpArray
=
address
.
split
(
"//"
);
String
[]
tmpArray
=
address
.
split
(
cn
.
escheduler
.
common
.
Constants
.
DOUBLE_SLASH
);
String
hostsAndPorts
=
tmpArray
[
tmpArray
.
length
-
1
];
StringBuilder
hosts
=
new
StringBuilder
(
""
);
String
[]
hostPortArray
=
hostsAndPorts
.
split
(
","
);
String
port
=
hostPortArray
[
0
].
split
(
":"
)[
1
];
StringBuilder
hosts
=
new
StringBuilder
();
String
[]
hostPortArray
=
hostsAndPorts
.
split
(
cn
.
escheduler
.
common
.
Constants
.
COMMA
);
String
port
=
hostPortArray
[
0
].
split
(
cn
.
escheduler
.
common
.
Constants
.
COLON
)[
1
];
for
(
String
hostPort
:
hostPortArray
)
{
hosts
.
append
(
hostPort
.
split
(
":"
)[
0
]).
append
(
","
);
hosts
.
append
(
hostPort
.
split
(
cn
.
escheduler
.
common
.
Constants
.
COLON
)[
0
]).
append
(
cn
.
escheduler
.
common
.
Constants
.
COMMA
);
}
hosts
.
deleteCharAt
(
hosts
.
length
()
-
1
);
result
[
0
]
=
hosts
.
toString
();
...
...
escheduler-common/src/main/java/cn/escheduler/common/Constants.java
浏览文件 @
6a2ef44a
...
...
@@ -489,6 +489,8 @@ public final class Constants {
public
static
final
String
TASK_RECORD_PWD
=
"task.record.datasource.password"
;
public
static
final
String
DEFAULT
=
"Default"
;
public
static
final
String
PASSWORD
=
"password"
;
public
static
final
String
XXXXXX
=
"xxxxxx"
;
public
static
String
TASK_RECORD_TABLE_HIVE_LOG
=
"eamp_hive_log_hd"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录