Mass removal of all Tabs (Style Warnings)
[aaf/authz.git] / auth / auth-locate / src / main / java / org / onap / aaf / auth / locate / api / API_Proxy.java
index d2e4583..8bdf479 100644 (file)
@@ -52,112 +52,112 @@ import org.onap.aaf.misc.env.TimeTaken;
  */
 public class API_Proxy {
 
-       /**
-        * Normal Init level APIs
-        
-        * @param gwAPI
-        * @param facade
-        * @throws Exception
-        */
-       public static void init(final AAF_Locate gwAPI, LocateFacade facade) throws Exception {
-               
-               String aafurl = gwAPI.access.getProperty(Config.AAF_URL,null);
-               if(aafurl==null) {
-               } else {
-                       ////////
-                       // Transferring APIs
-                       // But DO NOT transfer BasicAuth case... wastes resources.
-                       ///////
-                       final BasicAuthCode bac = new BasicAuthCode(gwAPI.aafAuthn,facade);
-                       
-                       gwAPI.routeAll(HttpMethods.GET,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy GET", true) {
-                               @Override
-                               public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
-                                       if("/proxy/authn/basicAuth".equals(req.getPathInfo()) && !(req.getUserPrincipal() instanceof OAuth2Principal)) {
-                                               bac.handle(trans, req, resp);
-                                       } else {
-                                               TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
-                                               try {
-                                                       gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
-                                                               @Override
-                                                               public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
-                                                                       Future<Void> ft = client.transfer(req,resp,pathParam(req, ":path"),HttpStatus.OK_200);
-                                                                       ft.get(10000); // Covers return codes and err messages
-                                                                       return null;
-                                                               }
-                                                       });
-                                               
-                                               } catch (CadiException | APIException e) {
-                                                       trans.error().log(e);
-                                               } finally {
-                                                       tt.done();
-                                               }
-                                       }
-                               }
-                       });
-                       
-                       gwAPI.routeAll(HttpMethods.POST,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy POST", true) {
-                               @Override
-                               public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
-                                       TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
-                                       try {
-                                               gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
-                                                       @Override
-                                                       public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
-                                                               Future<Void> ft = client.transfer(req,resp,pathParam(req, ":path"),HttpStatus.CREATED_201);
-                                                               ft.get(10000); // Covers return codes and err messages
-                                                               return null;
-                                                       }
-                                               });
-                                       } catch (CadiException | APIException e) {
-                                               trans.error().log(e);
-                                       } finally {
-                                               tt.done();
-                                       }
-                               }
-                       });
-                       
-                       gwAPI.routeAll(HttpMethods.PUT,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy PUT", true) {
-                               @Override
-                               public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
-                                       TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
-                                       try {
-                                               gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
-                                                       @Override
-                                                       public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
-                                                               Future<Void> ft = client.transfer(req,resp,pathParam(req, ":path"),HttpStatus.OK_200);
-                                                               ft.get(10000); // Covers return codes and err messages
-                                                               return null;
-                                                       }
-                                               });
-                                       } catch (CadiException | APIException e) {
-                                               trans.error().log(e);
-                                       } finally {
-                                               tt.done();
-                                       }
-                               }
-                       });
-                       
-                       gwAPI.routeAll(HttpMethods.DELETE,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy DELETE", true) {
-                               @Override
-                               public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
-                                       TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
-                                       try {
-                                               gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
-                                                       @Override
-                                                       public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
-                                                               Future<Void> ft = client.transfer(req,resp,pathParam(req, ":path"),HttpStatus.OK_200);
-                                                               ft.get(10000); // Covers return codes and err messages
-                                                               return null;
-                                                       }
-                                               });
-                                       } catch (CadiException | APIException e) {
-                                               trans.error().log(e);
-                                       } finally {
-                                               tt.done();
-                                       }
-                               }
-                       });
-               }
-       }
+    /**
+     * Normal Init level APIs
+     * 
+     * @param gwAPI
+     * @param facade
+     * @throws Exception
+     */
+    public static void init(final AAF_Locate gwAPI, LocateFacade facade) throws Exception {
+        
+        String aafurl = gwAPI.access.getProperty(Config.AAF_URL,null);
+        if(aafurl==null) {
+        } else {
+            ////////
+            // Transferring APIs
+            // But DO NOT transfer BasicAuth case... wastes resources.
+            ///////
+            final BasicAuthCode bac = new BasicAuthCode(gwAPI.aafAuthn,facade);
+            
+            gwAPI.routeAll(HttpMethods.GET,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy GET", true) {
+                @Override
+                public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
+                    if("/proxy/authn/basicAuth".equals(req.getPathInfo()) && !(req.getUserPrincipal() instanceof OAuth2Principal)) {
+                        bac.handle(trans, req, resp);
+                    } else {
+                        TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
+                        try {
+                            gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
+                                @Override
+                                public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
+                                    Future<Void> ft = client.transfer(req,resp,pathParam(req, ":path"),HttpStatus.OK_200);
+                                    ft.get(10000); // Covers return codes and err messages
+                                    return null;
+                                }
+                            });
+                        
+                        } catch (CadiException | APIException e) {
+                            trans.error().log(e);
+                        } finally {
+                            tt.done();
+                        }
+                    }
+                }
+            });
+            
+            gwAPI.routeAll(HttpMethods.POST,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy POST", true) {
+                @Override
+                public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
+                    TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
+                    try {
+                        gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
+                            @Override
+                            public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
+                                Future<Void> ft = client.transfer(req,resp,pathParam(req, ":path"),HttpStatus.CREATED_201);
+                                ft.get(10000); // Covers return codes and err messages
+                                return null;
+                            }
+                        });
+                    } catch (CadiException | APIException e) {
+                        trans.error().log(e);
+                    } finally {
+                        tt.done();
+                    }
+                }
+            });
+            
+            gwAPI.routeAll(HttpMethods.PUT,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy PUT", true) {
+                @Override
+                public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
+                    TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
+                    try {
+                        gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
+                            @Override
+                            public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
+                                Future<Void> ft = client.transfer(req,resp,pathParam(req, ":path"),HttpStatus.OK_200);
+                                ft.get(10000); // Covers return codes and err messages
+                                return null;
+                            }
+                        });
+                    } catch (CadiException | APIException e) {
+                        trans.error().log(e);
+                    } finally {
+                        tt.done();
+                    }
+                }
+            });
+            
+            gwAPI.routeAll(HttpMethods.DELETE,"/proxy/:path*",API.VOID,new LocateCode(facade,"Proxy DELETE", true) {
+                @Override
+                public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
+                    TimeTaken tt = trans.start("Forward to AAF Service", Env.REMOTE);
+                    try {
+                        gwAPI.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() {
+                            @Override
+                            public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
+                                Future<Void> ft = client.transfer(req,resp,pathParam(req, ":path"),HttpStatus.OK_200);
+                                ft.get(10000); // Covers return codes and err messages
+                                return null;
+                            }
+                        });
+                    } catch (CadiException | APIException e) {
+                        trans.error().log(e);
+                    } finally {
+                        tt.done();
+                    }
+                }
+            });
+        }
+    }
 }