Class RouteSpec

java.lang.Object
com.yahoo.messagebus.routing.RouteSpec

public class RouteSpec extends Object
Along with the RoutingSpec, RoutingTableSpec and HopSpec, this holds the routing specifications for all protocols. The only way a client can configure or alter the settings of a message bus instance is through these classes.

This class contains the spec for a single route.

Author:
Simon Thoresen Hult
  • Constructor Details

    • RouteSpec

      public RouteSpec(String name)
      Creates a new named route specification.
      Parameters:
      name - A protocol-unique name for this route.
    • RouteSpec

      public RouteSpec(String name, boolean verify)
      Creates a new named route specification.
      Parameters:
      name - A protocol-unique name for this route.
      verify - Whether or not this should be verified.
    • RouteSpec

      public RouteSpec(RouteSpec obj)
      Implements the copy constructor.
      Parameters:
      obj - The object to copy.
  • Method Details

    • getName

      public String getName()
      Returns the protocol-unique name of this route.
      Returns:
      The name.
    • getHop

      public String getHop(int i)
      Returns the hop name at the given index.
      Parameters:
      i - The index of the hop to return.
      Returns:
      The hop at the given index.
    • hasHops

      public boolean hasHops()
      Returns whether or not there are any hops in this route.
      Returns:
      True if there is at least one hop.
    • getNumHops

      public int getNumHops()
      Returns the number of hops that make up this route.
      Returns:
      The number of hops.
    • addHop

      public RouteSpec addHop(String hop)
      Adds the given hop name to this.
      Parameters:
      hop - The hop to add.
      Returns:
      This, to allow chaining.
    • addHops

      public RouteSpec addHops(List<String> hops)
      Adds the given hop names to this.
      Parameters:
      hops - The hops to add.
      Returns:
      This, to allow chaining.
    • setHop

      public RouteSpec setHop(int i, String hop)
      Sets the hop name for a given index.
      Parameters:
      i - The index of the hop to set.
      hop - The hop to set.
      Returns:
      This, to allow chaining.
    • removeHop

      public String removeHop(int i)
      Removes the hop name at the given index.
      Parameters:
      i - The index of the hop to remove.
      Returns:
      The removed hop.
    • clearHops

      public RouteSpec clearHops()
      Clears the list of hops that make up this route.
      Returns:
      This, to allow chaining.
    • verify

      public boolean verify(ApplicationSpec app, RoutingTableSpec table, List<String> errors)
      Verifies the content of this against the given application.
      Parameters:
      app - The application to verify against.
      table - The routing table to verify against.
      errors - The list of errors found.
      Returns:
      True if no errors where found.
    • toConfig

      public void toConfig(StringBuilder cfg, String prefix)
      Appends the content of this to the given config string builder.
      Parameters:
      cfg - The config to add to.
      prefix - The prefix to use for each add.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object