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
add097a3
Commit
add097a3
authored
Sep 10, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构类结构
parent
9138da46
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
14 deletions
+20
-14
discovery-common/src/main/java/com/nepxion/discovery/common/constant/DiscoveryConstant.java
+4
-0
discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java
+1
-1
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
+7
-6
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
+2
-2
discovery-console/src/main/java/com/nepxion/discovery/console/rest/AbstractRestInvoker.java
+1
-1
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/ConfigEndpoint.java
+3
-2
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/VersionEndpoint.java
+2
-2
No files found.
discovery-common/src/main/java/com/nepxion/discovery/common/constant/DiscoveryConstant.java
View file @
add097a3
...
@@ -40,4 +40,7 @@ public class DiscoveryConstant {
...
@@ -40,4 +40,7 @@ public class DiscoveryConstant {
public
static
final
String
DATE_FORMAT
=
"yyyy-MM-dd HH:mm:ss.SSS"
;
public
static
final
String
DATE_FORMAT
=
"yyyy-MM-dd HH:mm:ss.SSS"
;
public
static
final
String
ENCODING_UTF_8
=
"UTF-8"
;
public
static
final
String
ENCODING_UTF_8
=
"UTF-8"
;
public
static
final
String
SEPARATE
=
";"
;
public
static
final
String
SEPARATE
=
";"
;
public
static
final
String
OK
=
"OK"
;
public
static
final
String
NO
=
"NO"
;
}
}
\ No newline at end of file
discovery-common/src/main/java/com/nepxion/discovery/common/util/JsonUtil.java
View file @
add097a3
...
@@ -20,7 +20,7 @@ public class JsonUtil {
...
@@ -20,7 +20,7 @@ public class JsonUtil {
static
{
static
{
objectMapper
=
new
ObjectMapper
();
objectMapper
=
new
ObjectMapper
();
// objectMapper.setDateFormat(new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss.SSS"
));
// objectMapper.setDateFormat(new SimpleDateFormat(
DiscoveryConstant.DATE_FORMAT
));
}
}
public
static
<
T
>
String
toJson
(
T
object
)
{
public
static
<
T
>
String
toJson
(
T
object
)
{
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/controller/ServiceController.java
View file @
add097a3
...
@@ -19,6 +19,7 @@ import org.springframework.http.MediaType;
...
@@ -19,6 +19,7 @@ import org.springframework.http.MediaType;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.nepxion.discovery.common.constant.DiscoveryConstant
;
import
com.nepxion.discovery.common.entity.ResultEntity
;
import
com.nepxion.discovery.common.entity.ResultEntity
;
import
com.nepxion.discovery.common.entity.RouterEntity
;
import
com.nepxion.discovery.common.entity.RouterEntity
;
import
com.nepxion.discovery.common.handler.RestErrorHandler
;
import
com.nepxion.discovery.common.handler.RestErrorHandler
;
...
@@ -81,7 +82,7 @@ public class ServiceController {
...
@@ -81,7 +82,7 @@ public class ServiceController {
String
result
=
restTemplate
.
postForEntity
(
url
,
entity
,
String
.
class
).
getBody
();
String
result
=
restTemplate
.
postForEntity
(
url
,
entity
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
)
&&
!
StringUtils
.
equals
(
result
,
"NO"
))
{
if
(!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
OK
)
&&
!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
NO
))
{
result
=
RestUtil
.
getCause
(
restTemplate
);
result
=
RestUtil
.
getCause
(
restTemplate
);
}
}
...
@@ -93,7 +94,7 @@ public class ServiceController {
...
@@ -93,7 +94,7 @@ public class ServiceController {
String
result
=
restTemplate
.
postForEntity
(
url
,
null
,
String
.
class
).
getBody
();
String
result
=
restTemplate
.
postForEntity
(
url
,
null
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
)
&&
!
StringUtils
.
equals
(
result
,
"NO"
))
{
if
(!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
OK
)
&&
!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
NO
))
{
result
=
RestUtil
.
getCause
(
restTemplate
);
result
=
RestUtil
.
getCause
(
restTemplate
);
}
}
...
@@ -132,7 +133,7 @@ public class ServiceController {
...
@@ -132,7 +133,7 @@ public class ServiceController {
String
result
=
restTemplate
.
postForEntity
(
url
,
entity
,
String
.
class
).
getBody
();
String
result
=
restTemplate
.
postForEntity
(
url
,
entity
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
if
(!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
OK
))
{
result
=
RestUtil
.
getCause
(
restTemplate
);
result
=
RestUtil
.
getCause
(
restTemplate
);
}
}
...
@@ -153,7 +154,7 @@ public class ServiceController {
...
@@ -153,7 +154,7 @@ public class ServiceController {
String
result
=
restTemplate
.
postForEntity
(
url
,
null
,
String
.
class
).
getBody
();
String
result
=
restTemplate
.
postForEntity
(
url
,
null
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
if
(!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
OK
))
{
result
=
RestUtil
.
getCause
(
restTemplate
);
result
=
RestUtil
.
getCause
(
restTemplate
);
}
}
...
@@ -174,7 +175,7 @@ public class ServiceController {
...
@@ -174,7 +175,7 @@ public class ServiceController {
String
result
=
restTemplate
.
postForEntity
(
url
,
version
,
String
.
class
).
getBody
();
String
result
=
restTemplate
.
postForEntity
(
url
,
version
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
if
(!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
OK
))
{
result
=
RestUtil
.
getCause
(
restTemplate
);
result
=
RestUtil
.
getCause
(
restTemplate
);
}
}
...
@@ -195,7 +196,7 @@ public class ServiceController {
...
@@ -195,7 +196,7 @@ public class ServiceController {
String
result
=
restTemplate
.
postForEntity
(
url
,
null
,
String
.
class
).
getBody
();
String
result
=
restTemplate
.
postForEntity
(
url
,
null
,
String
.
class
).
getBody
();
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
if
(!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
OK
))
{
result
=
RestUtil
.
getCause
(
restTemplate
);
result
=
RestUtil
.
getCause
(
restTemplate
);
}
}
...
...
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
View file @
add097a3
...
@@ -233,7 +233,7 @@ public class ConsoleEndpoint {
...
@@ -233,7 +233,7 @@ public class ConsoleEndpoint {
try
{
try
{
boolean
result
=
configAdapter
.
updateConfig
(
group
,
serviceId
,
config
);
boolean
result
=
configAdapter
.
updateConfig
(
group
,
serviceId
,
config
);
return
ResponseEntity
.
ok
().
body
(
result
?
"OK"
:
"NO"
);
return
ResponseEntity
.
ok
().
body
(
result
?
DiscoveryConstant
.
OK
:
DiscoveryConstant
.
NO
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
e
.
getMessage
());
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
e
.
getMessage
());
}
}
...
@@ -249,7 +249,7 @@ public class ConsoleEndpoint {
...
@@ -249,7 +249,7 @@ public class ConsoleEndpoint {
try
{
try
{
boolean
result
=
configAdapter
.
clearConfig
(
group
,
serviceId
);
boolean
result
=
configAdapter
.
clearConfig
(
group
,
serviceId
);
return
ResponseEntity
.
ok
().
body
(
result
?
"OK"
:
"NO"
);
return
ResponseEntity
.
ok
().
body
(
result
?
DiscoveryConstant
.
OK
:
DiscoveryConstant
.
NO
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
e
.
getMessage
());
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
body
(
e
.
getMessage
());
}
}
...
...
discovery-console/src/main/java/com/nepxion/discovery/console/rest/AbstractRestInvoker.java
View file @
add097a3
...
@@ -60,7 +60,7 @@ public abstract class AbstractRestInvoker {
...
@@ -60,7 +60,7 @@ public abstract class AbstractRestInvoker {
checkPermission
(
serviceInstance
);
checkPermission
(
serviceInstance
);
result
=
doRest
(
url
);
result
=
doRest
(
url
);
if
(!
StringUtils
.
equals
(
result
,
"OK"
))
{
if
(!
StringUtils
.
equals
(
result
,
DiscoveryConstant
.
OK
))
{
result
=
RestUtil
.
getCause
(
restTemplate
);
result
=
RestUtil
.
getCause
(
restTemplate
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/ConfigEndpoint.java
View file @
add097a3
...
@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
...
@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nepxion.discovery.common.constant.DiscoveryConstant
;
import
com.nepxion.discovery.common.entity.RuleEntity
;
import
com.nepxion.discovery.common.entity.RuleEntity
;
import
com.nepxion.discovery.plugin.framework.adapter.PluginAdapter
;
import
com.nepxion.discovery.plugin.framework.adapter.PluginAdapter
;
import
com.nepxion.discovery.plugin.framework.context.PluginContextAware
;
import
com.nepxion.discovery.plugin.framework.context.PluginContextAware
;
...
@@ -109,7 +110,7 @@ public class ConfigEndpoint {
...
@@ -109,7 +110,7 @@ public class ConfigEndpoint {
// return ResponseEntity.ok().build();
// return ResponseEntity.ok().build();
return
ResponseEntity
.
ok
().
body
(
"OK"
);
return
ResponseEntity
.
ok
().
body
(
DiscoveryConstant
.
OK
);
}
}
private
ResponseEntity
<?>
clear
(
boolean
async
)
{
private
ResponseEntity
<?>
clear
(
boolean
async
)
{
...
@@ -125,7 +126,7 @@ public class ConfigEndpoint {
...
@@ -125,7 +126,7 @@ public class ConfigEndpoint {
pluginEventWapper
.
fireRuleCleared
(
new
RuleClearedEvent
(),
async
);
pluginEventWapper
.
fireRuleCleared
(
new
RuleClearedEvent
(),
async
);
return
ResponseEntity
.
ok
().
body
(
"OK"
);
return
ResponseEntity
.
ok
().
body
(
DiscoveryConstant
.
OK
);
}
}
private
ResponseEntity
<
List
<
String
>>
view
(
boolean
async
)
{
private
ResponseEntity
<
List
<
String
>>
view
(
boolean
async
)
{
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/VersionEndpoint.java
View file @
add097a3
...
@@ -115,7 +115,7 @@ public class VersionEndpoint {
...
@@ -115,7 +115,7 @@ public class VersionEndpoint {
pluginEventWapper
.
fireVersionUpdated
(
new
VersionUpdatedEvent
(
dynamicVersion
,
localVersion
),
async
);
pluginEventWapper
.
fireVersionUpdated
(
new
VersionUpdatedEvent
(
dynamicVersion
,
localVersion
),
async
);
return
ResponseEntity
.
ok
().
body
(
"OK"
);
return
ResponseEntity
.
ok
().
body
(
DiscoveryConstant
.
OK
);
}
}
private
ResponseEntity
<?>
clear
(
String
version
,
boolean
async
)
{
private
ResponseEntity
<?>
clear
(
String
version
,
boolean
async
)
{
...
@@ -131,7 +131,7 @@ public class VersionEndpoint {
...
@@ -131,7 +131,7 @@ public class VersionEndpoint {
pluginEventWapper
.
fireVersionCleared
(
new
VersionClearedEvent
(
version
),
async
);
pluginEventWapper
.
fireVersionCleared
(
new
VersionClearedEvent
(
version
),
async
);
return
ResponseEntity
.
ok
().
body
(
"OK"
);
return
ResponseEntity
.
ok
().
body
(
DiscoveryConstant
.
OK
);
}
}
private
ResponseEntity
<
List
<
String
>>
view
(
boolean
async
)
{
private
ResponseEntity
<
List
<
String
>>
view
(
boolean
async
)
{
...
...
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