当前位置: 首页>>代码示例>>Java>>正文


Java Utils.readStormConfig方法代码示例

本文整理汇总了Java中backtype.storm.utils.Utils.readStormConfig方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.readStormConfig方法的具体用法?Java Utils.readStormConfig怎么用?Java Utils.readStormConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backtype.storm.utils.Utils的用法示例。


在下文中一共展示了Utils.readStormConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
	// TODO Auto-generated method stub

	if (args.length < 2) {
		LOG.info("Invalid parameter");
		usage();
		return;
	}

	conf = Utils.readStormConfig();

	if (args[0].equalsIgnoreCase(READ_CMD)) {

		readData(args[1]);

	} else if (args[0].equalsIgnoreCase(RM_CMD)) {
		rmBakTopology(args[1]);
	}

}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:25,代码来源:ZkTool.java

示例2: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	// TODO Auto-generated method stub
	if (args == null || args.length == 0) {
		throw new InvalidParameterException("Should input key name");
	}

	String key = args[0];

	Map conf = Utils.readStormConfig();

	System.out.print("VALUE: " + String.valueOf(conf.get(key)));
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:16,代码来源:config_value.java

示例3: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	// TODO Auto-generated method stub
	if (args == null || args.length == 0) {
		throw new InvalidParameterException("Should input topology name");
	}

	String topologyName = args[0];

	NimbusClient client = null;
	try {

		Map conf = Utils.readStormConfig();
		client = NimbusClient.getConfiguredClient(conf);

		client.getClient().deactivate(topologyName);

		System.out.println("Successfully submit command deactivate "
				+ topologyName);
	} catch (Exception e) {
		System.out.println(e.getMessage());
		e.printStackTrace();
		throw new RuntimeException(e);
	} finally {
		if (client != null) {
			client.close();
		}
	}
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:32,代码来源:deactivate.java

示例4: getLocalConf

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
private static Map getLocalConf(int port) {
	List<String> zkServers = new ArrayList<String>(1);
	zkServers.add("localhost");
	Map conf = Utils.readStormConfig();
	conf.put(Config.STORM_CLUSTER_MODE, "local");
	conf.put(Config.STORM_ZOOKEEPER_SERVERS, zkServers);
	conf.put(Config.STORM_ZOOKEEPER_PORT, port);
	conf.put(Config.TOPOLOGY_SKIP_MISSING_KRYO_REGISTRATIONS, true);
	conf.put(Config.ZMQ_LINGER_MILLIS, 0);
	conf.put(Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS, false);
	conf.put(Config.TOPOLOGY_TRIDENT_BATCH_EMIT_INTERVAL_MILLIS, 50);
	ConfigExtension.setSpoutDelayRunSeconds(conf, 0);
	ConfigExtension.setTaskCleanupTimeoutSec(conf, 0);
	return conf;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:16,代码来源:LocalUtils.java

示例5: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {

	NimbusClient client = null;
	try {

		Map conf = Utils.readStormConfig();
		client = NimbusClient.getConfiguredClient(conf);
		
		if (args.length > 0 && StringUtils.isBlank(args[0]) == false) {
			String topologyId = args[0];
			TopologyInfo info = client.getClient().getTopologyInfo(topologyId);
			
			System.out.println("Successfully get topology info \n"
					+ info.toString());
		}else {
			ClusterSummary clusterSummary = client.getClient().getClusterInfo();
			

			System.out.println("Successfully get cluster info \n"
					+ clusterSummary.toString());
		}

		
	} catch (Exception e) {
		System.out.println(e.getMessage());
		e.printStackTrace();
		throw new RuntimeException(e);
	} finally {
		if (client != null) {
			client.close();
		}
	}
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:37,代码来源:list.java

示例6: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	// TODO Auto-generated method stub
	if (args == null || args.length == 0) {
		throw new InvalidParameterException("Should input topology name");
	}

	String topologyName = args[0];

	NimbusClient client = null;
	try {

		Map conf = Utils.readStormConfig();
		client = NimbusClient.getConfiguredClient(conf);

		client.getClient().activate(topologyName);

		System.out.println("Successfully submit command activate "
				+ topologyName);
	} catch (Exception e) {
		System.out.println(e.getMessage());
		e.printStackTrace();
		throw new RuntimeException(e);
	} finally {
		if (client != null) {
			client.close();
		}
	}
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:32,代码来源:activate.java

示例7: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    if (args == null || args.length == 0) {
        throw new InvalidParameterException("Should input topology name");
    }

    String topologyName = args[0];

    NimbusClient client = null;
    try {

        Map conf = Utils.readStormConfig();
        client = NimbusClient.getConfiguredClient(conf);

        client.getClient().activate(topologyName);

        System.out.println("Successfully submit command activate " + topologyName);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:31,代码来源:activate.java

示例8: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
@SuppressWarnings("rawtypes")
public static void main(String[] args) {
	if (args == null || args.length == 0) {
		throw new InvalidParameterException("Should input topology name");
	}

	String topologyName = args[0];

	NimbusClient client = null;
	try {

		Map conf = Utils.readStormConfig();
		client = NimbusClient.getConfiguredClient(conf);

		client.getClient().deactivate(topologyName);

		System.out.println("Successfully submit command deactivate "
				+ topologyName);
	} catch (Exception e) {
		System.out.println(e.getMessage());
		e.printStackTrace();
		throw new RuntimeException(e);
	} finally {
		if (client != null) {
			client.close();
		}
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:32,代码来源:deactivate.java

示例9: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
@SuppressWarnings("rawtypes")
public static void main(String[] args) {
	if (args == null || args.length <= 1) {
		throw new InvalidParameterException("Should input topology name and enable flag");
	}

	String topologyName = args[0];

	NimbusClient client = null;
	try {

		Map conf = Utils.readStormConfig();
		client = NimbusClient.getConfiguredClient(conf);

		boolean isEnable = Boolean.valueOf(args[1]).booleanValue();

		MonitorOptions options = new MonitorOptions();
		options.set_isEnable(isEnable);

		client.getClient().metricMonitor(topologyName, options);

		String str = (isEnable) ? "enable" : "disable";
		System.out.println("Successfully submit command to " + str
				+ " the monitor of " + topologyName);
	} catch (Exception e) {
		System.out.println(e.getMessage());
		e.printStackTrace();
		throw new RuntimeException(e);
	} finally {
		if (client != null) {
			client.close();
		}
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:38,代码来源:metrics_monitor.java

示例10: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	if (args == null || args.length == 0) {
		throw new InvalidParameterException("Should input topology name");
	}

	String topologyName = args[0];

	NimbusClient client = null;
	try {
		Map conf = Utils.readStormConfig();
		client = NimbusClient.getConfiguredClient(conf);
		
		System.out.println("It will take 15 ~ 100 seconds to restart, please wait patiently\n");

		if (args.length == 1) {
			client.getClient().restart(topologyName, null);
		} else {
			Map loadConf = LoadConf(args[1]);
			String jsonConf = Utils.to_json(loadConf);
			System.out.println("New configuration:\n" + jsonConf);
			
			client.getClient().restart(topologyName, jsonConf);
		}

		System.out.println("Successfully submit command restart "
				+ topologyName);
	} catch (Exception e) {
		System.out.println(e.getMessage());
		e.printStackTrace();
		throw new RuntimeException(e);
	} finally {
		if (client != null) {
			client.close();
		}
	}
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:40,代码来源:restart.java

示例11: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    if (args == null || args.length == 0) {
        throw new InvalidParameterException("Should input topology name");
    }

    String topologyName = args[0];

    NimbusClient client = null;
    try {

        Map conf = Utils.readStormConfig();
        client = NimbusClient.getConfiguredClient(conf);

        client.getClient().deactivate(topologyName);

        System.out.println("Successfully submit command deactivate " + topologyName);
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        throw new RuntimeException(e);
    } finally {
        if (client != null) {
            client.close();
        }
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:31,代码来源:deactivate.java

示例12: readUiConfig

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public static Map readUiConfig() {
	Map ret = Utils.readStormConfig();
	String curDir = System.getProperty("user.home");
	String confPath = curDir + File.separator + ".tstream" + File.separator
			+ "storm.yaml";
	File file = new File(confPath);
	if (file.exists()) {

		FileInputStream fileStream;
		try {
			fileStream = new FileInputStream(file);
			Yaml yaml = new Yaml();

			Map clientConf = (Map) yaml.load(fileStream);

			if (clientConf != null) {
				ret.putAll(clientConf);
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
		}

	}
	if (ret.containsKey(Config.NIMBUS_HOST) == false) {
		ret.put(Config.NIMBUS_HOST, "localhost");

	}
	return ret;
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:30,代码来源:UIUtils.java

示例13: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) {
	Map<Object, Object> conf = Utils.readStormConfig();
	
	conf.put("java.sandbox.enable", Boolean.valueOf(true));
	
	SandBoxMaker maker = new SandBoxMaker(conf);
	
	try {
		System.out.println("sandboxPolicy:" + maker.sandboxPolicy("simple", new HashMap<String, String>()));
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:14,代码来源:SandBoxMaker.java

示例14: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    if (args == null || args.length == 0) {
        throw new InvalidParameterException("Should input key name");
    }

    String key = args[0];

    Map conf = Utils.readStormConfig();

    System.out.print("VALUE: " + String.valueOf(conf.get(key)));
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:16,代码来源:config_value.java

示例15: main

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {

	NimbusClient client = null;
	try {

		Map conf = Utils.readStormConfig();
		client = NimbusClient.getConfiguredClient(conf);
		
		if (args.length > 0 && StringUtils.isBlank(args[0]) == false) {
			String topologyName = args[0];
			TopologyInfo info = client.getClient().getTopologyInfoByName(topologyName);
			
			System.out.println("Successfully get topology info \n"
					+ Utils.toPrettyJsonString(info));
		}else {
			ClusterSummary clusterSummary = client.getClient().getClusterInfo();
			
			System.out.println("Successfully get cluster info \n"
					+ Utils.toPrettyJsonString(clusterSummary));
		}

		
	} catch (Exception e) {
		System.out.println(e.getMessage());
		e.printStackTrace();
		throw new RuntimeException(e);
	} finally {
		if (client != null) {
			client.close();
		}
	}
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:36,代码来源:list.java


注:本文中的backtype.storm.utils.Utils.readStormConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。