Bug 8214: Consume AAAService
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / controller / config / yang / md / sal / rest / connector / RestConnectorModule.java
index 0b80458b639c82b4e618fbe12e2599b7fa08e699..fd026492cfec493032c2feb8176ebbb865dd4040 100644 (file)
@@ -9,12 +9,17 @@
 package org.opendaylight.controller.config.yang.md.sal.rest.connector;
 
 import org.opendaylight.RestconfWrapperProviders;
+import org.opendaylight.aaa.api.AAAService;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
+import org.osgi.framework.BundleContext;
 
 
 public class RestConnectorModule extends org.opendaylight.controller.config.yang.md.sal.rest.connector.AbstractRestConnectorModule {
 
     private static RestConnectorRuntimeRegistration runtimeRegistration;
 
+    private BundleContext bundleContext;
+
     public RestConnectorModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
@@ -30,6 +35,11 @@ public class RestConnectorModule extends org.opendaylight.controller.config.yang
 
     @Override
     public java.lang.AutoCloseable createInstance() {
+
+        final WaitingServiceTracker<AAAService> aaaServiceWaitingServiceTracker =
+                WaitingServiceTracker.create(AAAService.class, bundleContext);
+        aaaServiceWaitingServiceTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
         final RestconfWrapperProviders wrapperProviders = new RestconfWrapperProviders(getWebsocketPort());
         wrapperProviders.registerProviders(getDomBrokerDependency());
 
@@ -41,5 +51,9 @@ public class RestConnectorModule extends org.opendaylight.controller.config.yang
 
         return wrapperProviders;
     }
+
+    public void setBundleContext(final BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
 }