2 * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.binding.dom.adapter;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import org.eclipse.jdt.annotation.NonNullByDefault;
14 import org.opendaylight.mdsal.binding.api.ActionProviderService;
15 import org.opendaylight.mdsal.binding.api.ActionService;
16 import org.opendaylight.mdsal.binding.api.DataBroker;
17 import org.opendaylight.mdsal.binding.api.DataTreeService;
18 import org.opendaylight.mdsal.binding.api.MountPointService;
19 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
20 import org.opendaylight.mdsal.binding.api.NotificationService;
21 import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
22 import org.opendaylight.mdsal.binding.api.RpcProviderService;
23 import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory;
24 import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
25 import org.opendaylight.mdsal.dom.api.DOMActionService;
26 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
27 import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
28 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
29 import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
30 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
31 import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
32 import org.opendaylight.mdsal.dom.api.DOMRpcService;
33 import org.opendaylight.yangtools.concepts.Immutable;
36 * Implementation of AdapterFactory.
38 * @author Robert Varga
42 public final class BindingAdapterFactory implements AdapterFactory, Immutable {
43 private final BindingToNormalizedNodeCodec codec;
45 public BindingAdapterFactory(final BindingToNormalizedNodeCodec codec) {
46 this.codec = requireNonNull(codec);
50 * Create a {@link DataBroker} backed by a {@link DOMDataBroker}.
52 * @param domService Backing DOMDataBroker
53 * @return A DataBroker
54 * @throws NullPointerException if {@code domService} is null
57 public DataBroker createDataBroker(final DOMDataBroker domService) {
58 return new BindingDOMDataBrokerAdapter(domService, codec);
62 * Create a {@link DataTreeService} backed by a {@link DOMDataTreeService}.
64 * @param domService Backing DOMDataTreeService
65 * @return A DataTreeService
66 * @throws NullPointerException if {@code domService} is null
69 public DataTreeService createDataTreeService(final DOMDataTreeService domService) {
70 return BindingDOMDataTreeServiceAdapter.create(domService, codec);
74 * Create a {@link MountPointService} backed by a {@link DOMMountPointService}.
76 * @param domService Backing DOMMountPointService
77 * @return A MountPointService
78 * @throws NullPointerException if {@code domService} is null
81 public MountPointService createMountPointService(final DOMMountPointService domService) {
82 return new BindingDOMMountPointServiceAdapter(domService, codec);
86 * Create a {@link DataBroker} backed by a {@link DOMDataBroker}.
88 * @param domService Backing DOMDataBroker
89 * @return A DataBroker
90 * @throws NullPointerException if {@code domService} is null
93 public NotificationService createNotificationService(final DOMNotificationService domService) {
94 return new BindingDOMNotificationServiceAdapter(domService, codec);
98 * Create a {@link NotificationPublishService} backed by a {@link DOMNotificationPublishService}.
100 * @param domService Backing DOMNotificationPublishService
101 * @return A NotificationPublishService
102 * @throws NullPointerException if {@code domService} is null
105 public NotificationPublishService createNotificationPublishService(final DOMNotificationPublishService domService) {
106 return new BindingDOMNotificationPublishServiceAdapter(domService, codec);
110 * Create a {@link RpcConsumerRegistry} backed by a {@link DOMRpcService}.
112 * @param domService Backing DOMRpcService
113 * @return A RpcConsumerRegistry
114 * @throws NullPointerException if {@code domService} is null
117 public RpcConsumerRegistry createRpcConsumerRegistry(final DOMRpcService domService) {
118 return new BindingDOMRpcServiceAdapter(domService, codec);
122 * Create a {@link RpcProviderService} backed by a {@link DOMRpcProviderService}.
124 * @param domService Backing DOMRpcProviderService
125 * @return A RpcProviderService
126 * @throws NullPointerException if {@code domService} is null
129 public RpcProviderService createRpcProviderService(final DOMRpcProviderService domService) {
130 return new BindingDOMRpcProviderServiceAdapter(domService, codec);
134 public ActionService createActionService(final DOMActionService domService) {
135 return new ActionServiceAdapter(codec, domService);
139 public ActionProviderService createActionProviderService(final DOMActionProviderService domService) {
140 return new ActionProviderServiceAdapter(codec, domService);