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.DataBroker;
16 import org.opendaylight.mdsal.binding.api.DataTreeService;
17 import org.opendaylight.mdsal.binding.api.MountPointService;
18 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
19 import org.opendaylight.mdsal.binding.api.NotificationService;
20 import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
21 import org.opendaylight.mdsal.binding.api.RpcProviderService;
22 import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory;
23 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
24 import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
25 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
26 import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
27 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
28 import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
29 import org.opendaylight.mdsal.dom.api.DOMRpcService;
32 * Implementation of AdapterFactory.
34 * @author Robert Varga
39 public final class BindingAdapterFactory implements AdapterFactory {
40 private final BindingToNormalizedNodeCodec codec;
42 public BindingAdapterFactory(final BindingToNormalizedNodeCodec codec) {
43 this.codec = requireNonNull(codec);
47 * Create a {@link DataBroker} backed by a {@link DOMDataBroker}.
49 * @param domService Backing DOMDataBroker
50 * @return A DataBroker
51 * @throws NullPointerException if {@code domService} is null
54 public DataBroker createDataBroker(final DOMDataBroker domService) {
55 return new BindingDOMDataBrokerAdapter(domService, codec);
59 * Create a {@link DataTreeService} backed by a {@link DOMDataTreeService}.
61 * @param domService Backing DOMDataTreeService
62 * @return A DataTreeService
63 * @throws NullPointerException if {@code domService} is null
66 public DataTreeService createDataTreeService(final DOMDataTreeService domService) {
67 return BindingDOMDataTreeServiceAdapter.create(domService, codec);
71 * Create a {@link MountPointService} backed by a {@link DOMMountPointService}.
73 * @param domService Backing DOMMountPointService
74 * @return A MountPointService
75 * @throws NullPointerException if {@code domService} is null
78 public MountPointService createMountPointService(final DOMMountPointService domService) {
79 return new BindingDOMMountPointServiceAdapter(domService, codec);
83 * Create a {@link DataBroker} backed by a {@link DOMDataBroker}.
85 * @param domService Backing DOMDataBroker
86 * @return A DataBroker
87 * @throws NullPointerException if {@code domService} is null
90 public NotificationService createNotificationService(final DOMNotificationService domService) {
91 return new BindingDOMNotificationServiceAdapter(domService, codec);
95 * Create a {@link NotificationPublishService} backed by a {@link DOMNotificationPublishService}.
97 * @param domService Backing DOMNotificationPublishService
98 * @return A NotificationPublishService
99 * @throws NullPointerException if {@code domService} is null
102 public NotificationPublishService createNotificationPublishService(final DOMNotificationPublishService domService) {
103 return new BindingDOMNotificationPublishServiceAdapter(domService, codec);
107 * Create a {@link RpcConsumerRegistry} backed by a {@link DOMRpcService}.
109 * @param domService Backing DOMRpcService
110 * @return A RpcConsumerRegistry
111 * @throws NullPointerException if {@code domService} is null
114 public RpcConsumerRegistry createRpcConsumerRegistry(final DOMRpcService domService) {
115 return new BindingDOMRpcServiceAdapter(domService, codec);
119 * Create a {@link RpcProviderService} backed by a {@link DOMRpcProviderService}.
121 * @param domService Backing DOMRpcProviderService
122 * @return A RpcProviderService
123 * @throws NullPointerException if {@code domService} is null
126 public RpcProviderService createRpcProviderService(final DOMRpcProviderService domService) {
127 return new BindingDOMRpcProviderServiceAdapter(domService, codec);