Enable retries for the /authn/validate endpoint if it fails to connect
[aaf/authz.git] / cadi / aaf / src / main / java / org / onap / aaf / cadi / aaf / v2_0 / AAFCon.java
index 88333d8..9830309 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.aaf.cadi.aaf.v2_0;
 
 import java.net.URI;
 import java.net.UnknownHostException;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -265,6 +266,24 @@ public abstract class AAFCon<CLIENT> implements Connector {
     }
 
 
+    /**
+     * Use this call to get the appropriate client based on configuration (HTTP, future),
+     * ignoring those already attempted, using the default api version
+     *
+     * @param attemptedClients
+     * @return
+     * @throws CadiException
+     */
+    public Rcli<CLIENT> clientIgnoreAlreadyAttempted(List<URI> attemptedClients) throws CadiException {
+        Rcli<CLIENT> client = rclient(attemptedClients, si.defSS);
+        client.apiVersion(apiVersion)
+                .readTimeout(connTimeout);
+        clients.put(apiVersion, client);
+
+        return client;
+    }
+
+
     public RosettaEnv env() {
         return env;
     }
@@ -336,6 +355,8 @@ public abstract class AAFCon<CLIENT> implements Connector {
 
     protected abstract Rcli<CLIENT> rclient(URI uri, SecuritySetter<CLIENT> ss) throws CadiException;
 
+    protected abstract Rcli<CLIENT> rclient(List<URI> uris, SecuritySetter<CLIENT> ss) throws CadiException;
+
     public abstract Rcli<CLIENT> rclient(Locator<URI> loc, SecuritySetter<CLIENT> ss) throws CadiException;
 
     public Rcli<CLIENT> client(Locator<URI> locator) throws CadiException {