netclienttest.java

来自「java的团队合作代码」· Java 代码 · 共 53 行

JAVA
53
字号
package com.briup.impl.net;import java.util.Collection;import java.util.Properties;import com.briup.Backup;import com.briup.Config;import com.briup.Gather;import com.briup.Log;import com.briup.NetClient;import com.briup.exception.BackupException;import com.briup.impl.config.ConfigImpl;/* * /* * 1、获取config实例 * 2、获取Gather,Log,Backup,NetClient * 3、调用gather采集数据 * 4、调用backup备份数据 * 5、调用netClient发送数据 */public class NetClientTest {	public static void main(String[] agrs){		Collection c = null;		Properties pro = new Properties();		pro.setProperty("config_file_path", "src/com/briup/resource/config.xml");				Backup bu = null;			try {			Config config = ConfigImpl.newInstance(pro);			Gather gather = config.getGather();			Log log = (Log) config.getLog();			bu =config.getBackup();			NetClient nc = config.getNetClient();			c = gather.doGather();			nc.send(c);		} catch (Exception e) {			// TODO Auto-generated catch block			e.printStackTrace();			try {				bu.load();			} catch (BackupException e1) {				// TODO Auto-generated catch block				e1.printStackTrace();			}					}	}}				

⌨️ 快捷键说明

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