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

## com.sun.javatest.exec
Class BasicSession

    java.lang.Object
      com.sun.javatest.exec.BasicSession

All Implemented Interfaces:
  Session

    public class BasicSession

extends java.lang.Object
implements Session

The very classic implemetation of Session that incapsulates the WorkDirectory instance and InterviewParameters instance.

Nested Class Summary
`static class` | `BasicSession.E_NewConfig` Event which is delivered when current configuration has been modified.
`static class` | `BasicSession.E_NewWD` Event which is delivered when WorkDircotry has been set.
`static interface` | `BasicSession.OrderedObserver` Extentsion to the Observer interface for those classes which are sensitive to the order of notifying.
`static class` | `BasicSession.U_NewConfig` Class of update to configuration

Nested classes/interfaces inherited from interface com.sun.javatest.exec.Session
`Session.Event, Session.Fault, Session.Observer, Session.Update`

Field Summary
`protected InterviewParameters` | `config` Instance of configuration
`static java.lang.String` | `CONFIG_NAME_PROP`
`protected java.util.List<java.lang.String>` | `filterNames` List of available filters
`protected java.util.List<Session.Observer>` | `observers` List of registred observers
`protected java.util.List<java.lang.String>` | `props` List of observable properties
`protected WorkDirectory` | `wd` Instance of workdir
`static java.lang.String` | `WD_PROP`

Constructor Summary
`BasicSession(TestSuite ts)` Creates empty session for the passed test suite.

Method Summary
`void` | `addObserver(Session.Observer obs)` Registers the observer.
`protected void` | `applyWorkDir(WorkDirectory wd)` Associates session with the work dir.
`void` | `dispose()` Disposes configuration.
`protected TestFilter` | `findFilter(java.lang.String name)` Supposed to be overriden when extra filters added
`Parameters` | `getParameters()` Data required to execute tests.
`java.util.List<java.lang.String>` | `getPropertyNames()` Returns the config property names
`TestFilter` | `getTestFilter(java.lang.String name)`
`java.util.List<java.lang.String>` | `getTestFilterNames()`
`java.lang.String` | `getValue(java.lang.String name)`
`protected void` | `initFilterList()` Creates list of supported filters: ExcludeList, PriorStatus, Keyword, Relevant.
`protected void` | `initPropertyList()` Creates list of two session properties: WorkDirectory and Configuration.
`boolean` | `isReady()`
`protected void` | `loadInterviewFromFile(WorkDirectory wd, java.io.File cfgFile)` Loads interview from file.
`void` | `notifyObservers(Session.Event evn)` Delivers events to the all registered observers
`void` | `removeObserver(Session.Observer obs)` Unregisters the observer.
`void` | `restore(java.util.Map map)` Restores the config state from the map
`void` | `save(java.util.Map map)` Saves the config state to the map
`void` | `update(Session.Update u)` Applies the update.
`protected void` | `updateNewConfig(InterviewParameters ip)` Method invoked as a reaction on U_NewConfig update.
`protected void` | `updateWorkDir(WorkDirectory wd, boolean doRestoreConfig)` Sets the work dir to the new specified value, inovkes applyWorkDir() method, notifies observers of the work dir change.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### config

    protected final InterviewParameters config

  Instance of configuration

### wd

    protected WorkDirectory wd

  Instance of workdir

### observers

    protected final java.util.List<Session.Observer> observers

  List of registred observers

### filterNames

    protected final java.util.List<java.lang.String> filterNames

  List of available filters

### props

    protected final java.util.List<java.lang.String> props

  List of observable properties

### CONFIG_NAME_PROP

    public static final java.lang.String CONFIG_NAME_PROP

See Also:
  Constant Field Values

### WD_PROP

    public static final java.lang.String WD_PROP

See Also:
  Constant Field Values

Constructor Detail

### BasicSession

    public BasicSession(TestSuite ts)
                 throws Session.Fault

  Creates empty session for the passed test suite.

  Parameters:
    `ts` -
  Throws:
    `Session.Fault`

Method Detail

### update

    public void update(Session.Update u)
                throws Session.Fault

  Applies the update. Ignores updates of unknown type. Subclasses need override this methed to support more update types.

  Specified by:
    `update` in interface `Session`
  Parameters:
    `u` -
  Throws:
    `Session.Fault`

### addObserver

    public void addObserver(Session.Observer obs)

  Description copied from interface: `Session`
  Registers the observer. Does nothing if the observer is null or already registered.

  Specified by:
    `addObserver` in interface `Session`
  Parameters:
    `obs` - - observer

### removeObserver

    public void removeObserver(Session.Observer obs)

  Description copied from interface: `Session`
  Unregisters the observer. Does nothing if the observer is null or not registered.

  Specified by:
    `removeObserver` in interface `Session`
  Parameters:
    `obs` - - observer

### notifyObservers

    public void notifyObservers(Session.Event evn)

  Delivers events to the all registered observers

  Parameters:
    `evn` - - event to be sent out.

### getTestFilter

    public TestFilter getTestFilter(java.lang.String name)

### findFilter

    protected TestFilter findFilter(java.lang.String name)

  Supposed to be overriden when extra filters added

  Parameters:
    `name` -
  Returns:
    found filter or null, if not found.

### getTestFilterNames

    public java.util.List<java.lang.String> getTestFilterNames()

### save

    public void save(java.util.Map map)

  Description copied from interface: `Session`
  Saves the config state to the map

  Specified by:
    `save` in interface `Session`

### restore

    public void restore(java.util.Map map)
                 throws Session.Fault

  Description copied from interface: `Session`
  Restores the config state from the map

  Specified by:
    `restore` in interface `Session`
  Throws:
    `Session.Fault`

### loadInterviewFromFile

    protected void loadInterviewFromFile(WorkDirectory wd,
                                         java.io.File cfgFile)
                                  throws Session.Fault

  Loads interview from file.

  Parameters:
    `wd` -
    `cfgFile` -
  Throws:
    `Session.Fault`

### dispose

    public void dispose()

  Description copied from interface: `Session`
  Disposes configuration. Critical when heavy objects were used.

  Specified by:
    `dispose` in interface `Session`

### getPropertyNames

    public java.util.List<java.lang.String> getPropertyNames()

  Description copied from interface: `Session`
  Returns the config property names

  Specified by:
    `getPropertyNames` in interface `Session`
  Returns:
    Configuration property name List

### getValue

    public java.lang.String getValue(java.lang.String name)

  Specified by:
    `getValue` in interface `Session`
  Returns:
    the value of property or null if unset
  See Also:
    `Session.getPropertyNames()`

### getParameters

    public Parameters getParameters()

  Description copied from interface: `Session`
  Data required to execute tests. In future - should be replaced.

  Specified by:
    `getParameters` in interface `Session`
  Returns:
    The current parameters in use.

### isReady

    public boolean isReady()

  Specified by:
    `isReady` in interface `Session`
  Returns:
    true if configuration is ready for test execution

### initFilterList

    protected void initFilterList()

  Creates list of supported filters: ExcludeList, PriorStatus, Keyword, Relevant.

### initPropertyList

    protected void initPropertyList()

  Creates list of two session properties: WorkDirectory and Configuration.

### updateWorkDir

    protected void updateWorkDir(WorkDirectory wd,
                                 boolean doRestoreConfig)

  Sets the work dir to the new specified value, inovkes applyWorkDir() method, notifies observers of the work dir change.

  It's not recommended to override this method.

  Parameters:
    `wd` - - instance of WorkDirectory
    `doRestoreConfig` - - flag to be passed via Event signaling whether restoring configuration from wd is required

### applyWorkDir

    protected void applyWorkDir(WorkDirectory wd)

  Associates session with the work dir. To be overriden when wd sould be applied not only to session, but template or other properties.

  Parameters:
    `wd` -

### updateNewConfig

    protected void updateNewConfig(InterviewParameters ip)
                            throws Session.Fault

  Method invoked as a reaction on U_NewConfig update. Checks if there are any changes in the update, if none - does nothing, Otherwises, copies new values into the main configuration instance, notifies observers with E_NewConfig event.

  Parameters:
    `ip` -
  Throws:
    `Session.Fault`

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

Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.