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 rd...@apache.org on 2009/09/06 12:58:58 UTC
svn commit: r811805 -
/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java
Author: rdonkin
Date: Sun Sep 6 10:58:58 2009
New Revision: 811805
URL: http://svn.apache.org/viewvc?rev=811805&view=rev
Log:
Replace Servicable by injection.
Modified:
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java
Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java?rev=811805&r1=811804&r2=811805&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java Sun Sep 6 10:58:58 2009
@@ -33,6 +33,8 @@
import java.util.Map;
import java.util.StringTokenizer;
+import javax.annotation.Resource;
+
import org.apache.avalon.cornerstone.services.datasources.DataSourceSelector;
import org.apache.avalon.excalibur.datasource.DataSourceComponent;
import org.apache.avalon.framework.activity.Initializable;
@@ -61,7 +63,7 @@
* GreylistHandler which can be used to activate Greylisting
*/
public class GreylistHandler extends AbstractLogEnabled implements
- RcptHook, Configurable, Serviceable, Initializable {
+ RcptHook, Configurable, Initializable {
private DataSourceSelector datasources = null;
@@ -108,10 +110,75 @@
*/
private String repositoryPath;
- private DNSService dnsServer;
+ private DNSService dnsService;
private NetMatcher wNetworks;
+
+
+ /**
+ * Gets the file system service.
+ * @return the fileSystem
+ */
+ public final FileSystem getFileSystem() {
+ return fileSystem;
+ }
+
+ /**
+ * Sets the filesystem service
+ *
+ * @param system The filesystem service
+ */
+ @Resource(name="filesystem")
+ public void setFileSystem(FileSystem system) {
+ this.fileSystem = system;
+ }
+
+ /**
+ * @return the datasources
+ */
+ public final DataSourceSelector getDatasources() {
+ return datasources;
+ }
+
+ /**
+ * Set the datasources.
+ *
+ * @param datasources
+ * The datasources
+ */
+ @Resource(name="database-connections")
+ public void setDataSources(DataSourceSelector datasources) {
+ this.datasources = datasources;
+ }
+
+ /**
+ * Gets the DNS service.
+ * @return the dnsService
+ */
+ public final DNSService getDNSService() {
+ return dnsService;
+ }
+
+ /**
+ * Sets the DNS service.
+ * @param dnsService the dnsService to set
+ */
+ @Resource(name="dnsserver")
+ public final void setDNSService(DNSService dnsService) {
+ this.dnsService = dnsService;
+ }
+
+ /**
+ * Set the sqlFileUrl to use for getting the sqlRessource.xml file
+ *
+ * @param sqlFileUrl
+ * The fileUrl
+ */
+ public void setSqlFileUrl(String sqlFileUrl) {
+ this.sqlFileUrl = sqlFileUrl;
+ }
+
/**
* @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
*/
@@ -168,7 +235,7 @@
Collection nets = whitelistedNetworks(whitelistedNetworks.getValue());
if (nets != null) {
- wNetworks = new NetMatcher(nets,dnsServer);
+ wNetworks = new NetMatcher(nets,dnsService);
getLogger().info("Whitelisted addresses: " + wNetworks.toString());
}
}
@@ -184,36 +251,7 @@
// create table if not exist
createTable(datasource.getConnection(), "greyListTableName", "createGreyListTable");
}
-
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager serviceMan) throws ServiceException {
- setDataSources((DataSourceSelector) serviceMan.lookup(DataSourceSelector.ROLE));
- setDNSService((DNSService) serviceMan.lookup(DNSService.ROLE));
- setFileSystem((FileSystem) serviceMan.lookup(FileSystem.ROLE));
- }
-
- /**
- * Set the DNSServer
- *
- * @param dnsServer
- * The DNSServer
- */
- public void setDNSService(DNSService dnsServer) {
- this.dnsServer = dnsServer;
- }
-
- /**
- * Set the sqlFileUrl to use for getting the sqlRessource.xml file
- *
- * @param sqlFileUrl
- * The fileUrl
- */
- public void setSqlFileUrl(String sqlFileUrl) {
- this.sqlFileUrl = sqlFileUrl;
- }
-
+
/**
* Set the repositoryPath to use
*
@@ -225,26 +263,6 @@
}
/**
- * Set the datasources
- *
- * @param datasources
- * The datasources
- */
- public void setDataSources(DataSourceSelector datasources) {
- this.datasources = datasources;
- }
-
- /**
- * Sets the filesystem service
- *
- * @param system The filesystem service
- */
- private void setFileSystem(FileSystem system) {
- this.fileSystem = system;
- }
-
-
- /**
* Set the datasource
*
* @param datasource
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org