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.sal.binding.impl;
10 import java.util.Hashtable;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
13 import org.osgi.framework.BundleActivator;
14 import org.osgi.framework.BundleContext;
15 import org.osgi.framework.ServiceRegistration;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 public class BrokerActivator implements BundleActivator {
21 private static final Logger log = LoggerFactory.getLogger(BrokerActivator.class);
22 private BindingAwareBrokerImpl baSal;
23 private ServiceRegistration<BindingAwareBroker> baSalRegistration;
26 public void start(BundleContext context) throws Exception {
27 log.info("Binding Aware Broker initialized");
28 baSal = new BindingAwareBrokerImpl();
29 baSal.setBrokerBundleContext(context);
32 BindingAwareBroker baSalService = baSal;
33 Hashtable<String, String> properties = new Hashtable<>();
34 this.baSalRegistration = context.registerService(BindingAwareBroker.class, baSalService, properties);
39 public void stop(BundleContext context) throws Exception {
40 log.info("Binding Aware Broker stopped");
41 baSalRegistration.unregister();