2 * Copyright (c) 2015 Cisco Systems, Inc. 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
10 package org.opendaylight.yang.gen.v1.config.aaa.authn.mdsal.store.rev141031;
12 import org.opendaylight.aaa.api.IIDMStore;
13 import org.opendaylight.aaa.api.TokenStore;
14 import org.opendaylight.aaa.authn.mdsal.store.AuthNStore;
15 import org.opendaylight.aaa.authn.mdsal.store.IDMMDSALStore;
16 import org.opendaylight.aaa.authn.mdsal.store.IDMStore;
17 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
18 import org.osgi.framework.BundleContext;
19 import org.osgi.framework.ServiceRegistration;
21 public class AuthNStoreModule
23 org.opendaylight.yang.gen.v1.config.aaa.authn.mdsal.store.rev141031.AbstractAuthNStoreModule {
24 private BundleContext bundleContext;
26 public AuthNStoreModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
27 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
28 super(identifier, dependencyResolver);
31 public AuthNStoreModule(
32 org.opendaylight.controller.config.api.ModuleIdentifier identifier,
33 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
34 org.opendaylight.yang.gen.v1.config.aaa.authn.mdsal.store.rev141031.AuthNStoreModule oldModule,
35 java.lang.AutoCloseable oldInstance) {
36 super(identifier, dependencyResolver, oldModule, oldInstance);
40 public void customValidation() {
41 // add custom validation form module attributes here.
45 public java.lang.AutoCloseable createInstance() {
47 DataBroker dataBrokerService = getDataBrokerDependency();
48 final AuthNStore authNStore = new AuthNStore(dataBrokerService, getPassword());
49 final IDMMDSALStore mdsalStore = new IDMMDSALStore(dataBrokerService);
50 final IDMStore idmStore = new IDMStore(mdsalStore);
52 authNStore.setTimeToLive(getTimeToLive());
54 // Register the MD-SAL Token store with OSGI
55 final ServiceRegistration<?> serviceRegistration = bundleContext.registerService(
56 TokenStore.class.getName(), authNStore, null);
57 final ServiceRegistration<?> idmServiceRegistration = bundleContext.registerService(
58 IIDMStore.class.getName(), idmStore, null);
59 final class AutoCloseableStore implements AutoCloseable {
62 public void close() throws Exception {
63 serviceRegistration.unregister();
64 idmServiceRegistration.unregister();
69 return new AutoCloseableStore();
73 // throw new java.lang.UnsupportedOperationException();
77 * @param bundleContext
79 public void setBundleContext(BundleContext bundleContext) {
80 this.bundleContext = bundleContext;
84 * @return the bundleContext
86 public BundleContext getBundleContext() {