ePOST API

rice.environment
Class Environment

java.lang.Object
  extended by rice.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.

Author:
Jeff Hoye

Field Summary
static java.lang.String[] defaultParamFileArray
           
 
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)
           
Environment(java.lang.String[] orderedDefaultFiles, java.lang.String paramFileName)
          Convienience for defaults.
 
Method Summary
 void addDestructable(Destructable destructable)
           
protected  void chooseDefaults()
          Can be easily overridden by a subclass.
 void destroy()
          Tears down the environment.
static Environment directEnvironment()
           
static LogManager generateDefaultLogManager(TimeSource time, Parameters params)
           
static Processor generateDefaultProcessor()
           
static RandomSource generateDefaultRandomSource(Parameters params, LogManager logging)
           
static SelectorManager generateDefaultSelectorManager(TimeSource time, LogManager logging)
           
static TimeSource generateDefaultTimeSource()
           
 LogManager getLogManager()
           
 Parameters getParameters()
           
 Processor getProcessor()
           
 RandomSource getRandomSource()
           
 SelectorManager getSelectorManager()
           
 TimeSource getTimeSource()
           
 void removeDestructable(Destructable destructable)
           
 
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
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
props - the Properties. Default: empty properties

Environment

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

Parameters:
paramFileName - the file where parameters are saved
Throws:
java.io.IOException

Environment

public Environment(java.lang.String paramFileName)

Environment

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

Method Detail

directEnvironment

public static Environment directEnvironment()

chooseDefaults

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


generateDefaultRandomSource

public static RandomSource generateDefaultRandomSource(Parameters params,
                                                       LogManager logging)

generateDefaultTimeSource

public static TimeSource generateDefaultTimeSource()

generateDefaultLogManager

public static LogManager generateDefaultLogManager(TimeSource time,
                                                   Parameters params)

generateDefaultSelectorManager

public static SelectorManager generateDefaultSelectorManager(TimeSource time,
                                                             LogManager logging)

generateDefaultProcessor

public static Processor generateDefaultProcessor()

getSelectorManager

public SelectorManager getSelectorManager()

getProcessor

public Processor getProcessor()

getRandomSource

public RandomSource getRandomSource()

getTimeSource

public TimeSource getTimeSource()

getLogManager

public LogManager getLogManager()

getParameters

public Parameters getParameters()

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)

removeDestructable

public void removeDestructable(Destructable destructable)

ePOST API

Copyright © 2001-2005 - Rice Pastry.