Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
1cac5096
Commit
1cac5096
authored
Jul 11, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
path中send改成update,可容易理解一些
parent
fc0312eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
28 deletions
+28
-28
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
+16
-16
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/ConfigEndpoint.java
+9
-9
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/VersionEndpoint.java
+3
-3
No files found.
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
View file @
1cac5096
...
@@ -84,28 +84,28 @@ public class ConsoleEndpoint implements MvcEndpoint {
...
@@ -84,28 +84,28 @@ public class ConsoleEndpoint implements MvcEndpoint {
return
getInstanceMap
();
return
getInstanceMap
();
}
}
@RequestMapping
(
path
=
"/console/config/
send
-async/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/console/config/
update
-async/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"批量异步推送规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"批量异步推送
更新
规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
ResponseEntity
<?>
config
Send
Async
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
config
Update
Async
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
executeConfig
Send
(
serviceId
,
config
,
true
);
return
executeConfig
Update
(
serviceId
,
config
,
true
);
}
}
@RequestMapping
(
path
=
"/console/config/
send
-sync/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/console/config/
update
-sync/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"批量同步推送规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"批量同步推送
更新
规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
ResponseEntity
<?>
config
Send
Sync
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
config
Update
Sync
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
executeConfig
Send
(
serviceId
,
config
,
false
);
return
executeConfig
Update
(
serviceId
,
config
,
false
);
}
}
@RequestMapping
(
path
=
"/version/
send
/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/version/
update
/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"批量
设置
服务的动态版本"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"批量
更新
服务的动态版本"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
ResponseEntity
<?>
version
Send
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"版本号"
,
required
=
true
)
String
version
)
{
public
ResponseEntity
<?>
version
Update
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"版本号"
,
required
=
true
)
String
version
)
{
return
executeVersion
Send
(
serviceId
,
version
);
return
executeVersion
Update
(
serviceId
,
version
);
}
}
@RequestMapping
(
path
=
"/version/clear/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/version/clear/{serviceId}"
,
method
=
RequestMethod
.
GET
)
...
@@ -156,7 +156,7 @@ public class ConsoleEndpoint implements MvcEndpoint {
...
@@ -156,7 +156,7 @@ public class ConsoleEndpoint implements MvcEndpoint {
return
serviceMap
;
return
serviceMap
;
}
}
private
ResponseEntity
<?>
executeConfig
Send
(
String
serviceId
,
String
config
,
boolean
async
)
{
private
ResponseEntity
<?>
executeConfig
Update
(
String
serviceId
,
String
config
,
boolean
async
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
StringBuilder
stringBuilder
=
new
StringBuilder
();
List
<
ServiceInstance
>
serviceInstances
=
getInstances
(
serviceId
);
List
<
ServiceInstance
>
serviceInstances
=
getInstances
(
serviceId
);
...
@@ -164,7 +164,7 @@ public class ConsoleEndpoint implements MvcEndpoint {
...
@@ -164,7 +164,7 @@ public class ConsoleEndpoint implements MvcEndpoint {
String
host
=
serviceInstance
.
getHost
();
String
host
=
serviceInstance
.
getHost
();
int
port
=
serviceInstance
.
getPort
();
int
port
=
serviceInstance
.
getPort
();
String
url
=
"http://"
+
host
+
":"
+
port
+
"/config/
send
-"
+
(
async
?
"async"
:
"sync"
);
String
url
=
"http://"
+
host
+
":"
+
port
+
"/config/
update
-"
+
(
async
?
"async"
:
"sync"
);
String
result
=
consoleRestTemplate
.
postForEntity
(
url
,
config
,
String
.
class
).
getBody
();
String
result
=
consoleRestTemplate
.
postForEntity
(
url
,
config
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
...
@@ -182,7 +182,7 @@ public class ConsoleEndpoint implements MvcEndpoint {
...
@@ -182,7 +182,7 @@ public class ConsoleEndpoint implements MvcEndpoint {
return
ResponseEntity
.
ok
().
body
(
result
);
return
ResponseEntity
.
ok
().
body
(
result
);
}
}
private
ResponseEntity
<?>
executeVersion
Send
(
String
serviceId
,
String
version
)
{
private
ResponseEntity
<?>
executeVersion
Update
(
String
serviceId
,
String
version
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
();
StringBuilder
stringBuilder
=
new
StringBuilder
();
List
<
ServiceInstance
>
serviceInstances
=
getInstances
(
serviceId
);
List
<
ServiceInstance
>
serviceInstances
=
getInstances
(
serviceId
);
...
@@ -190,7 +190,7 @@ public class ConsoleEndpoint implements MvcEndpoint {
...
@@ -190,7 +190,7 @@ public class ConsoleEndpoint implements MvcEndpoint {
String
host
=
serviceInstance
.
getHost
();
String
host
=
serviceInstance
.
getHost
();
int
port
=
serviceInstance
.
getPort
();
int
port
=
serviceInstance
.
getPort
();
String
url
=
"http://"
+
host
+
":"
+
port
+
"/version/
send
"
;
String
url
=
"http://"
+
host
+
":"
+
port
+
"/version/
update
"
;
String
result
=
consoleRestTemplate
.
postForEntity
(
url
,
version
,
String
.
class
).
getBody
();
String
result
=
consoleRestTemplate
.
postForEntity
(
url
,
version
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/ConfigEndpoint.java
View file @
1cac5096
...
@@ -52,20 +52,20 @@ public class ConfigEndpoint implements MvcEndpoint {
...
@@ -52,20 +52,20 @@ public class ConfigEndpoint implements MvcEndpoint {
@Autowired
@Autowired
private
RuleCache
ruleCache
;
private
RuleCache
ruleCache
;
@RequestMapping
(
path
=
"/config/
send
-async"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/config/
update
-async"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"异步推送规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"异步推送
更新
规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
ResponseEntity
<?>
send
Async
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
update
Async
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
send
(
config
,
true
);
return
update
(
config
,
true
);
}
}
@RequestMapping
(
path
=
"/config/
send
-sync"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/config/
update
-sync"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"同步推送规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"同步推送
更新
规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
ResponseEntity
<?>
send
Sync
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
update
Sync
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
send
(
config
,
false
);
return
update
(
config
,
false
);
}
}
@RequestMapping
(
path
=
"/config/view"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/config/view"
,
method
=
RequestMethod
.
GET
)
...
@@ -83,7 +83,7 @@ public class ConfigEndpoint implements MvcEndpoint {
...
@@ -83,7 +83,7 @@ public class ConfigEndpoint implements MvcEndpoint {
return
ResponseEntity
.
ok
().
body
(
content
);
return
ResponseEntity
.
ok
().
body
(
content
);
}
}
private
ResponseEntity
<?>
send
(
String
config
,
boolean
async
)
{
private
ResponseEntity
<?>
update
(
String
config
,
boolean
async
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
if
(!
discoveryControlEnabled
)
{
if
(!
discoveryControlEnabled
)
{
// return new ResponseEntity<>(Collections.singletonMap("Message", "Discovery control is disabled"), HttpStatus.NOT_FOUND);
// return new ResponseEntity<>(Collections.singletonMap("Message", "Discovery control is disabled"), HttpStatus.NOT_FOUND);
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/VersionEndpoint.java
View file @
1cac5096
...
@@ -49,11 +49,11 @@ public class VersionEndpoint implements MvcEndpoint {
...
@@ -49,11 +49,11 @@ public class VersionEndpoint implements MvcEndpoint {
@Autowired
@Autowired
private
PluginEventWapper
pluginEventWapper
;
private
PluginEventWapper
pluginEventWapper
;
@RequestMapping
(
path
=
"/version/
send
"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/version/
update
"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"
设置
服务的动态版本"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"
更新
服务的动态版本"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ResponseBody
@ResponseBody
@ManagedOperation
@ManagedOperation
public
ResponseEntity
<?>
send
(
@RequestBody
@ApiParam
(
value
=
"版本号"
,
required
=
true
)
String
version
)
{
public
ResponseEntity
<?>
update
(
@RequestBody
@ApiParam
(
value
=
"版本号"
,
required
=
true
)
String
version
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
if
(!
discoveryControlEnabled
)
{
if
(!
discoveryControlEnabled
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
"Discovery control is disabled"
);
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
"Discovery control is disabled"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment