Karaf 4: remove aaa-cli4
[aaa.git] / aaa-shiro / impl / src / main / java / org / opendaylight / aaa / AAAShiroProvider.java
1 /*
2  * Copyright © 2017 Brocade Communications Systems 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 package org.opendaylight.aaa;
9
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13
14 /**
15  * Provider for AAA shiro implementation.
16  *
17  * @author Ryan Goulding (ryandgoulding@gmail.com)
18  */
19 public class AAAShiroProvider {
20
21     private static final Logger LOG = LoggerFactory.getLogger(AAAShiroProvider.class);
22
23     private static AAAShiroProvider INSTANCE;
24     private DataBroker dataBroker;
25
26     /**
27      * Provider for this bundle.
28      *
29      * @param dataBroker injected from blueprint
30      */
31     private AAAShiroProvider(final DataBroker dataBroker) {
32         this.dataBroker = dataBroker;
33     }
34
35     /**
36      * Singleton creation
37      *
38      * @return the Provider
39      */
40     public static AAAShiroProvider newInstance(final DataBroker dataBroker) {
41         INSTANCE = new AAAShiroProvider(dataBroker);
42         return INSTANCE;
43     }
44
45     /**
46      * Singleton extraction
47      *
48      * @return the Provider
49      */
50     public static AAAShiroProvider getInstance() {
51         if (INSTANCE == null) {
52             newInstance(null);
53         }
54         return INSTANCE;
55     }
56
57     /**
58      * Method called when the blueprint container is created.
59      */
60     public void init() {
61         LOG.info("AAAShiroProvider Session Initiated");
62     }
63
64     /**
65      * Method called when the blueprint container is destroyed.
66      */
67     public void close() {
68         LOG.info("AAAShiroProvider Closed");
69     }
70
71     /**
72      * Extract the data broker.
73      *
74      * @return the data broker
75      */
76     public DataBroker getDataBroker() {
77         return this.dataBroker;
78     }
79 }