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

📄 config.java~76~

📁 短信网关发送接受平台。
💻 JAVA~76~
📖 第 1 页 / 共 2 页
字号:
import java.io.*;
import java.util.*;
import UserDefinedException.*;
import LOG.Log;
import Utilities.*;
import java.sql.*;
import Services.*;
import XML.*;
//import DataBase.DatabaseConnection.*;
/**
 * <p>Title: sms_statistics</p>
 * <p>Description: InHand XMLCenter 短信服务平台计费统计程序</p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: 北京映翰通网络技术有限公司</p>
 * @author 韩传俊 shock2000@21cn.com
 * @version 1.0
 */
/**读取config.ini中的配置:

   [db_info]                                -----数据库的相关信息
        db_type=mssql                       -----数据库的类型:oracle、mssql、mysql
        db_host=localhost                   -----数据库服务器的位置
        db_name=sms_statistics              -----数据库名称
        db_user=stat.                       -----数据库dbo名称
        db_password=stat                    -----登录密码

   [administrator]
        mail_smtp_host=mail.inhand.com.cn                      -----SMTP服务器地址
        mail_sender=support@inhand.com.cn                      -----发信人邮件标识
        mail_need_auth=true                                    -----是否需要认证
        mail_sender_user_name=suport@inhand.com.cn             -----发信人邮箱用户名
        mail_sender_user_password=inhand                       -----发信人油箱密码
        mail_reciever=han@inhand.com.cn;support@inhand.com.cn  -----收信人地址

   [server_info]                                               -----取服务器信息
        xmlcenter_host=127.0.0.1                               -----xmlcenter的IP地址
        xmlcenter_port=8809                                    -----xmlcenter的侦听端口
        service_port=9000                                      -----xmlrouter的侦听端口
        service_connection_number=1                            -----xmlrouter的其他服务连接数
 */
public class Config {
        //信任地址
        public static Vector trustIP=new Vector();

        //当日log对象
        public static Log log;

        //xmlcenter的IP地址
        public static String server_host="";

        //xmlcenter的侦听端口
        public static int server_port=0;

        //xmlrouter的侦听端口
        public static int local_port=0;

        //xmlrouter的其他服务连接数
        public static int con_number=0;

        public static boolean book_conn=false;
        public static boolean channel_conn=false;
        public static boolean order_conn=false;

        //定义数据库的类型
        public final static int MSSQL_DB        =      1;
        public final static int MYSQL_DB        =      2;
        public final static int ORALCE_DB       =      3;

        //数据库类型
        public static int db_type   =   0;

        //数据库服务器位置
        public static String db_host="";
        //数据库名
        public static String db_name="";
        //数据库用户名
        public static String db_Account="";
        //数据库密码
        public static String db_Password="";

        public static DataPool send_queue=new DataPool(300);
        public static DataPool recv_queue=new DataPool(300);

        public static DataPool subcode_queue=new DataPool();
        public static DataPool service_id_queue=new DataPool();

        public static Vector subcode_item=new Vector();
        public static Vector service_id_item=new Vector();

        public static int flux=30;


        //管理信息
        public static String mail_smtp_host="mail.inhand.com.cn";                     //-----SMTP服务器地址
        public static String mail_sender="support@inhand.com.cn";                     //-----发信人邮件标识
        public static boolean mail_need_auth=true;                                    //-----是否需要认证
        public static String mail_sender_user_name="suport@inhand.com.cn";            //-----发信人邮箱用户名
        public static String mail_sender_user_password="";                            //-----发信人油箱密码
        public static Vector mail_reciever=new Vector();                              //-----收信人地址

        //错误提示信息
        public static byte[] is_not_working;
        public static byte[] no_such_service;

        //处理记录数
        public static long mt_recorder_number=0;
        public static long mo_recorder_number=0;

        public static long input_recorder_number=0;
        public static long output_recorder_number=0;

        public Config() {
        }

        public static synchronized void resetCounter(){
                Config.mt_recorder_number=0;
                Config.mo_recorder_number=0;
                Config.input_recorder_number=0;
                Config.output_recorder_number=0;
        }

        public static synchronized void incMt(){
                Config.mt_recorder_number++;
        }

        public static synchronized long getMt(){
                return Config.mt_recorder_number;
        }

        public static synchronized void incMo(){
                Config.mo_recorder_number++;
        }

        public static synchronized long getMo(){
                return Config.mo_recorder_number;
        }

        public static synchronized void incIn(){
                Config.input_recorder_number++;
        }

        public static synchronized long getIn(){
                return Config.input_recorder_number;
        }

        public static synchronized void incOut(){
                Config.output_recorder_number++;
        }

        public static synchronized long getOut(){
                return Config.output_recorder_number;
        }

        public static boolean getConfig() throws ConfigException{

                //得到当日Log对象
                Config.log=new Log();


                String temp="";
                String xmlStr="";

                Config.log.log("打开配置文件");

                //读取config.ini配置文件
                File file=new File("..\\config\\config.xml");
                try{
                        FileReader fin=new FileReader(file);
                        //在config.ini输入流中得到一个属性列表
                        BufferedReader in=new BufferedReader(fin);
                        temp=in.readLine();
                        if (!temp.startsWith("<xml ver")){
                                xmlStr+=temp.trim();
                        }
                        while((temp=in.readLine())!=null){
                                temp=temp.trim();
                                xmlStr+=temp;
                        }
                        in.close();
                        fin.close();
                        fin=null;
                        file=null;
                }catch(IOException ioe){
                        ioe.printStackTrace();
                        return false;
                }

                if (xmlStr.equalsIgnoreCase("")){
                        return false;
                }
                ParseXML xml=new ParseXML();
                xml.parse(xmlStr);


                //取数据库类型

⌨️ 快捷键说明

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