net.wgen.op
Class DirectOpExecutor

java.lang.Object
  extended bynet.wgen.op.DirectOpExecutor
All Implemented Interfaces:
OpExecutor

public class DirectOpExecutor
extends java.lang.Object
implements OpExecutor

An OpExecutor that does not connect thru RMI, but uses a Connection or ConnectionFactory to provide Ops with access to datasources.

Version:
$Id: DirectOpExecutor.html,v 1.2 2007/01/28 04:09:36 paulfeuer Exp $
Author:
Paul Feuer, Wireless Generation, Inc.

Field Summary
private  boolean _closeConnectionsWhenFinished
          Whether or not this OpExecutor should instruct the _connectionFactory to close any open connections after the Op is finished.
private  MappedConnectionFactory _connectionFactory
          A factory that knows how to access various datasources and is passed on to the instantiated CallExecutors.
 
Constructor Summary
DirectOpExecutor(java.sql.Connection connection, TraceKey traceKey)
           
DirectOpExecutor(MappedConnectionFactory connectionFactory)
           
 
Method Summary
 Op executeOp(Op op)
          Evaluate the Op's options, construct the appropriate CallExecutor and invoke the Op's _execute method.
 void setCloseConnectionsWhenFinished(boolean closeConnectionsWhenFinished)
          In the finally block of the executeOp method, tell the MappedConnectionFactory to close all the connections that it has open.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_connectionFactory

private MappedConnectionFactory _connectionFactory
A factory that knows how to access various datasources and is passed on to the instantiated CallExecutors.


_closeConnectionsWhenFinished

private boolean _closeConnectionsWhenFinished
Whether or not this OpExecutor should instruct the _connectionFactory to close any open connections after the Op is finished.

Constructor Detail

DirectOpExecutor

public DirectOpExecutor(MappedConnectionFactory connectionFactory)

DirectOpExecutor

public DirectOpExecutor(java.sql.Connection connection,
                        TraceKey traceKey)
Method Detail

setCloseConnectionsWhenFinished

public void setCloseConnectionsWhenFinished(boolean closeConnectionsWhenFinished)
In the finally block of the executeOp method, tell the MappedConnectionFactory to close all the connections that it has open.

Parameters:
closeConnectionsWhenFinished - whether or not to tell the MappedConnectionFactory to close all open connections

executeOp

public Op executeOp(Op op)
             throws OpException
Evaluate the Op's options, construct the appropriate CallExecutor and invoke the Op's _execute method. The method is not directly invoked; rather the CallExecutor's executeOp method is. If the options have a non-null object at the HandlingOption.PROP_DBUNIT_LOAD_SET key, a CallExecutorDBUnit will be instantiated and used. If otherwise, a typical CallExecutorDB will be instantiated and used.

Specified by:
executeOp in interface OpExecutor
Parameters:
op - the Op to execute
Returns:
the op after execution, it will be the same object
Throws:
OpException
java.lang.NullPointerException - if the op parameter is null