Bees v0.5.0 API

bees.core
Class ProtocolParameters

java.lang.Object
  |
  +--bees.core.ProtocolParameters
Direct Known Subclasses:
BenchmarkParameters, DiscoveryParameters, HealthParameters, HelloParameters, PathfinderParameters

public class ProtocolParameters
extends java.lang.Object

ProtocolParameters is a base class that provides basic configuration functionality.


Field Summary
protected  java.util.Properties properties
          The properties for this protocol.
 
Constructor Summary
ProtocolParameters(byte[] propertiesFile)
          Construct a ProtocolParameters object initialized with the given values.
ProtocolParameters(java.util.Properties properties)
          Construct a ProtocolParameters object initialized with the given values.
 
Method Summary
 int getInteger(java.lang.String name, int defaultValue)
          Get an integer value out of the properties object.
 long getLong(java.lang.String name, long defaultValue)
          Get an long value out of the properties object.
 long getMillisecondValue(java.lang.String name, long defaultValue)
          Get a millisecond value out of the properties object.
 java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
          Get an string value out of the properties object.
static java.util.Properties loadProperties(byte[] propertiesFile)
          Load the properties specified in given byte array.
static java.util.Properties loadProperties(java.util.Properties props, byte[] propertiesFile)
          Load the properties specified in given byte array.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

properties

protected final java.util.Properties properties
The properties for this protocol.
Constructor Detail

ProtocolParameters

public ProtocolParameters(java.util.Properties properties)
Construct a ProtocolParameters object initialized with the given values.
Parameters:
properties - The protocol configuration properties.

ProtocolParameters

public ProtocolParameters(byte[] propertiesFile)
Construct a ProtocolParameters object initialized with the given values.
Parameters:
propertiesFile - A fully loaded properties text file that should be used to initialize a Properties object.
Method Detail

loadProperties

public static java.util.Properties loadProperties(java.util.Properties props,
                                                  byte[] propertiesFile)
Load the properties specified in given byte array.
Parameters:
props - Null or the Properties object to initialize.
propertiesFile - Null or a properties text file.
Returns:
A Properties object that was initialized from the given file.

loadProperties

public static java.util.Properties loadProperties(byte[] propertiesFile)
Load the properties specified in given byte array.
Parameters:
propertiesFile - Null or a properties text file.
Returns:
A Properties object that was initialized from the given file.

getMillisecondValue

public long getMillisecondValue(java.lang.String name,
                                long defaultValue)
Get a millisecond value out of the properties object. This tries to be intelligent about the value in the file, for example, if it ends in "s", it will assume it is a seconds value and should be converted to millis.
Parameters:
name - The name of the millisecond property.
defaultValue - The defaultValue to be returned if the value isn't in the properties object or it cannot be parsed.
Returns:
The millisecond value specified in the file or defaultValue.

getInteger

public int getInteger(java.lang.String name,
                      int defaultValue)
Get an integer value out of the properties object.
Parameters:
name - The name of the integer property.
defaultValue - The defaultValue to be returned if the value isn't in the properties object or it cannot be parsed.
Returns:
The integer value specified in the file or defaultValue.

getLong

public long getLong(java.lang.String name,
                    long defaultValue)
Get an long value out of the properties object.
Parameters:
name - The name of the long property.
defaultValue - The defaultValue to be returned if the value isn't in the properties object or it cannot be parsed.
Returns:
The long value specified in the file or defaultValue.

getString

public java.lang.String getString(java.lang.String name,
                                  java.lang.String defaultValue)
Get an string value out of the properties object.
Parameters:
name - The name of the string property.
defaultValue - The defaultValue to be returned if the value isn't in the properties object or it cannot be parsed.
Returns:
The string value specified in the file or defaultValue.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/