📄 mastercngpclient.java
字号:
package cn.netjava.cngpclient;
import java.io.*;
import java.util.*;
import java.util.logging.*;
import cn.netjava.cngpclient.connection.*;
import cn.netjava.cngpclient.log.LogManage;
import cn.netjava.cngpclient.publics.*;
/**
*
* 中国网通短信网关客户端--蓝杰实训项目
* 客户端启动主类,读取配置,启动系统.
* @author www.NetJava.cn
*
*/
public class MasterCNGPClient {
public static void main(String[] args) {
System.out.println("\n\n");
System.out
.println(" *************************************************");
System.out
.println(" * THIS IS CNGP CLIENT Create by NetJava.cn *");
System.out
.println(" * good luck 2 you! *");
System.out
.println(" *************************************************");
System.out.println("\n");
MasterCNGPClient FoxspM = new MasterCNGPClient();
if (!FoxspM.init()) {
LogManage.ins().myLog.logp(Level.SEVERE, "", "",
"System init false !!!!!");
System.exit(-1);
} else {
FoxspM.connectCmpp();
PublicFuction.threadSleep(5000);
SubmitThread.getIns().start();
new Intery2DB().start();
LogManage.ins().myLog.logp(Level.INFO, "", "",
" nSystem started ! ");
}
}
private void connectCmpp() {
o_CmppConnectionManager = CmppConnectionManager.instance();
if (o_CmppConnectionManager == null)
LogManage.ins().myLog.logp(Level.SEVERE, "", "",
"System create Connection error ");
}
private boolean init() {
if (!loadCfgFile())
return false;
return true;
}
private boolean loadCfgFile() {
LogManage.ins().myLog.logp(Level.INFO, "", "", " read cfg .... ");
try {
String userHome = System.getProperties().getProperty("user.dir");
if (userHome == null)
userHome = "";
else
userHome = userHome + File.separator;
PublicConstants.ConfigFile = userHome + "cfg" + File.separator
+ "mobile.cf";
LogManage.ins().myLog.logp(Level.INFO, "", "", " cfgFile: "
+ PublicConstants.ConfigFile);
InputStream is = new FileInputStream(PublicConstants.ConfigFile);
Properties pt = new Properties();
pt.load(is);
PublicConstants.DEBUGLevel = 0;
PublicConstants.PackDEBUGLevel = 0;
PublicConstants.DB_DRIVER = pt.getProperty("public.DBDriver")
.trim();
PublicConstants.CONNECTION_URL = pt.getProperty(
"public.DBConnectString", "ERROR !").trim();
PublicConstants.DB_USER = pt.getProperty("public.DBUser").trim();
PublicConstants.DB_PASS = pt.getProperty("public.DBPasswd").trim();
PublicConstants.CONNECTION_intery = pt.getProperty(
"PublicConstants.CONNECTION_intery",
"jdbc:oracle:thin:@192.168.0.26:1521:orcl26");
PublicConstants.DB_DRIVER_intery = pt.getProperty(
"PublicConstants.DB_DRIVER_intery",
"oracle.jdbc.driver.OracleDriver");
PublicConstants.DB_USER_intery = pt.getProperty(
"PublicConstants.DB_USER_intery", "ydcs");
PublicConstants.DB_PASS_intery = pt.getProperty(
"PublicConstants.DB_PASS_intery", "ydcs");
PublicConstants.RECONNECTDB_INTERVAL = 5000;
// 网关IP
IsmgInfo.ismgIp = pt.getProperty("ismgIp", "211.138.225.68");
IsmgInfo.ismgMoPort = Integer.parseInt(pt.getProperty("ismgMoPort",
"7910"));
IsmgInfo.ismgMtPort = Integer.parseInt(pt.getProperty("ismgMtPort",
"7890"));
IsmgInfo.spPasswd = pt.getProperty("spPasswd", "01260");
IsmgInfo.spId = pt.getProperty("spId", "bbb");
IsmgInfo.spCode = pt.getProperty("spCode", "aaa");
IsmgInfo.sp_Ip = pt.getProperty("spIp", "202.103.67.121");
IsmgInfo.MaxLength = Integer.parseInt(pt.getProperty("MaxLength",
"60"));
IsmgInfo.SendInterval = Integer.parseInt(pt.getProperty(
"SendInterval", "50"));
is.close();
} catch (Exception e) {
LogManage.ins().myLog.logp(Level.SEVERE, "", "",
"reading CFG error " + e);
return false;
}
return true;
}
public static boolean shutdownFoxsp() {
CmppConnectionManager.instance().shutdownCmpp();
return true;
}
private MasterCNGPClient() {
myname = "foxSP";
}
private static CmppConnectionManager o_CmppConnectionManager;
private String myname;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -