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
9 package org.opendaylight.controller.netconf.auth.usermanager;
11 import java.util.Hashtable;
12 import org.opendaylight.controller.netconf.auth.AuthConstants;
13 import org.opendaylight.controller.netconf.auth.AuthProvider;
14 import org.osgi.framework.BundleActivator;
15 import org.osgi.framework.BundleContext;
16 import org.osgi.framework.ServiceRegistration;
18 public class AuthProviderActivator implements BundleActivator {
20 public static final int PREFERENCE = 0;
21 private ServiceRegistration<AuthProvider> authProviderServiceRegistration;
24 public void start(final BundleContext context) throws Exception {
25 final AuthProvider authProvider = new AuthProviderImpl(context);
26 // Set preference of this service to 0
27 final Hashtable<String, Object> properties = new Hashtable<>(1);
28 properties.put(AuthConstants.SERVICE_PREFERENCE_KEY, PREFERENCE);
30 authProviderServiceRegistration = context.registerService(AuthProvider.class, authProvider, properties);
34 public void stop(final BundleContext context) throws Exception {
35 if(authProviderServiceRegistration != null) {
36 authProviderServiceRegistration.unregister();