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