Package backtype.storm.generated

Examples of backtype.storm.generated.ComponentCommon


      return rtn;
  }

  static void add_component_system_streams(Object obj)
  {
      ComponentCommon common=null;
      if (obj instanceof StateSpoutSpec) {
          StateSpoutSpec spec = (StateSpoutSpec) obj;
          common=spec.get_common();
      }
 
      if (obj instanceof SpoutSpec) {
          SpoutSpec spec = (SpoutSpec) obj;
          common=spec.get_common();
      }
     
      if (obj instanceof Bolt) {
          Bolt spec = (Bolt) obj;
          common=spec.get_common();
      }
     
      if(common!=null)
      {
          StreamInfo sinfo=Thrift.outputFields(sysEventFields);
          common.put_to_streams(SYSTEM_STREAM_ID,sinfo);
      }
  }
View Full Code Here


    }
   
    public int maxTopologyMessageTimeout() {
        Integer max = Utils.getInt(_stormConf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS));
        for(String spout: getRawTopology().get_spouts().keySet()) {
            ComponentCommon common = getComponentCommon(spout);
            String jsonConf = common.get_json_conf();
            if(jsonConf!=null) {
                Map conf = (Map) JSONValue.parse(jsonConf);
                Object comp = conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS);
                if(comp!=null) {
                    max = Math.max(Utils.getInt(comp), max);
View Full Code Here

    public StormTopology createTopology() {
        Map<String, Bolt> boltSpecs = new HashMap<String, Bolt>();
        Map<String, SpoutSpec> spoutSpecs = new HashMap<String, SpoutSpec>();
        for(String boltId: _bolts.keySet()) {
            IRichBolt bolt = _bolts.get(boltId);
            ComponentCommon common = getComponentCommon(boltId, bolt);
            boltSpecs.put(boltId, new Bolt(ComponentObject.serialized_java(Utils.serialize(bolt)), common));
        }
        for(String spoutId: _spouts.keySet()) {
            IRichSpout spout = _spouts.get(spoutId);
            ComponentCommon common = getComponentCommon(spoutId, spout);
            spoutSpecs.put(spoutId, new SpoutSpec(ComponentObject.serialized_java(Utils.serialize(spout)), common));
           
        }
        return new StormTopology(spoutSpecs,
                                 boltSpecs,
View Full Code Here

            throw new IllegalArgumentException("State spout has already been declared for id " + id);
        }
    }

    private ComponentCommon getComponentCommon(String id, IComponent component) {
        ComponentCommon ret = new ComponentCommon(_commons.get(id));
       
        OutputFieldsGetter getter = new OutputFieldsGetter();
        component.declareOutputFields(getter);
        ret.set_streams(getter.getFieldsDeclaration());
        return ret;       
    }
View Full Code Here

        ret.set_streams(getter.getFieldsDeclaration());
        return ret;       
    }
   
    private void initCommon(String id, IComponent component, Number parallelism) {
        ComponentCommon common = new ComponentCommon();
        common.set_inputs(new HashMap<GlobalStreamId, Grouping>());
        if(parallelism!=null) common.set_parallelism_hint(parallelism.intValue());
        Map conf = component.getComponentConfiguration();
        if(conf!=null) common.set_json_conf(JSONValue.toJSONString(conf));
        _commons.put(id, common);
    }
View Full Code Here

            List<String> componentNames = new ArrayList<String>(topology.get_spouts().keySet());
            componentNames.addAll(topology.get_bolts().keySet());
            componentNames.addAll(topology.get_state_spouts().keySet());

            for(String name: componentNames) {
                ComponentCommon common = Utils.getComponentCommon(topology, name);
                List<String> streams = new ArrayList<String>(common.get_streams().keySet());
                streamNametoId.put(name, idify(streams));
                streamIdToName.put(name, Utils.reverseMap(streamNametoId.get(name)));
            }
        }
View Full Code Here

    Set<String> cids = ThriftTopologyUtils.getComponentIds(topology);
    for (Iterator it = cids.iterator(); it.hasNext();) {
      String componentId = (String) it.next();

      ComponentCommon common = ThriftTopologyUtils.getComponentCommon(
          topology, componentId);
      String json = common.get_json_conf();
      if (json == null) {
        continue;
      }
      Map mtmp = (Map) JStormUtils.from_json(json);
      if (mtmp == null) {
View Full Code Here

    Map<String, Object> components = ThriftTopologyUtils.getComponents(ret);
    for (Entry<String, Object> entry : components.entrySet()) {
      Object component = entry.getValue();
      String componentName = entry.getKey();

      ComponentCommon common = null;
      if (component instanceof Bolt) {
        common = ((Bolt) component).get_common();
        if (fromConf) {
          Integer paraNum = ConfigExtension.getBoltParallelism(stormConf, componentName);
          if (paraNum != null) common.set_parallelism_hint(paraNum);
        }
      }
      if (component instanceof SpoutSpec) {
        common = ((SpoutSpec) component).get_common();
        if (fromConf) {
          Integer paraNum = ConfigExtension.getSpoutParallelism(stormConf, componentName);
          if (paraNum != null) common.set_parallelism_hint(paraNum);
        }
      }
      if (component instanceof StateSpoutSpec) {
        common = ((StateSpoutSpec) component).get_common();
        if (fromConf) {
          Integer paraNum = ConfigExtension.getSpoutParallelism(stormConf, componentName);
          if (paraNum != null) common.set_parallelism_hint(paraNum);
        }
      }

      Map componentMap = new HashMap();

      String jsonConfString = common.get_json_conf();
      if (jsonConfString != null) {
        componentMap
            .putAll((Map) JStormUtils.from_json(jsonConfString));
      }

      Integer taskNum = componentParalism(stormConf, common);

      componentMap.put(Config.TOPOLOGY_TASKS, taskNum);
      // change the executor's task number
      common.set_parallelism_hint(taskNum);
      LOG.info("Set " + componentName + " parallelism " + taskNum);

      common.set_json_conf(JStormUtils.to_json(componentMap));
    }

    return ret;
  }
View Full Code Here

  }

  private static ComponentCommon mkAckerComponentcommon(
      Map<GlobalStreamId, Grouping> inputs,
      HashMap<String, StreamInfo> output_spec, Integer parallelism_hint) {
    ComponentCommon ret = new ComponentCommon(inputs, output_spec);
    if (parallelism_hint != null) {
      ret.set_parallelism_hint(parallelism_hint);
    }
    return ret;
  }
View Full Code Here

    return ret;
  }

  public static Bolt mkAckerBolt(Map<GlobalStreamId, Grouping> inputs,
      IBolt bolt, HashMap<String, StreamInfo> output, Integer p) {
    ComponentCommon common = mkAckerComponentcommon(inputs, output, p);
    byte[] boltSer = Utils.serialize(bolt);
    ComponentObject component = ComponentObject.serialized_java(boltSer);
    return new Bolt(component, common);
  }
View Full Code Here

TOP

Related Classes of backtype.storm.generated.ComponentCommon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.