planet.generic.commonapi
Class GenericApp

java.lang.Object
  extended byplanet.generic.commonapi.GenericApp
Direct Known Subclasses:
BroadcastTest, ChordDHT, DHTPeerTest, ScribePeerTest, TestAppFactory, TestEndPointFactory, TestIdFactory, TestNetFactory, TestNodeFactory, TestNodeHandleFactory, TestPool

public class GenericApp
extends java.lang.Object

This class only attemps to help to programmers make more simple the initialization of the required context of new applications. Are two ways to initialize the context:

One
The new application must extends this GenericApp and includes in theirs constructors the sentence super() or super(factoriesProperties,simProperties,chordProperties). For example:

 public NewTest() throws InitializationException {
     super(factoriesProperties,simProperties,chordProperties);
 
where parameters of super() constructor are the path to specified files.

Two
Includes theese lines before anything that make reference to the network and the simulator and ...
 Properties.init(factoriesProperties,simProperties,chordProperties);
 GenericFactory.init();
 
where parameters of init() method are the path to specified files.

Author:
Jordi Pujol

Constructor Summary
GenericApp()
          Make required initialization on the context of the application.
GenericApp(java.lang.String factoriesProperties, java.lang.String simProperties, java.lang.String chordProperties)
          Make required initialization on the context of the application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericApp

public GenericApp()
           throws InitializationException
Make required initialization on the context of the application. In concrete:
 Properties.init("../conf/factories.properties","../conf/sim.properties","../conf/chord.properties");
 GenericFactory.init();
 
Because of theese lines, the new application must be executed under bin directory.

Throws:
InitializationException - if any error has occurred during initialization of the context.

GenericApp

public GenericApp(java.lang.String factoriesProperties,
                  java.lang.String simProperties,
                  java.lang.String chordProperties)
           throws InitializationException
Make required initialization on the context of the application. In concrete:
 Properties.init(factoriesProperties,simProperties,chordProperties);
 GenericFactory.init();
 
Because of theese lines, the new application must be executed under the implicitly specified directory by the parameters files.

Parameters:
factoriesProperties - Path to properties file of factories attributes.
simProperties - Path to properties file of simulator attributes.
chordProperties - Path to properties file of chord attributes.
Throws:
InitializationException - if any error has occurred during initialization of the context.