2 * Copyright (c) 2016 Brocade Communications 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
9 package org.opendaylight.aaa.filterchain;
11 import org.opendaylight.aaa.filterchain.configuration.CustomFilterAdapterConfiguration;
12 import org.osgi.framework.BundleActivator;
13 import org.osgi.framework.BundleContext;
14 import org.osgi.framework.ServiceRegistration;
15 import org.osgi.service.cm.ManagedService;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * Activator for <code>aaa-filterchain</code>, a bundle which provides the ability
21 * to inject custom <code>Filter</code>(s) in front of servlets.
24 * This class is also responsible for offering contextual <code>DEBUG</code>
25 * level clues concerning the activation of the <code>aaa-filterchain</code> bundle.
26 * To enable these debug messages, issue the following command in the karaf
27 * shell: <code>log:set debug org.opendaylight.aaa.filterchain.Activator</code>
29 * @author Ryan Goulding (ryandgoulding@gmail.com)
31 public class Activator implements BundleActivator {
33 private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
35 private ServiceRegistration<ManagedService> managedServiceServiceRegistration;
38 public void stop(BundleContext context) throws Exception {
39 LOG.debug("Destroying the aaa-filterchain bundle");
40 managedServiceServiceRegistration.unregister();
44 public void start(BundleContext context) throws Exception {
45 LOG.debug("Initializing the aaa-filterchain bundle");
46 // Register the CustomFilterAdapterConfiguration ManagedService with the
47 // BundleContext so config values can be loaded from the config admin
48 managedServiceServiceRegistration = context.registerService(ManagedService.class,
49 CustomFilterAdapterConfiguration.getInstance(),
50 CustomFilterAdapterConfiguration.getInstance().getDefaultProperties());