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.
17 package io.fd.honeycomb.samples.interfaces.mapping;
19 import com.google.inject.AbstractModule;
20 import com.google.inject.Singleton;
21 import com.google.inject.multibindings.Multibinder;
22 import io.fd.honeycomb.data.init.DataTreeInitializer;
23 import io.fd.honeycomb.notification.ManagedNotificationProducer;
24 import io.fd.honeycomb.samples.interfaces.mapping.config.InterfacesWriterFactory;
25 import io.fd.honeycomb.samples.interfaces.mapping.oper.InterfacesReaderFactory;
26 import io.fd.honeycomb.samples.interfaces.mapping.cfgattrs.InterfacesPluginConfiguration;
27 import io.fd.honeycomb.samples.interfaces.mapping.init.InterfacesInitializer;
28 import io.fd.honeycomb.samples.interfaces.mapping.notification.InterfaceUpNotificationProducer;
29 import io.fd.honeycomb.translate.read.ReaderFactory;
30 import io.fd.honeycomb.translate.write.WriterFactory;
31 import net.jmob.guice.conf.core.ConfigurationModule;
34 * This is some glue code necessary for Honeycomb distribution to pick up the plugin classes
36 public final class SampleInterfaceModule extends AbstractModule {
39 protected void configure() {
40 // These are plugin specific config attributes
41 install(ConfigurationModule.create());
42 requestInjection(InterfacesPluginConfiguration.class);
44 // These are plugin's internal components
45 bind(LowerLayerAccess.class).in(Singleton.class);
47 // Below are classes picked up by HC framework
48 Multibinder.newSetBinder(binder(), WriterFactory.class).addBinding().to(InterfacesWriterFactory.class);
49 Multibinder.newSetBinder(binder(), ReaderFactory.class).addBinding().to(InterfacesReaderFactory.class);
50 Multibinder.newSetBinder(binder(), DataTreeInitializer.class).addBinding().to(InterfacesInitializer.class);
51 Multibinder.newSetBinder(binder(), ManagedNotificationProducer.class).addBinding()
52 .to(InterfaceUpNotificationProducer.class);