james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [05/15] james-project git commit: JAMES-1982 Set logger on MailboxManagement to avoid NPE
Date Mon, 03 Apr 2017 11:10:04 GMT
JAMES-1982 Set logger on MailboxManagement to avoid NPE


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/8942eaff
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/8942eaff
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/8942eaff

Branch: refs/heads/master
Commit: 8942eaff850265defa6c9c6e629350067d65a1f9
Parents: 95d241d
Author: benwa <btellier@linagora.com>
Authored: Sat Apr 1 12:08:11 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Mon Apr 3 18:09:32 2017 +0700

----------------------------------------------------------------------
 .../james/modules/server/JMXServerModule.java   | 36 +++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8942eaff/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java
b/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java
index fc97468..626ef3a 100644
--- a/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java
+++ b/server/container/guice/jmx/src/main/java/org/apache/james/modules/server/JMXServerModule.java
@@ -47,11 +47,13 @@ import org.apache.james.user.api.UsersRepositoryManagementMBean;
 import org.apache.james.user.lib.UsersRepositoryManagement;
 import org.apache.james.utils.ConfigurationPerformer;
 import org.apache.james.utils.GuiceMailboxManagerResolver;
+import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.inject.AbstractModule;
 import com.google.inject.Inject;
+import com.google.inject.Scopes;
 import com.google.inject.Singleton;
 import com.google.inject.multibindings.Multibinder;
 import com.google.inject.name.Names;
@@ -69,6 +71,15 @@ public class JMXServerModule extends AbstractModule {
 
     @Override
     protected void configure() {
+        bind(ReIndexerManagement.class).in(Scopes.SINGLETON);
+        bind(QuotaManagement.class).in(Scopes.SINGLETON);
+        bind(RecipientRewriteTableManagement.class).in(Scopes.SINGLETON);
+        bind(MailboxManagerManagement.class).in(Scopes.SINGLETON);
+        bind(UsersRepositoryManagement.class).in(Scopes.SINGLETON);
+        bind(DomainListManagement.class).in(Scopes.SINGLETON);
+        bind(MailboxCopierManagement.class).in(Scopes.SINGLETON);
+        bind(SieveRepositoryManagement.class).in(Scopes.SINGLETON);
+
         bind(MailboxCopier.class).annotatedWith(Names.named("mailboxcopier")).to(MailboxCopierImpl.class);
         bind(MailboxCopierManagementMBean.class).to(MailboxCopierManagement.class);
         bind(MailboxManagerResolver.class).to(GuiceMailboxManagerResolver.class);
@@ -81,7 +92,9 @@ public class JMXServerModule extends AbstractModule {
         bind(ReIndexerManagementMBean.class).to(ReIndexerManagement.class);
         bind(QuotaManagementMBean.class).to(QuotaManagement.class);
         bind(SieveRepositoryManagementMBean.class).to(SieveRepositoryManagement.class);
-        Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JMXModuleConfigurationPerformer.class);
+        Multibinder<ConfigurationPerformer> configurationMultibinder = Multibinder.newSetBinder(binder(),
ConfigurationPerformer.class);
+        configurationMultibinder.addBinding().to(JMXModuleConfigurationPerformer.class);
+        configurationMultibinder.addBinding().to(MailboxManagementLogSetter.class);
     }
 
     @Singleton
@@ -141,4 +154,25 @@ public class JMXServerModule extends AbstractModule {
         }
     }
 
+    @Singleton
+    public static class MailboxManagementLogSetter implements ConfigurationPerformer {
+
+        private final MailboxManagerManagement mailboxManagerManagement;
+
+        @Inject
+        public MailboxManagementLogSetter(MailboxManagerManagement mailboxManagerManagement)
{
+            this.mailboxManagerManagement = mailboxManagerManagement;
+        }
+
+        @Override
+        public void initModule() {
+            mailboxManagerManagement.setLog(LoggerFactory.getLogger(MailboxManagerManagement.class));
+        }
+
+        @Override
+        public List<Class<? extends Configurable>> forClasses() {
+            return ImmutableList.of();
+        }
+    }
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message