Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.environment
Class Environment

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

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 Environment` | `directEnvironment()` DESCRIBE THE METHOD
`static Environment` | `directEnvironment(int randomSeed)` DESCRIBE THE METHOD
`static Environment` | `directEnvironment(RandomSource rs)` DESCRIBE THE METHOD
`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
    `proc` - DESCRIBE THE PARAMETER
    `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
    `params` - DESCRIBE THE PARAMETER

### Environment

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

  Convienience for defaults.

  Parameters:
    `orderedDefaultFiles` - DESCRIBE THE PARAMETER
    `paramFileName` - the file where parameters are saved
  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

### directEnvironment

    public static Environment directEnvironment(int randomSeed)

  DESCRIBE THE METHOD

  Parameters:
    `randomSeed` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE

### directEnvironment

    public static Environment directEnvironment()

  DESCRIBE THE METHOD

  Returns:
    DESCRIBE THE RETURN VALUE

### directEnvironment

    public static Environment directEnvironment(RandomSource rs)

  DESCRIBE THE METHOD

  Parameters:
    `rs` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.