peersim.config
Class CheckConfig

java.lang.Object
  extended by peersim.config.CheckConfig

public class CheckConfig
extends java.lang.Object

This is utility tool that checks whether a config file can be loaded or not, without actually performing the simulation. All the error messages generated by controls and protocols when initialized are reported. This is useful to check all the configuration files in a directory.


Parameter Summary
range
          This is the prefix of the config properties whose value vary during a set of experiments.
 
Field Summary
protected static int CDSIM
          CDSimulator
protected static int EDSIM
          EDSimulator
protected static java.lang.String[] simName
          the class names of simulators used
protected static int UNKNOWN
           
 
Constructor Summary
CheckConfig()
           
 
Method Summary
protected static int getSimID()
          Returns the numeric id of the simulator to invoke.
static void main(java.lang.String[] args)
          Loads the configuration and checks the configuration files against simple configuration errors, such as missing classes, missing parameters or syntax errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Parameter Detail

range

This is the prefix of the config properties whose value vary during a set of experiments.

Field Detail

CDSIM

protected static final int CDSIM
CDSimulator

See Also:
Constant Field Values

EDSIM

protected static final int EDSIM
EDSimulator

See Also:
Constant Field Values

UNKNOWN

protected static final int UNKNOWN
See Also:
Constant Field Values

simName

protected static final java.lang.String[] simName
the class names of simulators used

Constructor Detail

CheckConfig

public CheckConfig()
Method Detail

getSimID

protected static int getSimID()
Returns the numeric id of the simulator to invoke. At the moment this can be CDSIM, EDSIM or UNKNOWN.


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Loads the configuration and checks the configuration files against simple configuration errors, such as missing classes, missing parameters or syntax errors.

The goal is to provide a mechanism to test a configuration file, without having to perform the actual simulations (that could be time-consuming) and without necessarily blocking after the first error encountered. It may be useful, for example, when a major refactoring of your code requires a thorough check on all your configuration files.

Loading the configuration is currently done with the help of constructing an instance of ParsedProperties using the constructor ParsedProperties.ParsedProperties(String[]), in the same way as the normal simulator.

After loading the configuration, the collection of nodes forming a Network is instantiated, together with all protocols forming a node. Initialization controls are executed, and then the simulation stops.

For each error encountered, a message is printed ons standard error, and the initialization keeps going without interruption. If multiple errors are present, an error message for each of them is printed. Apart from errors, default choices are also printed as warnings, to allow developers to spot subtle configuration errors such as missing parameters that defaults to standard values.

Parameters:
args - passed on to ParsedProperties.ParsedProperties(String[])
Throws:
java.lang.Exception