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.config.yang.store.impl;
10 import java.util.Dictionary;
11 import java.util.Hashtable;
13 import org.opendaylight.controller.config.yang.store.api.YangStoreService;
14 import org.osgi.framework.BundleActivator;
15 import org.osgi.framework.BundleContext;
16 import org.osgi.framework.ServiceRegistration;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
20 public class YangStoreActivator implements BundleActivator {
22 private ExtenderYangTracker extender;
23 private ServiceRegistration<YangStoreService> registration;
24 private static final Logger logger = LoggerFactory
25 .getLogger(YangStoreActivator.class);
28 public void start(BundleContext context) throws Exception {
29 extender = new ExtenderYangTracker(context);
32 Dictionary<String, ?> properties = new Hashtable<>();
33 registration = context.registerService(YangStoreService.class,
34 extender, properties);
38 public void stop(BundleContext context) throws Exception {
41 } catch (Exception e) {
42 logger.warn("Exception while closing extender", e);
45 if (registration != null)
47 registration.unregister();
48 } catch (Exception e) {
49 logger.warn("Exception while unregistring yang store service",