fe7dd2a678003b0e8b48ddbeca940319be99924c
[moon.git] /
1 package org.opendaylight.yang.gen.v1.config.aaa.authn.h2.store.rev151128;
2
3 import org.opendaylight.aaa.api.IIDMStore;
4 import org.opendaylight.aaa.h2.persistence.H2Store;
5 import org.osgi.framework.BundleContext;
6 import org.osgi.framework.ServiceRegistration;
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
9
10 public class AAAH2StoreModule extends org.opendaylight.yang.gen.v1.config.aaa.authn.h2.store.rev151128.AbstractAAAH2StoreModule {
11
12     private BundleContext bundleContext;
13     private static final Logger LOG = LoggerFactory.getLogger(AAAH2StoreModule.class);
14
15     public AAAH2StoreModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
16         super(identifier, dependencyResolver);
17     }
18
19     public AAAH2StoreModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.config.aaa.authn.h2.store.rev151128.AAAH2StoreModule oldModule, java.lang.AutoCloseable oldInstance) {
20         super(identifier, dependencyResolver, oldModule, oldInstance);
21     }
22
23     @Override
24     public java.lang.AutoCloseable createInstance() {
25         final H2Store h2Store = new H2Store();
26         final ServiceRegistration<?> serviceRegistration = bundleContext.registerService(IIDMStore.class.getName(), h2Store, null);
27         LOG.info("AAA H2 Store Initialized");
28         return new AutoCloseable() {
29             @Override
30             public void close() throws Exception {
31                 serviceRegistration.unregister();
32             }
33         };
34     }
35
36     /**
37      * @param bundleContext
38      */
39     public void setBundleContext(BundleContext bundleContext) {
40         this.bundleContext = bundleContext;
41     }
42
43     /**
44      * @return the bundleContext
45      */
46     public BundleContext getBundleContext() {
47         return bundleContext;
48     }
49 }