2 * Copyright (c) 2014, 2015 Hewlett-Packard Development Company, L.P. 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.federation;
11 import java.util.Dictionary;
12 import org.apache.felix.dm.DependencyActivatorBase;
13 import org.apache.felix.dm.DependencyManager;
14 import org.opendaylight.aaa.api.ClaimAuth;
15 import org.opendaylight.aaa.api.IdMService;
16 import org.opendaylight.aaa.api.TokenStore;
17 import org.osgi.framework.BundleContext;
18 import org.osgi.framework.Constants;
19 import org.osgi.service.cm.ManagedService;
22 * An activator for the secure token server to inject in a
23 * <code>CredentialAuth</code> implementation.
28 public class Activator extends DependencyActivatorBase {
29 private static final String FEDERATION_PID = "org.opendaylight.aaa.federation";
32 public void init(BundleContext context, DependencyManager manager) throws Exception {
33 manager.add(createComponent()
34 .setImplementation(ServiceLocator.getInstance())
35 .add(createServiceDependency().setService(TokenStore.class).setRequired(true))
36 .add(createServiceDependency().setService(IdMService.class).setRequired(true))
37 .add(createServiceDependency().setService(ClaimAuth.class).setRequired(false)
38 .setCallbacks("claimAuthAdded", "claimAuthRemoved")));
39 context.registerService(ManagedService.class, FederationConfiguration.instance(),
40 addPid(FederationConfiguration.defaults));
44 public void destroy(BundleContext context, DependencyManager manager) throws Exception {
47 private Dictionary<String, ?> addPid(Dictionary<String, String> dict) {
48 dict.put(Constants.SERVICE_PID, FEDERATION_PID);