changed to unmaintained
[aaf/authz.git] / auth / auth-locate / src / main / java / org / onap / aaf / auth / locate / AAF_Locate.java
index ebbeae6..5c5f9a6 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,6 +33,7 @@ import org.onap.aaf.auth.cache.Cache.Dated;
 import org.onap.aaf.auth.dao.CassAccess;
 import org.onap.aaf.auth.dao.cass.ConfigDAO;
 import org.onap.aaf.auth.dao.cass.LocateDAO;
+import org.onap.aaf.auth.dao.hl.Question;
 import org.onap.aaf.auth.direct.DirectLocatorCreator;
 import org.onap.aaf.auth.direct.DirectRegistrar;
 import org.onap.aaf.auth.env.AuthzEnv;
@@ -81,19 +82,19 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
     public final ConfigDAO configDAO;
     private Locator<URI> dal;
 
-    
+    public final Question question;
     /**
      * Construct AuthzAPI with all the Context Supporting Routes that Authz needs
-     * 
+     *
      * @param env
-     * @param si 
-     * @param dm 
-     * @param decryptor 
-     * @throws APIException 
+     * @param si
+     * @param dm
+     * @param decryptor
+     * @throws APIException
      */
     public AAF_Locate(final AuthzEnv env) throws Exception {
         super(env.access(), env);
-        
+
         expireIn = Long.parseLong(env.getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF));
 
         // Initialize Facade for all uses
@@ -121,6 +122,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
             }
         }
 
+        question = new Question(trans, cluster, CassAccess.KEYSPACE);
 
         ////////////////////////////////////////////////////////////////////////////
         // Time Critical
@@ -128,8 +130,8 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
         ////////////////////////////////////////////////////////////////////////
         API_AAFAccess.init(this,facade);
         API_Find.init(this, facade);
-        API_Proxy.init(this, facade);
-        
+        API_Proxy.init(this, facade, question);
+
         ////////////////////////////////////////////////////////////////////////
         // Management APIs
         ////////////////////////////////////////////////////////////////////////
@@ -143,21 +145,21 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
         // Default Function
         ////////////////////////////////////////////////////////////////////////
         API_AAFAccess.initDefault(this,facade);
-        
+
     }
 
-    
+
     /**
      * Setup XML and JSON implementations for each supported Version type
-     * 
+     *
      * We do this by taking the Code passed in and creating clones of these with the appropriate Facades and properties
      * to do Versions and Content switches
-     * 
+     *
      */
     public void route(HttpMethods meth, String path, API api, LocateCode code) throws Exception {
         String version = "1.0";
         // Get Correct API Class from Mapper
-        Class<?> respCls = facade.mapper().getClass(api); 
+        Class<?> respCls = facade.mapper().getClass(api);
         if (respCls==null) throw new Exception("Unknown class associated with " + api.getClass().getName() + ' ' + api.name());
         // setup Application API HTML ContentTypes for JSON and Route
         String application = applicationJSON(respCls, version);
@@ -166,11 +168,11 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
         // setup Application API HTML ContentTypes for XML and Route
         application = applicationXML(respCls, version);
         route(env,meth,path,code.clone(facade_1_1_XML,false),application,"text/xml;version="+version);
-        
+
         // Add other Supported APIs here as created
     }
-    
-    public void routeAll(HttpMethods meth, String path, API api, LocateCode code) throws Exception {
+
+    public void routeAll(HttpMethods meth, String path, API api, LocateCode code){
         route(env,meth,path,code,""); // this will always match
     }
 
@@ -193,13 +195,13 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
 
     public Locator<URI> getGUILocator() throws LocatorException {
         if (gui_locator==null) {
-               RegistrationPropHolder rph;
-               try {
-                                rph = new RegistrationPropHolder(access, 0);
-                       } catch (UnknownHostException | CadiException e) {
-                               throw new LocatorException(e);
-                       }
-               String url = rph.getPublicEntryName("gui", rph.default_container);
+            RegistrationPropHolder rph;
+            try {
+                 rph = new RegistrationPropHolder(access, 0);
+            } catch (UnknownHostException | CadiException e) {
+                throw new LocatorException(e);
+            }
+            String url = rph.getPublicEntryName("gui", rph.default_container);
             gui_locator = AbsAAFLocator.create(url,Config.AAF_DEFAULT_API_VERSION);
         }
         return gui_locator;
@@ -210,7 +212,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
     public Filter[] _filters(Object ... additionalTafLurs) throws CadiException, LocatorException {
         try {
             return new Filter[] {
-                new AuthzTransFilter(env, aafCon(), 
+                new AuthzTransFilter(env, aafCon(),
                     new AAFTrustChecker((Env)env)
                     ,additionalTafLurs
                 )};
@@ -243,11 +245,11 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
 
             try {
                 new JettyServiceStarter<AuthzEnv,AuthzTrans>(
-                       new AAF_Locate(new AuthzEnv(propAccess)),true)
-                               .start();
-               } catch (Exception e) {
-                   propAccess.log(e);
-               }
+                    new AAF_Locate(new AuthzEnv(propAccess)),true)
+                        .start();
+            } catch (Exception e) {
+                propAccess.log(e);
+            }
         } catch (Exception e) {
             e.printStackTrace();
         }