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.

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, ExceptionStrategy strategy)` 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.
`Environment` | `cloneEnvironment(java.lang.String prefix)`
`Environment` | `cloneEnvironment(java.lang.String prefix, boolean cloneSelector, boolean cloneProcessor)`
`protected LogManager` | `cloneLogManager(java.lang.String prefix)`
`protected Processor` | `cloneProcessor(java.lang.String prefix, LogManager lman, boolean cloneProcessor)`
`protected RandomSource` | `cloneRandomSource(LogManager lman)`
`protected SelectorManager` | `cloneSelectorManager(java.lang.String prefix, LogManager lman, boolean cloneSelector)`
`void` | `destroy()` Tears down the environment.
`static Environment` | `directEnvironment()`
`static Environment` | `directEnvironment(int randomSeed)`
`static Environment` | `directEnvironment(RandomSource rs)`
`static ExceptionStrategy` | `generateDefaultExceptionStrategy(LogManager manager)`
`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()`
`ExceptionStrategy` | `getExceptionStrategy()`
`LogManager` | `getLogManager()`
`Parameters` | `getParameters()`
`Processor` | `getProcessor()`
`RandomSource` | `getRandomSource()`
`SelectorManager` | `getSelectorManager()`
`TimeSource` | `getTimeSource()`
`void` | `removeDestructable(Destructable destructable)`
`ExceptionStrategy` | `setExceptionStrategy(ExceptionStrategy newStrategy)`

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,
                       ExceptionStrategy strategy)

  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(int randomSeed)

### directEnvironment

    public static Environment directEnvironment()

### directEnvironment

    public static Environment directEnvironment(RandomSource rs)

### chooseDefaults

    protected void chooseDefaults()

  Can be easily overridden by a subclass.

### generateDefaultExceptionStrategy

    public static ExceptionStrategy generateDefaultExceptionStrategy(LogManager manager)

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

### getExceptionStrategy

    public ExceptionStrategy getExceptionStrategy()

### setExceptionStrategy

    public ExceptionStrategy setExceptionStrategy(ExceptionStrategy newStrategy)

### cloneEnvironment

    public Environment cloneEnvironment(java.lang.String prefix)

### cloneEnvironment

    public Environment cloneEnvironment(java.lang.String prefix,
                                        boolean cloneSelector,
                                        boolean cloneProcessor)

### cloneLogManager

    protected LogManager cloneLogManager(java.lang.String prefix)

### cloneSelectorManager

    protected SelectorManager cloneSelectorManager(java.lang.String prefix,
                                                   LogManager lman,
                                                   boolean cloneSelector)

### cloneProcessor

    protected Processor cloneProcessor(java.lang.String prefix,
                                       LogManager lman,
                                       boolean cloneProcessor)

### cloneRandomSource

    protected RandomSource cloneRandomSource(LogManager lman)

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.