package com.huawei.esb;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Properties;
import java.util.Timer;
import org.apache.log4j.Logger;
import com.huawei.common.XMLParserHelper;
/*
* Class: FileManager
* Description: 加载并启动文件监听,并对外开放接口访问
* Version: 1.0
* Author: Carson.Huang
* Created on Dec 1, 2010
*/
public class FileManager
{
//注册的监听文件列表
private static HashMap<String, FileListener> FMap = new HashMap<String, FileListener>();
//配置文件路径(从命令行传入)
private String configFile = null;
//默认配置文件(从jar包中加载)
private String defaultConfigFile = "FileListener.properties";
private Logger logger = Logger.getLogger(FileManager.class);
//所有的枚举以这个为常量为标准
public static final String ENUMERATE="enumerateTemplet.xml";
/**
* @param args
*/
public static void main(String[] args)
{
FileManager fm = new FileManager();
if (args.length > 0)
{
fm.configFile = args[1];
}
if (FMap.size() == 0)
{
fm.regFileListener();
System.out.println("Execute Command success.");
}
else
{
System.out.println("The program is running. cannot run again.");
}
//enumerate_Eplus.xml
System.out.println(getTransferValue("TenantId","BLAU"));
System.out.println(getOriginallyValue("TenantId","100"));
System.out.println(getTransferValue("PaymentType","Postpaid"));
System.out.println(getOriginallyValue("PaymentType","0"));
}
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Properties;
import java.util.Timer;
import org.apache.log4j.Logger;
import com.huawei.common.XMLParserHelper;
/*
* Class: FileManager
* Description: 加载并启动文件监听,并对外开放接口访问
* Version: 1.0
* Author: Carson.Huang
* Created on Dec 1, 2010
*/
public class FileManager
{
//注册的监听文件列表
private static HashMap<String, FileListener> FMap = new HashMap<String, FileListener>();
//配置文件路径(从命令行传入)
private String configFile = null;
//默认配置文件(从jar包中加载)
private String defaultConfigFile = "FileListener.properties";
private Logger logger = Logger.getLogger(FileManager.class);
//所有的枚举以这个为常量为标准
public static final String ENUMERATE="enumerateTemplet.xml";
/**
* @param args
*/
public static void main(String[] args)
{
FileManager fm = new FileManager();
if (args.length > 0)
{
fm.configFile = args[1];
}
if (FMap.size() == 0)
{
fm.regFileListener();
System.out.println("Execute Command success.");
}
else
{
System.out.println("The program is running. cannot run again.");
}
//enumerate_Eplus.xml
System.out.println(getTransferValue("TenantId","BLAU"));
System.out.println(getOriginallyValue("TenantId","100"));
System.out.println(getTransferValue("PaymentType","Postpaid"));
System.out.println(getOriginallyValue("PaymentType","0"));
}