Bug 488: Removed BundleContext usage for registering to DOM Components.
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / config / yang / md / sal / binding / impl / ForwardedCompatibleDataBrokerImplModule.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
9
10 import java.util.Collection;
11 import java.util.Collections;
12
13 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompatibleDataBroker;
14 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
15 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
16 import org.opendaylight.controller.sal.binding.impl.connect.dom.BindingDomConnectorDeployer;
17 import org.opendaylight.controller.sal.core.api.Broker;
18 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
19 import org.opendaylight.controller.sal.core.api.Provider;
20 import org.opendaylight.controller.sal.core.api.model.SchemaService;
21 import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
22
23 import com.google.common.util.concurrent.ListeningExecutorService;
24
25 /**
26 *
27 */
28 public final class ForwardedCompatibleDataBrokerImplModule extends
29         org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractForwardedCompatibleDataBrokerImplModule
30         implements Provider {
31
32     public ForwardedCompatibleDataBrokerImplModule(
33             final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
34             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
35         super(identifier, dependencyResolver);
36     }
37
38     public ForwardedCompatibleDataBrokerImplModule(
39             final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
40             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
41             final ForwardedCompatibleDataBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
42
43         super(identifier, dependencyResolver, oldModule, oldInstance);
44     }
45
46     @Override
47     protected void customValidation() {
48         // Add custom validation for module attributes here.
49     }
50
51     @Override
52     public java.lang.AutoCloseable createInstance() {
53         ListeningExecutorService listeningExecutor = SingletonHolder.getDefaultCommitExecutor();
54         BindingIndependentMappingService mappingService = getBindingMappingServiceDependency();
55
56         Broker domBroker = getDomAsyncBrokerDependency();
57         ProviderSession session = domBroker.registerProvider(this, null);
58         DOMDataBroker domDataBroker = session.getService(DOMDataBroker.class);
59         SchemaService schemaService = session.getService(SchemaService.class);
60         ForwardedBackwardsCompatibleDataBroker dataBroker = new ForwardedBackwardsCompatibleDataBroker(domDataBroker,
61                 mappingService, schemaService,listeningExecutor);
62
63         dataBroker.setConnector(BindingDomConnectorDeployer.createConnector(getBindingMappingServiceDependency()));
64         dataBroker.setDomProviderContext(session);
65         return dataBroker;
66     }
67
68     @Override
69     public void onSessionInitiated(final ProviderSession session) {
70
71     }
72
73     @Override
74     public Collection<ProviderFunctionality> getProviderFunctionality() {
75         return Collections.emptySet();
76     }
77 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.