Class TopologyDef


  • public class TopologyDef
    extends Object
    Bean represenation of a topology.

    It consists of the following: 1. The topology name 2. A `java.util.Map` representing the `org.apache.storm.config` for the topology 3. A list of spout definitions 4. A list of bolt definitions 5. A list of stream definitions that define the flow between spouts and bolts.

    • Constructor Detail

      • TopologyDef

        public TopologyDef()
    • Method Detail

      • getName

        public String getName()
      • setName

        public void setName​(String name)
      • setName

        public void setName​(String name,
                            boolean override)
        Sets the name of the topology.
        Parameters:
        name - topology name
        override - whether to override if already set
      • getSpouts

        public List<SpoutDef> getSpouts()
        Returns all spout definitions.
        Returns:
        spout definitions.
      • setSpouts

        public void setSpouts​(List<SpoutDef> spouts)
        Set spout definitions.
        Parameters:
        spouts - spout definitions
      • getBolts

        public List<BoltDef> getBolts()
        Returns bolt definitions.
        Returns:
        bolt definitions
      • setBolts

        public void setBolts​(List<BoltDef> bolts)
        Sets bolt definitions.
        Parameters:
        bolts - bolt definitions
      • setStreams

        public void setStreams​(List<StreamDef> streams)
      • getComponents

        public List<BeanDef> getComponents()
        Returns a list of all component definitions.
        Returns:
        components
      • setComponents

        public void setComponents​(List<BeanDef> components)
        Sets the list of component definitions.
        Parameters:
        components - components definitions
      • setIncludes

        public void setIncludes​(List<IncludeDef> includes)
      • getWorkerHooks

        public List<WorkerHookDef> getWorkerHooks()
        Returns worker hook definitions.
        Returns:
        worker hook definitions
      • setWorkerHooks

        public void setWorkerHooks​(List<WorkerHookDef> workerHooks)
        Sets worker hook definitions.
        Parameters:
        workerHooks - worker hook definitions
      • parallelismForBolt

        public int parallelismForBolt​(String boltId)
      • addAllBolts

        public void addAllBolts​(List<BoltDef> bolts,
                                boolean override)
        Adds a list of bolt definitions. Optionally overriding existing definitions if one with the same ID already exists.
        Parameters:
        bolts - bolt definitions
        override - whether or not to override existing definitions
      • addAllSpouts

        public void addAllSpouts​(List<SpoutDef> spouts,
                                 boolean override)
        Adds a list of spout definitions. Optionally overriding existing definitions if one with the same ID already exists.
        Parameters:
        spouts - spout definitions
        override - whether or not to override existing definitions
      • addAllComponents

        public void addAllComponents​(List<BeanDef> components,
                                     boolean override)
        Adds a list of component definitions. Optionally overriding existing definitions if one with the same ID already exists.
        Parameters:
        components - component definitions
        override - whether or not to override existing definitions
      • addAllStreams

        public void addAllStreams​(List<StreamDef> streams,
                                  boolean override)
        Adds a list of stream definitions. Optionally overriding existing definitions if one with the same ID already exists.
        Parameters:
        streams - stream definitions
        override - whether or not to override existing definitions (currently ignored)
      • addAllWorkerHooks

        public void addAllWorkerHooks​(List<WorkerHookDef> workerHooks,
                                      boolean override)
        Adds a list of worker hook definitions. Optionally overriding existing definitions if one with the same ID already exists.
        Parameters:
        workerHooks - worker hook definitions
        override - whether or not to override existing definitions
      • setTopologySource

        public void setTopologySource​(TopologySourceDef topologySource)
      • isDslTopology

        public boolean isDslTopology()
      • validate

        public boolean validate()
        Determines is this represents a valid Topology.
        Returns:
        true if valid