X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/blobdiff_plain/475e6c234d491cc07dd24a09a2dc3b675b4eac11..41366dedd5ffc2fc1f318d4b9677160c3e20f927:/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/DatabaseTypeEnum.java diff --git a/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/DatabaseTypeEnum.java b/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/DatabaseTypeEnum.java index 44cb1558dc..90f7024699 100644 --- a/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/DatabaseTypeEnum.java +++ b/cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/DatabaseTypeEnum.java @@ -12,8 +12,9 @@ package eu.etaxonomy.cdm.database; import java.util.ArrayList; import java.util.List; +import javax.sql.DataSource; + import org.apache.log4j.Logger; -import org.springframework.jdbc.datasource.DriverManagerDataSource; import eu.etaxonomy.cdm.database.types.H2DatabaseType; import eu.etaxonomy.cdm.database.types.HSqlDbDatabaseType; @@ -23,7 +24,6 @@ import eu.etaxonomy.cdm.database.types.OdbcDatabaseType; import eu.etaxonomy.cdm.database.types.OracleDatabaseType; import eu.etaxonomy.cdm.database.types.PostgreSQLDatabaseType; import eu.etaxonomy.cdm.database.types.SqlServer2005DatabaseType; -import eu.etaxonomy.cdm.database.types.SqlServer2000DatabaseType; import eu.etaxonomy.cdm.database.types.SybaseDatabaseType; /** @@ -36,12 +36,33 @@ public enum DatabaseTypeEnum { ODBC(3), PostgreSQL(4), Oracle(5), - SqlServer2000(6), + //SqlServer2000(6), SqlServer2005(7), Sybase(8), H2(9) ; + /** + * + */ + private static final String P6SPY_DRIVER_CLASS_NAME = "com.p6spy.engine.spy.P6SpyDriver"; + private boolean useP6Spy = false; + + + /** + * @return the useP6Spy + */ + public boolean isUseP6Spy() { + return useP6Spy; + } + + /** + * @param useP6Spy the useP6Spy to set + */ + public void setUseP6Spy(boolean useP6Spy) { + this.useP6Spy = useP6Spy; + } + /** * Constructor * @param i @@ -59,8 +80,8 @@ public enum DatabaseTypeEnum { this.dbType = new PostgreSQLDatabaseType(); break; case 5: this.dbType = new OracleDatabaseType(); break; - case 6: - this.dbType = new SqlServer2000DatabaseType(); break; +// case 6: +// this.dbType = new SqlServer2000DatabaseType(); break; case 7: this.dbType = new SqlServer2005DatabaseType(); break; case 8: @@ -92,15 +113,20 @@ public enum DatabaseTypeEnum { * @return */ public String getDriverClassName(){ - return dbType.getClassString(); + if(useP6Spy){ + return P6SPY_DRIVER_CLASS_NAME; + + } else { + return dbType.getClassString(); + } } /** - * Returns the DriverManagerDataSource class that that the datasource needs to create a spring bean - * @return the DriverManagerDataSource class + * Returns the DataSource class that that the datasource needs to create a spring bean + * @return the DataSource class */ - public Class getDriverManagerDataSourceClass(){ - return dbType.getDriverManagerDataSourceClass(); + public Class getDataSourceClass(){ + return dbType.getDataSourceClass(); } /**