📄 properties.java
字号:
package planet.util;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.Vector;
import planet.commonapi.exception.InitializationException;
/**
* This class loads all mandatory attributes of the specified properties file.
* The loading process follows these steps:
* <ol type="1">
* <li><b>Open the specified master properties file.</b> This file contains the
* filename with the required attributes for the current simulation, under
* certain <b>master key</B>.</li>
* <li><b>Open the current properties file.</b> Opens the properties file
* in a normal serialization (no XML) and loads all mandatory attributes and
* these followings optional parts:
* <ul>
* <li><b>Behaviours</b> properties when the OVERLAY_WITH_BEHAVIOURS attribute
* is true.</li>
* <li><b>Serialization</b> properties when the FACTORIES_NETWORKTOPOLOGY
* attribute has the <b>serialized</b> value.</li>
* </ul>
* </li>
* </ol>
* Any other part must be explicitly activated with the related methods
* wich starts their names with <b>activate...()</b>.
* @author <a href="jordi.pujol@estudiants.urv.es">Jordi Pujol</a>
* @author <a href="marc.sanchez@urv.net">Marc Sanchez</a>
* 30-jun-2005
*/
public class Properties {
/* ************************** FACTORIES PROPERTIES NAMES ******************/
/* REQUIRED ATTRIBUTES */
/* Factories: */
/**
* Factories property: The default NetworkFactory key specified in the properties file.
*/
public static final String FACTORIES_NETWORKFACTORY = "FACTORIES_NETWORKFACTORY";
/**
* Factories property: The default IdFactory key specified in the properties file.
*/
public static final String FACTORIES_IDFACTORY = "FACTORIES_IDFACTORY";
/**
* Factories property: The default NodeHandleFactory key specified in the properties file.
*/
public static final String FACTORIES_NODEHANDLEFACTORY = "FACTORIES_NODEHANDLEFACTORY";
/**
* Factories property: The default NodeFactory key specified in the properties file.
*/
public static final String FACTORIES_NODEFACTORY = "FACTORIES_NODEFACTORY";
/**
* Factories property: The default RouteMessagePool key specified in the properties file.
*/
public static final String FACTORIES_ROUTEMESSAGEPOOL = "FACTORIES_ROUTEMESSAGEPOOL";
/* Specific classes: */
/**
* Factories property: Default key specified in the properties file that
* identifies implementation class for Network interface.
*/
public static final String FACTORIES_NETWORK = "FACTORIES_NETWORK";
/**
* Factories property: Default key specified in the properties file that
* identifies implementation class for NodeHandle interface.
*/
public static final String FACTORIES_NODEHANDLE = "FACTORIES_NODEHANDLE";
/**
* Factories property: Default key specified in the properties file that
* identifies implementation class for RouteMessage interface.
*/
public static final String FACTORIES_ROUTEMESSAGE = "FACTORIES_ROUTEMESSAGE";
/**
* Factories property: Default key specified in the properties file that
* identifies the network topology.
*/
public static final String FACTORIES_NETWORKTOPOLOGY = "FACTORIES_NETWORKTOPOLOGY";
/**
* Factories property: Default key specified in the properties file that
* identifies the network size.
*/
public static final String FACTORIES_NETWORKSIZE = "FACTORIES_NETWORKSIZE";
/* OPTIONAL ATTRIBUTES */
/* Factories: */
/**
* Factories property: The default ApplicationFactory key specified in the properties file.
*/
public static final String FACTORIES_APPLICATIONFACTORY = "FACTORIES_APPLICATIONFACTORY";
/**
* Factories property: The default EndPointFactory key specified in the properties file.
*/
public static final String FACTORIES_ENDPOINTFACTORY = "FACTORIES_ENDPOINTFACTORY";
/* Specific classes: */
/**
* Factories property: Default key specified in the properties file that
* identifies implementation class for Application interface.
*/
public static final String FACTORIES_APPLICATION = "FACTORIES_APPLICATION";
/**
* Factories property: Default key specified in the properties file that
* identifies implementation class for EndPoint interface.
*/
public static final String FACTORIES_ENDPOINT = "FACTORIES_ENDPOINT";
/* *********************** SIMULATOR PROPERTIES NAMES ***********************/
/* REQUIRED */
/**
* Simulator property: Default key specified in the properties file that
* identifies the number of stabilization steps for any node at join or leave.
*/
public static final String SIMULATOR_SIMULATION_STEPS = "SIMULATOR_SIMULATION_STEPS";
/**
* Simulator property: Default key specified in the properties file that
* identifies the log level.
*/
public static final String SIMULATOR_LOG_LEVEL = "SIMULATOR_LOG_LEVEL";
/**
* Simulator property: Default key specified in the properties file that
* identifies the print level for whole network.
*/
public static final String SIMULATOR_PRINT_LEVEL = "SIMULATOR_PRINT_LEVEL";
/**
* Simulator property: Default key specified in the properties file that
* identifies the environment for the current simulation.
*/
public static final String SIMULATOR_ENVIRONMENT = "SIMULATOR_ENVIRONMENT";
/**
* Simulator property: Default key specified in the properties file that
* identifies the queue size.
*/
public static final String SIMULATOR_QUEUE_SIZE = "SIMULATOR_QUEUE_SIZE";
/**
* Simulator property: Default key specified in the properties file that
* identifies the message processing.
*/
public static final String SIMULATOR_PROCESSED_MESSAGES = "SIMULATOR_PROCESSED_MESSAGES";
/* OPTIONAL */
/**
* Simulator property: Default key specified in the properties file that
* identifies the events filename to load.
*/
public static final String SIMULATOR_EVENT_FILE = "SIMULATOR_EVENT_FILE";
/* *********************** SERIALIZATION PROPERTIES NAMES ***********************/
/* Test dependant: All these attributes are optionals */
/**
* Serialization property: Default key specified in the properties file
* that identifies serialized file that contains the network to be loaded.
*/
public static final String SERIALIZATION_INPUT_FILE = "SERIALIZATION_INPUT_FILE";
/**
* Serialization property: Default key specified in the properties file
* that identifies filename to which serialize the final state.
*/
public static final String SERIALIZATION_OUTPUT_FILE = "SERIALIZATION_OUTPUT_FILE";
/**
* Serialization property: Default key specified in the properties file
* that identifies if the output file must be replaced with new outputs.
*/
public static final String SERIALIZATION_REPLACE_OUTPUT_FILE = "SERIALIZATION_REPLACE_OUTPUT_FILE";
/* *********************** BEHAVIOURS PROPERTIES NAMES ***********************/
/* Overlay dependant: All these attributes are optionals */
/**
* Behaviours property: Default key specified in the properties file that
* identifies implementation class for BehaviourFactory interface.
*/
public static final String BEHAVIOURS_FACTORY = "BEHAVIOURS_FACTORY";
/**
* Behaviours property: Default key specified in the properties file that
* identifies implementation class for BehaviourPool interface.
*/
public static final String BEHAVIOURS_POOL = "BEHAVIOURS_POOL";
/**
* Behaviours property: Default key specified in the properties file that
* identifies implementation class for BehaviourRoleSelector interface.
*/
public static final String BEHAVIOURS_ROLESELECTOR = "BEHAVIOURS_ROLESELECTOR";
/**
* Behaviours property: Default key specified in the properties file that
* identifies implementation class for BehaviourInvoker interface.
*/
public static final String BEHAVIOURS_INVOKER = "BEHAVIOURS_INVOKER";
/**
* Behaviours property: Default key specified in the properties file that
* identifies implementation class for BehaviourFilter interface.
*/
public static final String BEHAVIOURS_FILTER = "BEHAVIOURS_FILTER";
/**
* Behaviours property: Default key specified in the properties file that
* identifies implementation class for BehaviourPattern interface.
*/
public static final String BEHAVIOURS_PATTERN = "BEHAVIOURS_PATTERN";
/**
* Behaviours property: Default key specified in the properties file that
* identifies implementation class for PropertiesInitializer interface.
*/
public static final String BEHAVIOURS_PROPERTIES = "BEHAVIOURS_PROPERTIES";
/**
* Behaviours property: Default key specified in the properties file that
* identifies the number of message types used in the current overlay.
*/
public static final String BEHAVIOURS_NUMBEROFTYPES = "BEHAVIOURS_NUMBEROFTYPES";
/**
* Behaviours property: Default key specified in the properties file that
* identifies the number of message modes used in the current overlay.
*/
public static final String BEHAVIOURS_NUMBEROFMODES = "BEHAVIOURS_NUMBEROFMODES";
/* *********************** OVERLAY PROPERTIES NAMES ***********************/
/* Required: */
/**
* Overlay property: Default key specified in the properties file that
* identifies implementation class for Id interface.
*/
public static final String OVERLAY_ID = "OVERLAY_ID";
/**
* Overlay property: Default key specified in the properties file that
* identifies implementation class for Node interface.
*/
public static final String OVERLAY_NODE = "OVERLAY_NODE";
/**
* Overlay property: Default key specified in the properties file that
* identifies implementation class for OverlayProperties interface.
*/
public static final String OVERLAY_PROPERTIES = "OVERLAY_PROPERTIES";
/**
* Overlay property: Default key specified in the properties file that
* identifies if this overlay implementation uses behaviours.
*/
public static final String OVERLAY_WITH_BEHAVIOURS = "OVERLAY_WITH_BEHAVIOURS";
/* *********************** RESULTS PROPERTIES NAMES ***********************/
/* Test dependant: All these attributes are optionals */
/**
* Results property: Default key specified in the properties file that
* identifies implementation class for ResultsFactory interface.
*/
public static final String RESULTS_FACTORY ="RESULTS_FACTORY";
/**
* Results property: Default key specified in the properties file that
* identifies implementation class for ResultsEdge interface.
*/
public static final String RESULTS_EDGE ="RESULTS_EDGE";
/**
* Results property: Default key specified in the properties file that
* identifies implementation class for ResultsConstraint interface.
*/
public static final String RESULTS_CONSTRAINT ="RESULTS_CONSTRAINT";
/**
* Results property: Default key specified in the properties file that
* identifies implementation class for ResultsGenerator interface.
*/
public static final String RESULTS_GENERATOR ="RESULTS_GENERATOR";
/**
* Results property: Default key specified in the properties file that
* identifies implementation class for PropertiesInitializer interface.
*/
public static final String RESULTS_PROPERTIES ="RESULTS_PROPERTIES";
/**
* Results property: Default key specified in the properties file that
* identifies the unique names for results types.
*/
public static final String RESULTS_UNIQUE_NAME ="RESULTS_UNIQUE_NAME";
////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* ************************** FACTORIES PROPERTIES ********************/
/* REQUIRED ATTRIBUTES */
/* Factories: */
/**
* Factories property: The NetworkFactory implementation to use in current simulation.
*/
public static Class factoriesNetworkFactory = null;
/**
* Factories property: The IdFactory implementation to use in current simulation.
*/
public static Class factoriesIdFactory = null;
/**
* Factories property: The NodeHandleFactory implementation to use in current simulation.
*/
public static Class factoriesNodeHandleFactory = null;
/**
* Factories property: The NodeFactory implementation to use in current simulation.
*/
public static Class factoriesNodeFactory = null;
/**
* Factories property: The RouteMessagePool implementation to use in current simulation.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -