2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * Modifications copyright (c) 2017 AT&T Intellectual Property
21 package io.fd.honeycomb.tutorial;
23 import com.google.inject.AbstractModule;
24 import com.google.inject.multibindings.Multibinder;
25 import io.fd.honeycomb.data.init.DataTreeInitializer;
26 import io.fd.honeycomb.translate.read.ReaderFactory;
27 import io.fd.honeycomb.translate.v3po.util.NamingContext;
28 import io.fd.honeycomb.translate.write.WriterFactory;
29 import io.fd.honeycomb.tutorial.init.ConfigDataInitializer;
30 //import io.fd.honeycomb.tutorial.read.ModuleStateReaderFactory;
31 import io.fd.honeycomb.tutorial.write.ModuleWriterFactory;
32 import net.jmob.guice.conf.core.ConfigurationModule;
35 * Module class instantiating sample-plugin plugin components.
37 public final class Module extends AbstractModule {
40 protected void configure() {
41 // requests injection of properties
42 install(ConfigurationModule.create());
43 requestInjection(ModuleConfiguration.class);
45 // bind naming context instance for reader and writer factories
46 // the first parameter is artificial name prefix in cases a name needs to be reconstructed for a vxlan tunnel
47 // that is present in VPP but not in Honeycomb (could be extracted into configuration)
48 // the second parameter is just the naming context ID (could be extracted into configuration)
49 binder().bind(NamingContext.class).toInstance(new NamingContext("pgstream", "pgstream-context"));
51 // creates reader factory binding
52 // can hold multiple binding for separate yang modules
53 // final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
54 // readerFactoryBinder.addBinding().to(ModuleStateReaderFactory.class);
56 // create writer factory binding
57 // can hold multiple binding for separate yang modules
58 final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
59 writerFactoryBinder.addBinding().to(ModuleWriterFactory.class);
61 // create initializer binding
62 // can hold multiple binding for separate yang modules
63 final Multibinder<DataTreeInitializer> initializerBinder =
64 Multibinder.newSetBinder(binder(), DataTreeInitializer.class);
65 initializerBinder.addBinding().to(ConfigDataInitializer.class);
67 // Disable notification producer for now
68 // Multibinder.newSetBinder(binder(), ManagedNotificationProducer.class).addBinding()
69 // .to(SampleNotificationProducer.class);