org.mybatis.guice.datasource.builtin
Class UnpooledDataSourceProvider

java.lang.Object
  extended by org.mybatis.guice.datasource.builtin.UnpooledDataSourceProvider
All Implemented Interfaces:
javax.inject.Provider<DataSource>

public final class UnpooledDataSourceProvider
extends Object
implements javax.inject.Provider<DataSource>

Provides the myBatis built-in UnpooledDataSource.

Version:
$Id: UnpooledDataSourceProvider.java 3687 2011-03-16 13:37:53Z simone.tripodi $

Constructor Summary
UnpooledDataSourceProvider(String driver, String url, String username, String password)
          Creates a new UnpooledDataSource using the needed parameter.
 
Method Summary
 DataSource get()
          
 void setAutoCommit(boolean autoCommit)
           
 void setDriverProperties(Properties driverProperties)
           
 void setLoginTimeout(int loginTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnpooledDataSourceProvider

@Inject
public UnpooledDataSourceProvider(@Named(value="JDBC.driver")
                                         String driver,
                                         @Named(value="JDBC.url")
                                         String url,
                                         @Named(value="JDBC.username")
                                         String username,
                                         @Named(value="JDBC.password")
                                         String password)
Creates a new UnpooledDataSource using the needed parameter.

Parameters:
driver - The JDBC driver class.
url - the database URL of the form jdbc:subprotocol:subname.
username - the database user.
password - the user's password.
Method Detail

setAutoCommit

@Inject(optional=true)
public void setAutoCommit(@Named(value="JDBC.autoCommit")
                                 boolean autoCommit)
Parameters:
autoCommit -

setLoginTimeout

@Inject(optional=true)
public void setLoginTimeout(@Named(value="JDBC.loginTimeout")
                                   int loginTimeout)
Parameters:
loginTimeout -

setDriverProperties

@Inject(optional=true)
public void setDriverProperties(@Named(value="JDBC.driverProperties")
                                       Properties driverProperties)

get

public DataSource get()

Specified by:
get in interface javax.inject.Provider<DataSource>


Copyright © 2010-2011 MyBatis.org. All Rights Reserved.