Fixed deserialization of IdentityRefs in Restconf URI.
[controller.git] / opendaylight / md-sal / sal-dom-api / src / main / java / org / opendaylight / controller / sal / core / api / AbstractProvider.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.sal.core.api;
9
10 import java.util.Collection;
11 import java.util.Collections;
12
13 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
14 import org.osgi.framework.BundleActivator;
15 import org.osgi.framework.BundleContext;
16 import org.osgi.framework.ServiceReference;
17
18 public abstract class AbstractProvider implements BundleActivator, Provider {
19
20     private ServiceReference<Broker> brokerRef;
21     private Broker broker;
22
23     @Override
24     public Collection<ProviderFunctionality> getProviderFunctionality() {
25         return Collections.emptySet();
26     }
27
28     @Override
29     public final void start(BundleContext context) throws Exception {
30         brokerRef = context.getServiceReference(Broker.class);
31         broker = context.getService(brokerRef);
32
33         this.startImpl(context);
34
35         broker.registerProvider(this,context);
36     }
37
38     protected void startImpl(BundleContext context) {
39         // NOOP
40     }
41     protected void stopImpl(BundleContext context) {
42         // NOOP
43     }
44
45     @Override
46     public final void stop(BundleContext context) throws Exception {
47         stopImpl(context);
48     }
49
50 }