public class TrafficGeneratorBuilder
extends java.lang.Object
| Constructor and Description |
|---|
TrafficGeneratorBuilder() |
| Modifier and Type | Method and Description |
|---|---|
void |
configureComponent(ComponentSpecification specification)
Configures the builder to use a component following the provided
specification when the createTrafficGenerator() method is called.
|
void |
configureComponentsFromFile(java.lang.String configurationFile)
If the configurationFile contains a valid specification for a traffic
generator as defined in the ConfigurationParser class, configures the
builder to create the desired component types with the specified
parameters.
|
void |
configureComponentsFromString(java.lang.String configurationString)
If the configurationString contains a valid specification for a traffic
generator as defined in the ConfigurationParser class, configures the
builder to create the desired component types with the specified
parameters.
|
TrafficGenerator |
createTrafficGenerator() |
TrafficGenerator |
createTrafficGenerator(EventDispatcher dispatcher) |
TrafficGenerator |
createTrafficGenerator(EventDispatcher dispatcher,
java.lang.String streamIdentifier) |
ComponentSpecification |
getComponentSpecification(ComponentType type)
Obtains the curretnly configured component specification for the given
type
|
java.lang.String |
getConfigurationString() |
public void configureComponentsFromFile(java.lang.String configurationFile)
throws java.io.FileNotFoundException
configurationFile - the name of a text file containing specification
for how to configure components for a traffic generatorjava.io.FileNotFoundException - if the given file cannot be openedjava.lang.IllegalArgumentException - if the file contains invalid flagspublic void configureComponentsFromString(java.lang.String configurationString)
configurationString - a string containing specifications for how to
configure a traffic generatorjava.lang.IllegalArgumentException - if the string contains invalid flagspublic void configureComponent(ComponentSpecification specification)
specification - a ComponentSpecification indicating how to configure
the componentpublic ComponentSpecification getComponentSpecification(ComponentType type)
type - The type of component previously configured to return.public TrafficGenerator createTrafficGenerator()
java.lang.IllegalArgumentException - if the ComponentType contained in the
ComponentSpecification is an unrecognized type (one which
TrafficGeneratorBuilder is not equipped to handle), or if any of the
parameters contained within the specification are not the correct type of
parameters for the type of component specifiedpublic TrafficGenerator createTrafficGenerator(EventDispatcher dispatcher)
dispatcher - the event dispatcher the newly created traffic
generator will use to send packetsjava.lang.IllegalArgumentException - if the ComponentType contained in the
ComponentSpecification is an unrecognized type (one which
TrafficGeneratorBuilder is not equipped to handle), or if any of the
parameters contained within the specification are not the correct type of
parameters for the type of component specifiedpublic TrafficGenerator createTrafficGenerator(EventDispatcher dispatcher, java.lang.String streamIdentifier)
dispatcher - the event dispatcher the newly created traffic
generator will use to send packetsstreamIdentifier - a string which can be used to identify to which
stream data dispatched from the newly created traffic generator belongsjava.lang.IllegalArgumentException - if the ComponentType contained in the
ComponentSpecification is an unrecognized type (one which
TrafficGeneratorBuilder is not equipped to handle), or if any of the
parameters contained within the specification are not the correct type of
parameters for the type of component specifiedpublic java.lang.String getConfigurationString()