You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by da...@apache.org on 2006/11/07 13:19:16 UTC
svn commit: r472079 - in
/james/server/sandbox/mailet-refactorings/src/java/org/apache:
james/transport/mailets/ james/transport/matchers/ james/util/dbcp/
james/util/mordred/ mailet/
Author: danny
Date: Tue Nov 7 04:19:15 2006
New Revision: 472079
URL: http://svn.apache.org/viewvc?view=rev&rev=472079
Log:
removed org.apache.mailet.DataSource replaced its use with javax.sql.DataSource
Removed:
james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/DataSource.java
Modified:
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCAlias.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCListserv.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/dbcp/JdbcDataSource.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/mordred/JdbcDataSource.java
james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailetServiceJNDIRegistration.java
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java Tue Nov 7 04:19:15 2006
@@ -33,10 +33,10 @@
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.sql.DataSource;
import org.apache.james.Constants;
import org.apache.james.util.JDBCBayesianAnalyzer;
import org.apache.james.util.JDBCUtil;
-import org.apache.mailet.DataSource;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
import org.apache.mailet.MailetServiceJNDIRegistration;
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java Tue Nov 7 04:19:15 2006
@@ -31,9 +31,9 @@
import javax.mail.internet.MimeMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.sql.DataSource;
import org.apache.james.util.JDBCBayesianAnalyzer;
import org.apache.james.util.JDBCUtil;
-import org.apache.mailet.DataSource;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
import org.apache.mailet.MailetServiceJNDIRegistration;
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCAlias.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCAlias.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCAlias.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCAlias.java Tue Nov 7 04:19:15 2006
@@ -33,8 +33,8 @@
import javax.mail.internet.ParseException;
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.sql.DataSource;
import org.apache.james.util.JDBCUtil;
-import org.apache.mailet.DataSource;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCListserv.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCListserv.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCListserv.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCListserv.java Tue Nov 7 04:19:15 2006
@@ -33,8 +33,8 @@
import javax.mail.internet.ParseException;
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.sql.DataSource;
import org.apache.james.util.JDBCUtil;
-import org.apache.mailet.DataSource;
import org.apache.mailet.MailAddress;
import org.apache.mailet.MailetException;
import org.apache.mailet.MailetServiceJNDIRegistration;
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java Tue Nov 7 04:19:15 2006
@@ -32,9 +32,9 @@
import javax.mail.MessagingException;
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.sql.DataSource;
import org.apache.james.util.JDBCUtil;
import org.apache.james.util.VirtualUserTableUtil;
-import org.apache.mailet.DataSource;
import org.apache.mailet.MailAddress;
import org.apache.mailet.MailetException;
import org.apache.mailet.MailetServiceJNDIRegistration;
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/mailets/WhiteListManager.java Tue Nov 7 04:19:15 2006
@@ -48,12 +48,12 @@
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.sql.DataSource;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.james.Constants;
import org.apache.james.util.JDBCUtil;
import org.apache.james.util.SqlResources;
import org.apache.mailet.AliasedUser;
-import org.apache.mailet.DataSource;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/transport/matchers/IsInWhiteList.java Tue Nov 7 04:19:15 2006
@@ -42,7 +42,7 @@
import org.apache.james.util.JDBCUtil;
import org.apache.james.util.SqlResources;
import org.apache.mailet.AliasedUser;
-import org.apache.mailet.DataSource;
+import javax.sql.DataSource;
import org.apache.mailet.GenericMatcher;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/dbcp/JdbcDataSource.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/dbcp/JdbcDataSource.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/dbcp/JdbcDataSource.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/dbcp/JdbcDataSource.java Tue Nov 7 04:19:15 2006
@@ -28,7 +28,7 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.mailet.DataSource;
+import javax.sql.DataSource;
import org.apache.mailet.MailetException;
import org.apache.mailet.MailetServiceJNDIRegistration;
@@ -243,5 +243,57 @@
*/
public Connection getConnection() throws SQLException {
return source.getConnection();
+ }
+
+ /**
+ * @param username
+ * @param password
+ * @return
+ * @throws SQLException
+ * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
+ */
+ public Connection getConnection(String username, String password) throws SQLException {
+
+ return source.getConnection(username, password);
+ }
+
+ /**
+ * @return
+ * @throws SQLException
+ * @see javax.sql.DataSource#getLoginTimeout()
+ */
+ public int getLoginTimeout() throws SQLException {
+
+ return source.getLoginTimeout();
+ }
+
+ /**
+ * @return
+ * @throws SQLException
+ * @see javax.sql.DataSource#getLogWriter()
+ */
+ public PrintWriter getLogWriter() throws SQLException {
+
+ return source.getLogWriter();
+ }
+
+ /**
+ * @param seconds
+ * @throws SQLException
+ * @see javax.sql.DataSource#setLoginTimeout(int)
+ */
+ public void setLoginTimeout(int seconds) throws SQLException {
+
+ source.setLoginTimeout(seconds);
+ }
+
+ /**
+ * @param out
+ * @throws SQLException
+ * @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter)
+ */
+ public void setLogWriter(PrintWriter out) throws SQLException {
+
+ source.setLogWriter(out);
}
}
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/mordred/JdbcDataSource.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/mordred/JdbcDataSource.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/mordred/JdbcDataSource.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/james/util/mordred/JdbcDataSource.java Tue Nov 7 04:19:15 2006
@@ -26,7 +26,6 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.mailet.DataSource;
import org.apache.mailet.MailetException;
import org.apache.mailet.MailetServiceJNDIRegistration;
@@ -38,6 +37,7 @@
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.sql.DataSource;
/**
@@ -108,6 +108,8 @@
// a SQL command to execute to see if the connection is still ok
private String verifyConnSQL;
private String dsName;
+ private PrintWriter logWriter = new PrintWriter(System.out);
+ private int loginTimeout;
/**
* Implements the ConnDefinition behavior when a connection is needed. Checks the pool of
@@ -566,5 +568,53 @@
}
pool.remove(entry);
}
+ }
+
+ /**
+ * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
+ */
+ public Connection getConnection(String username, String password) throws SQLException {
+
+ if(jdbcUsername != username || jdbcPassword != password) {
+ throw new SQLException("Datasource already initialised with different credentials");
+ }
+
+ return getConnection();
+ }
+
+ /**
+ * @see javax.sql.DataSource#getLogWriter()
+ */
+ public PrintWriter getLogWriter() throws SQLException {
+
+
+ return logWriter ;
+ }
+
+ /**
+ * @see javax.sql.DataSource#getLoginTimeout()
+ */
+ public int getLoginTimeout() throws SQLException {
+
+
+ return loginTimeout;
+ }
+
+ /**
+ * @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter)
+ */
+ public void setLogWriter(PrintWriter out) throws SQLException {
+
+ this.logWriter = out;
+
+ }
+
+ /**
+ * @see javax.sql.DataSource#setLoginTimeout(int)
+ */
+ public void setLoginTimeout(int seconds) throws SQLException {
+
+ this.loginTimeout = seconds;
+
}
}
Modified: james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailetServiceJNDIRegistration.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailetServiceJNDIRegistration.java?view=diff&rev=472079&r1=472078&r2=472079
==============================================================================
--- james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailetServiceJNDIRegistration.java (original)
+++ james/server/sandbox/mailet-refactorings/src/java/org/apache/mailet/MailetServiceJNDIRegistration.java Tue Nov 7 04:19:15 2006
@@ -24,6 +24,7 @@
import javax.naming.NameAlreadyBoundException;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
+import javax.sql.DataSource;
/**
*
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org