📄 wayoutspmaster.java
字号:
package com.wayout.wayoutsp;import java.io.*;import java.util.*;import com.wayout.wayoutsp.communication.*;import com.wayout.wayoutsp.operation.*;import com.wayout.wayoutsp.publics.*;/** * <p>Title: 公司运营项目</p> * <p>Description: 实现短信SP之功能.短信互动系统</p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: wayout</p> * @author wayout Software * @version 1.01 */public class WayoutspMaster { public WayoutspMaster(String name) { myname = name; } /** * * wayoutsp系统执行入口 * 1、系统初始化 * 2、构造Cmpp连接管理器 * @param args main */ public static void main(String[] args) { WayoutspMaster wayoutspM = new WayoutspMaster("wayoutsp"); if( ! wayoutspM.init() ) { //若初始化失败,系统退出 PublicConstants.writeLog.info("wayoutsp system exit ...Because of init fault",0); System.exit(-1) ; } else { PublicConstants.writeLog.info("wayoutsp init OK! ",0); } wayoutspM.connectCmpp(); PublicFuction.threadSleep(200) ; wayoutspM.operationStart(); wayoutspM.addtionalFunction(); System.out.println("\nwayoutsp System started ! ");// rececmpp= new receCMPP(); //rececmpp.run(); } /** * 启动业务处理模块 */ private void operationStart() { com.wayout.wayoutsp.operation.OperManager.getInstance().startAllBusiModule(); startCustomServer();// com.wayout.wayoutsp.operation.attendChat.AttendChat.getInstanceAttendChat().start(); startGroupSend2User(); } /** * 启动网关附加功能模块 例如黑名单、敏感词、广告语等 */ private void addtionalFunction() {// com.wayout.wayoutsp.publics.BlackListCheck.getInstance().start();// com.wayout.wayoutsp.publics.BlackWordCheck.getInstance().start(); } /** * 构造Cmpp连接管理器 */ private void connectCmpp() { o_CmppConnectionManager = CmppConnectionManager.instance() ; if (o_CmppConnectionManager == null) System.out.println("o_CmppConnectionManager is null"); } /** * 系统初始化 * 1、从文件读出配置参数<br> * 2、从数据库读出配置参数<br> * @return * true :初始化成功 * false:初始化失败 */ private boolean init() { //Constants.msgid_number = 100000; if(! loadCfgFile() ) return false; /** * test db conn */ // System.out.println("FEE99=="+DatabaseAccess.instance().getOneSYSPara("FEE99")); return true; } /* //通知退出 public static int shutDownAll(){ return 0; } */ /** * 从数据库读取所需参数 * @return * true :成功 * false:失败 */ /** * 从文件读取所需参数 * @return * true :成功 * false:失败 */ private boolean loadCfgFile() { System.out.println("Reading Cfg from file ..."); try { /*String userHome = System.getProperties().getProperty("user.dir"); if( userHome == null ) userHome=""; else userHome = userHome + File.separator; PublicConstants.ConfigFile = userHome + "cfg" +File.separator +"com.wayout.wayoutsp.cf";*/ PublicConstants.ConfigFile=System.getProperties().getProperty("CONFIG_FILE"); System.out.println("cfgFile: \t\t\t"+PublicConstants.ConfigFile); InputStream is = new FileInputStream(PublicConstants.ConfigFile) ; Properties pt = new Properties() ; pt.load(is) ; PublicConstants.LogPath = pt.getProperty("public.LogPath", "logs/") ; System.out.println("public.logPath: \t\t"+PublicConstants.LogPath); PublicConstants.DEBUGLevel = Integer.parseInt( pt.getProperty("public.DebugLevel","0") ); System.out.println("public.DebugLevel: \t\t"+PublicConstants.DEBUGLevel); try { PublicConstants.writeLog = new WriteLog(PublicConstants.LogPath,PublicConstants.DEBUGLevel); } catch (IOException ioe) { System.out.println("Build log object: "+ioe); System.exit(-1); } PublicConstants.writeLog.info("\n\nwayoutsp SYSTEM STARTING ...",0); PublicConstants.PackDEBUGLevel = Integer.parseInt( pt.getProperty("public.PackDebugLevel","0") ); PublicConstants.DB_DRIVER=pt.getProperty("public.DBDriver").trim(); System.out.println("PublicConstants.DB_DRIVER:\t" + PublicConstants.DB_DRIVER); PublicConstants.CONNECTION_URL = pt.getProperty("public.DBConnectString", "ERROR !").trim(); System.out.println("DBConnectString:\t\t" + PublicConstants.CONNECTION_URL); PublicConstants.DB_USER = pt.getProperty("public.DBUser").trim(); //System.out.println("DB_USER: \t\t\t" + PublicConstants.DB_USER); PublicConstants.DB_PASS = pt.getProperty("public.DBPasswd").trim(); //System.out.println("DB_PASS: \t\t\t"+PublicConstants.DB_PASS); PublicConstants.RECONNECTDB_INTERVAL=Integer.parseInt(pt.getProperty("public.RECONNECTDB_INTERVAL").trim()); System.out.println("RECONNECTDB_INTERVAL: "+PublicConstants.RECONNECTDB_INTERVAL); PublicConstants.SectionNum=pt.getProperty("public.SectionNum").trim(); System.out.println("PublicConstants.SectionNum: "+PublicConstants.SectionNum); PublicConstants.DealerType=Byte.parseByte(pt.getProperty("public.DealerType").trim()); System.out.println("PublicConstants.DealerType: "+PublicConstants.DealerType); PublicConstants.TotalHelpMsg=pt.getProperty("operation.TotalHelpMsg","输入有误!!"); System.out.println("PublicConstants.TotalHelpMsg: "+PublicConstants.TotalHelpMsg); PublicConstants.TotalHelpFeeType=Byte.parseByte(pt.getProperty("operation.TotalHelpFeeType").trim()); System.out.println("PublicConstants.TotalHelpFeeType: "+PublicConstants.TotalHelpFeeType); PublicConstants.TotalHelpServieceType=pt.getProperty("operation.TotalHelpServieceType").trim(); System.out.println("PublicConstants.TotalHelpServieceType: "+PublicConstants.TotalHelpServieceType); PublicConstants.TotalHelpInfoFee=Integer.parseInt(pt.getProperty("operation.TotalHelpInfoFee").trim()); System.out.println("PublicConstants.TotalHelpInfoFee: "+PublicConstants.TotalHelpInfoFee); is.close() ; } catch (Exception e) { System.out.println("wayoutsp loadCfgFile: "+e.toString() ); PublicConstants.writeLog.info("wayoutsp loadCfgFile: "+e,0); return false; } return true; } /** * 关闭wayoutsp系统 * @return * true :成功 * false:失败 */ public static boolean shutdownwayoutsp() { PublicConstants.writeLog.info("wayoutsp shutdown ... ",0); CmppConnectionManager.instance().shutdownCmpp() ; return true; } /** * * 重新读wayoutsp参数(暂未使用) * type = 0 :增一个短信中心参数; * type = 1 :增一个SP参数; * type = 2 :刷新系统参数(Tlp_Sys_config表)参数; * @param type 类型 * @return boolean */ public static boolean reReadParam( int type ) { PublicConstants.writeLog.info("wayoutsp reRead parameter("+type+") ... ",0); return true; } //#############<ADD> by Simon Peng <BGN>############### private static void startCustomServer() {// com.wayout.wayoutsp.custom.BroadcastThread.startBroadcast(); } private static void startGroupSend2User() { com.wayout.wayoutsp.custom.GroupSend2User.getInstanceCompereToUser().start(); } private static CmppConnectionManager o_CmppConnectionManager; private String myname;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -