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

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