From: <pat...@us...> - 2009-01-21 20:56:38
|
Revision: 845 http://cishell.svn.sourceforge.net/cishell/?rev=845&view=rev Author: pataphil Date: 2009-01-21 20:56:31 +0000 (Wed, 21 Jan 2009) Log Message: ----------- Implemented part of the database service, but didn't finish. Modified Paths: -------------- trunk/core/org.cishell.service.database/src/org/cishell/service/database/DatabaseService.java Added Paths: ----------- trunk/core/org.cishell.service.database/.settings/org.eclipse.jdt.core.prefs trunk/core/org.cishell.service.database/src/org/cishell/service/database/DataSourceWithID.java Added: trunk/core/org.cishell.service.database/.settings/org.eclipse.jdt.core.prefs =================================================================== --- trunk/core/org.cishell.service.database/.settings/org.eclipse.jdt.core.prefs (rev 0) +++ trunk/core/org.cishell.service.database/.settings/org.eclipse.jdt.core.prefs 2009-01-21 20:56:31 UTC (rev 845) @@ -0,0 +1,12 @@ +#Wed Jan 21 13:34:47 EST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 Added: trunk/core/org.cishell.service.database/src/org/cishell/service/database/DataSourceWithID.java =================================================================== --- trunk/core/org.cishell.service.database/src/org/cishell/service/database/DataSourceWithID.java (rev 0) +++ trunk/core/org.cishell.service.database/src/org/cishell/service/database/DataSourceWithID.java 2009-01-21 20:56:31 UTC (rev 845) @@ -0,0 +1,56 @@ +package org.cishell.service.database; + +import java.io.PrintWriter; +import java.sql.Connection; +import java.sql.SQLException; + +import javax.sql.DataSource; + +public class DataSourceWithID implements DataSource { + private static int idCounter = 0; + + private DataSource wrappedDataSource; + private int id; + + private static int generateNewID() { + int newID = idCounter; + + idCounter++; + + return newID; + } + + public DataSourceWithID(DataSource wrappedDataSource) { + this.wrappedDataSource = wrappedDataSource; + this.id = generateNewID(); + } + + public int getID() { + return id; + } + + public Connection getConnection() throws SQLException { + return this.wrappedDataSource.getConnection(); + } + + public Connection getConnection(String username, String password) + throws SQLException { + return this.wrappedDataSource.getConnection(username, password); + } + + public PrintWriter getLogWriter() throws SQLException { + return this.wrappedDataSource.getLogWriter(); + } + + public void setLogWriter(PrintWriter out) throws SQLException { + this.wrappedDataSource.setLogWriter(out); + } + + public int getLoginTimeout() throws SQLException { + return this.wrappedDataSource.getLoginTimeout(); + } + + public void setLoginTimeout(int seconds) throws SQLException { + this.wrappedDataSource.setLoginTimeout(seconds); + } +} \ No newline at end of file Modified: trunk/core/org.cishell.service.database/src/org/cishell/service/database/DatabaseService.java =================================================================== --- trunk/core/org.cishell.service.database/src/org/cishell/service/database/DatabaseService.java 2009-01-20 16:45:20 UTC (rev 844) +++ trunk/core/org.cishell.service.database/src/org/cishell/service/database/DatabaseService.java 2009-01-21 20:56:31 UTC (rev 845) @@ -6,7 +6,7 @@ public interface DatabaseService { - public DataSource createDatabase() throws DatabaseCreationException; - public DataSource createDatabase(ResultSet resultSet) throws DatabaseCreationException; - public DataSource copyDatabase(DataSource database) throws DatabaseCopyException; + public DataSourceWithID createDatabase() throws DatabaseCreationException; + public DataSourceWithID createDatabase(ResultSet resultSet) throws DatabaseCreationException; + public DataSourceWithID copyDatabase(DataSourceWithID database) throws DatabaseCopyException; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |