summaryrefslogtreecommitdiffstats
path: root/infra/minimal-distribution/src
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-08-12 13:51:56 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-08-19 12:49:56 +0200
commitdcd507eff53e7c0abd659da416aac91a7d29e3d3 (patch)
tree8e021d05538cb862527ed98c3e9d1f3e19fc4d8f /infra/minimal-distribution/src
parentd022ca8d078e1731435bf3e69a9a1ff85e7e0c63 (diff)
HONEYCOMB-137: Put minimal distribution into RPM
Change-Id: I163be0361f75a29aac569b019892433b12bfb0a6 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'infra/minimal-distribution/src')
-rw-r--r--infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/Main.java75
-rw-r--r--infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json4
-rw-r--r--infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/logback.xml4
3 files changed, 47 insertions, 36 deletions
diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/Main.java b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/Main.java
index ff85cd2a7..6c63c213d 100644
--- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/Main.java
+++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/Main.java
@@ -17,10 +17,13 @@
package io.fd.honeycomb.infra.distro;
import com.google.common.collect.ImmutableList;
+import com.google.inject.ConfigurationException;
+import com.google.inject.CreationException;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
+import com.google.inject.ProvisionException;
import com.google.inject.name.Names;
import groovy.util.logging.Slf4j;
import io.fd.honeycomb.data.init.DataTreeInitializer;
@@ -68,49 +71,57 @@ public final class Main {
}
public static Injector init(final List<? extends Module> modules) {
- LOG.info("Starting honeycomb");
+ try {
+ LOG.info("Starting honeycomb");
- Injector injector = Guice.createInjector(modules);
- LOG.info("Honeycomb configuration: " + injector.getInstance(HoneycombConfiguration.class));
+ Injector injector = Guice.createInjector(modules);
+ LOG.info("Honeycomb configuration: " + injector.getInstance(HoneycombConfiguration.class));
- // Log all bindings
- injector.getAllBindings().entrySet().stream()
- .forEach(e -> LOG.trace("Component available under: {} is {}", e.getKey(), e.getValue()));
+ // Log all bindings
+ injector.getAllBindings().entrySet().stream()
+ .forEach(e -> LOG.trace("Component available under: {} is {}", e.getKey(), e.getValue()));
- final HoneycombConfiguration cfgAttributes = injector.getInstance(HoneycombConfiguration.class);
+ final HoneycombConfiguration cfgAttributes = injector.getInstance(HoneycombConfiguration.class);
- // Now get instances for all dependency roots
+ // Now get instances for all dependency roots
- LOG.info("Starting RESTCONF");
- injector.getInstance(RestConnector.class);
+ LOG.info("Starting RESTCONF");
+ injector.getInstance(RestConnector.class);
- LOG.info("Starting NETCONF");
- injector.getInstance(
- Key.get(NetconfOperationServiceFactory.class, Names.named("netconf-mapper-honeycomb")));
- injector.getInstance(
- Key.get(NetconfOperationServiceFactory.class, Names.named("netconf-mapper-notification")));
- injector.getInstance(
- Key.get(NetconfOperationServiceFactory.class, Names.named("netconf-mapper-monitoring")));
+ LOG.info("Starting NETCONF");
+ injector.getInstance(
+ Key.get(NetconfOperationServiceFactory.class, Names.named("netconf-mapper-honeycomb")));
+ injector.getInstance(
+ Key.get(NetconfOperationServiceFactory.class, Names.named("netconf-mapper-notification")));
+ injector.getInstance(
+ Key.get(NetconfOperationServiceFactory.class, Names.named("netconf-mapper-monitoring")));
- if (cfgAttributes.isNetconfTcpServerEnabled()) {
- injector.getInstance(NetconfTcpServerProvider.NetconfTcpServer.class);
- }
+ if (cfgAttributes.isNetconfTcpServerEnabled()) {
+ injector.getInstance(NetconfTcpServerProvider.NetconfTcpServer.class);
+ }
- injector.getInstance(NetconfSshServerProvider.NetconfSshServer.class);
- injector.getInstance(HoneycombNotification2NetconfProvider.HoneycombNotification2Netconf.class);
+ injector.getInstance(NetconfSshServerProvider.NetconfSshServer.class);
+ injector.getInstance(HoneycombNotification2NetconfProvider.HoneycombNotification2Netconf.class);
- LOG.info("Honeycomb started successfully!");
+ LOG.info("Honeycomb started successfully!");
- try {
- LOG.info("Initializing configuration");
- injector.getInstance(Key.get(InitializerRegistry.class, Names.named("honeycomb-initializer"))).initialize();
- LOG.info("Configuration initialized successfully");
- } catch (DataTreeInitializer.InitializeException e) {
- LOG.error("Unable to initialize configuration", e);
- }
+ try {
+ LOG.info("Initializing configuration");
+ injector.getInstance(Key.get(InitializerRegistry.class, Names.named("honeycomb-initializer"))).initialize();
+ LOG.info("Configuration initialized successfully");
+ } catch (DataTreeInitializer.InitializeException e) {
+ LOG.error("Unable to initialize configuration", e);
+ }
- LOG.info("Honeycomb started successfully!");
+ LOG.info("Honeycomb started successfully!");
- return injector;
+ return injector;
+ } catch (CreationException | ProvisionException | ConfigurationException e) {
+ LOG.error("Failed to initialize Honeycomb components", e);
+ throw e;
+ } catch (RuntimeException e) {
+ LOG.error("Unexpected initialization failure", e);
+ throw e;
+ }
}
}
diff --git a/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json b/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
index 350534ed7..d14feced0 100644
--- a/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
+++ b/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
@@ -1,7 +1,7 @@
{
- "persisted-context-path": "persist/context/data.json",
+ "persisted-context-path": "~/honeycomb/persist/context/data.json",
"persisted-context-restoration-type": "Merge",
- "persisted-config-path": "persist/config/data.json",
+ "persisted-config-path": "~/honeycomb/persist/config/data.json",
"persisted-config-restoration-type": "Merge",
"notification-service-queue-depth": 1,
diff --git a/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/logback.xml b/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/logback.xml
index c294d184c..ec7da7e13 100644
--- a/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/logback.xml
+++ b/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/logback.xml
@@ -6,10 +6,10 @@
</encoder>
</appender>
<appender name="honeycomb.log" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>logs/honeycomb.log</file>
+ <file>~/honeycomb/logs/honeycomb.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>logs/honeycomb.%d.log.zip</fileNamePattern>
+ <fileNamePattern>~/honeycomb/logs/honeycomb.%d.log.zip</fileNamePattern>
<maxHistory>1</maxHistory>
</rollingPolicy>