7467e544fdc8e2577447da8c62fca6319b7e3d0c
[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 import org.osgi.framework.BundleContext;
23
24 import com.google.common.util.concurrent.ListeningExecutorService;
25
26 /**
27 *
28 */
29 public final class ForwardedCompatibleDataBrokerImplModule extends
30         org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractForwardedCompatibleDataBrokerImplModule
31         implements Provider {
32
33     private BundleContext bundleContext;
34
35     public ForwardedCompatibleDataBrokerImplModule(
36             final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
37             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
38         super(identifier, dependencyResolver);
39     }
40
41     public ForwardedCompatibleDataBrokerImplModule(
42             final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
43             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
44             final ForwardedCompatibleDataBrokerImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
45
46         super(identifier, dependencyResolver, oldModule, oldInstance);
47     }
48
49     @Override
50     protected void customValidation() {
51         // Add custom validation for module attributes here.
52     }
53
54     @Override
55     public java.lang.AutoCloseable createInstance() {
56         ListeningExecutorService listeningExecutor = SingletonHolder.getDefaultCommitExecutor();
57         BindingIndependentMappingService mappingService = getBindingMappingServiceDependency();
58
59         Broker domBroker = getDomAsyncBrokerDependency();
60         ProviderSession session = domBroker.registerProvider(this, getBundleContext());
61         DOMDataBroker domDataBroker = session.getService(DOMDataBroker.class);
62         SchemaService schemaService = session.getService(SchemaService.class);
63         ForwardedBackwardsCompatibleDataBroker dataBroker = new ForwardedBackwardsCompatibleDataBroker(domDataBroker,
64                 mappingService, schemaService,listeningExecutor);
65
66         dataBroker.setConnector(BindingDomConnectorDeployer.createConnector(getBindingMappingServiceDependency()));
67         dataBroker.setDomProviderContext(session);
68         return dataBroker;
69     }
70
71     public BundleContext getBundleContext() {
72         return bundleContext;
73     }
74
75     public void setBundleContext(final BundleContext bundleContext2) {
76         this.bundleContext = bundleContext2;
77     }
78
79     @Override
80     public void onSessionInitiated(final ProviderSession session) {
81
82     }
83
84     @Override
85     public Collection<ProviderFunctionality> getProviderFunctionality() {
86         return Collections.emptySet();
87     }
88 }

©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.