Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wk1234123
DolphinScheduler
提交
dc55de4e
DolphinScheduler
项目概览
wk1234123
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
5
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,发现更多精彩内容 >>
提交
dc55de4e
编写于
5月 15, 2019
作者:
L
lidongdai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.0.2文档发布
上级
06acbe5f
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
163 addition
and
52 deletion
+163
-52
escheduler-api/pom.xml
escheduler-api/pom.xml
+14
-30
escheduler-api/src/main/java/cn/escheduler/api/ApiApplicationServer.java
...src/main/java/cn/escheduler/api/ApiApplicationServer.java
+6
-1
escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java
...ava/cn/escheduler/api/configuration/AppConfiguration.java
+46
-12
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerConfig.java
...n/java/cn/escheduler/api/configuration/SwaggerConfig.java
+5
-3
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerI18nPlugin.java
...va/cn/escheduler/api/configuration/SwaggerI18nPlugin.java
+52
-0
escheduler-api/src/main/java/cn/escheduler/api/controller/LoginController.java
...in/java/cn/escheduler/api/controller/LoginController.java
+14
-3
escheduler-api/src/main/resources/application.properties
escheduler-api/src/main/resources/application.properties
+5
-0
escheduler-api/src/main/resources/messages.properties
escheduler-api/src/main/resources/messages.properties
+5
-0
escheduler-api/src/main/resources/messages_en_US.properties
escheduler-api/src/main/resources/messages_en_US.properties
+5
-0
escheduler-api/src/main/resources/messages_zh_CN.properties
escheduler-api/src/main/resources/messages_zh_CN.properties
+5
-0
escheduler-server/src/main/java/cn/escheduler/server/worker/runner/FetchTaskThread.java
...a/cn/escheduler/server/worker/runner/FetchTaskThread.java
+0
-2
pom.xml
pom.xml
+6
-1
未找到文件。
escheduler-api/pom.xml
浏览文件 @
dc55de4e
...
...
@@ -35,35 +35,7 @@
</exclusions>
</dependency>
<!--<dependency>-->
<!--<groupId>cn.analysys</groupId>-->
<!--<artifactId>escheduler-dao</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>cn.analysys</groupId>-->
<!--<artifactId>escheduler-common</artifactId>-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>io.netty</groupId>-->
<!--<artifactId>netty</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<groupId>io.netty</groupId>-->
<!--<artifactId>netty-all</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<groupId>com.google</groupId>-->
<!--<artifactId>netty</artifactId>-->
<!--</exclusion>-->
<!--<exclusion>-->
<!--<artifactId>leveldbjni-all</artifactId>-->
<!--<groupId>org.fusesource.leveldbjni</groupId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<!--</dependency>-->
<!--springboot-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
...
...
@@ -170,14 +142,21 @@
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.
8.0
</version>
<version>
2.
9.2
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.8.0
</version>
<version>
2.9.2
</version>
</dependency>
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<artifactId>
swagger-bootstrap-ui
</artifactId>
<version>
1.9.3
</version>
</dependency>
<dependency>
<groupId>
cn.analysys
</groupId>
<artifactId>
escheduler-rpc
</artifactId>
...
...
@@ -189,6 +168,11 @@
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
io.swagger
</groupId>
<artifactId>
swagger-jaxrs
</artifactId>
<version>
1.5.12
</version>
</dependency>
</dependencies>
<build>
...
...
escheduler-api/src/main/java/cn/escheduler/api/ApiApplicationServer.java
浏览文件 @
dc55de4e
...
...
@@ -19,14 +19,19 @@ package cn.escheduler.api;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.context.annotation.ComponentScan
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@SpringBootApplication
@ServletComponentScan
@ComponentScan
(
"cn.escheduler"
)
public
class
ApiApplicationServer
{
@EnableSwagger2
public
class
ApiApplicationServer
extends
SpringBootServletInitializer
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ApiApplicationServer
.
class
,
args
);
}
}
escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java
浏览文件 @
dc55de4e
...
...
@@ -20,6 +20,12 @@ import cn.escheduler.api.interceptor.LoginHandlerInterceptor;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.*
;
import
org.springframework.web.servlet.LocaleResolver
;
import
org.springframework.web.servlet.i18n.CookieLocaleResolver
;
import
org.springframework.web.servlet.i18n.LocaleChangeInterceptor
;
import
java.util.Locale
;
/**
* application configuration
...
...
@@ -31,24 +37,48 @@ public class AppConfiguration implements WebMvcConfigurer {
public
static
final
String
LOGIN_PATH_PATTERN
=
"/login"
;
public
static
final
String
PATH_PATTERN
=
"/**"
;
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
loginInterceptor
()).
addPathPatterns
(
LOGIN_INTERCEPTOR_PATH_PATTERN
).
excludePathPatterns
(
LOGIN_PATH_PATTERN
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/v2/**"
,
"/swagger-ui.html"
);
}
//
// @Override
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
// registry.addResourceHandler("swagger-ui.html")
// .addResourceLocations("classpath:/META-INF/resources/");
// registry.addResourceHandler("/webjars/**")
// .addResourceLocations("classpath:/META-INF/resources/webjars/");
// }
@Bean
public
LoginHandlerInterceptor
loginInterceptor
()
{
return
new
LoginHandlerInterceptor
();
}
//Cookie
@Bean
public
LocaleResolver
localeResolver
()
{
CookieLocaleResolver
localeResolver
=
new
CookieLocaleResolver
();
localeResolver
.
setCookieName
(
"localeCookie"
);
//设置默认区域
localeResolver
.
setDefaultLocale
(
Locale
.
ENGLISH
);
localeResolver
.
setCookieMaxAge
(
3600
);
//设置cookie有效期.
return
localeResolver
;
}
@Bean
public
LocaleChangeInterceptor
localeChangeInterceptor
()
{
LocaleChangeInterceptor
lci
=
new
LocaleChangeInterceptor
();
// 参数名
lci
.
setParamName
(
"lang"
);
return
lci
;
}
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
loginInterceptor
()).
addPathPatterns
(
LOGIN_INTERCEPTOR_PATH_PATTERN
).
excludePathPatterns
(
LOGIN_PATH_PATTERN
,
"/swagger-resources/**"
,
"/webjars/**"
,
"/v2/**"
,
"/doc.html"
,
"*.html"
);
//i18n
registry
.
addInterceptor
(
localeChangeInterceptor
());
}
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"doc.html"
).
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"/webjars/**"
).
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
);
}
@Override
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
registry
.
addMapping
(
PATH_PATTERN
).
allowedOrigins
(
"*"
).
allowedMethods
(
"*"
);
...
...
@@ -64,4 +94,8 @@ public class AppConfiguration implements WebMvcConfigurer {
public
void
configureContentNegotiation
(
final
ContentNegotiationConfigurer
configurer
)
{
configurer
.
favorPathExtension
(
false
);
}
}
escheduler-api/src/main/java/cn/escheduler/api/configuration/Swagger
2
.java
→
escheduler-api/src/main/java/cn/escheduler/api/configuration/Swagger
Config
.java
浏览文件 @
dc55de4e
...
...
@@ -16,6 +16,7 @@
*/
package
cn.escheduler.api.configuration
;
import
com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -35,7 +36,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
*/
@Configuration
@EnableSwagger2
public
class
Swagger2
implements
WebMvcConfigurer
{
@EnableSwaggerBootstrapUI
public
class
SwaggerConfig
implements
WebMvcConfigurer
{
@Bean
public
Docket
createRestApi
()
{
...
...
@@ -45,8 +47,8 @@ public class Swagger2 implements WebMvcConfigurer {
}
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
().
title
(
"
api docs"
).
description
(
"easy scheduler api d
ocs"
)
.
termsOfServiceUrl
(
"https://www.analysys.com"
).
version
(
"1.0.0"
).
build
();
return
new
ApiInfoBuilder
().
title
(
"
Easy Scheduler Api Docs"
).
description
(
"Easy Scheduler Api D
ocs"
)
.
version
(
"1.0.0"
).
build
();
}
...
...
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerI18nPlugin.java
0 → 100644
浏览文件 @
dc55de4e
package
cn.escheduler.api.configuration
;
import
java.util.List
;
import
java.util.Locale
;
import
com.fasterxml.classmate.TypeResolver
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.i18n.LocaleContextHolder
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
io.swagger.annotations.ApiOperation
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spi.service.OperationBuilderPlugin
;
import
springfox.documentation.spi.service.contexts.OperationContext
;
@Component
@Order
(
Ordered
.
HIGHEST_PRECEDENCE
-
10
)
public
class
SwaggerI18nPlugin
implements
OperationBuilderPlugin
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SwaggerI18nPlugin
.
class
);
@Autowired
private
MessageSource
messageSource
;
@Override
public
void
apply
(
OperationContext
context
)
{
Locale
locale
=
LocaleContextHolder
.
getLocale
();
List
<
ApiOperation
>
list
=
context
.
findAllAnnotations
(
ApiOperation
.
class
);
if
(
list
.
size
()
>
0
)
{
for
(
ApiOperation
api
:
list
){
context
.
operationBuilder
().
summary
(
messageSource
.
getMessage
(
api
.
value
(),
null
,
locale
));
context
.
operationBuilder
().
notes
(
messageSource
.
getMessage
(
api
.
notes
(),
null
,
locale
));
}
}
}
@Override
public
boolean
supports
(
DocumentationType
delimiter
)
{
return
true
;
}
}
escheduler-api/src/main/java/cn/escheduler/api/controller/LoginController.java
浏览文件 @
dc55de4e
...
...
@@ -23,6 +23,7 @@ import cn.escheduler.api.service.UsersService;
import
cn.escheduler.api.utils.Constants
;
import
cn.escheduler.api.utils.Result
;
import
cn.escheduler.dao.model.User
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -31,12 +32,16 @@ import org.apache.commons.lang3.StringUtils;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.i18n.LocaleContextHolder
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Locale
;
import
static
cn
.
escheduler
.
api
.
enums
.
Status
.*;
/**
...
...
@@ -44,16 +49,22 @@ import static cn.escheduler.api.enums.Status.*;
*/
@RestController
@RequestMapping
(
""
)
@Api
(
value
=
""
,
tags
=
{
"中国"
},
description
=
"中国"
)
public
class
LoginController
extends
BaseController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LoginController
.
class
);
private
Locale
locale
=
LocaleContextHolder
.
getLocale
();
@Autowired
private
SessionService
sessionService
;
@Autowired
private
UsersService
userService
;
@Autowired
private
MessageSource
messageSource
;
/**
* login
*
...
...
@@ -63,10 +74,10 @@ public class LoginController extends BaseController {
* @param response
* @return
*/
@ApiOperation
(
value
=
"更新用户详细信息"
,
notes
=
"根据url的id来指定更新对象,并根据传过来的user信息来更新用户详细信息
"
)
@ApiOperation
(
value
=
"test"
,
notes
=
"loginNotes
"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"
用户名"
,
required
=
true
,
dataT
ype
=
"String"
),
@ApiImplicitParam
(
name
=
"userPassword"
,
value
=
"
密码"
,
required
=
true
,
dataType
=
"String"
)
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"
userName"
,
required
=
true
,
t
ype
=
"String"
),
@ApiImplicitParam
(
name
=
"userPassword"
,
value
=
"
userPassword"
,
required
=
true
,
type
=
"String"
)
})
@RequestMapping
(
value
=
"/login"
)
public
Result
login
(
@RequestParam
(
value
=
"userName"
)
String
userName
,
...
...
escheduler-api/src/main/resources/application.properties
浏览文件 @
dc55de4e
...
...
@@ -12,3 +12,8 @@ spring.servlet.multipart.max-request-size=1024MB
#post content
server.jetty.max-http-post-size
=
5000000
spring.messages.encoding
=
UTF-8
#i18n classpath folder , file prefix messages, if have many files, use "," seperator
spring.messages.basename
=
messages
escheduler-api/src/main/resources/messages.properties
0 → 100644
浏览文件 @
dc55de4e
welcome
=
hello, welcome !
test
=
test
userName
=
user name
userPassword
=
user password
loginNotes
=
login notes
\ No newline at end of file
escheduler-api/src/main/resources/messages_en_US.properties
0 → 100644
浏览文件 @
dc55de4e
welcome
=
hello, welcome !
test
=
test
userName
=
user name
userPassword
=
user password
loginNotes
=
login notes
\ No newline at end of file
escheduler-api/src/main/resources/messages_zh_CN.properties
0 → 100644
浏览文件 @
dc55de4e
welcome
=
您好,欢迎你!
test
=
测试
userName
=
用户名
userPassword
=
用户密码
loginNotes
=
登录xxx
\ No newline at end of file
escheduler-server/src/main/java/cn/escheduler/server/worker/runner/FetchTaskThread.java
浏览文件 @
dc55de4e
...
...
@@ -134,7 +134,6 @@ public class FetchTaskThread implements Runnable{
public
void
run
()
{
while
(
Stopper
.
isRunning
()){
long
start
=
System
.
currentTimeMillis
();
InterProcessMutex
mutex
=
null
;
try
{
if
(
OSUtils
.
checkResource
(
this
.
conf
,
false
))
{
...
...
@@ -222,7 +221,6 @@ public class FetchTaskThread implements Runnable{
// submit task
workerExecService
.
submit
(
new
TaskScheduleThread
(
taskInstance
,
processDao
));
logger
.
info
(
"{} 耗时: {} ms"
,
taskQueueStr
,
System
.
currentTimeMillis
()
-
start
);
}
}
...
...
pom.xml
浏览文件 @
dc55de4e
...
...
@@ -114,6 +114,11 @@
</dependency>
<dependency>
<groupId>
cn.analysys
</groupId>
<artifactId>
escheduler-server
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
cn.analysys
</groupId>
<artifactId>
escheduler-common
</artifactId>
...
...
@@ -326,7 +331,7 @@
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
19
.0
</version>
<version>
20
.0
</version>
</dependency>
<dependency>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录