dd861514603e45d4517d24d1e4535c4966e36fc6
[moon.git] /
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.federation;
10
11 import java.util.List;
12 import java.util.Vector;
13 import org.opendaylight.aaa.api.ClaimAuth;
14 import org.opendaylight.aaa.api.IdMService;
15 import org.opendaylight.aaa.api.TokenStore;
16
17 /**
18  * A service locator to bridge between the web world and OSGi world.
19  *
20  * @author liemmn
21  *
22  */
23 public class ServiceLocator {
24
25     private static final ServiceLocator instance = new ServiceLocator();
26
27     protected volatile List<ClaimAuth> claimAuthCollection = new Vector<>();
28
29     protected volatile TokenStore tokenStore;
30
31     protected volatile IdMService idmService;
32
33     private ServiceLocator() {
34     }
35
36     public static ServiceLocator getInstance() {
37         return instance;
38     }
39
40     /**
41      * Called through reflection from the federation Activator
42      *
43      * @see org.opendaylight.aaa.federation.ServiceLocator
44      * @param ca the injected claims implementation
45      */
46     protected void claimAuthAdded(ClaimAuth ca) {
47         this.claimAuthCollection.add(ca);
48     }
49
50     /**
51      * Called through reflection from the federation Activator
52      *
53      * @see org.opendaylight.aaa.federation.Activator
54      * @param ca the claims implementation to remove
55      */
56     protected void claimAuthRemoved(ClaimAuth ca) {
57         this.claimAuthCollection.remove(ca);
58     }
59
60     public List<ClaimAuth> getClaimAuthCollection() {
61         return claimAuthCollection;
62     }
63
64     public void setClaimAuthCollection(List<ClaimAuth> claimAuthCollection) {
65         this.claimAuthCollection = claimAuthCollection;
66     }
67
68     public TokenStore getTokenStore() {
69         return tokenStore;
70     }
71
72     public void setTokenStore(TokenStore tokenStore) {
73         this.tokenStore = tokenStore;
74     }
75
76     public IdMService getIdmService() {
77         return idmService;
78     }
79
80     public void setIdmService(IdMService idmService) {
81         this.idmService = idmService;
82     }
83 }