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 bt...@apache.org on 2017/08/24 03:46:51 UTC
[26/38] james-project git commit: JAMES-2114 Deprecate LogEnabled API
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/container/util/src/main/java/org/apache/james/util/retry/naming/directory/RetryingDirContext.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/main/java/org/apache/james/util/retry/naming/directory/RetryingDirContext.java b/server/container/util/src/main/java/org/apache/james/util/retry/naming/directory/RetryingDirContext.java
index 0b13966..88a65ca 100644
--- a/server/container/util/src/main/java/org/apache/james/util/retry/naming/directory/RetryingDirContext.java
+++ b/server/container/util/src/main/java/org/apache/james/util/retry/naming/directory/RetryingDirContext.java
@@ -33,7 +33,6 @@ import javax.naming.directory.SearchResult;
import org.apache.james.util.retry.api.RetrySchedule;
import org.apache.james.util.retry.naming.LoggingRetryHandler;
import org.apache.james.util.retry.naming.RetryingContext;
-import org.slf4j.Logger;
/**
* <code>RetryingDirContext</code> retries the methods defined by <code>javax.naming.directory.DirContext</code>
@@ -51,12 +50,11 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
*
* @param schedule
* @param maxRetries
- * @param logger
* @throws NamingException
*/
- public RetryingDirContext(RetrySchedule schedule, int maxRetries, Logger logger)
+ public RetryingDirContext(RetrySchedule schedule, int maxRetries)
throws NamingException {
- super(schedule, maxRetries, logger);
+ super(schedule, maxRetries);
}
/**
@@ -66,8 +64,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public void bind(final Name name, final Object obj, final Attributes attrs)
throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(),
- getLogger()) {
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -84,8 +81,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public void bind(final String name, final Object obj, final Attributes attrs)
throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(),
- getLogger()) {
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -103,7 +99,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
public DirContext createSubcontext(final Name name, final Attributes attrs)
throws NamingException {
return (DirContext) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this,
- getSchedule(), getMaxRetries(), getLogger()) {
+ getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -120,7 +116,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
public DirContext createSubcontext(final String name, final Attributes attrs)
throws NamingException {
return (DirContext) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this,
- getSchedule(), getMaxRetries(), getLogger()) {
+ getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -135,7 +131,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public Attributes getAttributes(final Name name) throws NamingException {
return (Attributes) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this,
- getSchedule(), getMaxRetries(), getLogger()) {
+ getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -150,7 +146,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public Attributes getAttributes(final String name) throws NamingException {
return (Attributes) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this,
- getSchedule(), getMaxRetries(), getLogger()) {
+ getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -166,7 +162,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public Attributes getAttributes(final Name name, final String[] attrIds) throws NamingException {
return (Attributes) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this,
- getSchedule(), getMaxRetries(), getLogger()) {
+ getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -183,7 +179,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
public Attributes getAttributes(final String name, final String[] attrIds)
throws NamingException {
return (Attributes) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this,
- getSchedule(), getMaxRetries(), getLogger()) {
+ getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -198,7 +194,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public DirContext getSchema(final Name name) throws NamingException {
final Context context = getDelegate();
- return new RetryingDirContext(getSchedule(), getMaxRetries(), getLogger()) {
+ return new RetryingDirContext(getSchedule(), getMaxRetries()) {
@Override
public DirContext newDelegate() throws NamingException {
@@ -213,7 +209,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public DirContext getSchema(final String name) throws NamingException {
final Context context = getDelegate();
- return new RetryingDirContext(getSchedule(), getMaxRetries(), getLogger()) {
+ return new RetryingDirContext(getSchedule(), getMaxRetries()) {
@Override
public DirContext newDelegate() throws NamingException {
@@ -228,7 +224,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public DirContext getSchemaClassDefinition(final Name name) throws NamingException {
final Context context = getDelegate();
- return new RetryingDirContext(getSchedule(), getMaxRetries(), getLogger()) {
+ return new RetryingDirContext(getSchedule(), getMaxRetries()) {
@Override
public DirContext newDelegate() throws NamingException {
@@ -243,7 +239,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public DirContext getSchemaClassDefinition(final String name) throws NamingException {
final Context context = getDelegate();
- return new RetryingDirContext(getSchedule(), getMaxRetries(), getLogger()) {
+ return new RetryingDirContext(getSchedule(), getMaxRetries()) {
@Override
public DirContext newDelegate() throws NamingException {
@@ -259,8 +255,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public void modifyAttributes(final Name name, final ModificationItem[] mods)
throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(),
- getLogger()) {
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -277,8 +272,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public void modifyAttributes(final String name, final ModificationItem[] mods)
throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(),
- getLogger()) {
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -295,8 +289,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public void modifyAttributes(final Name name, final int modOp, final Attributes attrs)
throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(),
- getLogger()) {
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -313,8 +306,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public void modifyAttributes(final String name, final int modOp, final Attributes attrs)
throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(),
- getLogger()) {
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -331,8 +323,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public void rebind(final Name name, final Object obj, final Attributes attrs)
throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(),
- getLogger()) {
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -349,8 +340,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
@Override
public void rebind(final String name, final Object obj, final Attributes attrs)
throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(),
- getLogger()) {
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -370,7 +360,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
final Attributes matchingAttributes)
throws NamingException {
return (NamingEnumeration<SearchResult>) new LoggingRetryHandler(
- DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()) {
+ DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -389,7 +379,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
final Attributes matchingAttributes)
throws NamingException {
return (NamingEnumeration<SearchResult>) new LoggingRetryHandler(
- DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()) {
+ DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -408,7 +398,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
final Attributes matchingAttributes,
String[] attributesToReturn) throws NamingException {
return (NamingEnumeration<SearchResult>) new LoggingRetryHandler(
- DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()) {
+ DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -427,7 +417,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
final Attributes matchingAttributes,
final String[] attributesToReturn) throws NamingException {
return (NamingEnumeration<SearchResult>) new LoggingRetryHandler(
- DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()) {
+ DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -447,7 +437,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
final SearchControls cons)
throws NamingException {
return (NamingEnumeration<SearchResult>) new LoggingRetryHandler(
- DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()) {
+ DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -466,7 +456,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
final SearchControls cons)
throws NamingException {
return (NamingEnumeration<SearchResult>) new LoggingRetryHandler(
- DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()) {
+ DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -485,7 +475,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
public NamingEnumeration<SearchResult> search(final Name name, final String filterExpr,
final Object[] filterArgs, final SearchControls cons) throws NamingException {
return (NamingEnumeration<SearchResult>) new LoggingRetryHandler(
- DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()) {
+ DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
@@ -504,7 +494,7 @@ abstract public class RetryingDirContext extends RetryingContext implements DirC
public NamingEnumeration<SearchResult> search(final String name, final String filterExpr,
final Object[] filterArgs, final SearchControls cons) throws NamingException {
return (NamingEnumeration<SearchResult>) new LoggingRetryHandler(
- DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()) {
+ DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()) {
@Override
public Object operation() throws NamingException {
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/container/util/src/main/java/org/apache/james/util/retry/naming/ldap/RetryingLdapContext.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/main/java/org/apache/james/util/retry/naming/ldap/RetryingLdapContext.java b/server/container/util/src/main/java/org/apache/james/util/retry/naming/ldap/RetryingLdapContext.java
index 7cde3d1..76678c9 100644
--- a/server/container/util/src/main/java/org/apache/james/util/retry/naming/ldap/RetryingLdapContext.java
+++ b/server/container/util/src/main/java/org/apache/james/util/retry/naming/ldap/RetryingLdapContext.java
@@ -30,7 +30,6 @@ import javax.naming.ldap.LdapContext;
import org.apache.james.util.retry.api.RetrySchedule;
import org.apache.james.util.retry.naming.LoggingRetryHandler;
import org.apache.james.util.retry.naming.directory.RetryingDirContext;
-import org.slf4j.Logger;
/**
* <code>RetryingLdapContext</code> retries the methods defined by <code>javax.naming.ldap.LdapContext</code>
@@ -48,8 +47,8 @@ abstract public class RetryingLdapContext extends RetryingDirContext implements
* @param maxRetries
* @throws NamingException
*/
- public RetryingLdapContext(RetrySchedule schedule, int maxRetries, Logger logger) throws NamingException {
- super(schedule, maxRetries, logger);
+ public RetryingLdapContext(RetrySchedule schedule, int maxRetries) throws NamingException {
+ super(schedule, maxRetries);
}
/**
@@ -57,7 +56,7 @@ abstract public class RetryingLdapContext extends RetryingDirContext implements
*/
@Override
public ExtendedResponse extendedOperation(final ExtendedRequest request) throws NamingException {
- return (ExtendedResponse) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()){
+ return (ExtendedResponse) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()){
@Override
public Object operation() throws NamingException {
@@ -70,7 +69,7 @@ abstract public class RetryingLdapContext extends RetryingDirContext implements
*/
@Override
public Control[] getConnectControls() throws NamingException {
- return (Control[]) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()){
+ return (Control[]) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()){
@Override
public Object operation() throws NamingException {
@@ -83,7 +82,7 @@ abstract public class RetryingLdapContext extends RetryingDirContext implements
*/
@Override
public Control[] getRequestControls() throws NamingException {
- return (Control[]) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()){
+ return (Control[]) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()){
@Override
public Object operation() throws NamingException {
@@ -96,7 +95,7 @@ abstract public class RetryingLdapContext extends RetryingDirContext implements
*/
@Override
public Control[] getResponseControls() throws NamingException {
- return (Control[]) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()){
+ return (Control[]) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()){
@Override
public Object operation() throws NamingException {
@@ -110,7 +109,7 @@ abstract public class RetryingLdapContext extends RetryingDirContext implements
@Override
public LdapContext newInstance(final Control[] requestControls) throws NamingException {
final Context context = getDelegate();
- return new RetryingLdapContext(getSchedule(), getMaxRetries(), getLogger()) {
+ return new RetryingLdapContext(getSchedule(), getMaxRetries()) {
@Override
public Context newDelegate() throws NamingException {
@@ -124,7 +123,7 @@ abstract public class RetryingLdapContext extends RetryingDirContext implements
*/
@Override
public void reconnect(final Control[] connCtls) throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()){
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()){
@Override
public Object operation() throws NamingException {
@@ -138,7 +137,7 @@ abstract public class RetryingLdapContext extends RetryingDirContext implements
*/
@Override
public void setRequestControls(final Control[] requestControls) throws NamingException {
- new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries(), getLogger()){
+ new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, getSchedule(), getMaxRetries()){
@Override
public Object operation() throws NamingException {
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-cassandra/src/test/java/org/apache/james/domainlist/cassandra/CassandraDomainListTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-cassandra/src/test/java/org/apache/james/domainlist/cassandra/CassandraDomainListTest.java b/server/data/data-cassandra/src/test/java/org/apache/james/domainlist/cassandra/CassandraDomainListTest.java
index 89c0438..b710e4e 100644
--- a/server/data/data-cassandra/src/test/java/org/apache/james/domainlist/cassandra/CassandraDomainListTest.java
+++ b/server/data/data-cassandra/src/test/java/org/apache/james/domainlist/cassandra/CassandraDomainListTest.java
@@ -22,7 +22,6 @@ package org.apache.james.domainlist.cassandra;
import org.apache.james.backends.cassandra.CassandraCluster;
import org.apache.james.domainlist.api.DomainList;
import org.apache.james.domainlist.lib.AbstractDomainListTest;
-import org.slf4j.LoggerFactory;
public class CassandraDomainListTest extends AbstractDomainListTest {
@@ -32,7 +31,6 @@ public class CassandraDomainListTest extends AbstractDomainListTest {
protected DomainList createDomainList() {
cassandra = CassandraCluster.create(new CassandraDomainListModule());
CassandraDomainList testee = new CassandraDomainList(getDNSServer("localhost"), cassandra.getConf());
- testee.setLog(LoggerFactory.getLogger(getClass()));
testee.setAutoDetect(false);
testee.setAutoDetectIP(false);
return testee;
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTableTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTableTest.java b/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTableTest.java
index e55ce6a..122161c 100644
--- a/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTableTest.java
+++ b/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraRecipientRewriteTableTest.java
@@ -24,7 +24,6 @@ import org.apache.james.backends.cassandra.utils.CassandraUtils;
import org.apache.james.rrt.api.RecipientRewriteTableException;
import org.apache.james.rrt.lib.AbstractRecipientRewriteTable;
import org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest;
-import org.slf4j.LoggerFactory;
import cucumber.api.java.After;
import cucumber.api.java.Before;
@@ -52,7 +51,6 @@ public class CassandraRecipientRewriteTableTest extends AbstractRecipientRewrite
@Override
protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
CassandraRecipientRewriteTable rrt = new CassandraRecipientRewriteTable(cassandra.getConf(), CassandraUtils.WITH_DEFAULT_CONFIGURATION);
- rrt.setLog(LoggerFactory.getLogger("MockLog"));
rrt.configure(new DefaultConfigurationBuilder());
return rrt;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraStepdefs.java
----------------------------------------------------------------------
diff --git a/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraStepdefs.java b/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraStepdefs.java
index d6ce16f..b3d1166 100644
--- a/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraStepdefs.java
+++ b/server/data/data-cassandra/src/test/java/org/apache/james/rrt/cassandra/CassandraStepdefs.java
@@ -23,7 +23,6 @@ import org.apache.james.backends.cassandra.CassandraCluster;
import org.apache.james.backends.cassandra.utils.CassandraUtils;
import org.apache.james.rrt.lib.AbstractRecipientRewriteTable;
import org.apache.james.rrt.lib.RewriteTablesStepdefs;
-import org.slf4j.LoggerFactory;
import cucumber.api.java.After;
import cucumber.api.java.Before;
@@ -53,7 +52,6 @@ public class CassandraStepdefs {
private AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
CassandraRecipientRewriteTable rrt = new CassandraRecipientRewriteTable(cassandra.getConf(), CassandraUtils.WITH_DEFAULT_CONFIGURATION);
- rrt.setLog(LoggerFactory.getLogger("MockLog"));
rrt.configure(new DefaultConfigurationBuilder());
return rrt;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
index 1b8a04f..b26d2e2 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
@@ -42,6 +42,8 @@ import org.apache.james.mailrepository.lib.AbstractMailRepository;
import org.apache.james.repository.file.FilePersistentObjectRepository;
import org.apache.james.repository.file.FilePersistentStreamRepository;
import org.apache.mailet.Mail;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* <p>
@@ -60,6 +62,7 @@ import org.apache.mailet.Mail;
* </p>
*/
public class FileMailRepository extends AbstractMailRepository {
+ private static final Logger LOGGER = LoggerFactory.getLogger(FileMailRepository.class);
private FilePersistentStreamRepository streamRepository;
private FilePersistentObjectRepository objectRepository;
@@ -80,8 +83,8 @@ public class FileMailRepository extends AbstractMailRepository {
protected void doConfigure(HierarchicalConfiguration config) throws org.apache.commons.configuration.ConfigurationException {
super.doConfigure(config);
destination = config.getString("[@destinationURL]");
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("FileMailRepository.destinationURL: " + destination);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("FileMailRepository.destinationURL: " + destination);
}
fifo = config.getBoolean("[@FIFO]", false);
cacheKeys = config.getBoolean("[@CACHEKEYS]", true);
@@ -96,13 +99,11 @@ public class FileMailRepository extends AbstractMailRepository {
reposConfiguration.addProperty("[@destinationURL]", destination);
objectRepository = new FilePersistentObjectRepository();
- objectRepository.setLog(getLogger());
objectRepository.setFileSystem(fileSystem);
objectRepository.configure(reposConfiguration);
objectRepository.init();
streamRepository = new FilePersistentStreamRepository();
- streamRepository.setLog(getLogger());
streamRepository.setFileSystem(fileSystem);
streamRepository.configure(reposConfiguration);
streamRepository.init();
@@ -144,13 +145,13 @@ public class FileMailRepository extends AbstractMailRepository {
keys.add(i.next());
}
}
- if (getLogger().isDebugEnabled()) {
+ if (LOGGER.isDebugEnabled()) {
String logBuffer = getClass().getName() + " created in " + destination;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
} catch (Exception e) {
final String message = "Failed to retrieve Store component:" + e.getMessage();
- getLogger().error(message, e);
+ LOGGER.error(message, e);
throw e;
}
}
@@ -235,7 +236,7 @@ public class FileMailRepository extends AbstractMailRepository {
remove(key);
}
final String errorMessage = exceptionBuffer.toString();
- getLogger().warn(errorMessage, re);
+ LOGGER.warn(errorMessage, re);
return null;
}
MimeMessageStreamRepositorySource source = new MimeMessageStreamRepositorySource(streamRepository, destination, key);
@@ -243,7 +244,7 @@ public class FileMailRepository extends AbstractMailRepository {
return mc;
} catch (Exception me) {
- getLogger().error("Exception retrieving mail: " + me);
+ LOGGER.error("Exception retrieving mail: " + me);
throw new MessagingException("Exception while retrieving mail: " + me.getMessage(), me);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/MBoxMailRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/MBoxMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/MBoxMailRepository.java
index 5f66612..f96e883 100755
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/MBoxMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/MBoxMailRepository.java
@@ -74,10 +74,10 @@ import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.commons.io.FileUtils;
import org.apache.james.core.MailImpl;
import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.lifecycle.api.LogEnabled;
import org.apache.james.mailrepository.api.MailRepository;
import org.apache.mailet.Mail;
import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Implementation of a MailRepository using UNIX mbox files.
@@ -114,7 +114,8 @@ import org.slf4j.Logger;
* and into something else (IMAP server or mail list displayer)
*/
-public class MBoxMailRepository implements MailRepository, LogEnabled, Configurable {
+public class MBoxMailRepository implements MailRepository, Configurable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(MBoxMailRepository.class);
static final SimpleDateFormat dy = new SimpleDateFormat("EE MMM dd HH:mm:ss yyyy", Locale.US);
static final String LOCKEXT = ".lock";
@@ -156,12 +157,6 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
MimeMessage messageAction(String messageSeparator, String bodyText, long messageStart);
}
- private Logger logger;
-
- public void setLog(Logger logger) {
- this.logger = logger;
- }
-
public void configure(HierarchicalConfiguration configuration) throws ConfigurationException {
/*
The repository configuration
@@ -178,24 +173,20 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
mboxFile = destination.substring("mbox://".length());
}
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("MBoxMailRepository.destinationURL: " + destination);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("MBoxMailRepository.destinationURL: " + destination);
}
String checkType = configuration.getString("[@type]");
if (!(checkType.equals("MAIL") || checkType.equals("SPOOL"))) {
String exceptionString = "Attempt to configure MboxMailRepository as " + checkType;
- if (getLogger().isWarnEnabled()) {
- getLogger().warn(exceptionString);
+ if (LOGGER.isWarnEnabled()) {
+ LOGGER.warn(exceptionString);
}
throw new ConfigurationException(exceptionString);
}
}
- protected Logger getLogger() {
- return logger;
- }
-
/**
* Convert a MimeMessage into raw text
*
@@ -231,12 +222,12 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
mimeMessage = new MimeMessage(session, mb);
} catch (MessagingException e) {
- getLogger().error("Unable to parse mime message!", e);
+ LOGGER.error("Unable to parse mime message!", e);
}
- if (mimeMessage == null && getLogger().isDebugEnabled()) {
+ if (mimeMessage == null && LOGGER.isDebugEnabled()) {
String logBuffer = this.getClass().getName() + " Mime message is null";
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
/*
@@ -246,14 +237,14 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
* .TO).toString(); } catch (Exception e) { // It has errored, so time
* for plan B // use the from field I suppose try {
* mimeMessage.setRecipients(javax.mail.Message.RecipientType.TO,
- * mimeMessage.getFrom()); if (getLogger().isDebugEnabled()) {
+ * mimeMessage.getFrom()); if (LOGGER.isDebugEnabled()) {
* StringBuffer logBuffer = new StringBuffer(128)
* .append(this.getClass().getName())
* .append(" Patching To: field for message ")
* .append(" with From: field");
- * getLogger().debug(logBuffer.toString()); } } catch
+ * LOGGER.debug(logBuffer.toString()); } } catch
* (MessagingException e1) {
- * getLogger().error("Unable to set to: field to from: field", e); } }
+ * LOGGER.error("Unable to set to: field to from: field", e); } }
*/
return mimeMessage;
}
@@ -285,10 +276,10 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
* The action to take when a message is found
*/
private MimeMessage parseMboxFile(RandomAccessFile ins, MessageAction messAct) {
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " Start parsing " + mboxFile;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
try {
@@ -307,8 +298,8 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
foundSep = sepMatchPattern.matcher(line).matches();
if (foundSep && inMessage) {
- // if ((DEEP_DEBUG) && (getLogger().isDebugEnabled())) {
- // getLogger().debug(this.getClass().getName() +
+ // if ((DEEP_DEBUG) && (LOGGER.isDebugEnabled())) {
+ // LOGGER.debug(this.getClass().getName() +
// " Invoking " + messAct.getClass() + " at " +
// prevMessageStart);
// }
@@ -338,8 +329,8 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
foundSep = sepMatchPattern.matcher(line).matches();
if (foundSep && inMessage) {
// if ((DEEP_DEBUG) &&
- // (getLogger().isDebugEnabled())) {
- // getLogger().debug(this.getClass().getName() +
+ // (LOGGER.isDebugEnabled())) {
+ // LOGGER.debug(this.getClass().getName() +
// " Invoking " + messAct.getClass() + " at " +
// prevMessageStart);
// }
@@ -373,14 +364,14 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
return messAct.messageAction(previousMessageSeparator, messageBuffer.toString(), prevMessageStart);
}
} catch (IOException ioEx) {
- getLogger().error("Unable to write file (General I/O problem) " + mboxFile, ioEx);
+ LOGGER.error("Unable to write file (General I/O problem) " + mboxFile, ioEx);
} catch (PatternSyntaxException e) {
- getLogger().error("Bad regex passed " + mboxFile, e);
+ LOGGER.error("Bad regex passed " + mboxFile, e);
} finally {
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " Finished parsing " + mboxFile;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
}
return null;
@@ -423,18 +414,18 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
// Can we find the key first
if (mList == null || !mList.containsKey(key)) {
// Not initiailised so no point looking
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " mList - key not found " + mboxFile;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
return foundMessage;
}
long messageStart = mList.get(key);
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " Load message starting at offset " + messageStart + " from file " + mboxFile;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
// Now try and find the position in the file
RandomAccessFile ins = null;
@@ -451,33 +442,33 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
public MimeMessage messageAction(String messageSeparator, String bodyText, long messageStart) {
try {
if (key.equals(generateKeyValue(bodyText))) {
- getLogger().debug(this.getClass().getName() + " Located message. Returning MIME message");
+ LOGGER.debug(this.getClass().getName() + " Located message. Returning MIME message");
return convertTextToMimeMessage(bodyText);
}
} catch (NoSuchAlgorithmException e) {
- getLogger().error("MD5 not supported! ", e);
+ LOGGER.error("MD5 not supported! ", e);
}
return null;
}
};
foundMessage = this.parseMboxFile(ins, op);
} catch (FileNotFoundException e) {
- getLogger().error("Unable to save(open) file (File not found) " + mboxFile, e);
+ LOGGER.error("Unable to save(open) file (File not found) " + mboxFile, e);
} catch (IOException e) {
- getLogger().error("Unable to write file (General I/O problem) " + mboxFile, e);
+ LOGGER.error("Unable to write file (General I/O problem) " + mboxFile, e);
} finally {
if (foundMessage == null) {
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " select - message not found " + mboxFile;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
}
if (ins != null)
try {
ins.close();
} catch (IOException e) {
- getLogger().error("Unable to close file (General I/O problem) " + mboxFile, e);
+ LOGGER.error("Unable to close file (General I/O problem) " + mboxFile, e);
}
}
return foundMessage;
@@ -510,28 +501,28 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
try {
String key = generateKeyValue(bodyText);
mList.put(key, messageStart);
- if ((getLogger().isDebugEnabled())) {
- getLogger().debug(this.getClass().getName() + " Key " + key + " at " + messageStart);
+ if ((LOGGER.isDebugEnabled())) {
+ LOGGER.debug(this.getClass().getName() + " Key " + key + " at " + messageStart);
}
} catch (NoSuchAlgorithmException e) {
- getLogger().error("MD5 not supported! ", e);
+ LOGGER.error("MD5 not supported! ", e);
}
return null;
}
});
// System.out.println("Done Load keys!");
} catch (FileNotFoundException e) {
- getLogger().error("Unable to save(open) file (File not found) " + mboxFile, e);
+ LOGGER.error("Unable to save(open) file (File not found) " + mboxFile, e);
this.mList = new Hashtable<>((int) DEFAULTMLISTCAPACITY);
} catch (IOException e) {
- getLogger().error("Unable to write file (General I/O problem) " + mboxFile, e);
+ LOGGER.error("Unable to write file (General I/O problem) " + mboxFile, e);
} finally {
if (ins != null)
try {
ins.close();
} catch (IOException e) {
- getLogger().error("Unable to close file (General I/O problem) " + mboxFile, e);
+ LOGGER.error("Unable to close file (General I/O problem) " + mboxFile, e);
}
}
}
@@ -541,10 +532,10 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
*/
public void store(Mail mc) {
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " Will store message to file " + mboxFile;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
this.mList = null;
// Now make up the from header
@@ -560,7 +551,7 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
}
} catch (IOException | MessagingException e) {
- getLogger().error("Unable to parse mime message for " + mboxFile, e);
+ LOGGER.error("Unable to parse mime message for " + mboxFile, e);
}
// And save only the new stuff to disk
RandomAccessFile saveFile;
@@ -572,9 +563,9 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
saveFile.close();
} catch (FileNotFoundException e) {
- getLogger().error("Unable to save(open) file (File not found) " + mboxFile, e);
+ LOGGER.error("Unable to save(open) file (File not found) " + mboxFile, e);
} catch (IOException e) {
- getLogger().error("Unable to write file (General I/O problem) " + mboxFile, e);
+ LOGGER.error("Unable to write file (General I/O problem) " + mboxFile, e);
}
}
@@ -591,10 +582,10 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
// correct for it BEFORE we return the iterator.
findMessage(keys.iterator().next());
}
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " " + keys.size() + " keys to be iterated over.";
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
if (fifo)
Collections.sort(keys); // Keys is a HashSet; impose FIFO for apps
@@ -612,16 +603,16 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
MimeMessage foundMessage = findMessage(key);
if (foundMessage == null) {
- getLogger().error("found message is null!");
+ LOGGER.error("found message is null!");
return null;
}
res = new MailImpl();
res.setMessage(foundMessage);
res.setName(key);
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " Retrieving entry for key " + key;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
return res;
}
@@ -650,16 +641,16 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
// So wait for a file
while (!mBoxLock.createNewFile() && sleepCount < MAXSLEEPTIMES) {
try {
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " Waiting for lock on file " + mboxFile;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
Thread.sleep(LOCKSLEEPDELAY);
sleepCount++;
} catch (InterruptedException e) {
- getLogger().error("File lock wait for " + mboxFile + " interrupted!", e);
+ LOGGER.error("File lock wait for " + mboxFile + " interrupted!", e);
}
}
@@ -680,7 +671,7 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
FileUtils.forceDelete(mBoxLock);
} catch (IOException e) {
String logBuffer = this.getClass().getName() + " Failed to delete lock file " + lockFileName;
- getLogger().error(logBuffer);
+ LOGGER.error(logBuffer);
}
}
@@ -688,10 +679,10 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
* @see org.apache.james.mailrepository.api.MailRepository#remove(Collection)
*/
public void remove(final Collection<Mail> mails) {
- if ((getLogger().isDebugEnabled())) {
+ if ((LOGGER.isDebugEnabled())) {
String logBuffer = this.getClass().getName() + " Removing entry for key " + mails;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
// The plan is as follows:
// Attempt to locate the message in the file
@@ -732,9 +723,9 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
}
} catch (NoSuchAlgorithmException e) {
- getLogger().error("MD5 not supported! ", e);
+ LOGGER.error("MD5 not supported! ", e);
} catch (IOException e) {
- getLogger().error("Unable to write file (General I/O problem) " + mboxFile, e);
+ LOGGER.error("Unable to write file (General I/O problem) " + mboxFile, e);
}
return null;
}
@@ -760,9 +751,9 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
}
} catch (FileNotFoundException e) {
- getLogger().error("Unable to save(open) file (File not found) " + mboxFile, e);
+ LOGGER.error("Unable to save(open) file (File not found) " + mboxFile, e);
} catch (IOException e) {
- getLogger().error("Unable to write file (General I/O problem) " + mboxFile, e);
+ LOGGER.error("Unable to write file (General I/O problem) " + mboxFile, e);
}
}
@@ -774,7 +765,7 @@ public class MBoxMailRepository implements MailRepository, LogEnabled, Configura
try {
lockMBox();
} catch (Exception e) {
- getLogger().error("Lock failed!", e);
+ LOGGER.error("Lock failed!", e);
return; // No lock, so exit
}
ArrayList<Mail> keys = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java b/server/data/data-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java
index b33e71f..262bb4a 100644
--- a/server/data/data-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/user/file/UsersFileRepository.java
@@ -33,6 +33,8 @@ import org.apache.james.repository.file.FilePersistentObjectRepository;
import org.apache.james.user.api.UsersRepositoryException;
import org.apache.james.user.api.model.User;
import org.apache.james.user.lib.AbstractJamesUsersRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* <p>
@@ -54,11 +56,7 @@ import org.apache.james.user.lib.AbstractJamesUsersRepository;
@Deprecated
@Singleton
public class UsersFileRepository extends AbstractJamesUsersRepository {
-
- /**
- * Whether 'deep debugging' is turned on.
- */
- protected static boolean DEEP_DEBUG = false;
+ private static final Logger LOGGER = LoggerFactory.getLogger(UsersFileRepository.class);
private FilePersistentObjectRepository objectRepository;
@@ -97,17 +95,16 @@ public class UsersFileRepository extends AbstractJamesUsersRepository {
objectConfiguration.addProperty("[@destinationURL]", destination);
objectRepository = new FilePersistentObjectRepository();
- objectRepository.setLog(getLogger());
objectRepository.setFileSystem(fileSystem);
objectRepository.configure(objectConfiguration);
objectRepository.init();
- if (getLogger().isDebugEnabled()) {
+ if (LOGGER.isDebugEnabled()) {
String logBuffer = this.getClass().getName() + " created in " + destination;
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
} catch (Exception e) {
- if (getLogger().isErrorEnabled()) {
- getLogger().error("Failed to initialize repository:" + e.getMessage(), e);
+ if (LOGGER.isErrorEnabled()) {
+ LOGGER.error("Failed to initialize repository:" + e.getMessage(), e);
}
throw e;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java b/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
index 1940e3b..80a8628 100644
--- a/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
+++ b/server/data/data-file/src/test/java/org/apache/james/domainlist/xml/XMLDomainListTest.java
@@ -34,7 +34,6 @@ import org.apache.james.domainlist.api.DomainListException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableList;
@@ -82,7 +81,6 @@ public class XMLDomainListTest {
public void testNoConfiguredDomains() throws Exception {
List<String> domains = new ArrayList<>();
XMLDomainList dom = new XMLDomainList(setUpDNSServer("localhost"));
- dom.setLog(LoggerFactory.getLogger("MockLog"));
dom.configure(setUpConfiguration(false, false, domains));
assertThat(dom.getDomains()).containsOnly(DEFAULT_DOMAIN);
@@ -95,7 +93,6 @@ public class XMLDomainListTest {
domains.add("domain2.");
XMLDomainList dom = new XMLDomainList(setUpDNSServer("localhost"));
- dom.setLog(LoggerFactory.getLogger("MockLog"));
dom.configure(setUpConfiguration(false, false, domains));
assertThat(dom.getDomains()).hasSize(3);
@@ -107,7 +104,6 @@ public class XMLDomainListTest {
domains.add("domain1.");
XMLDomainList dom = new XMLDomainList(setUpDNSServer("local"));
- dom.setLog(LoggerFactory.getLogger("MockLog"));
dom.configure(setUpConfiguration(true, false, domains));
assertThat(dom.getDomains()).hasSize(3);
@@ -119,10 +115,8 @@ public class XMLDomainListTest {
domains.add("domain1.");
XMLDomainList dom = new XMLDomainList(setUpDNSServer("localhost"));
- dom.setLog(LoggerFactory.getLogger("MockLog"));
dom.configure(setUpConfiguration(true, false, domains));
-
assertThat(dom.getDomains()).hasSize(2);
}
@@ -134,7 +128,6 @@ public class XMLDomainListTest {
domains.add("domain1");
XMLDomainList testee = new XMLDomainList(setUpDNSServer("hostname"));
- testee.setLog(LoggerFactory.getLogger("MockLog"));
testee.configure(setUpConfiguration(true, false, domains));
testee.addDomain("newDomain");
@@ -148,7 +141,6 @@ public class XMLDomainListTest {
domains.add("domain1");
XMLDomainList testee = new XMLDomainList(setUpDNSServer("localhost"));
- testee.setLog(LoggerFactory.getLogger("MockLog"));
testee.configure(setUpConfiguration(true, false, domains));
testee.removeDomain("newDomain");
@@ -164,7 +156,6 @@ public class XMLDomainListTest {
configuration.addProperty("defaultDomain", "localhost");
XMLDomainList testee = new XMLDomainList(setUpDNSServer("localhost"));
- testee.setLog(LoggerFactory.getLogger("MockLog"));
testee.configure(configuration);
assertThat(testee.getDomainListInternal()).hasSize(3);
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/test/java/org/apache/james/mailrepository/FileMailRepositoryTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/mailrepository/FileMailRepositoryTest.java b/server/data/data-file/src/test/java/org/apache/james/mailrepository/FileMailRepositoryTest.java
index 16a17ec..2c154bd 100644
--- a/server/data/data-file/src/test/java/org/apache/james/mailrepository/FileMailRepositoryTest.java
+++ b/server/data/data-file/src/test/java/org/apache/james/mailrepository/FileMailRepositoryTest.java
@@ -23,7 +23,6 @@ import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.james.filesystem.api.mock.MockFileSystem;
import org.apache.james.mailrepository.api.MailRepository;
import org.apache.james.mailrepository.file.FileMailRepository;
-import org.slf4j.LoggerFactory;
public class FileMailRepositoryTest extends AbstractMailRepositoryTest {
@@ -38,7 +37,6 @@ public class FileMailRepositoryTest extends AbstractMailRepositoryTest {
MockFileSystem fs = new MockFileSystem();
FileMailRepository mr = new FileMailRepository();
mr.setFileSystem(fs);
- mr.setLog(LoggerFactory.getLogger("MockLog"));
DefaultConfigurationBuilder defaultConfiguration = new DefaultConfigurationBuilder();
defaultConfiguration.addProperty("[@destinationURL]", "file://target/var/mr");
defaultConfiguration.addProperty("[@type]", "MAIL");
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/test/java/org/apache/james/mailrepository/MBoxMailRepositoryTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/mailrepository/MBoxMailRepositoryTest.java b/server/data/data-file/src/test/java/org/apache/james/mailrepository/MBoxMailRepositoryTest.java
index e8ff56d..3cbb431 100644
--- a/server/data/data-file/src/test/java/org/apache/james/mailrepository/MBoxMailRepositoryTest.java
+++ b/server/data/data-file/src/test/java/org/apache/james/mailrepository/MBoxMailRepositoryTest.java
@@ -18,16 +18,17 @@
****************************************************************/
package org.apache.james.mailrepository;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.util.Iterator;
+
import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.james.filesystem.api.mock.MockFileSystem;
import org.apache.james.mailrepository.api.MailRepository;
import org.apache.james.mailrepository.file.MBoxMailRepository;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.slf4j.LoggerFactory;
/**
* NOTE this test *WAS* disabled because MBoxMailRepository does not currently
@@ -48,7 +49,6 @@ public class MBoxMailRepositoryTest {
defaultConfiguration.addProperty("[@destinationURL]", mboxPath);
defaultConfiguration.addProperty("[@type]", "MAIL");
- mr.setLog(LoggerFactory.getLogger("MockLog"));
mr.configure(defaultConfiguration);
return mr;
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java b/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java
index 4d3aba6..bac9f98 100644
--- a/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java
+++ b/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLRecipientRewriteTableTest.java
@@ -30,7 +30,6 @@ import org.apache.james.rrt.lib.Mappings;
import org.apache.james.rrt.lib.MappingsImpl;
import org.apache.james.rrt.lib.MappingsImpl.Builder;
import org.junit.Before;
-import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
@@ -50,9 +49,7 @@ public class XMLRecipientRewriteTableTest extends AbstractRecipientRewriteTableT
@Override
protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
- XMLRecipientRewriteTable localVirtualUserTable = new XMLRecipientRewriteTable();
- localVirtualUserTable.setLog(LoggerFactory.getLogger("MockLog"));
- return localVirtualUserTable;
+ return new XMLRecipientRewriteTable();
}
@Override
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLStepdefs.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLStepdefs.java b/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLStepdefs.java
index f3d80a4..580f928 100644
--- a/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLStepdefs.java
+++ b/server/data/data-file/src/test/java/org/apache/james/rrt/file/XMLStepdefs.java
@@ -20,7 +20,6 @@ package org.apache.james.rrt.file;
import org.apache.james.rrt.lib.AbstractRecipientRewriteTable;
import org.apache.james.rrt.lib.RewriteTablesStepdefs;
-import org.slf4j.LoggerFactory;
import cucumber.api.java.Before;
@@ -38,8 +37,6 @@ public class XMLStepdefs {
}
private AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
- XMLRecipientRewriteTable localVirtualUserTable = new XMLRecipientRewriteTable();
- localVirtualUserTable.setLog(LoggerFactory.getLogger("MockLog"));
- return localVirtualUserTable;
+ return new XMLRecipientRewriteTable();
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java b/server/data/data-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java
index 59e6661..79c98b6 100644
--- a/server/data/data-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java
+++ b/server/data/data-file/src/test/java/org/apache/james/user/file/UsersFileRepositoryTest.java
@@ -37,7 +37,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-import org.slf4j.LoggerFactory;
/**
* Test basic behaviors of UsersFileRepository
@@ -90,7 +89,6 @@ public class UsersFileRepositoryTest extends AbstractUsersRepositoryTest {
UsersFileRepository res = new UsersFileRepository();
res.setFileSystem(fs);
- res.setLog(LoggerFactory.getLogger("MockLog"));
res.configure(configuration);
res.init();
return res;
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.java b/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.java
index 64104b1..e78ba41 100644
--- a/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.java
+++ b/server/data/data-hbase/src/test/java/org/apache/james/domainlist/hbase/HBaseDomainListTest.java
@@ -28,7 +28,6 @@ import org.apache.james.system.hbase.TablePool;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import org.slf4j.LoggerFactory;
/**
* Tests for the HBase DomainList implementation.
@@ -51,7 +50,6 @@ public class HBaseDomainListTest extends AbstractDomainListTest {
@Override
protected DomainList createDomainList() {
HBaseDomainList domainList = new HBaseDomainList(getDNSServer("localhost"));
- domainList.setLog(LoggerFactory.getLogger("MockLog"));
domainList.setAutoDetect(false);
domainList.setAutoDetectIP(false);
return domainList;
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
index e06b0b0..04dc114 100644
--- a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
+++ b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
@@ -27,7 +27,6 @@ import org.apache.james.rrt.lib.AbstractRecipientRewriteTable;
import org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest;
import org.apache.james.system.hbase.TablePool;
import org.junit.Before;
-import org.slf4j.LoggerFactory;
/**
* Tests for the HBase RecipientRewriteTable implementation.
@@ -50,7 +49,6 @@ public class HBaseRecipientRewriteTableTest extends AbstractRecipientRewriteTabl
@Override
protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
HBaseRecipientRewriteTable rrt = new HBaseRecipientRewriteTable();
- rrt.setLog(LoggerFactory.getLogger("MockLog"));
rrt.configure(new DefaultConfigurationBuilder());
return rrt;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java
----------------------------------------------------------------------
diff --git a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java
index 65d8327..e4e5b95 100644
--- a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java
+++ b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseStepdefs.java
@@ -28,7 +28,6 @@ import org.apache.james.rrt.lib.AbstractRecipientRewriteTable;
import org.apache.james.rrt.lib.RewriteTablesStepdefs;
import org.apache.james.system.hbase.TablePool;
import org.apache.james.user.hbase.def.HUsersRepository;
-import org.slf4j.LoggerFactory;
import com.google.common.base.Throwables;
@@ -64,7 +63,6 @@ public class HBaseStepdefs {
private AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
HBaseRecipientRewriteTable rrt = new HBaseRecipientRewriteTable();
- rrt.setLog(LoggerFactory.getLogger("MockLog"));
rrt.configure(new DefaultConfigurationBuilder());
return rrt;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java b/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java
index 44969a9..8267076 100644
--- a/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java
+++ b/server/data/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java
@@ -31,7 +31,6 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import org.slf4j.LoggerFactory;
/**
* Tests for the HBase UsersRepository implementation.
@@ -77,7 +76,6 @@ public class HBaseUsersRepositoryTest extends AbstractUsersRepositoryTest {
@Override
protected AbstractUsersRepository getUsersRepository() throws Exception {
HBaseUsersRepository userRepository = new HBaseUsersRepository();
- userRepository.setLog(LoggerFactory.getLogger("MockLog"));
userRepository.configure(new DefaultConfigurationBuilder());
return userRepository;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java b/server/data/data-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java
index e45df56..2029201 100644
--- a/server/data/data-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java
+++ b/server/data/data-jcr/src/main/java/org/apache/james/user/jcr/JCRUsersRepository.java
@@ -42,12 +42,15 @@ import org.apache.james.user.api.UsersRepositoryException;
import org.apache.james.user.api.model.User;
import org.apache.james.user.jcr.model.JCRUser;
import org.apache.james.user.lib.AbstractUsersRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* {@link UsersRepository} implementation which stores users to a JCR
* {@link Repository}
*/
public class JCRUsersRepository extends AbstractUsersRepository {
+ private static final Logger LOGGER = LoggerFactory.getLogger(JCRUsersRepository.class);
// TODO: Add namespacing
private static final String PASSWD_PROPERTY = "passwd";
@@ -112,8 +115,8 @@ public class JCRUsersRepository extends AbstractUsersRepository {
}
} catch (RepositoryException e) {
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Failed to add user: " + username, e);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Failed to add user: " + username, e);
}
user = null;
}
@@ -158,7 +161,7 @@ public class JCRUsersRepository extends AbstractUsersRepository {
session.save();
} catch (PathNotFoundException e) {
// user not found
- getLogger().debug("User not found");
+ LOGGER.debug("User not found");
throw new UsersRepositoryException("User " + user.getUserName() + " not exist");
}
} finally {
@@ -166,8 +169,8 @@ public class JCRUsersRepository extends AbstractUsersRepository {
}
} catch (RepositoryException e) {
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Failed to add user: " + userName, e);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Failed to add user: " + userName, e);
}
throw new UsersRepositoryException("Failed to add user: " + userName, e);
@@ -200,8 +203,8 @@ public class JCRUsersRepository extends AbstractUsersRepository {
}
} catch (RepositoryException e) {
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Failed to remove user: " + username, e);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Failed to remove user: " + username, e);
}
throw new UsersRepositoryException("Failed to remove user: " + username, e);
@@ -228,8 +231,8 @@ public class JCRUsersRepository extends AbstractUsersRepository {
session.logout();
}
} catch (PathNotFoundException e) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("User not found: " + name, e);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("User not found: " + name, e);
}
} catch (RepositoryException e) {
throw new UsersRepositoryException("Failed to search for user: " + name, e);
@@ -271,7 +274,7 @@ public class JCRUsersRepository extends AbstractUsersRepository {
return current.equals(hashPassword);
} catch (PathNotFoundException e) {
// user not found
- getLogger().debug("User not found");
+ LOGGER.debug("User not found");
return false;
}
} finally {
@@ -279,8 +282,8 @@ public class JCRUsersRepository extends AbstractUsersRepository {
}
} catch (RepositoryException e) {
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Failed to search user: " + username, e);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Failed to search user: " + username, e);
}
throw new UsersRepositoryException("Failed to search for user: " + username, e);
@@ -312,8 +315,8 @@ public class JCRUsersRepository extends AbstractUsersRepository {
session.logout();
}
} catch (RepositoryException e) {
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Failed to count user", e);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Failed to count user", e);
}
throw new UsersRepositoryException("Failed to count user", e);
@@ -343,18 +346,18 @@ public class JCRUsersRepository extends AbstractUsersRepository {
final String userName = node.getProperty(USERNAME_PROPERTY).getString();
userNames.add(userName);
} catch (PathNotFoundException e) {
- getLogger().info("Node missing user name. Ignoring.");
+ LOGGER.info("Node missing user name. Ignoring.");
}
}
} catch (PathNotFoundException e) {
- getLogger().info("Path not found. Forgotten to setup the repository?");
+ LOGGER.info("Path not found. Forgotten to setup the repository?");
}
} finally {
session.logout();
}
} catch (RepositoryException e) {
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Failed to list users", e);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Failed to list users", e);
}
throw new UsersRepositoryException("Failed to list users", e);
}
@@ -375,7 +378,7 @@ public class JCRUsersRepository extends AbstractUsersRepository {
final Node rootNode = session.getRootNode();
try {
rootNode.getNode(path);
- getLogger().info("User already exists");
+ LOGGER.info("User already exists");
throw new UsersRepositoryException("User " + lowerCasedUsername + " already exists");
} catch (PathNotFoundException e) {
// user does not exist
@@ -405,8 +408,8 @@ public class JCRUsersRepository extends AbstractUsersRepository {
}
} catch (RepositoryException e) {
- if (getLogger().isInfoEnabled()) {
- getLogger().info("Failed to add user: " + lowerCasedUsername, e);
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Failed to add user: " + lowerCasedUsername, e);
}
throw new UsersRepositoryException("Failed to add user: " + lowerCasedUsername, e);
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-jcr/src/test/java/org/apache/james/user/jcr/JcrUserRepositoryTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-jcr/src/test/java/org/apache/james/user/jcr/JcrUserRepositoryTest.java b/server/data/data-jcr/src/test/java/org/apache/james/user/jcr/JcrUserRepositoryTest.java
index 3a13555..d9b62d7 100644
--- a/server/data/data-jcr/src/test/java/org/apache/james/user/jcr/JcrUserRepositoryTest.java
+++ b/server/data/data-jcr/src/test/java/org/apache/james/user/jcr/JcrUserRepositoryTest.java
@@ -29,7 +29,6 @@ import org.apache.james.user.lib.AbstractUsersRepository;
import org.apache.james.user.lib.AbstractUsersRepositoryTest;
import org.junit.After;
import org.junit.Before;
-import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
import com.google.common.base.Throwables;
@@ -47,7 +46,6 @@ public class JcrUserRepositoryTest extends AbstractUsersRepositoryTest {
config.addProperty("username", "admin");
config.addProperty("password", "test");
repos.configure(config);
- repos.setLog(LoggerFactory.getLogger("MockLog"));
return repos;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/16b36cbd/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
index 20065b1..07f6e8a 100644
--- a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
+++ b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
@@ -61,6 +61,8 @@ import org.apache.james.util.sql.JDBCUtil;
import org.apache.james.util.sql.SqlResources;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Implementation of a MailRepository on a database.
@@ -90,6 +92,7 @@ import org.apache.mailet.MailAddress;
* Dec 2010) $
*/
public class JDBCMailRepository extends AbstractMailRepository {
+ private static final Logger LOGGER = LoggerFactory.getLogger(JDBCMailRepository.class);
/**
* The table name parsed from the destination URL
@@ -160,8 +163,8 @@ public class JDBCMailRepository extends AbstractMailRepository {
protected void doConfigure(HierarchicalConfiguration configuration) throws ConfigurationException {
super.doConfigure(configuration);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this.getClass().getName() + ".configure()");
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(this.getClass().getName() + ".configure()");
}
destination = configuration.getString("[@destinationURL]");
@@ -206,9 +209,9 @@ public class JDBCMailRepository extends AbstractMailRepository {
}
}
- if (getLogger().isDebugEnabled()) {
+ if (LOGGER.isDebugEnabled()) {
String logBuffer = "Parsed URL: table = '" + tableName + "', repositoryName = '" + repositoryName + "'";
- getLogger().debug(logBuffer);
+ LOGGER.debug(logBuffer);
}
inMemorySizeLimit = configuration.getInt("inMemorySizeLimit", 409600000);
@@ -235,8 +238,8 @@ public class JDBCMailRepository extends AbstractMailRepository {
@PostConstruct
public void init() throws Exception {
StringBuffer logBuffer;
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(this.getClass().getName() + ".initialize()");
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(this.getClass().getName() + ".initialize()");
}
try {
@@ -248,29 +251,28 @@ public class JDBCMailRepository extends AbstractMailRepository {
streamConfiguration.addProperty("[@destinationURL]", filestore);
sr = new FilePersistentStreamRepository();
- sr.setLog(getLogger());
sr.setFileSystem(fileSystem);
sr.configure(streamConfiguration);
sr.init();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Got filestore for JdbcMailRepository: " + filestore);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Got filestore for JdbcMailRepository: " + filestore);
}
}
- if (getLogger().isDebugEnabled()) {
+ if (LOGGER.isDebugEnabled()) {
String logBuf = this.getClass().getName() + " created according to " + destination;
- getLogger().debug(logBuf);
+ LOGGER.debug(logBuf);
}
} catch (Exception e) {
final String message = "Failed to retrieve Store component:" + e.getMessage();
- getLogger().error(message, e);
+ LOGGER.error(message, e);
throw new ConfigurationException(message, e);
}
theJDBCUtil = new JDBCUtil() {
protected void delegatedLog(String logString) {
- JDBCMailRepository.this.getLogger().warn("JDBCMailRepository: " + logString);
+ JDBCMailRepository.this.LOGGER.warn("JDBCMailRepository: " + logString);
}
};
@@ -285,13 +287,13 @@ public class JDBCMailRepository extends AbstractMailRepository {
try {
sqlFile = fileSystem.getResource(sqlFileName);
} catch (Exception e) {
- getLogger().error(e.getMessage(), e);
+ LOGGER.error(e.getMessage(), e);
throw e;
}
- if (getLogger().isDebugEnabled()) {
+ if (LOGGER.isDebugEnabled()) {
logBuffer = new StringBuffer(128).append("Reading SQL resources from file: ").append(sqlFileName).append(", section ").append(this.getClass().getName()).append(".");
- getLogger().debug(logBuffer.toString());
+ LOGGER.debug(logBuffer.toString());
}
// Build the statement parameters
@@ -316,9 +318,9 @@ public class JDBCMailRepository extends AbstractMailRepository {
createStatement = conn.prepareStatement(sqlQueries.getSqlString("createTable", true));
createStatement.execute();
- if (getLogger().isInfoEnabled()) {
+ if (LOGGER.isInfoEnabled()) {
logBuffer = new StringBuffer(64).append("JdbcMailRepository: Created table '").append(tableName).append("'.");
- getLogger().info(logBuffer.toString());
+ LOGGER.info(logBuffer.toString());
}
}
@@ -367,29 +369,29 @@ public class JDBCMailRepository extends AbstractMailRepository {
if (hasUpdateMessageAttributesSQL && !hasRetrieveMessageAttributesSQL) {
logBuffer.append("JDBC Mail Attributes support was activated for update but not for retrieval" + "(found 'updateMessageAttributesSQL' but not 'retrieveMessageAttributesSQL'" + "in table '").append(tableName).append("').");
- getLogger().error(logBuffer.toString());
+ LOGGER.error(logBuffer.toString());
throw new SQLException(logBuffer.toString());
}
if (!hasUpdateMessageAttributesSQL && hasRetrieveMessageAttributesSQL) {
logBuffer.append("JDBC Mail Attributes support was activated for retrieval but not for update" + "(found 'retrieveMessageAttributesSQL' but not 'updateMessageAttributesSQL'" + "in table '").append(tableName).append("'.");
- getLogger().error(logBuffer.toString());
+ LOGGER.error(logBuffer.toString());
throw new SQLException(logBuffer.toString());
}
if (!hasMessageAttributesColumn && (hasUpdateMessageAttributesSQL || hasRetrieveMessageAttributesSQL)) {
logBuffer.append("JDBC Mail Attributes support was activated but column '").append(attributesColumnName).append("' is missing in table '").append(tableName).append("'.");
- getLogger().error(logBuffer.toString());
+ LOGGER.error(logBuffer.toString());
throw new SQLException(logBuffer.toString());
}
if (hasUpdateMessageAttributesSQL && hasRetrieveMessageAttributesSQL) {
jdbcMailAttributesReady = true;
- if (getLogger().isInfoEnabled()) {
+ if (LOGGER.isInfoEnabled()) {
logBuffer.append("JDBC Mail Attributes support ready.");
- getLogger().info(logBuffer.toString());
+ LOGGER.info(logBuffer.toString());
}
} else {
jdbcMailAttributesReady = false;
logBuffer.append("JDBC Mail Attributes support not activated. " + "Missing both 'updateMessageAttributesSQL' " + "and 'retrieveMessageAttributesSQL' " + "statements for table '").append(tableName).append("' in sqlResources.xml. ").append("Will not persist in the repository '").append(repositoryName).append("'.");
- getLogger().warn(logBuffer.toString());
+ LOGGER.warn(logBuffer.toString());
}
}
@@ -509,14 +511,14 @@ public class JDBCMailRepository extends AbstractMailRepository {
oos.close();
}
} catch (IOException ioe) {
- getLogger().debug("JDBCMailRepository: Unexpected exception while closing output stream.", ioe);
+ LOGGER.debug("JDBCMailRepository: Unexpected exception while closing output stream.", ioe);
}
}
updateMessageAttr.setString(2, mc.getName());
updateMessageAttr.setString(3, repositoryName);
updateMessageAttr.execute();
} catch (SQLException sqle) {
- getLogger().info("JDBCMailRepository: Trying to update mail attributes failed.", sqle);
+ LOGGER.info("JDBCMailRepository: Trying to update mail attributes failed.", sqle);
} finally {
theJDBCUtil.closeJDBCStatement(updateMessageAttr);
@@ -591,7 +593,7 @@ public class JDBCMailRepository extends AbstractMailRepository {
oos.close();
}
} catch (IOException ioe) {
- getLogger().debug("JDBCMailRepository: Unexpected exception while closing output stream.", ioe);
+ LOGGER.debug("JDBCMailRepository: Unexpected exception while closing output stream.", ioe);
}
}
}
@@ -605,7 +607,7 @@ public class JDBCMailRepository extends AbstractMailRepository {
conn.commit();
conn.setAutoCommit(true);
} catch (SQLException e) {
- getLogger().debug("Failed to store internal mail", e);
+ LOGGER.debug("Failed to store internal mail", e);
throw new IOException(e.getMessage());
} finally {
theJDBCUtil.closeJDBCConnection(conn);
@@ -637,9 +639,9 @@ public class JDBCMailRepository extends AbstractMailRepository {
System.err.println("ran the query " + key);
}
if (!rsMessage.next()) {
- if (getLogger().isDebugEnabled()) {
+ if (LOGGER.isDebugEnabled()) {
String debugBuffer = "Did not find a record " + key + " in " + repositoryName;
- getLogger().debug(debugBuffer);
+ LOGGER.debug(debugBuffer);
}
return null;
}
@@ -674,20 +676,20 @@ public class JDBCMailRepository extends AbstractMailRepository {
ois.close();
}
} catch (IOException ioe) {
- if (getLogger().isDebugEnabled()) {
+ if (LOGGER.isDebugEnabled()) {
String debugBuffer = "Exception reading attributes " + key + " in " + repositoryName;
- getLogger().debug(debugBuffer, ioe);
+ LOGGER.debug(debugBuffer, ioe);
}
}
} else {
- if (getLogger().isDebugEnabled()) {
+ if (LOGGER.isDebugEnabled()) {
String debugBuffer = "Did not find a record (attributes) " + key + " in " + repositoryName;
- getLogger().debug(debugBuffer);
+ LOGGER.debug(debugBuffer);
}
}
} catch (SQLException sqle) {
String errorBuffer = "Error retrieving message" + sqle.getMessage() + sqle.getErrorCode() + sqle.getSQLState() + sqle.getNextException();
- getLogger().error(errorBuffer);
+ LOGGER.error(errorBuffer);
} finally {
theJDBCUtil.closeJDBCResultSet(rsMessageAttr);
theJDBCUtil.closeJDBCStatement(retrieveMessageAttr);
@@ -721,8 +723,8 @@ public class JDBCMailRepository extends AbstractMailRepository {
return mc;
} catch (SQLException sqle) {
String errorBuffer = "Error retrieving message" + sqle.getMessage() + sqle.getErrorCode() + sqle.getSQLState() + sqle.getNextException();
- getLogger().error(errorBuffer);
- getLogger().debug("Failed to retrieve mail", sqle);
+ LOGGER.error(errorBuffer);
+ LOGGER.debug("Failed to retrieve mail", sqle);
throw new MessagingException("Exception while retrieving mail: " + sqle.getMessage(), sqle);
} catch (Exception me) {
throw new MessagingException("Exception while retrieving mail: " + me.getMessage(), me);
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org