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.protocol.bgp.parser.spi.osgi;
10 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerActivator;
11 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext;
12 import org.osgi.framework.BundleActivator;
13 import org.osgi.framework.BundleContext;
15 import com.google.common.base.Preconditions;
17 public abstract class AbstractOSGiBGPExtensionConsumerActivator implements BundleActivator, BGPExtensionConsumerActivator {
18 private BGPExtensionConsumerContext consumerContext;
21 public final void start(final BundleContext context) throws Exception {
22 Preconditions.checkState(consumerContext == null);
23 final BGPExtensionConsumerContext consumerContext = new OSGiBGPExtensionProviderContext(context);
24 start(consumerContext);
25 this.consumerContext = consumerContext;
29 public final void stop(final BundleContext context) throws Exception {
30 Preconditions.checkState(consumerContext != null);
34 consumerContext = null;