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 ie...@apache.org on 2013/01/05 14:09:12 UTC
svn commit: r1429276 [1/2] - in /james/server/trunk: ./ container-spring/
container-spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/
data/data-file/src/main/java/org/apache/james/domainlist/xml/
data/data-file/sr...
Author: ieugen
Date: Sat Jan 5 13:09:12 2013
New Revision: 1429276
URL: http://svn.apache.org/viewvc?rev=1429276&view=rev
Log:
JAMES-1460 Updated dependencies and other fixes
* derby 10.9.1.0
* geronimo-spec: 1.1.1
* commons-daemon: 1.0.10
* commons-pool: 1.6
* commons-configuration: 1.9
* commons-net: 3.2
* commons-beanutils: 1.8.3
* commons-io: 2.4
* jmock: 2.6.0
* log4j: 1.2.17
* openjpa: 2.2.1
* tika-parserts: 1.2
* xbean-spring: 3.12
* osgi-core: 5.0.0
* slf4j: 1.7.2
* jackrabbit: 2.5.2
* junit: 4.11
* activemq: 5.7.0
* camel: 2.10.3
* hadoop: 1.1.1
Modified:
james/server/trunk/container-spring/pom.xml
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java
james/server/trunk/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java
james/server/trunk/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java
james/server/trunk/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java
james/server/trunk/data/data-jdbc/pom.xml
james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java
james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java
james/server/trunk/data/data-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyLDAPGroupRestriction.java
james/server/trunk/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java
james/server/trunk/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java
james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
james/server/trunk/pom.xml
james/server/trunk/protocols/protocols-imap4/pom.xml
james/server/trunk/protocols/protocols-library/pom.xml
james/server/trunk/protocols/protocols-lmtp/pom.xml
james/server/trunk/protocols/protocols-pop3/pom.xml
james/server/trunk/protocols/protocols-smtp/pom.xml
james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java
james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java
james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java
james/server/trunk/queue/queue-activemq/pom.xml
james/server/trunk/queue/queue-file/pom.xml
james/server/trunk/queue/queue-jms/pom.xml
james/server/trunk/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
Modified: james/server/trunk/container-spring/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/pom.xml?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/container-spring/pom.xml (original)
+++ james/server/trunk/container-spring/pom.xml Sat Jan 5 13:09:12 2013
@@ -113,6 +113,10 @@
<artifactId>commons-configuration</artifactId>
</dependency>
<dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java Sat Jan 5 13:09:12 2013
@@ -18,13 +18,6 @@
****************************************************************/
package org.apache.james.container.spring.bean.factory.mailrepositorystore;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-
import org.apache.commons.collections.map.ReferenceMap;
import org.apache.commons.configuration.CombinedConfiguration;
import org.apache.commons.configuration.ConfigurationException;
@@ -38,6 +31,12 @@ import org.apache.james.mailrepository.a
import org.slf4j.Logger;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Provides a registry of mail repositories. A mail repository is uniquely
* identified by its destinationURL, type and model.
@@ -70,8 +69,7 @@ public class MailRepositoryStoreBeanFact
private Logger logger;
/**
- * @see
- * org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
+ * @see org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
*/
public void configure(HierarchicalConfiguration configuration) throws ConfigurationException {
this.configuration = configuration;
@@ -87,8 +85,8 @@ public class MailRepositoryStoreBeanFact
classes = new HashMap<String, String>();
defaultConfigs = new HashMap<String, HierarchicalConfiguration>();
List<HierarchicalConfiguration> registeredClasses = configuration.configurationsAt("mailrepositories.mailrepository");
- for (int i = 0; i < registeredClasses.size(); i++) {
- registerRepository(registeredClasses.get(i));
+ for (HierarchicalConfiguration registeredClass : registeredClasses) {
+ registerRepository(registeredClass);
}
}
@@ -98,16 +96,14 @@ public class MailRepositoryStoreBeanFact
* Registers a new mail repository type in the mail store's registry based
* upon a passed in <code>Configuration</code> object.
* </p>
- *
+ * <p/>
* <p>
* This is presumably synchronized to prevent corruption of the internal
* registry.
* </p>
- *
- * @param repConf
- * the Configuration object used to register the repository
- * @throws ConfigurationException
- * if an error occurs accessing the Configuration object
+ *
+ * @param repConf the Configuration object used to register the repository
+ * @throws ConfigurationException if an error occurs accessing the Configuration object
*/
@SuppressWarnings("unchecked")
public synchronized void registerRepository(HierarchicalConfiguration repConf) throws ConfigurationException {
@@ -116,12 +112,7 @@ public class MailRepositoryStoreBeanFact
boolean infoEnabled = getLogger().isInfoEnabled();
- List<String> protocols = repConf.getList("protocols.protocol");
-
- for (int i = 0; i < protocols.size(); i++) {
-
- String protocol = protocols.get(i);
-
+ for (String protocol : repConf.getStringArray("protocols.protocol")) {
HierarchicalConfiguration defConf = null;
if (repConf.getKeys("config").hasNext()) {
@@ -130,21 +121,25 @@ public class MailRepositoryStoreBeanFact
defConf = repConf.configurationAt("config");
}
- String key = protocol;
-
if (infoEnabled) {
- StringBuffer infoBuffer = new StringBuffer(128).append("Registering Repository instance of class ").append(className).append(" to handle ").append(protocol).append(" protocol requests for repositories with key ").append(key);
+ StringBuilder infoBuffer = new StringBuilder(128);
+ infoBuffer.append("Registering Repository instance of class ");
+ infoBuffer.append(className);
+ infoBuffer.append(" to handle ");
+ infoBuffer.append(protocol);
+ infoBuffer.append(" protocol requests for repositories with key ");
+ infoBuffer.append(protocol);
getLogger().info(infoBuffer.toString());
}
- if (classes.get(key) != null) {
+ if (classes.get(protocol) != null) {
throw new ConfigurationException("The combination of protocol and type comprise a unique key for repositories. This constraint has been violated. Please check your repository configuration.");
}
- classes.put(key, className);
+ classes.put(protocol, className);
if (defConf != null) {
- defaultConfigs.put(key, defConf);
+ defaultConfigs.put(protocol, defConf);
}
}
@@ -153,7 +148,7 @@ public class MailRepositoryStoreBeanFact
/**
* This method accept a Configuration object as hint and return the
* corresponding MailRepository. The Configuration must be in the form of:
- *
+ * <p/>
* <pre>
* <repository destinationURL="[URL of this mail repository]"
* type="[repository type ex. OBJECT or STREAM or MAIL etc.]"
@@ -161,26 +156,21 @@ public class MailRepositoryStoreBeanFact
* [addition configuration]
* </repository>
* </pre>
- *
- * @param destination
- * the destinationURL used to look up the repository
+ *
+ * @param destination the destinationURL used to look up the repository
* @return the selected repository
- * @throws MailRepositoryStoreException
- * if any error occurs while parsing the Configuration or
- * retrieving the MailRepository
+ * @throws MailRepositoryStoreException if any error occurs while parsing the Configuration or
+ * retrieving the MailRepository
*/
public synchronized MailRepository select(String destination) throws MailRepositoryStoreException {
-
- String protocol = null;
-
int idx = destination.indexOf(':');
if (idx == -1)
throw new MailRepositoryStoreException("Destination is malformed. Must be a valid URL: " + destination);
- protocol = destination.substring(0, idx);
+ String protocol = destination.substring(0, idx);
String repID = destination;
MailRepository reply = repositories.get(repID);
- StringBuffer logBuffer = null;
+ StringBuffer logBuffer;
if (reply != null) {
if (getLogger().isDebugEnabled()) {
logBuffer = new StringBuffer(128).append("obtained repository: ").append(repID).append(",").append(reply.getClass());
@@ -188,10 +178,9 @@ public class MailRepositoryStoreBeanFact
}
return reply;
} else {
- String key = protocol;
- String repClass = (String) classes.get(key);
+ String repClass = classes.get(protocol);
if (getLogger().isDebugEnabled()) {
- logBuffer = new StringBuffer(128).append("obtained repository: ").append(repClass).append(" to handle: ").append(protocol).append(" with key ").append(key);
+ logBuffer = new StringBuffer(128).append("obtained repository: ").append(repClass).append(" to handle: ").append(protocol).append(" with key ").append(protocol);
getLogger().debug(logBuffer.toString());
}
@@ -200,7 +189,7 @@ public class MailRepositoryStoreBeanFact
// and the values in the selector.
// If no default values, just use the selector.
final CombinedConfiguration config = new CombinedConfiguration();
- HierarchicalConfiguration defConf = defaultConfigs.get(key);
+ HierarchicalConfiguration defConf = defaultConfigs.get(protocol);
if (defConf != null) {
config.addConfiguration(defConf);
}
@@ -221,7 +210,7 @@ public class MailRepositoryStoreBeanFact
((Configurable) reply).configure(config);
}
- reply = (MailRepository) getBeanFactory().initializeBean(reply, key);
+ reply = (MailRepository) getBeanFactory().initializeBean(reply, protocol);
repositories.put(repID, reply);
if (getLogger().isInfoEnabled()) {
Modified: james/server/trunk/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java (original)
+++ james/server/trunk/data/data-file/src/main/java/org/apache/james/domainlist/xml/XMLDomainList.java Sat Jan 5 13:09:12 2013
@@ -19,64 +19,50 @@
package org.apache.james.domainlist.xml;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.james.domainlist.api.DomainListException;
import org.apache.james.domainlist.lib.AbstractDomainList;
import org.apache.james.lifecycle.api.Configurable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
/**
* Mimic the old behavior of JAMES
*/
public class XMLDomainList extends AbstractDomainList implements Configurable {
- private List<String> domainNames = new ArrayList<String>();
+ private final List<String> domainNames = new ArrayList<String>();
private boolean managementDisabled = false;
- /**
- * @see
- * org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
- */
- @SuppressWarnings("unchecked")
+ @Override
public void configure(HierarchicalConfiguration config) throws ConfigurationException {
super.configure(config);
- List<String> serverNameConfs = config.getList("domainnames.domainname");
- for (int i = 0; i < serverNameConfs.size(); i++) {
+ for (String serverNameConf : config.getStringArray("domainnames.domainname")) {
try {
- addDomain(serverNameConfs.get(i));
+ addDomain(serverNameConf);
} catch (DomainListException e) {
throw new ConfigurationException("Unable to add domain to memory", e);
}
}
managementDisabled = true;
-
}
- /**
- * @see org.apache.james.domainlist.lib.AbstractDomainList#getDomainListInternal()
- */
+ @Override
protected List<String> getDomainListInternal() {
-
return new ArrayList<String>(domainNames);
}
- /**
- * @see org.apache.james.domainlist.api.DomainList#containsDomain(java.lang.String)
- */
+ @Override
public boolean containsDomain(String domains) throws DomainListException {
return domainNames.contains(domains);
}
- /**
- * @see
- * org.apache.james.domainlist.api.DomainList#addDomain(java.lang.String)
- */
+ @Override
public void addDomain(String domain) throws DomainListException {
// TODO: Remove later. Temporary fix to get sure no domains can be added
// to the XMLDomainList
@@ -87,13 +73,9 @@ public class XMLDomainList extends Abstr
if (containsDomain(newDomain) == false) {
domainNames.add(newDomain);
}
-
}
- /**
- * @see
- * org.apache.james.domainlist.api.DomainList#removeDomain(java.lang.String)
- */
+ @Override
public void removeDomain(String domain) throws DomainListException {
// TODO: Remove later. Temporary fix to get sure no domains can be added
// to the XMLDomainList
Modified: james/server/trunk/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java (original)
+++ james/server/trunk/data/data-file/src/main/java/org/apache/james/rrt/file/XMLRecipientRewriteTable.java Sat Jan 5 13:09:12 2013
@@ -18,18 +18,18 @@
****************************************************************/
package org.apache.james.rrt.file;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
+import com.google.common.collect.Maps;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.james.rrt.api.RecipientRewriteTableException;
import org.apache.james.rrt.lib.AbstractRecipientRewriteTable;
import org.apache.james.rrt.lib.RecipientRewriteTableUtil;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* Class responsible to implement the Virtual User Table in XML disk file.
*/
@@ -40,30 +40,20 @@ public class XMLRecipientRewriteTable ex
*/
private Map<String, String> mappings;
- /**
- * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTable#doConfigure(org.apache.commons.configuration.HierarchicalConfiguration)
- */
- @SuppressWarnings("unchecked")
+ @Override
protected void doConfigure(HierarchicalConfiguration arg0) throws ConfigurationException {
-
- List<String> mapConf = arg0.getList("mapping");
-
- mappings = new HashMap<String, String>();
-
- if (mapConf != null && mapConf.size() > 0) {
- for (int i = 0; i < mapConf.size(); i++) {
- mappings.putAll(RecipientRewriteTableUtil.getXMLMappings(mapConf.get(i)));
+ String[] mapConf = arg0.getStringArray("mapping");
+ mappings = Maps.newHashMap();
+ if (mapConf != null && mapConf.length > 0) {
+ for (String aMapConf : mapConf) {
+ mappings.putAll(RecipientRewriteTableUtil.getXMLMappings(aMapConf));
}
} else {
throw new ConfigurationException("No mapping configured");
}
-
}
- /**
- * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTable#mapAddressInternal(java.lang.String,
- * java.lang.String)
- */
+ @Override
protected String mapAddressInternal(String user, String domain) throws RecipientRewriteTableException {
if (mappings == null) {
return null;
@@ -72,10 +62,7 @@ public class XMLRecipientRewriteTable ex
}
}
- /**
- * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTable#getUserDomainMappingsInternal(java.lang.String,
- * java.lang.String)
- */
+ @Override
protected Collection<String> getUserDomainMappingsInternal(String user, String domain) throws RecipientRewriteTableException {
if (mappings == null) {
return null;
@@ -89,9 +76,7 @@ public class XMLRecipientRewriteTable ex
}
}
- /**
- * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTable#getAllMappingsInternal()
- */
+ @Override
protected Map<String, Collection<String>> getAllMappingsInternal() throws RecipientRewriteTableException {
if (mappings != null && mappings.size() > 0) {
Map<String, Collection<String>> mappingsNew = new HashMap<String, Collection<String>>();
@@ -115,5 +100,4 @@ public class XMLRecipientRewriteTable ex
protected void removeMappingInternal(String user, String domain, String mapping) throws RecipientRewriteTableException {
throw new RecipientRewriteTableException("Read-Only implementation");
}
-
}
Modified: james/server/trunk/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java (original)
+++ james/server/trunk/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java Sat Jan 5 13:09:12 2013
@@ -18,9 +18,6 @@
****************************************************************/
package org.apache.james.rrt.file;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.james.rrt.api.RecipientRewriteTable;
import org.apache.james.rrt.api.RecipientRewriteTableException;
@@ -30,12 +27,16 @@ import org.apache.james.rrt.lib.Recipien
import org.junit.Before;
import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
/**
* Test the XML Virtual User Table implementation.
*/
public class XMLRecipientRewriteTableTest extends AbstractRecipientRewriteTableTest {
- private DefaultConfigurationBuilder defaultConfiguration = new DefaultConfigurationBuilder();
+ private final DefaultConfigurationBuilder defaultConfiguration = new DefaultConfigurationBuilder();
@Before
@Override
@@ -51,11 +52,6 @@ public class XMLRecipientRewriteTableTes
return localVirtualUserTable;
}
- /**
- * @throws RecipientRewriteTableException
- * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest#addMapping(java.lang.String,
- * java.lang.String, java.lang.String, int)
- */
@Override
protected boolean addMapping(String user, String domain, String mapping, int type) throws
RecipientRewriteTableException {
@@ -86,22 +82,13 @@ public class XMLRecipientRewriteTableTes
try {
virtualUserTable.configure(defaultConfiguration);
} catch (Exception e) {
- if (mappings.size() > 0) {
- return false;
- } else {
- return true;
- }
+ return mappings.size() <= 0;
}
return true;
}
- /**
- * @throws RecipientRewriteTableException
- * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest#removeMapping(java.lang.String,
- * java.lang.String, java.lang.String, int)
- */
@Override
protected boolean removeMapping(String user, String domain, String mapping, int type) throws
RecipientRewriteTableException {
@@ -132,25 +119,15 @@ public class XMLRecipientRewriteTableTes
try {
virtualUserTable.configure(defaultConfiguration);
} catch (Exception e) {
- if (mappings.size() > 0) {
- return false;
- } else {
- return true;
- }
+ return mappings.size() <= 0;
}
-
return true;
-
}
- @SuppressWarnings("unchecked")
private void removeMappingsFromConfig(String user, String domain, Collection<String> mappings) {
- List<String> confs = defaultConfiguration.getList("mapping");
List<String> stored = new ArrayList<String>();
- for (int i = 0; i < confs.size(); i++) {
- String c = confs.get(i);
+ for (String c : defaultConfiguration.getStringArray("mapping")) {
String mapping = user + "@" + domain + "=" + RecipientRewriteTableUtil.CollectionToMapping(mappings);
-
if (!c.equalsIgnoreCase(mapping)) {
stored.add(c);
}
@@ -158,8 +135,8 @@ public class XMLRecipientRewriteTableTes
// clear old values
defaultConfiguration.clear();
// add stored mappings
- for (int i = 0; i < stored.size(); i++) {
- defaultConfiguration.addProperty("mapping", stored.get(i));
+ for (String aStored : stored) {
+ defaultConfiguration.addProperty("mapping", aStored);
}
}
}
Modified: james/server/trunk/data/data-jdbc/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-jdbc/pom.xml?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/data/data-jdbc/pom.xml (original)
+++ james/server/trunk/data/data-jdbc/pom.xml Sat Jan 5 13:09:12 2013
@@ -88,6 +88,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.james</groupId>
<artifactId>james-server-data-library</artifactId>
<type>test-jar</type>
Modified: james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java (original)
+++ james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java Sat Jan 5 13:09:12 2013
@@ -52,12 +52,6 @@ public class DefaultUsersJdbcRepositoryT
return res;
}
- /**
- * @param res
- * @param tableString
- * @throws Exception
- * @throws ConfigurationException
- */
protected void configureAbstractJdbcUsersRepository(AbstractJdbcUsersRepository res, String tableString) throws Exception, ConfigurationException {
res.setFileSystem(new MockFileSystem());
DataSource dataSource = getDataSource();
@@ -81,13 +75,7 @@ public class DefaultUsersJdbcRepositoryT
return ds;
}
- /**
- * @return
- */
- protected boolean getCheckCase() {
- return true;
- }
-
+ @Override
protected void disposeUsersRepository() throws UsersRepositoryException {
Iterator<String> i = this.usersRepository.list();
while (i.hasNext()) {
Modified: james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java (original)
+++ james/server/trunk/data/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java Sat Jan 5 13:09:12 2013
@@ -19,11 +19,6 @@
package org.apache.james.user.jdbc;
-import java.util.Iterator;
-
-import javax.sql.DataSource;
-
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.derby.jdbc.EmbeddedDriver;
@@ -33,6 +28,9 @@ import org.apache.james.user.api.UsersRe
import org.apache.james.user.api.UsersRepositoryException;
import org.slf4j.LoggerFactory;
+import javax.sql.DataSource;
+import java.util.Iterator;
+
/**
* Test basic behaviors of UsersFileRepository
*/
@@ -40,7 +38,7 @@ public class JamesUsersJdbcRepositoryTes
/**
* Create the repository to be tested.
- *
+ *
* @return the user repository
* @throws Exception
*/
@@ -52,13 +50,7 @@ public class JamesUsersJdbcRepositoryTes
return res;
}
- /**
- * @param res
- * @param tableString
- * @throws Exception
- * @throws ConfigurationException
- */
- protected void configureAbstractJdbcUsersRepository(AbstractJdbcUsersRepository res, String tableString) throws Exception, ConfigurationException {
+ protected void configureAbstractJdbcUsersRepository(AbstractJdbcUsersRepository res, String tableString) throws Exception {
res.setFileSystem(new MockFileSystem());
DataSource dataSource = getDataSource();
res.setDatasource(dataSource);
@@ -79,17 +71,11 @@ public class JamesUsersJdbcRepositoryTes
return ds;
}
- /**
- * @return
- */
- protected boolean getCheckCase() {
- return true;
- }
-
+ @Override
protected void disposeUsersRepository() throws UsersRepositoryException {
Iterator<String> i = this.usersRepository.list();
while (i.hasNext()) {
- this.usersRepository.removeUser((String) i.next());
+ this.usersRepository.removeUser(i.next());
}
LifecycleUtil.dispose(this.usersRepository);
}
Modified: james/server/trunk/data/data-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyLDAPGroupRestriction.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyLDAPGroupRestriction.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/data/data-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyLDAPGroupRestriction.java (original)
+++ james/server/trunk/data/data-ldap/src/main/java/org/apache/james/user/ldap/ReadOnlyLDAPGroupRestriction.java Sat Jan 5 13:09:12 2013
@@ -18,20 +18,19 @@
****************************************************************/
package org.apache.james.user.ldap;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import org.apache.commons.configuration.HierarchicalConfiguration;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.ldap.LdapContext;
-
-import org.apache.commons.configuration.HierarchicalConfiguration;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
/**
* <p>
@@ -40,7 +39,7 @@ import org.apache.commons.configuration.
* <code><users-store></code> configuration child-element
* <code><restriction><code>.
* </p>
- *
+ *
* @see ReadOnlyUsersLDAPRepository
* @see ReadOnlyLDAPUser
*/
@@ -62,18 +61,15 @@ public class ReadOnlyLDAPGroupRestrictio
/**
* Initialises an instance from the contents of a
- * <code><restriction><code> configuration XML
+ * <code><restriction><code> configuration XML
* element.
- *
- * @param configuration
- * The avalon configuration instance that encapsulates the
- * contents of the <code><restriction><code> XML element.
- *
- * @throws ConfigurationException
- * If an error occurs extracting values from the configuration
- * element.
+ *
+ * @param configuration The avalon configuration instance that encapsulates the
+ * contents of the <code><restriction><code> XML element.
+ * @throws org.apache.commons.configuration.ConfigurationException
+ * If an error occurs extracting values from the configuration
+ * element.
*/
- @SuppressWarnings("unchecked")
public ReadOnlyLDAPGroupRestriction(HierarchicalConfiguration configuration) {
groupDNs = new ArrayList<String>();
@@ -81,11 +77,7 @@ public class ReadOnlyLDAPGroupRestrictio
memberAttribute = configuration.getString("[@memberAttribute]");
if (configuration.getKeys("group").hasNext()) {
- List<String> groupNames = configuration.getList("group");
-
- for (int i = 0; i < groupNames.size(); i++) {
- groupDNs.add(groupNames.get(i));
- }
+ Collections.addAll(groupDNs, configuration.getStringArray("group"));
}
}
}
@@ -93,7 +85,7 @@ public class ReadOnlyLDAPGroupRestrictio
/**
* Indicates if group/role-based restriction is enabled for the the
* user-store, based on the information encapsulated in the instance.
- *
+ *
* @return <code>True</code> If there list of group/role distinguished names
* is not empty, and <code>false</code> otherwise.
*/
@@ -103,7 +95,7 @@ public class ReadOnlyLDAPGroupRestrictio
/**
* Converts an instance of this type to a string.
- *
+ *
* @return A string representation of the instance.
*/
public String toString() {
@@ -116,23 +108,15 @@ public class ReadOnlyLDAPGroupRestrictio
* of <code>"<groupDN>=<
* [userDN1,userDN2,...,userDNn]>"</code>. Put differently, each
* <code>groupDN</code> is associated to a list of <code>userDNs</code>.
- *
- * @param connection
- * The connection to the LDAP directory server.
+ *
* @return Returns a map of groupDNs to userDN lists.
- * @throws NamingException
- * Propagated from underlying LDAP communication layer.
+ * @throws NamingException Propagated from underlying LDAP communication layer.
*/
protected Map<String, Collection<String>> getGroupMembershipLists(LdapContext ldapContext) throws NamingException {
Map<String, Collection<String>> result = new HashMap<String, Collection<String>>();
- Iterator<String> groupDNsIterator = groupDNs.iterator();
-
- Attributes groupAttributes;
- while (groupDNsIterator.hasNext()) {
- String groupDN = (String) groupDNsIterator.next();
- groupAttributes = ldapContext.getAttributes(groupDN);
- result.put(groupDN, extractMembers(groupAttributes));
+ for (String groupDN : groupDNs) {
+ result.put(groupDN, extractMembers(ldapContext.getAttributes(groupDN)));
}
return result;
@@ -143,13 +127,11 @@ public class ReadOnlyLDAPGroupRestrictio
* attributes. This is achieved by extracting all the values of the LDAP
* attribute, with name equivalent to the field value
* {@link #memberAttribute}, from the attributes collection.
- *
- * @param groupAttributes
- * The attributes taken from the group's LDAP context.
+ *
+ * @param groupAttributes The attributes taken from the group's LDAP context.
* @return A collection of distinguished-names for the users belonging to
* the group with the specified attributes.
- * @throws NamingException
- * Propagated from underlying LDAP communication layer.
+ * @throws NamingException Propagated from underlying LDAP communication layer.
*/
private Collection<String> extractMembers(Attributes groupAttributes) throws NamingException {
Collection<String> result = new ArrayList<String>();
Modified: james/server/trunk/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java (original)
+++ james/server/trunk/data/data-library/src/test/java/org/apache/james/user/lib/AbstractUsersRepositoryTest.java Sat Jan 5 13:09:12 2013
@@ -200,7 +200,7 @@ public abstract class AbstractUsersRepos
*
* @throws UsersRepositoryException
*/
- private void disposeUsersRepository() throws UsersRepositoryException {
+ protected void disposeUsersRepository() throws UsersRepositoryException {
if (usersRepository != null) {
LifecycleUtil.dispose(this.usersRepository);
}
Modified: james/server/trunk/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java
URL: http://svn.apache.org/viewvc/james/server/trunk/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java (original)
+++ james/server/trunk/dns-service/dnsservice-dnsjava/src/main/java/org/apache/james/dnsservice/dnsjava/DNSJavaService.java Sat Jan 5 13:09:12 2013
@@ -18,22 +18,10 @@
****************************************************************/
package org.apache.james.dnsservice.dnsjava;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.james.dnsservice.api.DNSServiceMBean;
import org.apache.james.dnsservice.api.DNSService;
+import org.apache.james.dnsservice.api.DNSServiceMBean;
import org.apache.james.dnsservice.api.TemporaryResolutionException;
import org.apache.james.lifecycle.api.Configurable;
import org.apache.james.lifecycle.api.LogEnabled;
@@ -55,6 +43,16 @@ import org.xbill.DNS.TXTRecord;
import org.xbill.DNS.TextParseException;
import org.xbill.DNS.Type;
+import javax.annotation.PostConstruct;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
/**
* Provides DNS client functionality to services running inside James
*/
@@ -85,7 +83,7 @@ public class DNSJavaService implements D
/**
* The DNS servers to be used by this service
*/
- private List<String> dnsServers = new ArrayList<String>();
+ private final List<String> dnsServers = new ArrayList<String>();
/**
* The search paths to be used
@@ -95,7 +93,7 @@ public class DNSJavaService implements D
/**
* The MX Comparator used in the MX sort.
*/
- private Comparator<MXRecord> mxComparator = new MXRecordComparator();
+ private final Comparator<MXRecord> mxComparator = new MXRecordComparator();
/**
* If true register this service as the default resolver/cache for DNSJava
@@ -119,8 +117,7 @@ public class DNSJavaService implements D
}
/**
- * @see
- * org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
+ * @see org.apache.james.lifecycle.api.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
*/
@SuppressWarnings("unchecked")
public void configure(HierarchicalConfiguration configuration) throws ConfigurationException {
@@ -132,9 +129,9 @@ public class DNSJavaService implements D
logger.info("Autodiscovery is enabled - trying to discover your system's DNS Servers");
String[] serversArray = ResolverConfig.getCurrentConfig().servers();
if (serversArray != null) {
- for (int i = 0; i < serversArray.length; i++) {
- dnsServers.add(serversArray[i]);
- logger.info("Adding autodiscovered server " + serversArray[i]);
+ for (String aServersArray : serversArray) {
+ dnsServers.add(aServersArray);
+ logger.info("Adding autodiscovered server " + aServersArray);
}
}
Name[] systemSearchPath = ResolverConfig.getCurrentConfig().searchPath();
@@ -142,8 +139,7 @@ public class DNSJavaService implements D
sPaths.addAll(Arrays.asList(systemSearchPath));
}
if (logger.isInfoEnabled()) {
- for (Iterator<Name> i = sPaths.iterator(); i.hasNext();) {
- Name searchPath = i.next();
+ for (Name searchPath : sPaths) {
logger.info("Adding autodiscovered search path " + searchPath.toString());
}
}
@@ -154,24 +150,18 @@ public class DNSJavaService implements D
setAsDNSJavaDefault = configuration.getBoolean("setAsDNSJavaDefault", true);
// Get the DNS servers that this service will use for lookups
- final List<String> serversConfigurations = configuration.getList("servers.server");
-
- for (int i = 0; i < serversConfigurations.size(); i++) {
- dnsServers.add(serversConfigurations.get(i));
- }
+ Collections.addAll(dnsServers, configuration.getStringArray("servers.server"));
// Get the DNS servers that this service will use for lookups
- final List<String> searchPathsConfiguration = configuration.getList("searchpaths.searchpath");
-
- for (int i = 0; i < searchPathsConfiguration.size(); i++) {
+ for (String aSearchPathsConfiguration : configuration.getStringArray("searchpaths.searchpath")) {
try {
- sPaths.add(Name.fromString(searchPathsConfiguration.get(i)));
+ sPaths.add(Name.fromString(aSearchPathsConfiguration));
} catch (TextParseException e) {
- throw new ConfigurationException("Unable to parse searchpath host: " + searchPathsConfiguration.get(i), e);
+ throw new ConfigurationException("Unable to parse searchpath host: " + aSearchPathsConfiguration, e);
}
}
- searchPaths = (Name[]) sPaths.toArray(new Name[0]);
+ searchPaths = sPaths.toArray(new Name[sPaths.size()]);
if (dnsServers.isEmpty()) {
logger.info("No DNS servers have been specified or found by autodiscovery - adding 127.0.0.1");
@@ -201,11 +191,11 @@ public class DNSJavaService implements D
}
// Create the extended resolver...
- final String[] serversArray = (String[]) dnsServers.toArray(new String[0]);
+ final String[] serversArray = dnsServers.toArray(new String[dnsServers.size()]);
if (logger.isInfoEnabled()) {
- for (int c = 0; c < serversArray.length; c++) {
- logger.info("DNS Server is: " + serversArray[c]);
+ for (String aServersArray : serversArray) {
+ logger.info("DNS Server is: " + aServersArray);
}
}
@@ -240,16 +230,16 @@ public class DNSJavaService implements D
/**
* Return the list of DNS servers in use by this service
- *
+ *
* @return an array of DNS server names
*/
public String[] getDNSServers() {
- return (String[]) dnsServers.toArray(new String[0]);
+ return dnsServers.toArray(new String[dnsServers.size()]);
}
/**
* Return the list of DNS servers in use by this service
- *
+ *
* @return an array of DNS server names
*/
public Name[] getSearchPaths() {
@@ -259,13 +249,10 @@ public class DNSJavaService implements D
/**
* Return a prioritized unmodifiable list of MX records obtained from the
* server.
- *
- * @param hostname
- * domain name to look up
- *
+ *
+ * @param hostname domain name to look up
* @return a list of MX records corresponding to this mail domain
- * @throws TemporaryResolutionException
- * get thrown on temporary problems
+ * @throws TemporaryResolutionException get thrown on temporary problems
*/
private List<String> findMXRecordsRaw(String hostname) throws TemporaryResolutionException {
Record answers[] = lookup(hostname, Type.MX, "MX");
@@ -294,13 +281,9 @@ public class DNSJavaService implements D
if (i == 0) {
currentPrio = mx.getPriority();
} else {
- if (currentPrio == mx.getPriority()) {
- same = true;
- } else {
- same = false;
- }
+ same = currentPrio == mx.getPriority();
}
-
+
String mxRecord = mx.getTarget().toString();
if (same) {
samePrio.add(mxRecord);
@@ -309,19 +292,19 @@ public class DNSJavaService implements D
// JAMES-913
Collections.shuffle(samePrio);
servers.addAll(samePrio);
-
+
samePrio.clear();
samePrio.add(mxRecord);
-
+
}
-
+
if (lastItem) {
// shuffle entries with same prio
// JAMES-913
Collections.shuffle(samePrio);
servers.addAll(samePrio);
}
- logger.debug(new StringBuffer("Found MX record ").append(mxRecord).toString());
+ logger.debug("Found MX record " + mxRecord);
}
return servers;
}
@@ -356,15 +339,12 @@ public class DNSJavaService implements D
/**
* Looks up DNS records of the specified type for the specified name.
- *
+ * <p/>
* This method is a public wrapper for the private implementation method
- *
- * @param namestr
- * the name of the host to be looked up
- * @param type
- * the type of record desired
- * @param typeDesc
- * the description of the record type, for debugging purpose
+ *
+ * @param namestr the name of the host to be looked up
+ * @param type the type of record desired
+ * @param typeDesc the description of the record type, for debugging purpose
*/
protected Record[] lookup(String namestr, int type, String typeDesc) throws TemporaryResolutionException {
// Name name = null;
@@ -481,11 +461,11 @@ public class DNSJavaService implements D
try {
// Check if its local
if (name.equalsIgnoreCase(localHostName) || name.equalsIgnoreCase(localCanonicalHostName) || name.equals(localAddress)) {
- return new InetAddress[] { getLocalHost() };
+ return new InetAddress[]{getLocalHost()};
}
InetAddress addr = org.xbill.DNS.Address.getByAddress(name);
- return new InetAddress[] { addr };
+ return new InetAddress[]{addr};
} catch (UnknownHostException e) {
Record[] records = lookupNoException(name, Type.A, "A");
@@ -509,8 +489,8 @@ public class DNSJavaService implements D
Record[] records = lookupNoException(hostname, Type.TXT, "TXT");
if (records != null) {
- for (int i = 0; i < records.length; i++) {
- TXTRecord txt = (TXTRecord) records[i];
+ for (Record record : records) {
+ TXTRecord txt = (TXTRecord) record;
txtR.add(txt.rdataToString());
}
@@ -522,7 +502,7 @@ public class DNSJavaService implements D
* @see org.apache.james.dnsservice.api.DNSService#getHostName(java.net.InetAddress)
*/
public String getHostName(InetAddress addr) {
- String result = null;
+ String result;
Name name = ReverseMap.fromAddress(addr);
Record[] records = lookupNoException(name.toString(), Type.PTR, "PTR");
@@ -543,16 +523,14 @@ public class DNSJavaService implements D
}
/**
- * @see
- * org.apache.james.dnsservice.api.DNSServiceMBean#getMaximumCacheSize()
+ * @see org.apache.james.dnsservice.api.DNSServiceMBean#getMaximumCacheSize()
*/
public int getMaximumCacheSize() {
return maxCacheSize;
}
/**
- * @see
- * org.apache.james.dnsservice.api.DNSServiceMBean#getCurrentCacheSize()
+ * @see org.apache.james.dnsservice.api.DNSServiceMBean#getCurrentCacheSize()
*/
public int getCurrentCacheSize() {
return cache.getSize();
Modified: james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java (original)
+++ james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/FetchMail.java Sat Jan 5 13:09:12 2013
@@ -19,22 +19,10 @@
package org.apache.james.fetchmail;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.mail.MessagingException;
-import javax.mail.Session;
-
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.configuration.HierarchicalConfiguration.Node;
+import org.apache.commons.configuration.tree.ConfigurationNode;
import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.domainlist.api.DomainList;
import org.apache.james.lifecycle.api.Configurable;
@@ -44,25 +32,36 @@ import org.apache.james.user.api.UsersRe
import org.apache.james.user.api.UsersRepositoryException;
import org.slf4j.Logger;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
/**
* <p>
* Class <code>FetchMail</code> is an Avalon task that is periodically triggered
* to fetch mail from a JavaMail Message Store.
* </p>
- *
+ * <p/>
* <p>
* The lifecycle of an instance of <code>FetchMail</code> is managed by Avalon.
* The <code>configure(Configuration)</code> method is invoked to parse and
* validate Configuration properties. The targetTriggered(String) method is
* invoked to execute the task.
* </p>
- *
+ * <p/>
* <p>
* When triggered, a sorted list of Message Store Accounts to be processed is
* built. Each Message Store Account is processed by delegating to
* <code>StoreProcessor</code>.
* </p>
- *
+ * <p/>
* <p>
* There are two kinds of Message Store Accounts, static and dynamic. Static
* accounts are expliciltly declared in the Configuration. Dynamic accounts are
@@ -72,7 +71,7 @@ import org.slf4j.Logger;
* allow <code>FetchMail</code> to fetch mail for all James users without
* modifying the Configuration parameters or restarting the Avalon server.
* </p>
- *
+ * <p/>
* <p>
* To fully understand the operations supported by this task, read the Class
* documention for each Class in the delegation chain starting with this class'
@@ -130,7 +129,7 @@ public class FetchMail implements Runnab
/**
* Returns the sequenceNumber.
- *
+ *
* @return int
*/
public int getSequenceNumber() {
@@ -139,7 +138,7 @@ public class FetchMail implements Runnab
/**
* Returns the userName.
- *
+ *
* @return String
*/
public String getUserName() {
@@ -148,9 +147,8 @@ public class FetchMail implements Runnab
/**
* Sets the sequenceNumber.
- *
- * @param sequenceNumber
- * The sequenceNumber to set
+ *
+ * @param sequenceNumber The sequenceNumber to set
*/
protected void setSequenceNumber(int sequenceNumber) {
fieldSequenceNumber = sequenceNumber;
@@ -158,9 +156,8 @@ public class FetchMail implements Runnab
/**
* Sets the userName.
- *
- * @param userName
- * The userName to set
+ *
+ * @param userName The userName to set
*/
protected void setUserName(String userName) {
fieldUserName = userName;
@@ -205,7 +202,7 @@ public class FetchMail implements Runnab
/**
* Returns the custom recipient header.
- *
+ *
* @return String
*/
public String getCustomRecipientHeader() {
@@ -214,7 +211,7 @@ public class FetchMail implements Runnab
/**
* Returns the recipientprefix.
- *
+ *
* @return String
*/
public String getRecipientPrefix() {
@@ -223,7 +220,7 @@ public class FetchMail implements Runnab
/**
* Returns the recipientsuffix.
- *
+ *
* @return String
*/
public String getRecipientSuffix() {
@@ -232,7 +229,7 @@ public class FetchMail implements Runnab
/**
* Returns the userprefix.
- *
+ *
* @return String
*/
public String getUserPrefix() {
@@ -241,7 +238,7 @@ public class FetchMail implements Runnab
/**
* Returns the userSuffix.
- *
+ *
* @return String
*/
public String getUserSuffix() {
@@ -250,9 +247,8 @@ public class FetchMail implements Runnab
/**
* Sets the custom recipient header.
- *
- * @param customRecipientHeader
- * The header to be used
+ *
+ * @param customRecipientHeader The header to be used
*/
public void setCustomRecipientHeader(String customRecipientHeader) {
this.customRecipientHeader = customRecipientHeader;
@@ -260,9 +256,8 @@ public class FetchMail implements Runnab
/**
* Sets the recipientprefix.
- *
- * @param recipientprefix
- * The recipientprefix to set
+ *
+ * @param recipientprefix The recipientprefix to set
*/
protected void setRecipientPrefix(String recipientprefix) {
fieldRecipientPrefix = recipientprefix;
@@ -270,9 +265,8 @@ public class FetchMail implements Runnab
/**
* Sets the recipientsuffix.
- *
- * @param recipientsuffix
- * The recipientsuffix to set
+ *
+ * @param recipientsuffix The recipientsuffix to set
*/
protected void setRecipientSuffix(String recipientsuffix) {
fieldRecipientSuffix = recipientsuffix;
@@ -280,9 +274,8 @@ public class FetchMail implements Runnab
/**
* Sets the userprefix.
- *
- * @param userprefix
- * The userprefix to set
+ *
+ * @param userprefix The userprefix to set
*/
protected void setUserPrefix(String userprefix) {
fieldUserPrefix = userprefix;
@@ -290,9 +283,8 @@ public class FetchMail implements Runnab
/**
* Sets the userSuffix.
- *
- * @param userSuffix
- * The userSuffix to set
+ *
+ * @param userSuffix The userSuffix to set
*/
protected void setUserSuffix(String userSuffix) {
fieldUserSuffix = userSuffix;
@@ -300,7 +292,7 @@ public class FetchMail implements Runnab
/**
* Returns the password.
- *
+ *
* @return String
*/
public String getPassword() {
@@ -309,9 +301,8 @@ public class FetchMail implements Runnab
/**
* Sets the ignoreRecipientHeader.
- *
- * @param ignoreRecipientHeader
- * The ignoreRecipientHeader to set
+ *
+ * @param ignoreRecipientHeader The ignoreRecipientHeader to set
*/
protected void setIgnoreRecipientHeader(boolean ignoreRecipientHeader) {
fieldIgnoreRecipientHeader = ignoreRecipientHeader;
@@ -319,9 +310,8 @@ public class FetchMail implements Runnab
/**
* Sets the password.
- *
- * @param password
- * The password to set
+ *
+ * @param password The password to set
*/
protected void setPassword(String password) {
fieldPassword = password;
@@ -329,7 +319,7 @@ public class FetchMail implements Runnab
/**
* Returns the ignoreRecipientHeader.
- *
+ *
* @return boolean
*/
public boolean isIgnoreRecipientHeader() {
@@ -338,7 +328,7 @@ public class FetchMail implements Runnab
/**
* Returns the sequenceNumber.
- *
+ *
* @return int
*/
public int getSequenceNumber() {
@@ -347,9 +337,8 @@ public class FetchMail implements Runnab
/**
* Sets the sequenceNumber.
- *
- * @param sequenceNumber
- * The sequenceNumber to set
+ *
+ * @param sequenceNumber The sequenceNumber to set
*/
protected void setSequenceNumber(int sequenceNumber) {
fieldSequenceNumber = sequenceNumber;
@@ -357,9 +346,6 @@ public class FetchMail implements Runnab
}
- /**
- * @see org.apache.avalon.cornerstone.services.scheduler.Target#targetTriggered(String)
- */
private boolean fieldFetching = false;
/**
@@ -419,7 +405,7 @@ public class FetchMail implements Runnab
* a new <code>ParsedConfiguration</code>, an <code>Account</code> for each
* configured static account and a
* <code>ParsedDynamicAccountParameters</code> for each dynamic account.
- *
+ *
* @see org.apache.james.lifecycle.api.Configurable#configure(HierarchicalConfiguration)
*/
@SuppressWarnings("unchecked")
@@ -443,11 +429,9 @@ public class FetchMail implements Runnab
if (accounts.getKeys().hasNext() == false)
throw new ConfigurationException("Missing <account> section.");
- List<Node> accountsChildren = accounts.getRoot().getChildren();
int i = 0;
-
// Create an Account for every configured account
- for (Node accountsChild : accountsChildren) {
+ for (ConfigurationNode accountsChild : accounts.getRoot().getChildren()) {
String accountsChildName = accountsChild.getName();
@@ -475,7 +459,6 @@ public class FetchMail implements Runnab
/**
* Method target triggered fetches mail for each configured account.
- *
*/
public void run() {
// if we are already fetching then just return
@@ -510,10 +493,9 @@ public class FetchMail implements Runnab
logger.info(logMessage.toString());
// Fetch each account
- Iterator<Account> accounts = mergedAccounts.iterator();
- while (accounts.hasNext()) {
+ for (Account mergedAccount : mergedAccounts) {
try {
- new StoreProcessor(accounts.next()).process();
+ new StoreProcessor(mergedAccount).process();
} catch (MessagingException ex) {
logger.error("A MessagingException has terminated processing of this Account", ex);
}
@@ -550,7 +532,7 @@ public class FetchMail implements Runnab
/**
* Returns the fetching.
- *
+ *
* @return boolean
*/
protected boolean isFetching() {
@@ -559,9 +541,8 @@ public class FetchMail implements Runnab
/**
* Sets the fetching.
- *
- * @param fetching
- * The fetching to set
+ *
+ * @param fetching The fetching to set
*/
protected void setFetching(boolean fetching) {
fieldFetching = fetching;
@@ -569,7 +550,7 @@ public class FetchMail implements Runnab
/**
* Returns the configuration.
- *
+ *
* @return ParsedConfiguration
*/
protected ParsedConfiguration getConfiguration() {
@@ -578,9 +559,8 @@ public class FetchMail implements Runnab
/**
* Sets the configuration.
- *
- * @param configuration
- * The configuration to set
+ *
+ * @param configuration The configuration to set
*/
protected void setParsedConfiguration(ParsedConfiguration configuration) {
fieldConfiguration = configuration;
@@ -588,7 +568,7 @@ public class FetchMail implements Runnab
/**
* Returns the localUsers.
- *
+ *
* @return UsersRepository
*/
protected UsersRepository getLocalUsers() {
@@ -597,7 +577,7 @@ public class FetchMail implements Runnab
/**
* Returns the DNSService.
- *
+ *
* @return DNSService
*/
protected DNSService getDNSService() {
@@ -618,7 +598,7 @@ public class FetchMail implements Runnab
/**
* Returns the accounts. Initializes if required.
- *
+ *
* @return List
*/
protected List<Account> getStaticAccounts() {
@@ -631,7 +611,7 @@ public class FetchMail implements Runnab
/**
* Returns the staticAccounts.
- *
+ *
* @return List
*/
private List<Account> getStaticAccountsBasic() {
@@ -640,9 +620,8 @@ public class FetchMail implements Runnab
/**
* Sets the accounts.
- *
- * @param accounts
- * The accounts to set
+ *
+ * @param accounts The accounts to set
*/
protected void setStaticAccounts(List<Account> accounts) {
fieldStaticAccounts = accounts;
@@ -701,7 +680,7 @@ public class FetchMail implements Runnab
// Process each ParsedDynamicParameters
while (parameterIterator.hasNext()) {
- Map<DynamicAccountKey, DynamicAccount> accounts = computeDynamicAccounts(oldAccounts, (ParsedDynamicAccountParameters) parameterIterator.next());
+ Map<DynamicAccountKey, DynamicAccount> accounts = computeDynamicAccounts(oldAccounts, parameterIterator.next());
// Remove accounts from oldAccounts.
// This avoids an average 2*N increase in heapspace used as the
// newAccounts are created.
@@ -718,7 +697,7 @@ public class FetchMail implements Runnab
/**
* Returns the dynamicAccounts. Initializes if required.
- *
+ *
* @return Map
*/
protected Map<DynamicAccountKey, DynamicAccount> getDynamicAccounts() throws ConfigurationException {
@@ -731,7 +710,7 @@ public class FetchMail implements Runnab
/**
* Returns the dynamicAccounts.
- *
+ *
* @return Map
*/
private Map<DynamicAccountKey, DynamicAccount> getDynamicAccountsBasic() {
@@ -740,9 +719,8 @@ public class FetchMail implements Runnab
/**
* Sets the dynamicAccounts.
- *
- * @param dynamicAccounts
- * The dynamicAccounts to set
+ *
+ * @param dynamicAccounts The dynamicAccounts to set
*/
protected void setDynamicAccounts(Map<DynamicAccountKey, DynamicAccount> dynamicAccounts) {
fieldDynamicAccounts = dynamicAccounts;
@@ -751,7 +729,7 @@ public class FetchMail implements Runnab
/**
* Compute the dynamicAccounts for the passed parameters. Accounts for
* existing users are copied and accounts for new users are created.
- *
+ *
* @param oldAccounts
* @param parameters
* @return Map - The current Accounts
@@ -791,7 +769,7 @@ public class FetchMail implements Runnab
/**
* Returns the ParsedDynamicAccountParameters.
- *
+ *
* @return List
*/
protected List<ParsedDynamicAccountParameters> getParsedDynamicAccountParameters() {
@@ -804,7 +782,7 @@ public class FetchMail implements Runnab
/**
* Returns the ParsedDynamicAccountParameters.
- *
+ *
* @return List
*/
private List<ParsedDynamicAccountParameters> getParsedDynamicAccountParametersBasic() {
@@ -813,9 +791,8 @@ public class FetchMail implements Runnab
/**
* Sets the ParsedDynamicAccountParameters.
- *
- * @param parsedDynamicAccountParameters
- * The ParsedDynamicAccountParameters to set
+ *
+ * @param parsedDynamicAccountParameters The ParsedDynamicAccountParameters to set
*/
protected void setParsedDynamicAccountParameters(List<ParsedDynamicAccountParameters> parsedDynamicAccountParameters) {
fieldParsedDynamicAccountParameters = parsedDynamicAccountParameters;
@@ -823,11 +800,11 @@ public class FetchMail implements Runnab
/**
* Returns the session, lazily initialized if required.
- *
+ *
* @return Session
*/
protected Session getSession() {
- Session session = null;
+ Session session;
if (null == (session = getSessionBasic())) {
updateSession();
return getSession();
@@ -837,7 +814,7 @@ public class FetchMail implements Runnab
/**
* Returns the session.
- *
+ *
* @return Session
*/
private Session getSessionBasic() {
@@ -846,7 +823,7 @@ public class FetchMail implements Runnab
/**
* Answers a new Session.
- *
+ *
* @return Session
*/
protected Session computeSession() {
@@ -865,9 +842,8 @@ public class FetchMail implements Runnab
/**
* Sets the session.
- *
- * @param session
- * The session to set
+ *
+ * @param session The session to set
*/
protected void setSession(Session session) {
fieldSession = session;
@@ -875,9 +851,8 @@ public class FetchMail implements Runnab
/**
* Propagate any Session parameters in the configuration to the Session.
- *
- * @param configuration
- * The configuration containing the parameters
+ *
+ * @param configuration The configuration containing the parameters
* @throws ConfigurationException
*/
@SuppressWarnings("unchecked")
@@ -886,8 +861,7 @@ public class FetchMail implements Runnab
if (configuration.getKeys("javaMailProperties.property").hasNext()) {
Properties properties = getSession().getProperties();
List<HierarchicalConfiguration> allProperties = configuration.configurationsAt("javaMailProperties.property");
- for (int i = 0; i < allProperties.size(); i++) {
- HierarchicalConfiguration propConf = allProperties.get(i);
+ for (HierarchicalConfiguration propConf : allProperties) {
properties.setProperty(propConf.getString("[@name]"), propConf.getString("[@value]"));
if (logger.isDebugEnabled()) {
StringBuilder messageBuffer = new StringBuilder("Set property name: ");
Modified: james/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/pom.xml?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/pom.xml (original)
+++ james/server/trunk/pom.xml Sat Jan 5 13:09:12 2013
@@ -94,57 +94,57 @@
</distributionManagement>
<properties>
- <activemq.version>5.4.2</activemq.version>
- <camel.version>2.10.1</camel.version>
- <derby.version>10.7.1.1</derby.version>
- <hadoop.version>1.0.1</hadoop.version>
+ <activemq.version>5.7.0</activemq.version>
+ <camel.version>2.10.3</camel.version>
+ <derby.version>10.9.1.0</derby.version>
+ <hadoop.version>1.1.1</hadoop.version>
<hbase.version>0.92.0</hbase.version>
<imap.version>0.4-SNAPSHOT</imap.version>
<javax.mail.groupId>org.apache.geronimo.javamail</javax.mail.groupId>
<javax.mail.artifactId>geronimo-javamail_1.4_mail</javax.mail.artifactId>
<javax.activation.groupId>org.apache.geronimo.specs</javax.activation.groupId>
<javax.activation.artifactId>geronimo-activation_1.1_spec</javax.activation.artifactId>
- <jackrabbit.version>2.2.5</jackrabbit.version>
+ <jackrabbit.version>2.5.2</jackrabbit.version>
<jsieve.version>0.6-SNAPSHOT</jsieve.version>
<mailbox.version>0.5-SNAPSHOT</mailbox.version>
<mailet.version>2.5.0</mailet.version>
<productName>Apache-James Mail Server</productName>
<protocols.version>1.6.3-SNAPSHOT</protocols.version>
<spring.version>3.1.0.RELEASE</spring.version>
- <geronimo-jms-spec.version>1.0</geronimo-jms-spec.version>
+ <geronimo-jms-spec.version>1.1.1</geronimo-jms-spec.version>
<h2.version>1.3.170</h2.version>
<apache-jspf-resolver.version>1.0.0</apache-jspf-resolver.version>
<mail.version>1.4.4</mail.version>
<javax-activation.version>1.1.1</javax-activation.version>
<geronimo-activation-spec.version>1.1</geronimo-activation-spec.version>
<geronimo-javamail.version>1.8.3</geronimo-javamail.version>
- <commons-daemon.version>1.0.5</commons-daemon.version>
+ <slf4j.version>1.7.2</slf4j.version>
+ <servlet-api.version>2.4</servlet-api.version>
+ <commons-daemon.version>1.0.10</commons-daemon.version>
<commons-collections.version>3.2.1</commons-collections.version>
<commons-lang.version>2.6</commons-lang.version>
<commons-codec.version>1.7</commons-codec.version>
- <slf4j.version>1.6.1</slf4j.version>
<commons-cli.version>1.2</commons-cli.version>
- <servlet-api.version>2.4</servlet-api.version>
- <commons-pool.version>1.5.5</commons-pool.version>
- <commons-configuration.version>1.6</commons-configuration.version>
+ <commons-pool.version>1.6</commons-pool.version>
+ <commons-configuration.version>1.9</commons-configuration.version>
<commons-dbcp.version>1.4</commons-dbcp.version>
- <commons-net.version>3.0</commons-net.version>
+ <commons-net.version>3.2</commons-net.version>
+ <commons-beanutils-core.version>1.8.3</commons-beanutils-core.version>
+ <commons-io.version>2.4</commons-io.version>
<dnsjava.version>2.1.1</dnsjava.version>
- <junit.version>4.10</junit.version>
- <jmock.version>1.1.0</jmock.version>
+ <junit.version>4.11</junit.version>
+ <jmock.version>2.6.0</jmock.version>
<concurrent.version>1.3.4</concurrent.version>
- <commons-beanutils-core.version>1.8.3</commons-beanutils-core.version>
- <commons-io.version>2.0.1</commons-io.version>
- <log4j.version>1.2.16</log4j.version>
- <openjpa.version>2.2.0</openjpa.version>
- <geronimo-jpa-spec.version>1.0</geronimo-jpa-spec.version>
+ <log4j.version>1.2.17</log4j.version>
+ <openjpa.version>2.2.1</openjpa.version>
+ <geronimo-jpa-spec.version>1.1</geronimo-jpa-spec.version>
<jcr.version>2.0</jcr.version>
- <tika-parsers.version>0.8</tika-parsers.version>
- <xbean-spring.version>3.6</xbean-spring.version>
+ <tika-parsers.version>1.2</tika-parsers.version>
+ <xbean-spring.version>3.12</xbean-spring.version>
<netty.version>3.3.1.Final</netty.version>
<geronimo-annotation_1.1_spec.version>1.0.1</geronimo-annotation_1.1_spec.version>
<spring-osgi-extender.version>1.2.1</spring-osgi-extender.version>
- <org.osgi.core.version>4.2.0</org.osgi.core.version>
+ <org.osgi.core.version>5.0.0</org.osgi.core.version>
<guava.version>13.0</guava.version>
</properties>
@@ -688,6 +688,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons-lang.version}</version>
@@ -1081,6 +1087,18 @@
</dependencies>
</dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
<build>
<plugins>
<plugin>
@@ -1093,6 +1111,14 @@
<artifactId>versions-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- During release:perform, enable the "release" profile -->
+ <releaseProfiles>with-assembly</releaseProfiles>
+ <goals>deploy assembly:single</goals>
+ </configuration>
+ </plugin>
</plugins>
</build>
Modified: james/server/trunk/protocols/protocols-imap4/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols/protocols-imap4/pom.xml?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/protocols/protocols-imap4/pom.xml (original)
+++ james/server/trunk/protocols/protocols-imap4/pom.xml Sat Jan 5 13:09:12 2013
@@ -63,6 +63,11 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</dependency>
Modified: james/server/trunk/protocols/protocols-library/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols/protocols-library/pom.xml?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/protocols/protocols-library/pom.xml (original)
+++ james/server/trunk/protocols/protocols-library/pom.xml Sat Jan 5 13:09:12 2013
@@ -68,7 +68,7 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
- <artifactId>slf4j-nop</artifactId>
+ <artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Modified: james/server/trunk/protocols/protocols-lmtp/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols/protocols-lmtp/pom.xml?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/protocols/protocols-lmtp/pom.xml (original)
+++ james/server/trunk/protocols/protocols-lmtp/pom.xml Sat Jan 5 13:09:12 2013
@@ -102,6 +102,11 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</dependency>
Modified: james/server/trunk/protocols/protocols-pop3/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols/protocols-pop3/pom.xml?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/protocols/protocols-pop3/pom.xml (original)
+++ james/server/trunk/protocols/protocols-pop3/pom.xml Sat Jan 5 13:09:12 2013
@@ -60,6 +60,11 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</dependency>
Modified: james/server/trunk/protocols/protocols-smtp/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols/protocols-smtp/pom.xml?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/protocols/protocols-smtp/pom.xml (original)
+++ james/server/trunk/protocols/protocols-smtp/pom.xml Sat Jan 5 13:09:12 2013
@@ -97,6 +97,11 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</dependency>
@@ -194,11 +199,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-nop</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<scope>test</scope>
Modified: james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java (original)
+++ james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/DNSRBLHandler.java Sat Jan 5 13:09:12 2013
@@ -19,19 +19,18 @@
package org.apache.james.smtpserver.fastfail;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.annotation.Resource;
-
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import javax.annotation.Resource;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
public class DNSRBLHandler extends org.apache.james.protocols.smtp.core.fastfail.DNSRBLHandler implements InitializingLifecycleAwareProtocolHandler {
@@ -41,52 +40,40 @@ public class DNSRBLHandler extends org.a
public void setDNSService(DNSService dns) {
this.dns = dns;
}
+
@SuppressWarnings("unchecked")
@Override
public void init(Configuration config) throws ConfigurationException {
boolean validConfig = false;
- HierarchicalConfiguration handlerConfiguration = (HierarchicalConfiguration)config;
+ HierarchicalConfiguration handlerConfiguration = (HierarchicalConfiguration) config;
ArrayList<String> rblserverCollection = new ArrayList<String>();
- List<String> whiteList = handlerConfiguration.getList("rblservers.whitelist");
- if (whiteList != null) {
- for (int i = 0; i < whiteList.size(); i++) {
- String rblServerName = whiteList.get(i);
- rblserverCollection.add(rblServerName);
-
- }
- if (rblserverCollection != null && rblserverCollection.size() > 0) {
- setWhitelist((String[]) rblserverCollection.toArray(new String[rblserverCollection.size()]));
- rblserverCollection.clear();
- validConfig = true;
- }
- }
- List<String> blackList = handlerConfiguration.getList("rblservers.blacklist");
- if (blackList != null) {
- for (int i = 0; i < blackList.size(); i++) {
- String rblServerName = blackList.get(i);
- rblserverCollection.add(rblServerName);
-
- }
- if (rblserverCollection != null && rblserverCollection.size() > 0) {
- setBlacklist((String[]) rblserverCollection.toArray(new String[rblserverCollection.size()]));
- rblserverCollection.clear();
- validConfig = true;
- }
+ Collections.addAll(rblserverCollection, handlerConfiguration.getStringArray("rblservers.whitelist"));
+ if (rblserverCollection.size() > 0) {
+ setWhitelist(rblserverCollection.toArray(new String[rblserverCollection.size()]));
+ rblserverCollection.clear();
+ validConfig = true;
+ }
+ Collections.addAll(rblserverCollection, handlerConfiguration.getStringArray("rblservers.blacklist"));
+ if (rblserverCollection.size() > 0) {
+ setBlacklist(rblserverCollection.toArray(new String[rblserverCollection.size()]));
+ rblserverCollection.clear();
+ validConfig = true;
}
// Throw an ConfiigurationException on invalid config
- if (validConfig == false) {
+ if (!validConfig) {
throw new ConfigurationException("Please configure whitelist or blacklist");
}
- setGetDetail(handlerConfiguration.getBoolean("getDetail", false));
+ setGetDetail(handlerConfiguration.getBoolean("getDetail", false));
}
@Override
public void destroy() {
// Do nothing
}
+
@Override
protected boolean resolve(String ip) {
try {
@@ -96,10 +83,9 @@ public class DNSRBLHandler extends org.a
return false;
}
}
+
@Override
protected Collection<String> resolveTXTRecords(String ip) {
return dns.findTXTRecords(ip);
}
-
-
}
Modified: james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java?rev=1429276&r1=1429275&r2=1429276&view=diff
==============================================================================
--- james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java (original)
+++ james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java Sat Jan 5 13:09:12 2013
@@ -19,32 +19,29 @@
package org.apache.james.smtpserver.fastfail;
-import java.util.List;
-
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import java.util.Arrays;
+
public class SpamTrapHandler extends org.apache.james.protocols.smtp.core.fastfail.SpamTrapHandler implements InitializingLifecycleAwareProtocolHandler {
- @SuppressWarnings("unchecked")
@Override
public void init(Configuration config) throws ConfigurationException {
- List<String> rcpts = config.getList("spamTrapRecip");
+ String[] rcpts = config.getStringArray("spamTrapRecip");
- if (rcpts.isEmpty() == false) {
- setSpamTrapRecipients(rcpts);
+ if (rcpts.length == 0) {
+ setSpamTrapRecipients(Arrays.asList(rcpts));
} else {
throw new ConfigurationException("Please configure a spamTrapRecip.");
}
- setBlockTime(config.getLong("blockTime", blockTime));
+ setBlockTime(config.getLong("blockTime", blockTime));
}
@Override
public void destroy() {
// nothing to-do
}
-
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org