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

📄 testclient.java

📁 springGather 在JAVA环境开发的电信运营支持系统
💻 JAVA
字号:
package lianxi;

import org.com.gather.*; 
import java.util.*;
import java.lang.reflect.*;

public class TestClient{
	public static void main(String[] args)throws Exception{
		Properties pro = new Properties();

		String value = System.getProperty("beanFactory.xml");
		// 如果没有从命令行获取参数,则初始值为本机路径;
		if(value == null){
			value = "D:/EXAMPLE/NetCTOSS/springGather/beanFactory.xml";
		}
		pro.setProperty("beanFactory.xml",value);

		String config_Class = System.getProperty("config");

		if(config_Class == null){
			config_Class = "org.com.gather.SpringConfig";
		}

		ClassLoader cl = ClassLoader.getSystemClassLoader();
		Class c = cl.loadClass(config_Class);
		Constructor[] ctr = c.getConstructors();
		Config config = (Config)ctr[0].newInstance(new Object[]{pro});




	//	Config config = new SpringConfig(pro);

		Gather gather = config.getGather();
		long start = System.currentTimeMillis();
		Collection col = gather.getData();
		BackUp back = config.getBackUp();
		Client client = config.getClient();

		if(!col.isEmpty()){
			Collection backCol = back.load();
			
			if(!backCol.isEmpty()){
				//如果成功把备份文件东西调出,则把备份文件清空;
				back.clear();
				backCol.addAll(col);
				client.send(backCol);
			}else{
				client.send(col);
				back.clear();
			}
		}else{
			Collection backCol = back.load();
			System.out.println("采集到的数据为空,检测备份文件;");
			client.send(backCol);
			back.clear();
		}

		long end = System.currentTimeMillis();
		long time = end - start;
		System.out.println("时间是:"+time/1000+"秒");
	}
}

⌨️ 快捷键说明

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