From b024dcc91d67045a6be8db6fd51673696481b41b Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 28 Aug 2019 12:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/redis/conf/ShellConfigManager.java | 98 ------------------- .../conf/ShellConfigManagerProvider.java | 12 --- 2 files changed, 110 deletions(-) delete mode 100644 src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManager.java delete mode 100644 src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManagerProvider.java diff --git a/src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManager.java b/src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManager.java deleted file mode 100644 index 40218b8..0000000 --- a/src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManager.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.fr.plugin.db.redis.conf; - -import com.fr.file.XMLFileManager; -import com.fr.general.GeneralContext; -import com.fr.stable.EnvChangedListener; -import com.fr.stable.StringUtils; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLTools; -import com.fr.stable.xml.XMLableReader; - -import java.io.InputStream; - -/** - * Created by richie on 2017/6/5. - */ -public class ShellConfigManager extends XMLFileManager implements ShellConfigManagerProvider { - - private static final String XML_TAG = "ShellConfigManager"; - - private static ShellConfigManagerProvider shellManager = null; - - - public synchronized static ShellConfigManager getInstance() { - return (ShellConfigManager) getProviderInstance(); - } - - public synchronized static ShellConfigManagerProvider getProviderInstance() { - if (shellManager == null) { - if (isClusterMember()) { - return shellManager; - } - shellManager.readXMLFile(); - } - return shellManager; - } - - private synchronized static boolean isClusterMember() { - - return false; - } - - static { - GeneralContext.addEnvChangedListener(new EnvChangedListener() { - public void envChanged() { - ShellConfigManager.envChanged(); - } - }); - } - - private synchronized static void envChanged() { - shellManager = null; - } - - private String shellText; - - @Override - public String getShellText() { - return shellText; - } - - public void setShellText(String shellText) { - this.shellText = shellText; - } - - @Override - public void readXML(XMLableReader reader) { - if (reader.isAttr()) { - shellText = reader.getAttrAsString("shell", StringUtils.EMPTY); - } - } - - @Override - public void writeXML(XMLPrintWriter writer) { - writer.startTAG(XML_TAG); - writer.attr("shell", shellText); - writer.end(); - } - - @Override - public String fileName() { - return "redis.xml"; - } - - @Override - public void readFromInputStream(InputStream input) throws Exception { - // 服务器端新建一个对象 - ShellConfigManager manager = new ShellConfigManager(); - // 从客户端传过来的inputstream中读取对象属性 - XMLTools.readInputStreamXML(manager, input); - // 赋值给当前服务器端对象 - shellManager = manager; - } - - - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManagerProvider.java b/src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManagerProvider.java deleted file mode 100644 index ac07e56..0000000 --- a/src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManagerProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.fr.plugin.db.redis.conf; - -import com.fr.stable.FCloneable; -import com.fr.stable.file.RemoteXMLFileManagerProvider; - -/** - * Created by richie on 2017/6/5. - */ -public interface ShellConfigManagerProvider extends RemoteXMLFileManagerProvider, java.io.Serializable, FCloneable { - - String getShellText(); -}