From 6c3f614edb18bdb8cc6e7b87627f240d97a258c3 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Thu, 13 Oct 2016 13:56:47 +0200 Subject: HONEYCOMB-207 : Configurable modules list for distributions Export list of modules for built distribution on compile time according to distribution.modules property to ***module-config.txt Load aggregated set of modules on start from all descriptors in /modules folder Change-Id: Icdeb23536aee3a243a221d3f2ec5f340d387764e Signed-off-by: Jan Srnicek --- .../io/fd/honeycomb/vppnsh/impl/VppNshModule.java | 24 ------------- .../vppnsh/impl/cfgattrs/VppNshConfiguration.java | 41 ---------------------- .../honeycomb-minimal-resources/config/vppnsh.json | 3 -- 3 files changed, 68 deletions(-) delete mode 100755 nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/cfgattrs/VppNshConfiguration.java delete mode 100644 nsh/impl/src/main/resources/honeycomb-minimal-resources/config/vppnsh.json (limited to 'nsh') diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java index 156646628..e7d9d1535 100755 --- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java +++ b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java @@ -17,8 +17,6 @@ package io.fd.honeycomb.vppnsh.impl; import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Injector; import com.google.inject.Singleton; import com.google.inject.multibindings.Multibinder; import com.google.inject.name.Names; @@ -26,12 +24,10 @@ import io.fd.honeycomb.data.init.DataTreeInitializer; import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.honeycomb.vppnsh.impl.cfgattrs.VppNshConfiguration; import io.fd.honeycomb.vppnsh.impl.config.VppNshWriterFactory; import io.fd.honeycomb.vppnsh.impl.init.VppNshInitializer; import io.fd.honeycomb.vppnsh.impl.oper.VppNshReaderFactory; import io.fd.honeycomb.vppnsh.impl.util.JVppNshProvider; -import net.jmob.guice.conf.core.ConfigurationModule; import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,11 +41,6 @@ public final class VppNshModule extends AbstractModule { @Override protected void configure() { - // TODO HONEYCOMB-207 workaround: - if (!isEnabled()) { - LOG.info("VppNshModule is disabled. Skipping module configuration."); - return; - } LOG.info("Configuring VppNsh module"); // Naming contexts @@ -70,19 +61,4 @@ public final class VppNshModule extends AbstractModule { Multibinder.newSetBinder(binder(), DataTreeInitializer.class).addBinding().to(VppNshInitializer.class); LOG.info("NSH module successfully configured"); } - - private static boolean isEnabled() { - final Injector injector = Guice.createInjector(new AbstractModule() { - @Override - protected void configure() { - // These are plugin specific config attributes - install(ConfigurationModule.create()); - requestInjection(VppNshConfiguration.class); - } - }); - - final VppNshConfiguration cfgAttributes = injector.getInstance(VppNshConfiguration.class); - LOG.debug("Configuration for VppNsh module: {}", cfgAttributes); - return cfgAttributes.isNshEnabled(); - } } diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/cfgattrs/VppNshConfiguration.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/cfgattrs/VppNshConfiguration.java deleted file mode 100755 index e6491509d..000000000 --- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/cfgattrs/VppNshConfiguration.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2016 Intel and/or its affiliates. - * - * Licensed 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 io.fd.honeycomb.vppnsh.impl.cfgattrs; - -import com.google.common.base.MoreObjects; - -import net.jmob.guice.conf.core.BindConfig; -import net.jmob.guice.conf.core.InjectConfig; -import net.jmob.guice.conf.core.Syntax; - -@BindConfig(value = "vppnsh", syntax = Syntax.JSON) -public class VppNshConfiguration { - - public boolean isNshEnabled() { - return Boolean.valueOf(nshEnable); - } - - @InjectConfig("nsh-enabled") - public String nshEnable; - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("nshEnable", nshEnable) - .toString(); - } -} diff --git a/nsh/impl/src/main/resources/honeycomb-minimal-resources/config/vppnsh.json b/nsh/impl/src/main/resources/honeycomb-minimal-resources/config/vppnsh.json deleted file mode 100644 index b03a962f1..000000000 --- a/nsh/impl/src/main/resources/honeycomb-minimal-resources/config/vppnsh.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "nsh-enabled": "false" -} \ No newline at end of file -- cgit 1.2.3-korg