Commit 1ec065cd by Nepxion

增加动态版本功能

parent f0e474ab
......@@ -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
......@@ -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);
......
......@@ -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) {
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment