|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.generic.commonapi.GenericApp
This class only attemps to help to programmers make more simple the initialization of the
simulator context. There are two ways to initialize the context:
One
The new main application has to extend this GenericApp and includes in theirs constructors the
sentence super(...) with the desired arguments.
For example:
....
public NewTest() throws InitializationException {
super("../conf/master2.properties","TEST_ONE",false,false,false,false);
....
See the constructor description for more details on the arguments.
Two
To include at first these lines (before any other simulator related statement):
//FIRST: complete Properties initialization
Properties.init(masterPropertiesFile, masterPropertyName);
if (activateApplicationLevel)
Properties.activateApplicationLevelAttributes();
if (activateEvents)
Properties.activateEventsAttributes();
if (activateResults)
Properties.activateResultsAttributes();
if (activateSerialization)
Properties.activateSerializationAttributes();
//SECOND: GenericFactory initialization
GenericFactory.init();
//THIRD: making postinitialization
Properties.postinit();
GenericFactory.postinit();
where the masterPropertiesFile is the main cofiguration file,
with the desired properties filename with the current configuration, and
masterPropertyName is the key to load the configuration and
runs the current test.
Constructor Summary | |
GenericApp(java.lang.String masterPropertyName,
boolean activateApplicationLevel,
boolean activateEvents,
boolean activateResults,
boolean activateSerialization)
Make the complete initialization of the simulator context, according to the arguments. |
|
GenericApp(java.lang.String masterPropertiesFile,
java.lang.String masterPropertyName,
boolean activateApplicationLevel,
boolean activateEvents,
boolean activateResults,
boolean activateSerialization)
Make the complete initialization of the simulator context, according to the arguments. |
Method Summary | |
static void |
printNetwork(Network network)
Using the attribute planet.util.Properties.simulatorPrintLevel prints out (or not) the whole network. |
static void |
restart(boolean activateApplicationLevel,
boolean activateEvents,
boolean activateResults,
boolean activateSerialization)
Make an update of the current simulator context using the actual configuration into the planet.util.Properties. |
static void |
start(java.lang.String masterPropertiesFile,
java.lang.String masterPropertyName,
boolean activateApplicationLevel,
boolean activateEvents,
boolean activateResults,
boolean activateSerialization)
Make the complete initialization of the simulator context, according to the arguments. |
static java.lang.String |
timeElapsedInSeconds(long firstTime,
long lastTime)
Shows in Y.XXX string format, the seconds elapsed between firstTime and lastTime, where 'Y' are the seconds, and 'XXX' the milliseconds ones. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GenericApp(java.lang.String masterPropertiesFile, java.lang.String masterPropertyName, boolean activateApplicationLevel, boolean activateEvents, boolean activateResults, boolean activateSerialization) throws InitializationException
//FIRST: complete Properties initialization Properties.init(masterPropertiesFile); if (activateApplicationLevel) Properties.activateApplicationLevelAttributes(); if (activateEvents) Properties.activateEventsAttributes(); if (activateResults) Properties.activateResultsAttributes(); if (activateSerialization) Properties.activateSerializationAttributes(); //SECOND: GenericFactory initialization GenericFactory.init(); //THIRD: making postinitialization Properties.postinit(); GenericFactory.postinit();Depending on the masterPropertiesFile specification, you must select the correct directory to run the main application.
masterPropertiesFile
- The intermediate file necessary to load
the required configuration attributes to run the current test.masterPropertyName
- The key that have to appear in the
masterPropertiesFile which identifies the last file with
current configuration.activateApplicationLevel
- Flag that shows when to load
specific application level attributes for the current test.activateEvents
- Flag that shows when to load
specific events attributes for the current test.activateResults
- Flag that shows when to load
specific results attributes for the current test.activateSerialization
- Flag that shows when to load
specific serialization attributes for the current test.
InitializationException
- if any error has occurred during
initialization of the simulator context.public GenericApp(java.lang.String masterPropertyName, boolean activateApplicationLevel, boolean activateEvents, boolean activateResults, boolean activateSerialization) throws InitializationException
//FIRST: complete Properties initialization Properties.init("../conf/master.properties"); if (activateApplicationLevel) Properties.activateApplicationLevelAttributes(); if (activateEvents) Properties.activateEventsAttributes(); if (activateResults) Properties.activateResultsAttributes(); if (activateSerialization) Properties.activateSerializationAttributes(); //SECOND: GenericFactory initialization GenericFactory.init(); //THIRD: making postinitialization Properties.postinit(); GenericFactory.postinit();According to the master properties file path, you must run the main application into the bin directory of this distribution.
masterPropertyName
- The key that have to appear in the
masterPropertiesFile which identifies the last file with
current configuration.activateApplicationLevel
- Flag that shows when to load
specific application level attributes for the current test.activateEvents
- Flag that shows when to load
specific events attributes for the current test.activateResults
- Flag that shows when to load
specific results attributes for the current test.activateSerialization
- Flag that shows when to load
specific serialization attributes for the current test.
InitializationException
- if any error has occurred during
initialization of the simulator context.Method Detail |
public static void start(java.lang.String masterPropertiesFile, java.lang.String masterPropertyName, boolean activateApplicationLevel, boolean activateEvents, boolean activateResults, boolean activateSerialization) throws InitializationException
//FIRST: complete Properties initialization Properties.init(masterPropertiesFile,masterPropertyName); if (activateApplicationLevel) Properties.activateApplicationLevelAttributes(); if (activateEvents) Properties.activateEventsAttributes(); if (activateResults) Properties.activateResultsAttributes(); if (activateSerialization) Properties.activateSerializationAttributes(); //SECOND: GenericFactory initialization GenericFactory.init(); //THIRD: making postinitialization Properties.postinit(); GenericFactory.postinit();Depending on the masterPropertiesFile specification, you must select the correct directory to run the main application.
masterPropertiesFile
- The intermediate file necessary to load
the required configuration attributes to run the current test.masterPropertyName
- The key that have to appear in the
masterPropertiesFile which identifies the last file with
current configuration.activateApplicationLevel
- Flag that shows when to load
specific application level attributes for the current test.activateEvents
- Flag that shows when to load
specific events attributes for the current test.activateResults
- Flag that shows when to load
specific results attributes for the current test.activateSerialization
- Flag that shows when to load
specific serialization attributes for the current test.
InitializationException
- if any error has occurred during
initialization of the simulator context.public static void restart(boolean activateApplicationLevel, boolean activateEvents, boolean activateResults, boolean activateSerialization) throws InitializationException
if (activateApplicationLevel) Properties.activateApplicationLevelAttributes(); if (activateEvents) Properties.activateEventsAttributes(); if (activateResults) Properties.activateResultsAttributes(); if (activateSerialization) Properties.activateSerializationAttributes(); GenericFactory.init(); Properties.postinit(); GenericFactory.postinit();
activateApplicationLevel
- Flag that shows when to load
specific application level attributes for the current test.activateEvents
- Flag that shows when to load
specific events attributes for the current test.activateResults
- Flag that shows when to load
specific results attributes for the current test.activateSerialization
- Flag that shows when to load
specific serialization attributes for the current test.
InitializationException
- if any error has occurred during
initialization of the simulator context.public static void printNetwork(Network network)
network
- The network to print out.public static java.lang.String timeElapsedInSeconds(long firstTime, long lastTime)
firstTime
- First logged time.lastTime
- Second logged time.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |