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.core.api;
10 import java.util.Collection;
11 import java.util.Collections;
13 import org.osgi.framework.BundleActivator;
14 import org.osgi.framework.BundleContext;
15 import org.osgi.framework.ServiceReference;
17 public abstract class AbstractConsumer implements Consumer, BundleActivator {
20 ServiceReference<Broker> brokerRef;
22 public final void start(BundleContext context) throws Exception {
23 this.startImpl(context);
24 brokerRef = context.getServiceReference(Broker.class);
25 broker = context.getService(brokerRef);
26 broker.registerConsumer(this,context);
32 public final void stop(BundleContext context) throws Exception {
35 if(brokerRef != null) {
36 context.ungetService(brokerRef);
40 protected void startImpl(BundleContext context) {
43 protected void stopImpl(BundleContext context) {
48 public Collection<ConsumerFunctionality> getConsumerFunctionality() {
49 return Collections.emptySet();