net.wgen.op
Class DirectExecutorFactory

java.lang.Object
  extended bynet.wgen.op.OpExecutorFactory
      extended bynet.wgen.op.DirectExecutorFactory

public class DirectExecutorFactory
extends OpExecutorFactory

Creates an OpExecutorFactory that produces DirectOpExecutors. A DirectOpExecutor is instantiated with a MappedConnectionFactory that is passed on to all CallExecutors created by that OpExecutor.

The following code, for example, creates a "Direct" factory which creates DirectOpExecutors who make direct connections to the database (not thru EJB or JNDI).

    OracleConnectionPoolDataSource ds = new OracleConnectionPoolDataSource();
    ds.setURL( "jdbc:oracle:thin:@ora.widgets.com:1521:DEV" );
    DirectExecutorFactory fact = new DirectExecutorFactory();
    fact.mapConnectionFactory( MyModule.DATA_SOURCE_NAME, "myapp" , "myapp123", ds );
    fact.mapConnectionFactory( PlatformModule.DATA_SOURCE_NAME, "platform" , "platform123", ds );
    OpExecutorFactory.setDelegatingFactory( fact );
 

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

Field Summary
private static java.util.Map DATASOURCE_MAPPINGS
           
 
Fields inherited from class net.wgen.op.OpExecutorFactory
SYSTEM_PROPERTY
 
Constructor Summary
DirectExecutorFactory()
           
 
Method Summary
protected  OpExecutor _createExecutorForOp(Op op)
          An OpExecutor packed with a MappedConnectionFactory that will provide the Op access to various datasources.
private  MappedConnectionFactory createMappedConnectionFactory(Op op)
          For each datasource registered in this factory, create a connection factory that can access those connections.
 org.apache.commons.dbcp.ConnectionFactory getConnectionFactory(java.lang.String dataSourceName)
          Get the connection factory for the DataSource.
 void mapConnectionFactory(java.lang.String dataSourceName, org.apache.commons.dbcp.ConnectionFactory cxFactory)
          Map a connection factory to a dataSourceName.
 void mapConnectionFactory(java.lang.String dataSourceName, java.lang.String user, java.lang.String pass, javax.sql.DataSource dataSource)
          Map connection factory to a dataSourceName.
 
Methods inherited from class net.wgen.op.OpExecutorFactory
create, getDelegatingFactory, setDelegatingFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATASOURCE_MAPPINGS

private static final java.util.Map DATASOURCE_MAPPINGS
Constructor Detail

DirectExecutorFactory

public DirectExecutorFactory()
Method Detail

mapConnectionFactory

public void mapConnectionFactory(java.lang.String dataSourceName,
                                 org.apache.commons.dbcp.ConnectionFactory cxFactory)
Map a connection factory to a dataSourceName.

Parameters:
dataSourceName -
cxFactory -

mapConnectionFactory

public void mapConnectionFactory(java.lang.String dataSourceName,
                                 java.lang.String user,
                                 java.lang.String pass,
                                 javax.sql.DataSource dataSource)
                          throws java.lang.IllegalAccessException,
                                 java.lang.InstantiationException
Map connection factory to a dataSourceName. Data

Parameters:
dataSourceName -
user -
pass -
Throws:
java.lang.IllegalAccessException
java.lang.InstantiationException

getConnectionFactory

public org.apache.commons.dbcp.ConnectionFactory getConnectionFactory(java.lang.String dataSourceName)
Get the connection factory for the DataSource.

Parameters:
dataSourceName -
Returns:
the ConnectionFactory for the dataSourceName if it exists

_createExecutorForOp

protected OpExecutor _createExecutorForOp(Op op)
An OpExecutor packed with a MappedConnectionFactory that will provide the Op access to various datasources.

Specified by:
_createExecutorForOp in class OpExecutorFactory
Parameters:
op - the Op to be executed
Returns:
an OpExecutor with knowledge of how to access datasources

createMappedConnectionFactory

private MappedConnectionFactory createMappedConnectionFactory(Op op)
For each datasource registered in this factory, create a connection factory that can access those connections.

Parameters:
op - the Op to be executed
Returns:
the connection factory that will provide access to datasources