⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 daemonconfiguration.java.svn-base

📁 监控整个SP系统的SMS信息通道的发送情况并且生成日志。 支持权限判断。
💻 SVN-BASE
字号:
package com.infobank.superchannel.util;import java.math.BigDecimal;import java.math.BigInteger;import java.util.Iterator;import java.util.List;import java.util.Properties;import java.util.concurrent.atomic.AtomicReference;import org.apache.commons.configuration.Configuration;import org.apache.commons.configuration.CombinedConfiguration;import org.apache.commons.configuration.ConfigurationException;import org.apache.commons.configuration.DefaultConfigurationBuilder;import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine;import com.infobank.superchannel.daemon.GenericDaemon;/** * @author Xiaoguang Sun * @version 类说明: DaemonConfiguration */public class DaemonConfiguration implements Configuration{  // underlying apache common configuration loader   private AtomicReference<CombinedConfiguration> daemonConfig=new AtomicReference<CombinedConfiguration>(null);    /**   * default private constructor. for singleton pattern   */  private DaemonConfiguration(){  }  /**   * initialize daemon configuration utility class   * @return if the initialization is successful or not   */  public static boolean init(){    if(instance.daemonConfig.get()==null){      try{        StringBuilder confPath=new StringBuilder();        confPath.append("conf");        confPath.append(System.getProperty("file.separator"));        confPath.append("SuperChannelConfig.xml");        DefaultConfigurationBuilder builder=new DefaultConfigurationBuilder(confPath.toString());        instance.daemonConfig.set((CombinedConfiguration)builder.getConfiguration());                instance.daemonConfig.get().setExpressionEngine(new XPathExpressionEngine());      }      catch (ConfigurationException ce){        ce.printStackTrace();        return false;      }    }    return true;  }  // singleton instance of DaemonConfiguration  private static DaemonConfiguration instance=new DaemonConfiguration();    /**   * get singleton instance of DaemonConfiguration   * @return singleton instance   */  public static DaemonConfiguration getInstance(){    return instance;  }  /**   * add new property into current configuration   *  @param key key of configuration   *  @param value value of configuration   */  public void addProperty(String key, Object value) {    daemonConfig.get().addProperty(key, value);  }  /**   * clear all configuration settings   */  public void clear() {    daemonConfig.get().clear();  }  /**   * clear configuration setting with the given key   * @param key configuration key    */  public void clearProperty(String key) {    daemonConfig.get().clearProperty(key);  }  /**   * test if a configuration item exists or not   * @param key key of configuration   * @return if a configuration item exists or not   */  public boolean containsKey(String key) {    return daemonConfig.get().containsKey(key);  }  public BigDecimal getBigDecimal(String arg0) {    return daemonConfig.get().getBigDecimal(arg0);  }  public BigDecimal getBigDecimal(String arg0, BigDecimal arg1) {    return daemonConfig.get().getBigDecimal(arg0,arg1);  }  public BigInteger getBigInteger(String arg0) {    return daemonConfig.get().getBigInteger(arg0);  }  public BigInteger getBigInteger(String arg0, BigInteger arg1) {    return daemonConfig.get().getBigInteger(arg0,arg1);  }  public boolean getBoolean(String arg0) {    return daemonConfig.get().getBoolean(arg0);  }  public boolean getBoolean(String arg0, boolean arg1) {    return daemonConfig.get().getBoolean(arg0,arg1);  }  public Boolean getBoolean(String arg0, Boolean arg1) {    return daemonConfig.get().getBoolean(arg0,arg1);  }  public byte getByte(String arg0) {    return daemonConfig.get().getByte(arg0);  }  public byte getByte(String arg0, byte arg1) {    return daemonConfig.get().getByte(arg0,arg1);  }  public Byte getByte(String arg0, Byte arg1) {    return daemonConfig.get().getByte(arg0,arg1);  }  public double getDouble(String arg0) {    return daemonConfig.get().getDouble(arg0);  }  public double getDouble(String arg0, double arg1) {    return daemonConfig.get().getDouble(arg0,arg1);  }  public Double getDouble(String arg0, Double arg1) {    return daemonConfig.get().getDouble(arg0,arg1);  }  public float getFloat(String arg0) {    return daemonConfig.get().getFloat(arg0);  }  public float getFloat(String arg0, float arg1) {    return daemonConfig.get().getFloat(arg0,arg1);  }  public Float getFloat(String arg0, Float arg1) {    return daemonConfig.get().getFloat(arg0,arg1);  }  public int getInt(String arg0) {    return daemonConfig.get().getInt(arg0);  }  public int getInt(String arg0, int arg1) {    return daemonConfig.get().getInt(arg0,arg1);  }  public Integer getInteger(String arg0, Integer arg1) {    return daemonConfig.get().getInteger(arg0,arg1);  }  public Iterator getKeys() {    return daemonConfig.get().getKeys();  }  public Iterator getKeys(String arg0) {    return daemonConfig.get().getKeys(arg0);  }  public List getList(String arg0) {    return daemonConfig.get().getList(arg0);  }  public List getList(String arg0, List arg1) {    return daemonConfig.get().getList(arg0,arg1);  }  public long getLong(String arg0) {    return daemonConfig.get().getLong(arg0);  }  public long getLong(String arg0, long arg1) {    return daemonConfig.get().getLong(arg0,arg1);  }  public Long getLong(String arg0, Long arg1) {    return daemonConfig.get().getLong(arg0,arg1);  }  public Properties getProperties(String arg0) {    return daemonConfig.get().getProperties(arg0);  }  public Object getProperty(String arg0) {    return daemonConfig.get().getProperty(arg0);  }  public short getShort(String arg0) {    return daemonConfig.get().getShort(arg0);  }  public short getShort(String arg0, short arg1) {    return daemonConfig.get().getShort(arg0,arg1);  }  public Short getShort(String arg0, Short arg1) {    return daemonConfig.get().getShort(arg0,arg1);  }  public String getString(String arg0) {    return daemonConfig.get().getString(arg0);  }  public String getString(String arg0, String arg1) {    return daemonConfig.get().getString(arg0,arg1);  }  public String[] getStringArray(String arg0) {    return daemonConfig.get().getStringArray(arg0);  }  public boolean isEmpty() {    return daemonConfig.get().isEmpty();  }  public void setProperty(String arg0, Object arg1) {    daemonConfig.get().setProperty(arg0, arg1);  }  public Configuration subset(String arg0) {    return daemonConfig.get().subset(arg0);  }    public int getMaxIndex(String path){      return daemonConfig.get().getMaxIndex(path);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -