org.nees.util.sessions
Class FilterSession

java.lang.Object
  extended byorg.nees.util.sessions.FilterSession
All Implemented Interfaces:
Filter, Session

public class FilterSession
extends java.lang.Object
implements Session, Filter

Extend this class to provide a session that pre- and post- processes the commands and results results sent to and from another, delegate session.


Constructor Summary
FilterSession(Session s)
           
 
Method Summary
 void close()
          Release resources used by this session.
 Interpreter getInterpreter()
          Returns an interpreter that pre-processes commands before executing them, and post-processes the results before returning them.
 void open()
          Acquire resources required by this session.
 Result[] postProcess(Result[] r)
          Implement this method to post-process results after they are returned from the delegate session's interpreter.
 Command[] preProcess(Command[] c)
          Implement this method to pre-process commands before they are sent to the delegate session's interpreter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterSession

public FilterSession(Session s)
Parameters:
s - the delegate session which will execute commands after pre-processing, and whose results will be post-processed.
Method Detail

open

public void open()
          throws SessionException
Description copied from interface: Session
Acquire resources required by this session.

Specified by:
open in interface Session
Throws:
SessionException

close

public void close()
           throws SessionException
Description copied from interface: Session
Release resources used by this session.

Specified by:
close in interface Session
Throws:
SessionException

getInterpreter

public Interpreter getInterpreter()
Returns an interpreter that pre-processes commands before executing them, and post-processes the results before returning them.

Specified by:
getInterpreter in interface Session
Returns:
the interpreter

preProcess

public Command[] preProcess(Command[] c)
Implement this method to pre-process commands before they are sent to the delegate session's interpreter. The default behavior is to simply return the unmodified commands.

Specified by:
preProcess in interface Filter
Parameters:
c - the commands to pre-process
Returns:
the pre-processed commands

postProcess

public Result[] postProcess(Result[] r)
Implement this method to post-process results after they are returned from the delegate session's interpreter. The default behavior is to simply return the unmodified results.

Specified by:
postProcess in interface Filter
Parameters:
r - the results to post-process
Returns:
the post-processed results