private ScenarioManager createScenarioManager ( Class < ? extends Scenario > scenarioClass , String scenarioID , String initialState , Properties properties ) throws ShanksException { // throws UnsupportedNetworkElementFieldException, // TooManyConnectionException, UnsupportedScenarioStatusException, // DuplicatedIDException, SecurityException, NoSuchMethodException, // IllegalArgumentException, InstantiationException, // IllegalAccessException, InvocationTargetException, // DuplicatedPortrayalIDException, ScenarioNotFoundException { Constructor < ? extends Scenario > c ; Scenario s = null ; try { c = scenarioClass . getConstructor ( new Class [ ] { String . class , String . class , Properties . class , Logger . class } ) ; s = c . newInstance ( scenarioID , initialState , properties , this . getLogger ( ) ) ; } catch ( SecurityException e ) { throw new ShanksException ( e ) ; } catch ( NoSuchMethodException e ) { throw new ShanksException ( e ) ; } catch ( IllegalArgumentException e ) { throw new ShanksException ( e ) ; } catch ( InstantiationException e ) { throw new ShanksException ( e ) ; } catch ( IllegalAccessException e ) { throw new ShanksException ( e ) ; } catch ( InvocationTargetException e ) { throw new ShanksException ( e ) ; } logger . fine ( "Scenario created" ) ; ScenarioPortrayal sp = s . createScenarioPortrayal ( ) ; if ( sp == null && ! properties . get ( Scenario . SIMULATION_GUI ) . equals ( Scenario . NO_GUI ) ) { logger . severe ( "ScenarioPortrayals is null" ) ; logger . severe ( "Impossible to follow with the execution..." ) ; throw new ShanksException ( "ScenarioPortrayals is null. Impossible to continue with the simulation..." ) ; } ScenarioManager sm = new ScenarioManager ( s , sp , logger ) ; return sm ; }
This method will set all required information about Scenario