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
1ec065cd
Commit
1ec065cd
authored
Jul 16, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加动态版本功能
parent
f0e474ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
29 deletions
+53
-29
discovery-plugin-config-center/src/main/java/com/nepxion/discovery/plugin/configcenter/xml/Dom4JParser.java
+0
-29
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/event/PluginEventWapper.java
+8
-0
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/event/PluginSubscriber.java
+28
-0
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/event/RuleClearedEvent.java
+17
-0
No files found.
discovery-plugin-config-center/src/main/java/com/nepxion/discovery/plugin/configcenter/xml/Dom4JParser.java
View file @
1ec065cd
...
...
@@ -20,10 +20,6 @@ import org.dom4j.DocumentException;
import
org.dom4j.Element
;
public
abstract
class
Dom4JParser
{
private
String
text
;
private
File
file
;
private
InputStream
inputStream
;
public
void
parse
(
String
text
)
throws
DocumentException
{
if
(
StringUtils
.
isEmpty
(
text
))
{
throw
new
IllegalArgumentException
(
"The text is empty"
);
...
...
@@ -31,8 +27,6 @@ public abstract class Dom4JParser {
Document
document
=
Dom4JReader
.
getDocument
(
text
);
this
.
text
=
text
;
parse
(
document
);
}
...
...
@@ -43,8 +37,6 @@ public abstract class Dom4JParser {
Document
document
=
Dom4JReader
.
getFormatDocument
(
text
);
this
.
text
=
text
;
parse
(
document
);
}
...
...
@@ -55,8 +47,6 @@ public abstract class Dom4JParser {
Document
document
=
Dom4JReader
.
getDocument
(
file
);
this
.
file
=
file
;
parse
(
document
);
}
...
...
@@ -67,8 +57,6 @@ public abstract class Dom4JParser {
Document
document
=
Dom4JReader
.
getFormatDocument
(
file
);
this
.
file
=
file
;
parse
(
document
);
}
...
...
@@ -79,8 +67,6 @@ public abstract class Dom4JParser {
Document
document
=
Dom4JReader
.
getDocument
(
inputStream
);
this
.
inputStream
=
inputStream
;
parse
(
document
);
}
...
...
@@ -91,8 +77,6 @@ public abstract class Dom4JParser {
Document
document
=
Dom4JReader
.
getFormatDocument
(
inputStream
);
this
.
inputStream
=
inputStream
;
parse
(
document
);
}
...
...
@@ -102,17 +86,5 @@ public abstract class Dom4JParser {
parseRoot
(
rootElement
);
}
public
String
getText
()
{
return
text
;
}
public
File
getFile
()
{
return
file
;
}
public
InputStream
getInputStream
()
{
return
inputStream
;
}
protected
abstract
void
parseRoot
(
Element
element
);
}
\ No newline at end of file
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/event/PluginEventWapper.java
View file @
1ec065cd
...
...
@@ -26,6 +26,14 @@ public class PluginEventWapper {
}
}
public
void
fireRuleCleared
(
RuleClearedEvent
ruleClearedEvent
,
boolean
async
)
{
if
(
async
)
{
pluginPublisher
.
asyncPublish
(
ruleClearedEvent
);
}
else
{
pluginSubscriber
.
onRuleCleared
(
ruleClearedEvent
);
}
}
public
void
fireVersionUpdated
(
VersionUpdatedEvent
versionUpdatedEvent
,
boolean
async
)
{
if
(
async
)
{
pluginPublisher
.
asyncPublish
(
versionUpdatedEvent
);
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/event/PluginSubscriber.java
View file @
1ec065cd
...
...
@@ -79,6 +79,34 @@ public class PluginSubscriber {
}
@Subscribe
public
void
onRuleCleared
(
RuleClearedEvent
ruleClearedEvent
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
Boolean
remoteConfigEnabled
=
pluginContextAware
.
isRemoteConfigEnabled
();
if
(!
discoveryControlEnabled
)
{
LOG
.
info
(
"********** Discovery control is disabled, ignore to subscribe **********"
);
return
;
}
if
(!
remoteConfigEnabled
)
{
LOG
.
info
(
"********** Remote config is disabled, ignore to subscribe **********"
);
return
;
}
LOG
.
info
(
"********** Remote rule clearing has been triggered **********"
);
if
(
ruleClearedEvent
==
null
)
{
throw
new
PluginException
(
"RuleClearedEvent can't be null"
);
}
pluginAdapter
.
clearDynamicRule
();
refreshLoadBalancer
();
}
@Subscribe
public
void
onVersionUpdated
(
VersionUpdatedEvent
versionUpdatedEvent
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
if
(!
discoveryControlEnabled
)
{
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/event/RuleClearedEvent.java
0 → 100644
View file @
1ec065cd
package
com
.
nepxion
.
discovery
.
plugin
.
framework
.
event
;
/**
* <p>Title: Nepxion Discovery</p>
* <p>Description: Nepxion Discovery</p>
* <p>Copyright: Copyright (c) 2017-2050</p>
* <p>Company: Nepxion</p>
* @author Haojun Ren
* @version 1.0
*/
import
java.io.Serializable
;
public
class
RuleClearedEvent
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4942710381954711909L
;
}
\ No newline at end of file
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