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 org.onap.vnf.vlb;
19 import static org.onap.vnf.vlb.ModuleConfiguration.ELEMENT_SERVICE_NAME;
21 import com.google.inject.AbstractModule;
22 import com.google.inject.TypeLiteral;
23 import com.google.inject.multibindings.Multibinder;
24 import com.google.inject.name.Names;
25 //import org.onap.vnf.vlb.read.ModuleStateReaderFactory;
26 import org.onap.vnf.vlb.write.ModuleWriterFactory;
27 import io.fd.honeycomb.data.init.DataTreeInitializer;
28 import io.fd.honeycomb.translate.read.ReaderFactory;
29 import io.fd.honeycomb.translate.write.WriterFactory;
30 import net.jmob.guice.conf.core.ConfigurationModule;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance;
34 * Module class instantiating vlb-business-vnf-onap-plugin plugin components.
36 public final class Module extends AbstractModule {
38 // TODO This initiates all the plugin components, but it still needs to be registered/wired into an integration
39 // module producing runnable distributions. There is one such distribution in honeycomb project:
40 // vpp-integration/minimal-distribution
41 // In order to integrate this plugin with the distribution:
42 // 1. Add a dependency on this maven module to the the distribution's pom.xml
43 // 2. Add an instance of this module into the distribution in its Main class
46 protected void configure() {
47 // requests injection of properties
48 install(ConfigurationModule.create());
49 requestInjection(ModuleConfiguration.class);
51 // creates binding for interface implementation by name
52 bind(new TypeLiteral<CrudService<VdnsInstance>>(){})
53 .annotatedWith(Names.named(ELEMENT_SERVICE_NAME))
54 .to(ElementCrudService.class);
56 // creates reader factory binding
57 // can hold multiple binding for separate yang modules
58 //final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
59 //readerFactoryBinder.addBinding().to(ModuleStateReaderFactory.class);
61 // create writer factory binding
62 // can hold multiple binding for separate yang modules
63 final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
64 writerFactoryBinder.addBinding().to(ModuleWriterFactory.class);