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 org.opendaylight.controller.sal.core.api.Broker.ProviderSession
11 import org.opendaylight.controller.sal.core.api.Provider
12 import org.opendaylight.controller.sal.core.api.RpcImplementation
13 import org.opendaylight.yangtools.yang.common.QName
14 import org.osgi.framework.BundleContext
15 import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration
16 import org.opendaylight.controller.sal.core.api.RpcRegistrationListener
17 import org.opendaylight.yangtools.concepts.Registration
20 import java.util.HashSet
22 class ProviderContextImpl extends ConsumerContextImpl implements ProviderSession {
25 private val Provider provider;
27 private val Set<Registration<?>> registrations = new HashSet();
29 new(Provider provider, BundleContext ctx) {
31 this._provider = provider;
34 override addRpcImplementation(QName rpcType, RpcImplementation implementation) throws IllegalArgumentException {
35 val origReg = broker.router.addRpcImplementation(rpcType, implementation);
36 val newReg = new RpcRegistrationWrapper(origReg);
37 registrations.add(newReg);
41 protected def removeRpcImplementation(RpcRegistrationWrapper implToRemove) throws IllegalArgumentException {
42 registrations.remove(implToRemove);
47 for (reg : registrations) {
53 override addMountedRpcImplementation(QName rpcType, RpcImplementation implementation) {
54 throw new UnsupportedOperationException("TODO: auto-generated method stub")
57 override addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation) {
58 throw new UnsupportedOperationException("TODO: auto-generated method stub")
61 override getSupportedRpcs() {
62 broker.router.supportedRpcs;
65 override addRpcRegistrationListener(RpcRegistrationListener listener) {
66 broker.router.addRpcRegistrationListener(listener);
70 class RpcRegistrationWrapper implements RpcRegistration {
74 val RpcRegistration delegate
76 new(RpcRegistration delegate) {
80 override getInstance() {