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
24 class OsgiProviderContext extends OsgiConsumerContext implements ProviderContext {
27 val Map<Class<? extends RpcService>, RpcRegistration<? extends RpcService>> registeredServices
29 new(BundleContext ctx, BindingAwareBrokerImpl broker) {
31 _registeredServices = new HashMap();
34 override <T extends RpcService> addRpcImplementation(Class<T> type, T implementation) {
36 // TODO Auto-generated method stub
37 val properties = new Hashtable<String, String>();
38 properties.salServiceType = SAL_SERVICE_TYPE_PROVIDER
41 val salReg = broker.registerRpcImplementation(type, implementation, this, properties)
42 registeredServices.put(type, salReg)
46 override <T extends RpcService> addMountRpcImplementation(Class<T> type, InstanceIdentifier<?> mount, T implementation) throws IllegalStateException {
48 val properties = new Hashtable<String, String>();
49 properties.salServiceType = SAL_SERVICE_TYPE_PROVIDER
52 val salReg = broker.registerMountedRpcImplementation(type, implementation, mount, this, properties)
53 registeredServices.put(type, salReg)
57 override <T extends RpcService> addRoutedRpcImplementation(Class<T> type, T implementation) throws IllegalStateException {
58 val properties = new Hashtable<String, String>();
59 properties.salServiceType = SAL_SERVICE_TYPE_PROVIDER
62 val salReg = broker.registerRoutedRpcImplementation(type, implementation, this, properties)
63 registeredServices.put(type, salReg)
67 override registerFunctionality(ProviderFunctionality functionality) {
71 override unregisterFunctionality(ProviderFunctionality functionality) {