Bug 3680 - Adding post activation service registration callbacks
[aaa.git] / aaa-authn-sts / src / main / java / org / opendaylight / aaa / sts / Activator.java
1 /*
2  * Copyright (c) 2014, 2015 Hewlett-Packard Development Company, L.P. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.aaa.sts;
10
11 import org.apache.felix.dm.DependencyActivatorBase;
12 import org.apache.felix.dm.DependencyManager;
13 import org.opendaylight.aaa.api.AuthenticationService;
14 import org.opendaylight.aaa.api.ClaimAuth;
15 import org.opendaylight.aaa.api.ClientService;
16 import org.opendaylight.aaa.api.CredentialAuth;
17 import org.opendaylight.aaa.api.IdMService;
18 import org.opendaylight.aaa.api.TokenAuth;
19 import org.opendaylight.aaa.api.TokenStore;
20 import org.osgi.framework.BundleContext;
21
22 /**
23  * An activator for the secure token server to inject in a
24  * {@link CredentialAuth} implementation.
25  *
26  * @author liemmn
27  *
28  */
29 public class Activator extends DependencyActivatorBase {
30
31     @Override
32     public void init(BundleContext context, DependencyManager manager)
33             throws Exception {
34         manager.add(createComponent()
35                 .setImplementation(ServiceLocator.INSTANCE)
36                 .add(createServiceDependency().setService(CredentialAuth.class)
37                     .setRequired(true)
38                     .setCallbacks("credentialAuthAdded", "credentialAuthRemoved"))
39                 .add(createServiceDependency().setService(ClaimAuth.class)
40                 .setRequired(false)
41                 .setCallbacks("claimAuthAdded", "claimAuthRemoved"))
42                 .add(createServiceDependency().setService(TokenAuth.class)
43                     .setRequired(false)
44                         .setCallbacks("tokenAuthAdded", "tokenAuthRemoved"))
45                 .add(createServiceDependency().setService(TokenStore.class)
46                         .setRequired(true)
47                         .setCallbacks("tokenStoreAdded", "tokenStoreRemoved"))
48                 .add(createServiceDependency().setService(TokenStore.class)
49                   .setRequired(true))
50                 .add(createServiceDependency().setService(
51                         AuthenticationService.class).setRequired(true)
52                         .setCallbacks("authenticationServiceAdded", "authenticationServiceRemoved"))
53             .add(createServiceDependency().setService(IdMService.class)
54                 .setRequired(true))
55             .add(createServiceDependency().setService(ClientService.class)
56                         .setRequired(true)));
57     }
58
59     @Override
60     public void destroy(BundleContext context, DependencyManager manager)
61             throws Exception {
62     }
63 }