Package com.yahoo.messagebus.routing
Class RoutingSpec
- java.lang.Object
-
- com.yahoo.messagebus.routing.RoutingSpec
-
public class RoutingSpec extends java.lang.Object
Along with theRoutingTableSpec
,RouteSpec
andHopSpec
, 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 Summary
Constructors Constructor Description RoutingSpec()
Creates an empty specification.RoutingSpec(boolean verify)
Creates an empty specification.RoutingSpec(RoutingSpec spec)
Implements the copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RoutingSpec
addTable(RoutingTableSpec table)
Adds a routing table spec to the list of tables.RoutingSpec
clearTables()
Clears the list of routing table specs contained in this.boolean
equals(java.lang.Object obj)
int
getNumTables()
Returns the number of routing table specs that are contained in this.RoutingTableSpec
getTable(int i)
Returns the routing table spec at the given index.int
hashCode()
boolean
hasTables()
Returns whether or not there are routing table specs contained in this.RoutingTableSpec
removeTable(int i)
Returns the routing table spec at the given index.RoutingSpec
setTable(int i, RoutingTableSpec table)
Sets the routing table spec at the given index.void
toConfig(java.lang.StringBuilder cfg, java.lang.String prefix)
Appends the content of this to the given config string builder.java.lang.String
toString()
boolean
verify(ApplicationSpec app, java.util.List<java.lang.String> errors)
Verifies the content of this against the given application.
-
-
-
Constructor Detail
-
RoutingSpec
public RoutingSpec()
Creates an empty specification.
-
RoutingSpec
public RoutingSpec(boolean verify)
Creates an empty specification.- Parameters:
verify
- Whether or not this should be verified.
-
RoutingSpec
public RoutingSpec(RoutingSpec spec)
Implements the copy constructor.- Parameters:
spec
- the spec to copy.
-
-
Method Detail
-
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, java.util.List<java.lang.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(java.lang.StringBuilder cfg, java.lang.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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-