Class RoutingSpec

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

public class RoutingSpec extends Object
Along with the RoutingTableSpec, RouteSpec 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 is the root spec class for configuring message bus routing.

Author:
Simon Thoresen Hult
  • Constructor Details

    • RoutingSpec

      public RoutingSpec()
      Creates an empty specification.
    • RoutingSpec

      public RoutingSpec(boolean verify)
      Creates an empty specification.
      Parameters:
      verify - Whether this should be verified.
    • RoutingSpec

      public RoutingSpec(RoutingSpec spec)
      Implements the copy constructor.
      Parameters:
      spec - the spec to copy.
  • Method Details

    • hasTables

      public boolean hasTables()
      Returns whether or not there are routing table specs contained in this.
      Returns:
      True if there is at least one table.
    • getNumTables

      public int getNumTables()
      Returns the number of routing table specs that are contained in this.
      Returns:
      The number of routing tables.
    • getTable

      public RoutingTableSpec getTable(int i)
      Returns the routing table spec at the given index.
      Parameters:
      i - The index of the routing table to return.
      Returns:
      The routing table at the given index.
    • setTable

      public RoutingSpec setTable(int i, RoutingTableSpec table)
      Sets the routing table spec at the given index.
      Parameters:
      i - The index at which to set the routing table.
      table - The routing table to set.
      Returns:
      This, to allow chaining.
    • addTable

      public RoutingSpec addTable(RoutingTableSpec table)
      Adds a routing table spec to the list of tables.
      Parameters:
      table - The routing table to add.
      Returns:
      This, to allow chaining.
    • removeTable

      public RoutingTableSpec removeTable(int i)
      Returns the routing table spec at the given index.
      Parameters:
      i - The index of the routing table to remove.
      Returns:
      The removed routing table.
    • clearTables

      public RoutingSpec clearTables()
      Clears the list of routing table specs contained in this.
      Returns:
      This, to allow chaining.
    • verify

      public boolean verify(ApplicationSpec app, List<String> errors)
      Verifies the content of this against the given application.
      Parameters:
      app - The application 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