edu.rit.m2mp
Class M2MPProperties

java.lang.Object
  extended by edu.rit.m2mp.M2MPProperties

public class M2MPProperties
extends Object

Class M2MPProperties provides access to properties that are used to configure the M2MP Layer. In addition to the M2MP properties below, the device properties must also be specified. See class DeviceProperties for further information. The M2MP Layer properties are as follows:

To get the value of a given property, the M2MP Layer first searches for the property name in the Java system properties by calling System.getProperty(). If not found there, the M2MP Layer searches for the property name in the M2MP properties file (see below). If not found there, the M2MP Layer throws an exception to indicate the property cannot be found. Thus, property values specified with the -D option on the java command line override property values in the M2MP properties file.

To find the M2MP properties file, the M2MP Layer searches for the following files, in order, stopping as soon as it finds one:

If the M2MP properties file cannot be found, the M2MP Layer thows an exception.

The M2MP properties file obeys the format specified in class java.util.Properties.

To run the M2MP Layer, all the properties listed above (other than edu.rit.m2mp.properties) must be defined, either as system properties, or in the M2MP properties file. There are no default values. Also, all the device properties must be defined, either as system properties, or in the device properties file; see class DeviceProperties for further information.

Here is an example of an M2MP properties file. A copy of this file is included in the M2MP Library (m2mp.properties).

 # M2MP Properties File
 
 # Message timeout, milliseconds (decimal integer > 0)
 edu.rit.m2mp.messagetimeout = 5000
 
 # Flow control timeout, milliseconds (decimal integer > 0)
 edu.rit.m2mp.flowtimeout = 100

 # Packet redundancy (decimal integer > 0)
 edu.rit.m2mp.redundancy = 2
 
 # ReceiverThread debug level (integer)
 # 0 = Don't print
 # 1 = Print exception stack traces
 # 2 = Print exception stack traces and debug messages
 edu.rit.m2mp.debug.ReceiverThread = 0
 
 # Packet debug level (integer)
 # 0 = Don't print
 # 1 = Print packet arrivals and departures
 # 2 = Print packet arrivals and departures, including packet contents
 edu.rit.m2mp.debug.packets = 0
 
 # Message filter debug level (integer)
 # 0 = Don't print
 # 1 = Print message filter additions and removals
 # 2 = Print message filter additions and removals including message prefixes
 edu.rit.m2mp.debug.messagefilters = 0

 # M2MP Layer control panel (integer)
 # 0 = Don't display control panel
 # 1 = Display control panel
 edu.rit.m2mp.debug.controlpanel = 0
 
 # M2MP Daemon process's port number (0 if no M2MP Daemon process)
 edu.rit.m2mp.daemon.port = 5678
 
 # M2MP channel implementation class name
 edu.rit.m2mp.channel.class = edu.rit.m2mp.udp.UDPMulticastChannel
 


Method Summary
static String getChannelClass()
          Returns the M2MP channel implementation class name, property edu.rit.m2mp.channel.class.
static int getDaemonPort()
          Returns the M2MP Daemon process's port number, property edu.rit.m2mp.daemon.port.
static int getDebugControlPanel()
          Returns the debug level telling whether to display the M2MP Layer control panel, property edu.rit.m2mp.debug.controlpanel.
static int getDebugMessageFilters()
          Returns the debug level telling which, if any, debugging messages the M2MP Layer should print for each message filter that is added or removed, property edu.rit.m2mp.debug.messagefilters.
static int getDebugPackets()
          Returns the debug level telling which, if any, debugging messages the M2MP Layer should print for each M2MP packet that arrives at or departs from the M2MP Layer, property edu.rit.m2mp.debug.packets.
static int getDebugReceiverThread()
          Returns the debug level for the ReceiverThread, property edu.rit.m2mp.debug.ReceiverThread.
static int getFlowTimeout()
          Returns the flow control timeout interval in milliseconds, property edu.rit.m2mp.flowtimeout.
static int getIntProperty(String name, int base, int lb, int ub, String valueErrMsg, String formatErrMsg)
          Get the int-valued M2MP property with the given name.
static int getMessageTimeout()
          Returns the message timeout interval in milliseconds, property edu.rit.m2mp.messagetimeout.
static String getPropertyValue(String name)
          Get the value of the M2MP property with the given name.
static int getRedundancy()
          Returns the M2MP packet redundancy, property edu.rit.m2mp.redundancy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMessageTimeout

public static int getMessageTimeout()
Returns the message timeout interval in milliseconds, property edu.rit.m2mp.messagetimeout.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is not a decimal integer greater than zero.

getFlowTimeout

public static int getFlowTimeout()
Returns the flow control timeout interval in milliseconds, property edu.rit.m2mp.flowtimeout.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is not a decimal integer greater than zero.

getRedundancy

public static int getRedundancy()
Returns the M2MP packet redundancy, property edu.rit.m2mp.redundancy.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is not a decimal integer greater than zero.

getDebugReceiverThread

public static int getDebugReceiverThread()
Returns the debug level for the ReceiverThread, property edu.rit.m2mp.debug.ReceiverThread.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is not a decimal integer in the range 0 through 2.

getDebugPackets

public static int getDebugPackets()
Returns the debug level telling which, if any, debugging messages the M2MP Layer should print for each M2MP packet that arrives at or departs from the M2MP Layer, property edu.rit.m2mp.debug.packets.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is not a decimal integer in the range 0 through 2.

getDebugMessageFilters

public static int getDebugMessageFilters()
Returns the debug level telling which, if any, debugging messages the M2MP Layer should print for each message filter that is added or removed, property edu.rit.m2mp.debug.messagefilters.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is not a decimal integer in the range 0 through 2.

getDebugControlPanel

public static int getDebugControlPanel()
Returns the debug level telling whether to display the M2MP Layer control panel, property edu.rit.m2mp.debug.controlpanel.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is not a decimal integer in the range 0 through 1.

getDaemonPort

public static int getDaemonPort()
Returns the M2MP Daemon process's port number, property edu.rit.m2mp.daemon.port.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is not a decimal integer in the range 0 through 65535.

getChannelClass

public static String getChannelClass()
Returns the M2MP channel implementation class name, property edu.rit.m2mp.channel.class.

Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.

getIntProperty

public static int getIntProperty(String name,
                                 int base,
                                 int lb,
                                 int ub,
                                 String valueErrMsg,
                                 String formatErrMsg)
Get the int-valued M2MP property with the given name.

Parameters:
name - Property name.
base - Number base (10 = decimal, 16 = hexadecimal).
lb - Lower bound value.
ub - Upper bound value.
valueErrMsg - Message for a value error.
formatErrMsg - Message for a format error.
Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.
M2MPPropertyValueException - (unchecked exception) Thrown if the property value is illegal.

getPropertyValue

public static String getPropertyValue(String name)
Get the value of the M2MP property with the given name.

Parameters:
name - Property name.
Returns:
String value of the property.
Throws:
M2MPPropertyFileException - (unchecked exception) Thrown if the M2MP properties file cannot be found or cannot be read.
M2MPPropertyMissingException - (unchecked exception) Thrown if the property value cannot be found.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.