Add copyright headers to sal-rest-connector
[netconf.git] / opendaylight / netconf / messagebus-netconf / src / main / java / org / opendaylight / controller / config / yang / messagebus / netconf / MessageBusNetconfModule.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.config.yang.messagebus.netconf;
10
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
13 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
14 import org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService;
15 import org.opendaylight.controller.messagebus.app.util.Providers;
16 import org.opendaylight.netconf.messagebus.eventsources.netconf.NetconfEventSourceManager;
17 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
18 import org.opendaylight.controller.sal.core.api.Broker;
19
20 public class MessageBusNetconfModule extends org.opendaylight.controller.config.yang.messagebus.netconf.AbstractMessageBusNetconfModule {
21     public MessageBusNetconfModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
22         super(identifier, dependencyResolver);
23     }
24
25     public MessageBusNetconfModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.messagebus.netconf.MessageBusNetconfModule oldModule, java.lang.AutoCloseable oldInstance) {
26         super(identifier, dependencyResolver, oldModule, oldInstance);
27     }
28
29     @Override
30     public void customValidation() {}
31
32     @Override
33     public java.lang.AutoCloseable createInstance() {
34         final BindingAwareBroker.ProviderContext bindingCtx = getBindingBrokerDependency().registerProvider(new Providers.BindingAware());
35         final Broker.ProviderSession domCtx = getDomBrokerDependency().registerProvider(new Providers.BindingIndependent());
36
37         final MountPointService mountPointService = bindingCtx.getSALService(MountPointService.class);
38         final DataBroker dataBroker = bindingCtx.getSALService(DataBroker.class);
39
40         final DOMNotificationPublishService domPublish = domCtx.getService(DOMNotificationPublishService.class);
41         final DOMMountPointService domMount = domCtx.getService(DOMMountPointService.class);
42
43         return NetconfEventSourceManager.create(dataBroker, domPublish, domMount,
44             mountPointService, getEventSourceRegistryDependency(), getNamespaceToStream());
45     }
46
47 }