2 * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.sal.dom.broker;
10 import java.util.HashSet;
13 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
14 import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
15 import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
16 import org.opendaylight.controller.sal.core.api.Provider;
17 import org.opendaylight.controller.sal.core.api.RpcImplementation;
18 import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
19 import org.opendaylight.yangtools.concepts.ListenerRegistration;
20 import org.opendaylight.yangtools.yang.common.QName;
22 class ProviderContextImpl extends ConsumerContextImpl implements ProviderSession {
23 private final Set<RpcRegistrationWrapper> registrations = new HashSet<>();
24 private final Provider provider;
26 public ProviderContextImpl(final Provider provider, final BrokerImpl broker) {
28 this.provider = provider;
32 public RpcRegistrationWrapper addRpcImplementation(final QName rpcType,
33 final RpcImplementation implementation) throws IllegalArgumentException {
34 final RpcRegistration origReg = getBrokerChecked().getRouter()
35 .addRpcImplementation(rpcType, implementation);
36 final RpcRegistrationWrapper newReg = new RpcRegistrationWrapper(
38 registrations.add(newReg);
42 protected boolean removeRpcImplementation(final RpcRegistrationWrapper implToRemove) {
43 return registrations.remove(implToRemove);
48 for (final RpcRegistrationWrapper reg : registrations) {
54 public RoutedRpcRegistration addMountedRpcImplementation(
55 final QName rpcType, final RpcImplementation implementation) {
56 throw new UnsupportedOperationException(
57 "TODO: auto-generated method stub");
62 public RoutedRpcRegistration addRoutedRpcImplementation(
63 final QName rpcType, final RpcImplementation implementation) {
64 return getBrokerChecked().getRouter().addRoutedRpcImplementation(rpcType, implementation);
68 public Set<QName> getSupportedRpcs() {
69 return getBrokerChecked().getRouter().getSupportedRpcs();
73 public ListenerRegistration<RpcRegistrationListener> addRpcRegistrationListener(
74 final RpcRegistrationListener listener) {
75 return getBrokerChecked().getRouter().addRpcRegistrationListener(listener);
79 * @return the provider
81 public Provider getProvider() {