Sonar Fixes, Formatting
[aaf/authz.git] / cadi / aaf / src / main / java / org / onap / aaf / cadi / oauth / TzHClient.java
index c565fa8..241abf4 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.
@@ -40,43 +40,43 @@ import org.onap.aaf.misc.env.APIException;
 
 /**
  * Tokenized HClient
- * 
+ *
  * @author Jonathan
  *
  */
 public class TzHClient extends TzClient {
-       private HMangr hman;
-       public SecurityInfoC<HttpURLConnection> si;
-       private TimedToken token;
-       private SecuritySetter<HttpURLConnection> tokenSS;
+    private HMangr hman;
+    public SecurityInfoC<HttpURLConnection> si;
+    private TimedToken token;
+    private SecuritySetter<HttpURLConnection> tokenSS;
+
+    public TzHClient(Access access, String tagOrURL) throws CadiException, LocatorException {
+        try {
+            si = SecurityInfoC.instance(access, HttpURLConnection.class);
+            hman = new HMangr(access, new AAFLocator(si,new URI(access.getProperty(tagOrURL, tagOrURL))));
+        } catch (URISyntaxException e) {
+            throw new CadiException(e);
+        }
+    }
+    public TzHClient(Access access, SecurityInfoC<HttpURLConnection> hsi, Locator<URI> loc) throws LocatorException {
+        si = hsi;
+        hman = new HMangr(access, loc);
+    }
 
-       public TzHClient(Access access, String tagOrURL) throws CadiException, LocatorException {
-               try {
-                       si = SecurityInfoC.instance(access, HttpURLConnection.class);
-                       hman = new HMangr(access, new AAFLocator(si,new URI(access.getProperty(tagOrURL, tagOrURL))));
-               } catch (URISyntaxException e) {
-                       throw new CadiException(e);
-               }
-       }
-       public TzHClient(Access access, SecurityInfoC<HttpURLConnection> hsi, Locator<URI> loc) throws LocatorException {
-               si = hsi;
-               hman = new HMangr(access, loc);
-       }
-       
-       public void setToken(final String client_id, TimedToken token) throws IOException {
-               this.token = token;
-               tokenSS = new HTokenSS(si, client_id, token.getAccessToken());
-       }
+    public void setToken(final String client_id, TimedToken token) throws IOException {
+        this.token = token;
+        tokenSS = new HTokenSS(si, client_id, token.getAccessToken());
+    }
 
-       public <RET> RET best (Retryable<RET> retryable) throws CadiException, LocatorException, APIException {
-               if(token == null || tokenSS==null) {
-                       throw new CadiException("OAuth2 Token has not been set");
-               }
-               if(token.expired()) {
-                       //TODO Refresh?
-                       throw new CadiException("Expired Token");
-               } else {
-                       return hman.best(tokenSS, retryable);
-               }
-       }
+    public <RET> RET best (Retryable<RET> retryable) throws CadiException, LocatorException, APIException {
+        if (token == null || tokenSS==null) {
+            throw new CadiException("OAuth2 Token has not been set");
+        }
+        if (token.expired()) {
+            //TODO Refresh?
+            throw new CadiException("Expired Token");
+        } else {
+            return hman.best(tokenSS, retryable);
+        }
+    }
 }