Merge "Add exists method on DOMStoreReadTransaction and DOMDataReadTransaction"
[controller.git] / opendaylight / config / config-persister-feature-adapter / src / main / java / org / opendaylight / controller / configpusherfeature / ConfigPusherFeatureActivator.java
1 /*
2  * Copyright (c) 2014 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.configpusherfeature;
9
10 import org.opendaylight.controller.config.persist.api.ConfigPusher;
11 import org.opendaylight.controller.configpusherfeature.internal.ConfigPusherCustomizer;
12 import org.osgi.framework.BundleActivator;
13 import org.osgi.framework.BundleContext;
14 import org.osgi.util.tracker.ServiceTracker;
15
16 public class ConfigPusherFeatureActivator implements BundleActivator {
17
18     BundleContext bc = null;
19     ConfigPusherCustomizer cpc = null;
20     ServiceTracker<ConfigPusher,ConfigPusher> cpst = null;
21
22     public void start(BundleContext context) throws Exception {
23         bc = context;
24         cpc = new ConfigPusherCustomizer();
25         cpst = new ServiceTracker<ConfigPusher, ConfigPusher>(bc, ConfigPusher.class.getName(), cpc);
26         cpst.open();
27     }
28
29     public void stop(BundleContext context) throws Exception {
30         if(cpst != null) {
31             cpst.close();
32             cpst = null;
33         }
34         if(cpc != null) {
35             cpc.close();
36             cpc = null;
37         }
38         bc = null;
39     }
40 }