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

📄 crbtgwifglobal.java

📁 中国联通炫铃业务接口开发
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.wireless.crbt.gwif.global;

import java.util.Vector;
import java.io.File;

import com.wireless.sms.pub.util.XMLConfig;
import com.wireless.sms.pub.entity.Monitor;
import com.wireless.sms.pub.net.MonitorClientSocket;
import com.wireless.sms.pub.db.*;

public class CrbtGWIFGlobal {
  private static CrbtGWIFGlobal _instance = null;
  public ConnectionPool POOL = null;
  /**监听其他机器传过来的CRBT**/
  public static Vector CRBT_CLIENT_IP = new Vector();
  public static Vector CRBT_PORT = new Vector();
  /**网关编号**/
  public String GATEWAY;
  public String GATEWAYNAME;
  public static String ServerIP;
  public static int ServerPort;
  public static String LocalIP;
  public static int LocalPort;
  public static String SP_CODE;//SP代码,实际长度不足20位,右补空格
  public static String PASSWORD;//SP登录密码
  public static String sou_addr;//此域为消息源地址,表示消息发起的原始发起方地址描述字串
  public static String des_addr;//此域为消息目的地址,表示消息希望到达的终端地址描述字串
  public static String ProcessClassName;
  public static int SubmitRetry;
  public static int waitTime = 0;
  public static int RequestTimeout=0;
  public static String TimeStamp;
  public static String Type;
  public static String Version;
  public static int ControlSize=16;
  public static boolean IsSendActiveTest;
  public static int SpanSend;
  public static int SendCount;
  public static String gatewayVendor;
  public static int ThreadNum;
  public static int flowControl;
  public static int operesponsetime;
  /**监控主机和端口**/
  public static String[] monitorHosta = null;
  public static String[] monitorPorta = null;
  public static Vector MTserverSocketVec = new Vector();
  public static Vector vManage = new Vector();   //运营商连接客户端 (服务端) 起停保存
  /**监控信息**/
  public static MonitorClientSocket monitorClientSocket = null; //监控包发送程序
  public static Monitor monitor = null; //监控包
  public static String switchip = null;
  public static String switchname = null;
  public static String reloadPort = null;


  public static synchronized CrbtGWIFGlobal getInstance() {
      if (_instance == null) {
          _instance = new CrbtGWIFGlobal();
      }
      return _instance;
  }

  public void initCommon() {
      XMLConfig.setConfiguration(null);
      initDB();
      monitorHosta = XMLConfig.getConfiguration().getStringArray("monitorclient.monitor");
      monitorPorta = XMLConfig.getConfiguration().getStringArray("monitorclient.monitor[@port]");
      
      reloadPort = XMLConfig.getConfiguration().getString("socket.reload.port");
      
      CRBT_CLIENT_IP = XMLConfig.getConfiguration().getVector("reciveCRBT.CRBT_CLIENT_IP[@HOST]");
      CRBT_PORT = XMLConfig.getConfiguration().getVector("reciveCRBT.CRBT_CLIENT_IP[@CRBT_PORT]");

      /**监控包发送对象及监控包初始化  **/
      monitorClientSocket = new MonitorClientSocket(
                            XMLConfig.getConfiguration().getStringArray("monitorclient.monitor"),
                            XMLConfig.getConfiguration().getStringArray("monitorclient.monitor[@port]"));
      monitor = new Monitor();
      switchip = System.getProperty("switch_ip");
      switchip = switchip == null ? "":switchip.trim();
      monitor.setIp(switchip);
      switchname = System.getProperty("switch_name");
      switchname = switchname == null ? "":switchname.trim();
      monitor.setProcessName(switchname);
  }

  private void initDB(){
      try {
          String dbconfigfile = System.getProperty("dbconfig");
          File temFile = null;
          if (dbconfigfile != null && !dbconfigfile.equals("")) {
              temFile = new File(dbconfigfile);
              if (temFile != null && temFile.exists()) {
                  POOL = ConnectionPool.getInstance(dbconfigfile);
              } else {
                  POOL = ConnectionPool.getInstance();
              }
          }
          else {
              POOL = ConnectionPool.getInstance();
          }
      } catch (Exception ex1) {
          ex1.printStackTrace();
      }
  }
  
  /**
   *  读取配置文件
   */
  public void initYD_System() {
      initCommon();
      waitTime = XMLConfig.getConfiguration().getInt("cm.WaitTime");
      GATEWAY = XMLConfig.getConfiguration().getString("cm.GateWayID");
      GATEWAYNAME = XMLConfig.getConfiguration().getString("cm.GateName");
      sou_addr = XMLConfig.getConfiguration().getString("cm.Sou_addr");
      des_addr = XMLConfig.getConfiguration().getString("cm.Des_addr");
      SP_CODE = XMLConfig.getConfiguration().getString("cm.Sp_code");
      PASSWORD = XMLConfig.getConfiguration().getString("cm.Password");
      
      ServerIP = XMLConfig.getConfiguration().getString("cm.ServerIP");
      ServerPort= XMLConfig.getConfiguration().getInt("cm.ServerPort");
      LocalIP = XMLConfig.getConfiguration().getString("cm.LocalIP");
      LocalPort= XMLConfig.getConfiguration().getInt("cm.LocalPort");
      ProcessClassName= XMLConfig.getConfiguration().getString("cm.ProcessClassName");
      SubmitRetry = XMLConfig.getConfiguration().getInt("cm.SubmitRetry");
      RequestTimeout= XMLConfig.getConfiguration().getInt("cm.RequestTimeout");
      TimeStamp= XMLConfig.getConfiguration().getString("cm.TimeStamp");
      Type = XMLConfig.getConfiguration().getString("cm.Type");
      Version= XMLConfig.getConfiguration().getString("cm.Version");
      ControlSize= XMLConfig.getConfiguration().getInt("cm.ControlSize");
      IsSendActiveTest = XMLConfig.getConfiguration().getBoolean("cm.IsSendActiveTest");
      SpanSend= XMLConfig.getConfiguration().getInt("cm.SpanSend");
      SendCount= XMLConfig.getConfiguration().getInt("cm.SendCount");
      gatewayVendor = XMLConfig.getConfiguration().getString("cm.gatewayVendor");
      ThreadNum= XMLConfig.getConfiguration().getInt("cm.ThreadNum");
      flowControl= XMLConfig.getConfiguration().getInt("cm.flowControl");
      operesponsetime = XMLConfig.getConfiguration().getInt("cm.operesponsetime");
  }

  public void initUN_System() {
      initCommon();
      waitTime = XMLConfig.getConfiguration().getInt("un.WaitTime");
      GATEWAY = XMLConfig.getConfiguration().getString("un.GateWayID");
      GATEWAYNAME = XMLConfig.getConfiguration().getString("un.GateName");
      sou_addr = XMLConfig.getConfiguration().getString("un.Sou_addr");
      des_addr = XMLConfig.getConfiguration().getString("un.Des_addr");
      SP_CODE = XMLConfig.getConfiguration().getString("un.Sp_code");
      PASSWORD = XMLConfig.getConfiguration().getString("un.Password");
      
      ServerIP = XMLConfig.getConfiguration().getString("un.ServerIP");
      ServerPort= XMLConfig.getConfiguration().getInt("un.ServerPort");
      LocalIP = XMLConfig.getConfiguration().getString("un.LocalIP");
      LocalPort= XMLConfig.getConfiguration().getInt("un.LocalPort");
      ProcessClassName= XMLConfig.getConfiguration().getString("un.ProcessClassName");
      SubmitRetry = XMLConfig.getConfiguration().getInt("un.SubmitRetry");
      RequestTimeout= XMLConfig.getConfiguration().getInt("un.RequestTimeout");
      TimeStamp= XMLConfig.getConfiguration().getString("un.TimeStamp");
      Type = XMLConfig.getConfiguration().getString("un.Type");
      Version= XMLConfig.getConfiguration().getString("un.Version");
      ControlSize= XMLConfig.getConfiguration().getInt("un.ControlSize");
      IsSendActiveTest = XMLConfig.getConfiguration().getBoolean("un.IsSendActiveTest");
      SpanSend= XMLConfig.getConfiguration().getInt("un.SpanSend");
      SendCount= XMLConfig.getConfiguration().getInt("un.SendCount");
      gatewayVendor = XMLConfig.getConfiguration().getString("un.gatewayVendor");
      ThreadNum= XMLConfig.getConfiguration().getInt("un.ThreadNum");
      flowControl= XMLConfig.getConfiguration().getInt("un.flowControl");
      operesponsetime = XMLConfig.getConfiguration().getInt("un.operesponsetime");
  }

  public void initCN_System() {
      initCommon();
      waitTime = XMLConfig.getConfiguration().getInt("cn.WaitTime");
      GATEWAY = XMLConfig.getConfiguration().getString("cn.GateWayID");
      GATEWAYNAME = XMLConfig.getConfiguration().getString("cn.GateName");
      sou_addr = XMLConfig.getConfiguration().getString("cn.Sou_addr");
      des_addr = XMLConfig.getConfiguration().getString("cn.Des_addr");
      SP_CODE = XMLConfig.getConfiguration().getString("cn.Sp_code");
      PASSWORD = XMLConfig.getConfiguration().getString("cn.Password");
      
      ServerIP = XMLConfig.getConfiguration().getString("cn.ServerIP");
      ServerPort= XMLConfig.getConfiguration().getInt("cn.ServerPort");
      LocalIP = XMLConfig.getConfiguration().getString("cn.LocalIP");
      LocalPort= XMLConfig.getConfiguration().getInt("cn.LocalPort");

⌨️ 快捷键说明

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