/**
*
*/
Package Com.sprucetec.dbatch.tmsfee;
Import java.io.Serializable;
Import Java.sql.Connection;
Import Java.sql.DriverManager;
Import Java.sql.SQLException;
Import Scala.runtime.AbstractFunction0;
public class Dbconnectionfactory {
Static abstractfunction0<connection>Gettmsbasic () {
return new Abstractfunction0seri (Constants.Url4tmsbasic, Constants.User4tmsbasic, Constants.Pass4tmsbasic);
}
Static abstractfunction0<connection>Gettms () {
return new Abstractfunction0seri (Constants.Url4tms, Constants.User4tms, Constants.PASS4TMS);
}
Static abstractfunction0<connection>GETTMSDC () {
return new Abstractfunction0seri (Constants.Url4tmsdc, Constants.User4tmsdc, Constants.PASS4TMSDC);
}
private Static Class Abstractfunction0seriExtends abstractfunction0<connection>Implements serializable{
private static final longSerialversionuid =1L;
Private Final StringUrl;
Private Final StringUsername;
Private Final StringPassword;
Public abstractfunction0seri (String URL, String username, String password) {
This.url = URL;
This.Username = Username;
This.Password = password;
}
@Override
public Connection apply () {
try {
return DriverManager. getconnection (this. Url Username Password) } catch (SQLException e) {
throw new RuntimeException ( "database connection failed" , E) }
}
}
}
/span>
Dbconnectionfactory Database Connection