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.notification.ManagedNotificationProducer;
23 import io.fd.honeycomb.samples.interfaces.mapping.cfgattrs.InterfacesPluginConfiguration;
24 import io.fd.honeycomb.samples.interfaces.mapping.config.InterfacesWriterFactory;
25 import io.fd.honeycomb.samples.interfaces.mapping.notification.InterfaceUpNotificationProducer;
26 import io.fd.honeycomb.samples.interfaces.mapping.oper.InterfacesReaderFactory;
27 import io.fd.honeycomb.translate.read.ReaderFactory;
28 import io.fd.honeycomb.translate.write.WriterFactory;
29 import net.jmob.guice.conf.core.ConfigurationModule;
32 * This is some glue code necessary for Honeycomb distribution to pick up the plugin classes
34 public final class SampleInterfaceModule extends AbstractModule {
37 protected void configure() {
38 // These are plugin specific config attributes
39 install(ConfigurationModule.create());
40 requestInjection(InterfacesPluginConfiguration.class);
42 // These are plugin's internal components
43 bind(LowerLayerAccess.class).in(Singleton.class);
45 // Below are classes picked up by HC framework
46 Multibinder.newSetBinder(binder(), WriterFactory.class).addBinding().to(InterfacesWriterFactory.class);
47 Multibinder.newSetBinder(binder(), ReaderFactory.class).addBinding().to(InterfacesReaderFactory.class);
48 Multibinder.newSetBinder(binder(), ManagedNotificationProducer.class).addBinding()
49 .to(InterfaceUpNotificationProducer.class);