* 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.core.impl;
+package org.opendaylight.controller.sal.dom.broker;
import java.util.Collection;
import java.util.Collections;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// Implementation specific
private ExecutorService executor;
+ private BundleContext bundleContext;
+
@Override
- public ConsumerSession registerConsumer(Consumer consumer) {
+ public ConsumerSession registerConsumer(Consumer consumer,BundleContext ctx) {
checkPredicates(consumer);
log.info("Registering consumer " + consumer);
- ConsumerSessionImpl session = newSessionFor(consumer);
+ ConsumerSessionImpl session = newSessionFor(consumer,ctx);
consumer.onSessionInitiated(session);
sessions.add(session);
return session;
}
@Override
- public ProviderSession registerProvider(Provider provider) {
+ public ProviderSession registerProvider(Provider provider,BundleContext ctx) {
checkPredicates(provider);
- ProviderSessionImpl session = newSessionFor(provider);
+ ProviderSessionImpl session = newSessionFor(provider,ctx);
provider.onSessionInitiated(session);
providerSessions.add(session);
return session;
// Private Factory methods
- private ConsumerSessionImpl newSessionFor(Consumer cons) {
- return new ConsumerSessionImpl(cons);
+ private ConsumerSessionImpl newSessionFor(Consumer provider, BundleContext ctx) {
+ return new ConsumerSessionImpl(provider,ctx);
}
- private ProviderSessionImpl newSessionFor(Provider provider) {
- return new ProviderSessionImpl(provider);
+ private ProviderSessionImpl newSessionFor(Provider provider, BundleContext ctx) {
+ return new ProviderSessionImpl(provider,ctx);
}
private void consumerSessionClosed(ConsumerSessionImpl consumerSessionImpl) {
.synchronizedMap(new HashMap<Class<? extends BrokerService>, BrokerService>());
private boolean closed = false;
+ private BundleContext context;
+
public Consumer getConsumer() {
return consumer;
}
- public ConsumerSessionImpl(Consumer consumer) {
+ public ConsumerSessionImpl(Consumer consumer, BundleContext ctx) {
this.consumer = consumer;
+ this.context = ctx;
}
@Override
private Provider provider;
private Map<QName, RpcImplementation> sessionRpcImpls = Collections.synchronizedMap(new HashMap<QName, RpcImplementation>());
- public ProviderSessionImpl(Provider provider) {
- super(null);
+ public ProviderSessionImpl(Provider provider, BundleContext ctx) {
+ super(null,ctx);
this.provider = provider;
}
}
}
+
+ public void setBundleContext(BundleContext context) {
+ this.bundleContext = context;
+ }
}