X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fsal%2Fsal-binding-broker-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fimpl%2FOsgiProviderContext.xtend;fp=opendaylight%2Fsal%2Fyang-prototype%2Fsal%2Fsal-binding-broker-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fimpl%2FOsgiProviderContext.xtend;h=195fa8b9597ba19b5784e68e15d8d2fc563eef42;hb=42183ad5bfefff7d6de9df467cdaa600a450af29;hp=0000000000000000000000000000000000000000;hpb=f3bdffc96f0c221111faeef07db2a6b975f56463;p=controller.git diff --git a/opendaylight/sal/yang-prototype/sal/sal-binding-broker-impl/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiProviderContext.xtend b/opendaylight/sal/yang-prototype/sal/sal-binding-broker-impl/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiProviderContext.xtend new file mode 100644 index 0000000000..195fa8b959 --- /dev/null +++ b/opendaylight/sal/yang-prototype/sal/sal-binding-broker-impl/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiProviderContext.xtend @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.sal.binding.impl; + +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcServiceRegistration; +import org.opendaylight.yangtools.yang.binding.RpcService; +import org.osgi.framework.BundleContext; + +import static extension org.opendaylight.controller.sal.binding.impl.utils.PropertiesUtils.*; + +class OsgiProviderContext extends OsgiConsumerContext implements ProviderContext { + + @Property + val Map, RpcServiceRegistrationImpl> registeredServices + + new(BundleContext ctx, BindingAwareBrokerImpl broker) { + super(ctx, broker); + _registeredServices = new HashMap(); + } + + override def RpcServiceRegistration addRpcImplementation(Class type, T implementation) { + + // TODO Auto-generated method stub + val properties = new Hashtable(); + properties.salServiceType = Constants.SAL_SERVICE_TYPE_PROVIDER + + // Fill requirements + val salReg = broker.registerRpcImplementation(type, implementation, this, properties) + registeredServices.put(type, salReg) + return salReg; + } +}