avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosu...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/microcontainer/src/java/org/apache/excalibur/microcontainer/util DataSourceFactory.java
Date Sun, 30 Jun 2002 11:40:02 GMT
leosutic    2002/06/30 04:40:02

  Modified:    microcontainer/src/java/org/apache/excalibur/microcontainer/util
                        DataSourceFactory.java
  Log:
  Refactored so that other data sources than the JDBC data source could be created.
  
  Revision  Changes    Path
  1.3       +46 -1     jakarta-avalon-excalibur/microcontainer/src/java/org/apache/excalibur/microcontainer/util/DataSourceFactory.java
  
  Index: DataSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/microcontainer/src/java/org/apache/excalibur/microcontainer/util/DataSourceFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DataSourceFactory.java	27 Jun 2002 14:33:38 -0000	1.2
  +++ DataSourceFactory.java	30 Jun 2002 11:40:02 -0000	1.3
  @@ -71,7 +71,25 @@
           return child;
       }
       
  +    /**
  +     * Creates a DataSourceComponent.
  +     *
  +     * @param componentClass The component class.
  +     * @param driver the database driver.
  +     * @param dbUrl the JDBC database url.
  +     * @param user the user name.
  +     * @param password user's password.
  +     * @param keepAliveCommand command to ping the DB server with occasionally 
  +                               to keep the connection alive. Optional, may be null.
  +     * @param poolMin minimum number of pooled connections.
  +     * @param poolMax maximum number of pooled connections.
  +     * @param timeout timeout.
  +     * @param autoCommit use auto commit.
  +     * @param useOracle set to true if you are connecting to an Oracle DB.
  +     * @param connectionClass the class to use for connections. Optional, may be null.
  +     */
       public static DataSourceComponent getDataSource( 
  +        Class componentClass,
           String driver, String dbUrl, String user, 
           String password, String keepAliveCommand, 
           int poolMin, int poolMax, long timeout, 
  @@ -109,8 +127,35 @@
           controller.addChild( keepAlive );
           config.addChild( controller );
                   
  -        return (DataSourceComponent) new MicroContainer( JdbcDataSource.class ).configuration(
config ).create();
  +        return (DataSourceComponent) new MicroContainer( componentClass ).configuration(
config ).create();
       }
       
  +    /**
  +     * Creates a JDBCDataSource.
  +     */
  +    public static DataSourceComponent getDataSource( 
  +        String driver, String dbUrl, String user, 
  +        String password, String keepAliveCommand, 
  +        int poolMin, int poolMax, long timeout, 
  +        boolean autoCommit, boolean useOracle, 
  +        String connectionClass ) throws MicroContainerException 
  +    {
  +        return getDataSource( JdbcDataSource.class, driver, dbUrl, user, password, keepAliveCommand,
poolMin, poolMax, timeout,
  +            autoCommit, useOracle, connectionClass );
  +    }
       
  +    /**
  +     * Creates a JDBCDataSource.
  +     */
  +    public static DataSourceComponent getJDBCDataSource( 
  +        String driver, String dbUrl, String user, 
  +        String password, String keepAliveCommand, 
  +        int poolMin, int poolMax, long timeout, 
  +        boolean autoCommit, boolean useOracle, 
  +        String connectionClass ) throws MicroContainerException 
  +    {
  +        return getDataSource( JdbcDataSource.class, driver, dbUrl, user, password, keepAliveCommand,
poolMin, poolMax, timeout,
  +            autoCommit, useOracle, connectionClass );
  +    }
  +        
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message