@Override public void process(Config conf, CommandLine commandLine) throws ParseException { for (String s : commandLine.getOptionValues("D")) { String[] keyval = s.split("=", 2); if (keyval.length != 2) throw new ParseException("Invalid option value `" + s + "'"); conf.putAll((Map) yaml.load(keyval[0] + ": " + keyval[1])); } } }
public static Config getConfig(String[] args) { Config ret = new Config(); if (args == null || args.length == 0) { return ret; } if (StringUtils.isBlank(args[0])) { return ret; } Map conf = JStormHelper.LoadConf(args[0]); ret.putAll(conf); return ret; }
@Override public void process(Config conf, CommandLine commandLine) throws ParseException { try { for (String f : commandLine.getOptionValues("conf")) { Map m = loadConf(f); if (m == null) throw new ParseException("Empty configuration file " + f); conf.putAll(m); } } catch (IOException e) { throw new ParseException(e.getMessage()); } } }
Map yamlConf = LoadConf.LoadYaml(args[0]); if (yamlConf != null) { conf.putAll(yamlConf);
/** * Given a topology definition, return a populated `backtype.storm.Config` instance. * * @param topologyDef * @return */ public static Config buildConfig(TopologyDef topologyDef) { // merge contents of `config` into topology config Config conf = new Config(); conf.putAll(topologyDef.getConfig()); return conf; }
@Override public void process(Config conf, CommandLine commandLine) throws ParseException { for (String s : commandLine.getOptionValues("D")) { String[] keyval = s.split("=", 2); if (keyval.length != 2) throw new ParseException("Invalid option value `" + s + "'"); conf.putAll((Map) yaml.load(keyval[0] + ": " + keyval[1])); } } }
@Override public void process(Config conf, CommandLine commandLine) throws ParseException { try { for (String f : commandLine.getOptionValues("conf")) { Map m = loadConf(f); if (m == null) throw new ParseException("Empty configuration file " + f); conf.putAll(m); } } catch (IOException e) { throw new ParseException(e.getMessage()); } } }
private static StormTopology buildExternalTopology(ObjectDef def, ExecutionContext context) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { Object topologySource = buildObject(def, context); String methodName = context.getTopologyDef().getTopologySource().getMethodName(); Method getTopology = findGetTopologyMethod(topologySource, methodName); if(getTopology.getParameterTypes()[0].equals(Config.class)){ Config config = new Config(); config.putAll(context.getTopologyDef().getConfig()); return (StormTopology) getTopology.invoke(topologySource, config); } else { return (StormTopology) getTopology.invoke(topologySource, context.getTopologyDef().getConfig()); } }