2 * Copyright (c) 2014 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.frm;
10 import org.opendaylight.controller.frm.impl.ForwardingRulesManagerImpl;
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
14 import org.osgi.framework.BundleContext;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
19 * Forwarding Rules Manager Activator
21 * Activator {@link ForwardingRulesManager}.
22 * It registers all listeners (DataChangeEvent, ReconcilNotification)
23 * in the Session Initialization phase.
25 * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
28 public class FRMActivator extends AbstractBindingAwareProvider {
30 private final static Logger LOG = LoggerFactory.getLogger(FRMActivator.class);
32 private ForwardingRulesManager manager;
35 public void onSessionInitiated(ProviderContext session) {
36 LOG.info("FRMActivator initialization.");
38 final DataBroker dataBroker = session.getSALService(DataBroker.class);
39 this.manager = new ForwardingRulesManagerImpl(dataBroker, session);
41 LOG.info("FRMActivator initialization successfull.");
44 LOG.error("Unexpected error by FRM initialization!", e);
50 protected void stopImpl(final BundleContext context) {
51 if (manager != null) {
54 } catch (Exception e) {
55 LOG.error("Unexpected error by stopping FRMActivator", e);
58 LOG.info("FRMActivator stopped.");