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 javax.annotation.concurrent.ThreadSafe;
14 import org.eclipse.jdt.annotation.NonNullByDefault;
15 import org.opendaylight.mdsal.binding.api.ActionProviderService;
16 import org.opendaylight.mdsal.binding.api.ActionService;
17 import org.opendaylight.mdsal.binding.api.DataBroker;
18 import org.opendaylight.mdsal.binding.api.DataTreeService;
19 import org.opendaylight.mdsal.binding.api.MountPointService;
20 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
21 import org.opendaylight.mdsal.binding.api.NotificationService;
22 import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
23 import org.opendaylight.mdsal.binding.api.RpcProviderService;
24 import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory;
25 import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
26 import org.opendaylight.mdsal.dom.api.DOMActionService;
27 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
28 import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
29 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
30 import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
31 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
32 import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
33 import org.opendaylight.mdsal.dom.api.DOMRpcService;
36 * Implementation of AdapterFactory.
38 * @author Robert Varga
43 public final class BindingAdapterFactory implements AdapterFactory {
44 private final BindingToNormalizedNodeCodec codec;
46 public BindingAdapterFactory(final BindingToNormalizedNodeCodec codec) {
47 this.codec = requireNonNull(codec);
51 * Create a {@link DataBroker} backed by a {@link DOMDataBroker}.
53 * @param domService Backing DOMDataBroker
54 * @return A DataBroker
55 * @throws NullPointerException if {@code domService} is null
58 public DataBroker createDataBroker(final DOMDataBroker domService) {
59 return new BindingDOMDataBrokerAdapter(domService, codec);
63 * Create a {@link DataTreeService} backed by a {@link DOMDataTreeService}.
65 * @param domService Backing DOMDataTreeService
66 * @return A DataTreeService
67 * @throws NullPointerException if {@code domService} is null
70 public DataTreeService createDataTreeService(final DOMDataTreeService domService) {
71 return BindingDOMDataTreeServiceAdapter.create(domService, codec);
75 * Create a {@link MountPointService} backed by a {@link DOMMountPointService}.
77 * @param domService Backing DOMMountPointService
78 * @return A MountPointService
79 * @throws NullPointerException if {@code domService} is null
82 public MountPointService createMountPointService(final DOMMountPointService domService) {
83 return new BindingDOMMountPointServiceAdapter(domService, codec);
87 * Create a {@link DataBroker} backed by a {@link DOMDataBroker}.
89 * @param domService Backing DOMDataBroker
90 * @return A DataBroker
91 * @throws NullPointerException if {@code domService} is null
94 public NotificationService createNotificationService(final DOMNotificationService domService) {
95 return new BindingDOMNotificationServiceAdapter(domService, codec);
99 * Create a {@link NotificationPublishService} backed by a {@link DOMNotificationPublishService}.
101 * @param domService Backing DOMNotificationPublishService
102 * @return A NotificationPublishService
103 * @throws NullPointerException if {@code domService} is null
106 public NotificationPublishService createNotificationPublishService(final DOMNotificationPublishService domService) {
107 return new BindingDOMNotificationPublishServiceAdapter(domService, codec);
111 * Create a {@link RpcConsumerRegistry} backed by a {@link DOMRpcService}.
113 * @param domService Backing DOMRpcService
114 * @return A RpcConsumerRegistry
115 * @throws NullPointerException if {@code domService} is null
118 public RpcConsumerRegistry createRpcConsumerRegistry(final DOMRpcService domService) {
119 return new BindingDOMRpcServiceAdapter(domService, codec);
123 * Create a {@link RpcProviderService} backed by a {@link DOMRpcProviderService}.
125 * @param domService Backing DOMRpcProviderService
126 * @return A RpcProviderService
127 * @throws NullPointerException if {@code domService} is null
130 public RpcProviderService createRpcProviderService(final DOMRpcProviderService domService) {
131 return new BindingDOMRpcProviderServiceAdapter(domService, codec);
135 public ActionService createActionService(final DOMActionService domService) {
136 return new ActionServiceAdapter(codec, domService);
140 public ActionProviderService createActionProviderService(final DOMActionProviderService domService) {
141 return new ActionProviderServiceAdapter(codec, domService);