diff options
author | 2016-10-13 13:56:47 +0200 | |
---|---|---|
committer | 2016-10-13 13:28:56 +0000 | |
commit | 6c3f614edb18bdb8cc6e7b87627f240d97a258c3 (patch) | |
tree | 52b9e116e7984d72a94ddee1c4b70b363e05c6ac /nsh/impl/src/main/java | |
parent | 9d69639d39bd55628cadc445e816fcccf23c1361 (diff) |
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 <jsrnicek@cisco.com>
Diffstat (limited to 'nsh/impl/src/main/java')
-rwxr-xr-x | nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/VppNshModule.java | 24 | ||||
-rwxr-xr-x | nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/cfgattrs/VppNshConfiguration.java | 41 |
2 files changed, 0 insertions, 65 deletions
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(); - } -} |