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.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.DOMDataBroker;
25 import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
26 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
27 import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
28 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
29 import org.opendaylight.mdsal.dom.api.DOMOperationService;
30 import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
31 import org.opendaylight.mdsal.dom.api.DOMRpcService;
34 * Implementation of AdapterFactory.
36 * @author Robert Varga
41 public final class BindingAdapterFactory implements AdapterFactory {
42 private final BindingToNormalizedNodeCodec codec;
44 public BindingAdapterFactory(final BindingToNormalizedNodeCodec codec) {
45 this.codec = requireNonNull(codec);
49 * Create a {@link DataBroker} backed by a {@link DOMDataBroker}.
51 * @param domService Backing DOMDataBroker
52 * @return A DataBroker
53 * @throws NullPointerException if {@code domService} is null
56 public DataBroker createDataBroker(final DOMDataBroker domService) {
57 return new BindingDOMDataBrokerAdapter(domService, codec);
61 * Create a {@link DataTreeService} backed by a {@link DOMDataTreeService}.
63 * @param domService Backing DOMDataTreeService
64 * @return A DataTreeService
65 * @throws NullPointerException if {@code domService} is null
68 public DataTreeService createDataTreeService(final DOMDataTreeService domService) {
69 return BindingDOMDataTreeServiceAdapter.create(domService, codec);
73 * Create a {@link MountPointService} backed by a {@link DOMMountPointService}.
75 * @param domService Backing DOMMountPointService
76 * @return A MountPointService
77 * @throws NullPointerException if {@code domService} is null
80 public MountPointService createMountPointService(final DOMMountPointService domService) {
81 return new BindingDOMMountPointServiceAdapter(domService, codec);
85 * Create a {@link DataBroker} backed by a {@link DOMDataBroker}.
87 * @param domService Backing DOMDataBroker
88 * @return A DataBroker
89 * @throws NullPointerException if {@code domService} is null
92 public NotificationService createNotificationService(final DOMNotificationService domService) {
93 return new BindingDOMNotificationServiceAdapter(domService, codec);
97 * Create a {@link NotificationPublishService} backed by a {@link DOMNotificationPublishService}.
99 * @param domService Backing DOMNotificationPublishService
100 * @return A NotificationPublishService
101 * @throws NullPointerException if {@code domService} is null
104 public NotificationPublishService createNotificationPublishService(final DOMNotificationPublishService domService) {
105 return new BindingDOMNotificationPublishServiceAdapter(domService, codec);
109 * Create a {@link RpcConsumerRegistry} backed by a {@link DOMRpcService}.
111 * @param domService Backing DOMRpcService
112 * @return A RpcConsumerRegistry
113 * @throws NullPointerException if {@code domService} is null
116 public RpcConsumerRegistry createRpcConsumerRegistry(final DOMRpcService domService) {
117 return new BindingDOMRpcServiceAdapter(domService, codec);
121 * Create a {@link RpcProviderService} backed by a {@link DOMRpcProviderService}.
123 * @param domService Backing DOMRpcProviderService
124 * @return A RpcProviderService
125 * @throws NullPointerException if {@code domService} is null
128 public RpcProviderService createRpcProviderService(final DOMRpcProviderService domService) {
129 return new BindingDOMRpcProviderServiceAdapter(domService, codec);
133 public ActionService createActionService(final DOMOperationService domService) {
134 return new ActionServiceAdapter(codec, domService);