james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [04/23] james-project git commit: JAMES-2138 Always use ElasticSearch in names
Date Mon, 11 Sep 2017 02:36:48 GMT
JAMES-2138 Always use ElasticSearch in names


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

Branch: refs/heads/master
Commit: 5354f2310f39d5708f510abae5f272f84a11ffaa
Parents: 840a885
Author: Matthieu Baechler <matthieu@apache.org>
Authored: Mon Sep 4 10:48:27 2017 +0200
Committer: benwa <btellier@linagora.com>
Committed: Sat Sep 9 10:40:29 2017 +0700

----------------------------------------------------------------------
 .../apache/james/CassandraJamesServerMain.java  |   4 +-
 .../modules/server/ESMetricReporterModule.java  | 115 -------------------
 .../ElasticSearchMetricReporterModule.java      | 115 +++++++++++++++++++
 .../org/apache/james/JPAJamesServerMain.java    |   4 +-
 .../org/apache/james/JPAJamesServerMain.java    |   4 +-
 5 files changed, 121 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/5354f231/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index f047959..d6910f3 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -40,7 +40,7 @@ import org.apache.james.modules.protocols.SMTPServerModule;
 import org.apache.james.modules.server.ActiveMQQueueModule;
 import org.apache.james.modules.server.CassandraRoutesModule;
 import org.apache.james.modules.server.DataRoutesModules;
-import org.apache.james.modules.server.ESMetricReporterModule;
+import org.apache.james.modules.server.ElasticSearchMetricReporterModule;
 import org.apache.james.modules.server.JMXServerModule;
 import org.apache.james.modules.server.MailboxRoutesModule;
 import org.apache.james.modules.server.SwaggerRoutesModules;
@@ -76,7 +76,7 @@ public class CassandraJamesServerMain {
         new ElasticSearchMailboxModule(),
         new TikaMailboxModule(),
         new ActiveMQQueueModule(),
-        new ESMetricReporterModule(),
+        new ElasticSearchMetricReporterModule(),
         new CassandraMetricsModule(),
         new MailboxModule());
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/5354f231/server/container/guice/es-metric-reporter/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/es-metric-reporter/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java
b/server/container/guice/es-metric-reporter/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java
deleted file mode 100644
index 43cf53e..0000000
--- a/server/container/guice/es-metric-reporter/src/main/java/org/apache/james/modules/server/ESMetricReporterModule.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.modules.server;
-
-import java.io.FileNotFoundException;
-import java.util.List;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.HierarchicalConfiguration;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.commons.lang.NotImplementedException;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.metrics.es.ESMetricReporter;
-import org.apache.james.metrics.es.ESReporterConfiguration;
-import org.apache.james.utils.ConfigurationPerformer;
-import org.apache.james.utils.PropertiesProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-import com.google.inject.multibindings.Multibinder;
-
-public class ESMetricReporterModule extends AbstractModule {
-    private static final String ELASTICSEARCH_CONFIGURATION_NAME = "elasticsearch";
-    private static final String ELASTICSEARCH_MASTER_HOST = "elasticsearch.masterHost";
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(ESMetricReporterModule.class);
-
-    public static final boolean DEFAULT_DISABLE = false;
-    public static final int DEFAULT_ES_HTTP_PORT = 9200;
-
-    @Override
-    protected void configure() {
-        Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(ESMetricReporterStarter.class);
-    }
-
-    @Provides
-    public ESReporterConfiguration provideConfiguration(PropertiesProvider propertiesProvider)
throws ConfigurationException {
-        try {
-            PropertiesConfiguration propertiesReader = propertiesProvider.getConfiguration(ELASTICSEARCH_CONFIGURATION_NAME);
-
-            if (isMetricEnable(propertiesReader)) {
-                return ESReporterConfiguration.builder()
-                    .enabled()
-                    .onHost(locateHost(propertiesReader),
-                        propertiesReader.getInt("elasticsearch.http.port", DEFAULT_ES_HTTP_PORT))
-                    .onIndex(propertiesReader.getString("elasticsearch.metrics.reports.index",
null))
-                    .periodInSecond(propertiesReader.getLong("elasticsearch.metrics.reports.period",
null))
-                    .build();
-            }
-        } catch (FileNotFoundException e) {
-            LOGGER.info("Can not locate " + ELASTICSEARCH_CONFIGURATION_NAME + " configuration");
-        }
-        return ESReporterConfiguration.builder()
-            .disabled()
-            .build();
-    }
-
-    private String locateHost(PropertiesConfiguration propertiesReader) {
-        return propertiesReader.getString("elasticsearch.http.host",
-            propertiesReader.getString(ELASTICSEARCH_MASTER_HOST));
-    }
-
-    private boolean isMetricEnable(PropertiesConfiguration propertiesReader) {
-        return propertiesReader.getBoolean("elasticsearch.metrics.reports.enabled", DEFAULT_DISABLE);
-    }
-
-    @Singleton
-    public static class ESMetricReporterStarter implements ConfigurationPerformer, Configurable
{
-
-        private final ESMetricReporter esMetricReporter;
-
-        @Inject
-        public ESMetricReporterStarter(ESMetricReporter esMetricReporter) {
-            this.esMetricReporter = esMetricReporter;
-        }
-
-        @Override
-        public void initModule() {
-            esMetricReporter.start();
-        }
-
-        @Override
-        public List<Class<? extends Configurable>> forClasses() {
-            return ImmutableList.of(ESMetricReporterStarter.class);
-        }
-
-        @Override
-        public void configure(HierarchicalConfiguration config) throws ConfigurationException
{
-            throw new NotImplementedException();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5354f231/server/container/guice/es-metric-reporter/src/main/java/org/apache/james/modules/server/ElasticSearchMetricReporterModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/es-metric-reporter/src/main/java/org/apache/james/modules/server/ElasticSearchMetricReporterModule.java
b/server/container/guice/es-metric-reporter/src/main/java/org/apache/james/modules/server/ElasticSearchMetricReporterModule.java
new file mode 100644
index 0000000..f31e07c
--- /dev/null
+++ b/server/container/guice/es-metric-reporter/src/main/java/org/apache/james/modules/server/ElasticSearchMetricReporterModule.java
@@ -0,0 +1,115 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.modules.server;
+
+import java.io.FileNotFoundException;
+import java.util.List;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.metrics.es.ESMetricReporter;
+import org.apache.james.metrics.es.ESReporterConfiguration;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.PropertiesProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class ElasticSearchMetricReporterModule extends AbstractModule {
+    private static final String ELASTICSEARCH_CONFIGURATION_NAME = "elasticsearch";
+    private static final String ELASTICSEARCH_MASTER_HOST = "elasticsearch.masterHost";
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(ElasticSearchMetricReporterModule.class);
+
+    public static final boolean DEFAULT_DISABLE = false;
+    public static final int DEFAULT_ES_HTTP_PORT = 9200;
+
+    @Override
+    protected void configure() {
+        Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(ESMetricReporterStarter.class);
+    }
+
+    @Provides
+    public ESReporterConfiguration provideConfiguration(PropertiesProvider propertiesProvider)
throws ConfigurationException {
+        try {
+            PropertiesConfiguration propertiesReader = propertiesProvider.getConfiguration(ELASTICSEARCH_CONFIGURATION_NAME);
+
+            if (isMetricEnable(propertiesReader)) {
+                return ESReporterConfiguration.builder()
+                    .enabled()
+                    .onHost(locateHost(propertiesReader),
+                        propertiesReader.getInt("elasticsearch.http.port", DEFAULT_ES_HTTP_PORT))
+                    .onIndex(propertiesReader.getString("elasticsearch.metrics.reports.index",
null))
+                    .periodInSecond(propertiesReader.getLong("elasticsearch.metrics.reports.period",
null))
+                    .build();
+            }
+        } catch (FileNotFoundException e) {
+            LOGGER.info("Can not locate " + ELASTICSEARCH_CONFIGURATION_NAME + " configuration");
+        }
+        return ESReporterConfiguration.builder()
+            .disabled()
+            .build();
+    }
+
+    private String locateHost(PropertiesConfiguration propertiesReader) {
+        return propertiesReader.getString("elasticsearch.http.host",
+            propertiesReader.getString(ELASTICSEARCH_MASTER_HOST));
+    }
+
+    private boolean isMetricEnable(PropertiesConfiguration propertiesReader) {
+        return propertiesReader.getBoolean("elasticsearch.metrics.reports.enabled", DEFAULT_DISABLE);
+    }
+
+    @Singleton
+    public static class ESMetricReporterStarter implements ConfigurationPerformer, Configurable
{
+
+        private final ESMetricReporter esMetricReporter;
+
+        @Inject
+        public ESMetricReporterStarter(ESMetricReporter esMetricReporter) {
+            this.esMetricReporter = esMetricReporter;
+        }
+
+        @Override
+        public void initModule() {
+            esMetricReporter.start();
+        }
+
+        @Override
+        public List<Class<? extends Configurable>> forClasses() {
+            return ImmutableList.of(ESMetricReporterStarter.class);
+        }
+
+        @Override
+        public void configure(HierarchicalConfiguration config) throws ConfigurationException
{
+            throw new NotImplementedException();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5354f231/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
index e47868c..c3d89f5 100644
--- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -33,7 +33,7 @@ import org.apache.james.modules.protocols.SMTPServerModule;
 import org.apache.james.modules.server.ActiveMQQueueModule;
 import org.apache.james.modules.server.DataRoutesModules;
 import org.apache.james.modules.server.DefaultProcessorsConfigurationProviderModule;
-import org.apache.james.modules.server.ESMetricReporterModule;
+import org.apache.james.modules.server.ElasticSearchMetricReporterModule;
 import org.apache.james.modules.server.JMXServerModule;
 import org.apache.james.modules.server.MailboxRoutesModule;
 import org.apache.james.modules.server.NoJwtModule;
@@ -65,7 +65,7 @@ public class JPAJamesServerMain {
         new MailboxModule(),
         new NoJwtModule(),
         new DefaultProcessorsConfigurationProviderModule(),
-        new ESMetricReporterModule());
+        new ElasticSearchMetricReporterModule());
 
     public static void main(String[] args) throws Exception {
         GuiceJamesServer server = new GuiceJamesServer()

http://git-wip-us.apache.org/repos/asf/james-project/blob/5354f231/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
index ea2fc04..a2079c6 100644
--- a/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
+++ b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java
@@ -27,7 +27,7 @@ import org.apache.james.modules.protocols.SMTPServerModule;
 import org.apache.james.modules.server.ActiveMQQueueModule;
 import org.apache.james.modules.server.DataRoutesModules;
 import org.apache.james.modules.server.DefaultProcessorsConfigurationProviderModule;
-import org.apache.james.modules.server.ESMetricReporterModule;
+import org.apache.james.modules.server.ElasticSearchMetricReporterModule;
 import org.apache.james.modules.server.NoJwtModule;
 import org.apache.james.modules.server.RawPostDequeueDecoratorModule;
 import org.apache.james.modules.server.WebAdminServerModule;
@@ -51,7 +51,7 @@ public class JPAJamesServerMain {
         (binder) -> binder.bind(EntityManagerFactory.class).toProvider(OpenJPAPersistence::getEntityManagerFactory),
         new ActiveMQQueueModule(),
         new RawPostDequeueDecoratorModule(),
-        new ESMetricReporterModule());
+        new ElasticSearchMetricReporterModule());
 
     public static void main(String[] args) throws Exception {
         GuiceJamesServer server = new GuiceJamesServer()


---------------------------------------------------------------------
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