2 * Copyright (c) 2013 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.binding.impl;
10 import java.util.HashMap;
11 import java.util.Hashtable;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
15 import org.opendaylight.yangtools.yang.binding.RpcService;
16 import org.osgi.framework.BundleContext;
18 import static org.opendaylight.controller.sal.binding.impl.osgi.Constants.*;
19 import static extension org.opendaylight.controller.sal.binding.impl.osgi.PropertiesUtils.*;
20 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration
21 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
22 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality
23 import static com.google.common.base.Preconditions.*
25 class OsgiProviderContext extends OsgiConsumerContext implements ProviderContext {
28 val Map<Class<? extends RpcService>, RpcRegistration<? extends RpcService>> registeredServices
30 new(BundleContext ctx, BindingAwareBrokerImpl broker) {
32 _registeredServices = new HashMap();
35 override <T extends RpcService> addRpcImplementation(Class<T> type, T implementation) {
36 val salReg = broker.addRpcImplementation(type, implementation)
37 registeredServices.put(type, salReg)
41 override <T extends RpcService> addRoutedRpcImplementation(Class<T> type, T implementation) throws IllegalStateException {
42 val salReg = broker.addRoutedRpcImplementation(type, implementation)
43 registeredServices.put(type, salReg)
47 override registerFunctionality(ProviderFunctionality functionality) {
51 override unregisterFunctionality(ProviderFunctionality functionality) {