Rice Pastry API

rice.environment
Class Environment

java.lang.Object
  extended byrice.environment.Environment
All Implemented Interfaces:
Destructable

public class Environment
extends java.lang.Object
implements Destructable

Used to provide properties, timesource, loggers etc to the FreePastry apps and components. XXX: Plan is to place the environment inside a PastryNode.

Version:
$Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $
Author:
Jeff Hoye

Field Summary
static java.lang.String[] defaultParamFileArray
          DESCRIBE THE FIELD
 
Constructor Summary
Environment()
          Convienience for defaults.
Environment(SelectorManager sm, Processor proc, RandomSource rs, TimeSource time, LogManager lm, Parameters params)
          Constructor.
Environment(java.lang.String paramFileName)
          Constructor for Environment.
Environment(java.lang.String[] orderedDefaultFiles, java.lang.String paramFileName)
          Convienience for defaults.
 
Method Summary
 void addDestructable(Destructable destructable)
          Adds a feature to the Destructable attribute of the Environment object
protected  void chooseDefaults()
          Can be easily overridden by a subclass.
 void destroy()
          Tears down the environment.
static LogManager generateDefaultLogManager(TimeSource time, Parameters params)
          DESCRIBE THE METHOD
static Processor generateDefaultProcessor()
          DESCRIBE THE METHOD
static RandomSource generateDefaultRandomSource(Parameters params, LogManager logging)
          DESCRIBE THE METHOD
static SelectorManager generateDefaultSelectorManager(TimeSource time, LogManager logging)
          DESCRIBE THE METHOD
static TimeSource generateDefaultTimeSource()
          DESCRIBE THE METHOD
 LogManager getLogManager()
          Gets the LogManager attribute of the Environment object
 Parameters getParameters()
          Gets the Parameters attribute of the Environment object
 Processor getProcessor()
          Gets the Processor attribute of the Environment object
 RandomSource getRandomSource()
          Gets the RandomSource attribute of the Environment object
 SelectorManager getSelectorManager()
          Gets the SelectorManager attribute of the Environment object
 TimeSource getTimeSource()
          Gets the TimeSource attribute of the Environment object
 void removeDestructable(Destructable destructable)
          DESCRIBE THE METHOD
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultParamFileArray

public static final java.lang.String[] defaultParamFileArray
DESCRIBE THE FIELD

Constructor Detail

Environment

public Environment(SelectorManager sm,
                   Processor proc,
                   RandomSource rs,
                   TimeSource time,
                   LogManager lm,
                   Parameters params)
Constructor. You can provide null values for all/any paramenters, which will result in a default choice. If you want different defaults, consider extending Environment and providing your own chooseDefaults() method.

Parameters:
sm - the SelectorManager. Default: rice.selector.SelectorManager
rs - the RandomSource. Default: rice.environment.random.simple.SimpleRandomSource
time - the TimeSource. Default: rice.environment.time.simple.SimpleTimeSource
lm - the LogManager. Default: rice.environment.logging.simple.SimpleLogManager
proc - DESCRIBE THE PARAMETER
params - DESCRIBE THE PARAMETER

Environment

public Environment(java.lang.String[] orderedDefaultFiles,
                   java.lang.String paramFileName)
Convienience for defaults.

Parameters:
paramFileName - the file where parameters are saved
orderedDefaultFiles - DESCRIBE THE PARAMETER
Throws:
java.io.IOException

Environment

public Environment(java.lang.String paramFileName)
Constructor for Environment.

Parameters:
paramFileName - DESCRIBE THE PARAMETER

Environment

public Environment()
Convienience for defaults. Has no parameter file to load/store.

Method Detail

getSelectorManager

public SelectorManager getSelectorManager()
Gets the SelectorManager attribute of the Environment object

Returns:
The SelectorManager value

getProcessor

public Processor getProcessor()
Gets the Processor attribute of the Environment object

Returns:
The Processor value

getRandomSource

public RandomSource getRandomSource()
Gets the RandomSource attribute of the Environment object

Returns:
The RandomSource value

getTimeSource

public TimeSource getTimeSource()
Gets the TimeSource attribute of the Environment object

Returns:
The TimeSource value

getLogManager

public LogManager getLogManager()
Gets the LogManager attribute of the Environment object

Returns:
The LogManager value

getParameters

public Parameters getParameters()
Gets the Parameters attribute of the Environment object

Returns:
The Parameters value

chooseDefaults

protected void chooseDefaults()
Can be easily overridden by a subclass.


destroy

public void destroy()
Tears down the environment. Calls params.store(), selectorManager.destroy().

Specified by:
destroy in interface Destructable

addDestructable

public void addDestructable(Destructable destructable)
Adds a feature to the Destructable attribute of the Environment object

Parameters:
destructable - The feature to be added to the Destructable attribute

removeDestructable

public void removeDestructable(Destructable destructable)
DESCRIBE THE METHOD

Parameters:
destructable - DESCRIBE THE PARAMETER

generateDefaultRandomSource

public static RandomSource generateDefaultRandomSource(Parameters params,
                                                       LogManager logging)
DESCRIBE THE METHOD

Parameters:
params - DESCRIBE THE PARAMETER
logging - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

generateDefaultTimeSource

public static TimeSource generateDefaultTimeSource()
DESCRIBE THE METHOD

Returns:
DESCRIBE THE RETURN VALUE

generateDefaultLogManager

public static LogManager generateDefaultLogManager(TimeSource time,
                                                   Parameters params)
DESCRIBE THE METHOD

Parameters:
time - DESCRIBE THE PARAMETER
params - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

generateDefaultSelectorManager

public static SelectorManager generateDefaultSelectorManager(TimeSource time,
                                                             LogManager logging)
DESCRIBE THE METHOD

Parameters:
time - DESCRIBE THE PARAMETER
logging - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

generateDefaultProcessor

public static Processor generateDefaultProcessor()
DESCRIBE THE METHOD

Returns:
DESCRIBE THE RETURN VALUE

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection