summaryrefslogtreecommitdiffstats
path: root/auth/auth-locate/src
diff options
context:
space:
mode:
Diffstat (limited to 'auth/auth-locate/src')
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java36
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java8
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java44
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java8
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java16
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java20
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java26
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java6
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java54
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java8
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java4
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java26
-rw-r--r--auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java14
-rw-r--r--auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java4
17 files changed, 143 insertions, 143 deletions
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
index 0ad14c84..ff538269 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/AAF_Locate.java
@@ -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.
@@ -81,19 +81,19 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
public final ConfigDAO configDAO;
private Locator<URI> dal;
-
+
/**
* 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
@@ -129,7 +129,7 @@ public class AAF_Locate extends AbsService<AuthzEnv, AuthzTrans> {
API_AAFAccess.init(this,facade);
API_Find.init(this, facade);
API_Proxy.init(this, facade);
-
+
////////////////////////////////////////////////////////////////////////
// Management APIs
////////////////////////////////////////////////////////////////////////
@@ -143,21 +143,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,10 +166,10 @@ 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){
route(env,meth,path,code,""); // this will always match
}
@@ -210,7 +210,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
)};
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
index 30258d80..80dffc27 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/BasicAuthCode.java
@@ -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.
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java
index 214c9d80..a2fd5c24 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/LocateCode.java
@@ -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.
@@ -32,7 +32,7 @@ public abstract class LocateCode extends HttpCode<AuthzTrans, LocateFacade> impl
super(facade, description, roles);
this.useJSON = useJSON;
}
-
+
public <D extends LocateCode> D clone(LocateFacade facade, boolean useJSON) throws Exception {
@SuppressWarnings("unchecked")
D d = (D)clone();
@@ -40,5 +40,5 @@ public abstract class LocateCode extends HttpCode<AuthzTrans, LocateFacade> impl
d.context = facade;
return d;
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
index b5ab4351..36a987e5 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_AAFAccess.java
@@ -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.
@@ -55,22 +55,22 @@ import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.TimeTaken;
public class API_AAFAccess {
-// private static String service, version, envContext;
+// private static String service, version, envContext;
private static final String GET_PERMS_BY_USER = "Get Perms by User";
private static final String USER_HAS_PERM ="User Has Perm";
// private static final String USER_IN_ROLE ="User Has Role";
-
+
/**
* Normal Init level APIs
- *
+ *
* @param gwAPI
* @param facade
* @throws Exception
*/
public static void init(final AAF_Locate gwAPI, LocateFacade facade) throws Exception {
-
-
+
+
gwAPI.route(HttpMethods.GET,"/authz/perms/user/:user",API.VOID,new LocateCode(facade,GET_PERMS_BY_USER, true) {
@Override
public void handle(final AuthzTrans trans, final HttpServletRequest req, final HttpServletResponse resp) throws Exception {
@@ -90,7 +90,7 @@ public class API_AAFAccess {
} finally {
tt2.done();
}
-
+
if (d==null || d.data.isEmpty()) {
tt2 = trans.start("AAF Service Call",Env.REMOTE);
try {
@@ -136,7 +136,7 @@ public class API_AAFAccess {
/**
* Query User Has Perm is DEPRECATED
- *
+ *
* Need to move towards NS declaration... is this even being used?
* @deprecated
*/
@@ -169,8 +169,8 @@ public class API_AAFAccess {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
"gui/"+pathParam(req,":path"));
} catch (LocatorException e) {
context.error(trans, resp, Result.ERR_BadData, e.getMessage());
@@ -184,8 +184,8 @@ public class API_AAFAccess {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
pathParam(req,":path"));
} catch (LocatorException e) {
context.error(trans, resp, Result.ERR_BadData, e.getMessage());
@@ -195,7 +195,7 @@ public class API_AAFAccess {
}
});
}
-
+
public static void initDefault(final AAF_Locate gwAPI, LocateFacade facade) throws Exception {
/**
@@ -205,7 +205,7 @@ public class API_AAFAccess {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
+ redirect(trans, req, resp, context,
gwAPI.getGUILocator(),
"login");
} catch (LocatorException e) {
@@ -216,7 +216,7 @@ public class API_AAFAccess {
}
});
-
+
/**
* Default URL
*/
@@ -224,17 +224,17 @@ public class API_AAFAccess {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
try {
- redirect(trans, req, resp, context,
- gwAPI.getGUILocator(),
+ redirect(trans, req, resp, context,
+ gwAPI.getGUILocator(),
"gui/home");
} catch (Exception e) {
context.error(trans, resp, Result.ERR_General, e.getMessage());
}
}
});
-
+
/**
- * Configuration
+ * Configuration
*/
gwAPI.route(HttpMethods.GET,"/configure/:id/:type",API.CONFIG,new LocateCode(facade,"Deliver Configuration Properties to AAF", true) {
@Override
@@ -261,7 +261,7 @@ public class API_AAFAccess {
if (loc.hasItems()) {
Item item = loc.best();
URI uri = loc.get(item);
- StringBuilder redirectURL = new StringBuilder(uri.toString());
+ StringBuilder redirectURL = new StringBuilder(uri.toString());
redirectURL.append('/');
redirectURL.append(path);
String str = req.getQueryString();
@@ -282,7 +282,7 @@ public class API_AAFAccess {
private static class User {
public final int code;
public final String resp;
-
+
public User(int code, String resp) {
this.code = code;
this.resp = resp;
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java
index 1e60e796..90cfa68d 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Api.java
@@ -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.
@@ -44,7 +44,7 @@ import org.onap.aaf.cadi.Symm;
public class API_Api {
/**
* Normal Init level APIs
- *
+ *
* @param gwAPI
* @param facade
* @throws Exception
@@ -76,7 +76,7 @@ public class API_Api {
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
String pathInfo = req.getPathInfo();
int question = pathInfo.lastIndexOf('?');
-
+
pathInfo = pathInfo.substring(13, question<0?pathInfo.length():question);// IMPORTANT, this is size of "/api/example/"
String nameOrContextType=Symm.base64noSplit.decode(pathInfo);
// String param = req.getParameter("optional");
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
index 88fcc079..08236aa3 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Find.java
@@ -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.
@@ -39,14 +39,14 @@ import org.onap.aaf.misc.env.util.Split;
/**
* API Apis.. using Redirect for mechanism
- *
+ *
* @author Jonathan
*
*/
public class API_Find {
/**
* Normal Init level APIs
- *
+ *
* @param gwAPI
* @param facade
* @throws Exception
@@ -55,7 +55,7 @@ public class API_Find {
////////
// Overall APIs
///////
-
+
final LocateCode locationInfo = new LocateCode(facade,"Location Information", true) {
@Override
public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception {
@@ -75,7 +75,7 @@ public class API_Find {
service=Define.varReplace(service);
Result<Void> r = context.getEndpoints(trans,resp,
req.getPathInfo(), // use as Key
- service,version,other
+ service,version,other
);
switch(r.status) {
case OK:
@@ -90,8 +90,8 @@ public class API_Find {
gwAPI.route(HttpMethods.GET,"/locate/:service/:version",API.ENDPOINTS,locationInfo);
gwAPI.route(HttpMethods.GET,"/locate/:service/:version/:other",API.ENDPOINTS,locationInfo);
gwAPI.route(HttpMethods.GET,"/locate/:service",API.ENDPOINTS,locationInfo);
-
-
+
+
gwAPI.route(HttpMethods.GET,"/download/agent", API.VOID, new LocateCode(facade,"Redirect to latest Agent",false) {
@Override
public void handle(AuthzTrans arg0, HttpServletRequest arg1, HttpServletResponse arg2) throws Exception {
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
index 85860316..962b9859 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/api/API_Proxy.java
@@ -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.
@@ -46,7 +46,7 @@ import org.onap.aaf.misc.env.TimeTaken;
/**
* API Apis.. using Redirect for mechanism
- *
+ *
* @author Jonathan
*
*/
@@ -54,13 +54,13 @@ 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) {
////////
@@ -68,7 +68,7 @@ public class API_Proxy {
// 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 {
@@ -85,7 +85,7 @@ public class API_Proxy {
return null;
}
});
-
+
} catch (CadiException | APIException e) {
trans.error().log(e);
} finally {
@@ -94,7 +94,7 @@ public class API_Proxy {
}
}
});
-
+
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 {
@@ -115,7 +115,7 @@ public class API_Proxy {
}
}
});
-
+
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 {
@@ -136,7 +136,7 @@ public class API_Proxy {
}
}
});
-
+
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 {
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java
index 4a2afa58..18d4f350 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade.java
@@ -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.
@@ -30,14 +30,14 @@ import org.onap.aaf.auth.rserv.RServlet;
/**
- *
+ *
* @author Jonathan
*
*/
public interface LocateFacade {
///////////////////// STANDARD ELEMENTS //////////////////
- /**
+ /**
* @param trans
* @param response
* @param result
@@ -45,7 +45,7 @@ public interface LocateFacade {
void error(AuthzTrans trans, HttpServletResponse response, Result<?> result);
/**
- *
+ *
* @param trans
* @param response
* @param status
@@ -54,7 +54,7 @@ public interface LocateFacade {
/**
- *
+ *
* @param trans
* @param resp
* @param rservlet
@@ -63,7 +63,7 @@ public interface LocateFacade {
public Result<Void> getAPI(AuthzTrans trans, HttpServletResponse resp, RServlet<AuthzTrans> rservlet);
/**
- *
+ *
* @param trans
* @param resp
* @param typeCode
@@ -73,20 +73,20 @@ public interface LocateFacade {
public abstract Result<Void> getAPIExample(AuthzTrans trans, HttpServletResponse resp, String typeCode, boolean optional);
/**
- *
+ *
* @param trans
* @param resp
* @param service
* @param version
* @param other
- * @param string
+ * @param string
* @return
*/
- public abstract Result<Void> getEndpoints(AuthzTrans trans, HttpServletResponse resp, String key,
+ public abstract Result<Void> getEndpoints(AuthzTrans trans, HttpServletResponse resp, String key,
String service, String version, String other);
/**
- *
+ *
* @param trans
* @param req
* @param resp
@@ -95,7 +95,7 @@ public interface LocateFacade {
public abstract Result<Void> putMgmtEndpoints(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
/**
- *
+ *
* @param trans
* @param req
* @param resp
@@ -104,7 +104,7 @@ public interface LocateFacade {
public abstract Result<Void> removeMgmtEndpoints(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp);
/**
- *
+ *
* @param trans
* @param req
* @param resp
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java
index 0bb9fbdb..e2d7cf96 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeFactory.java
@@ -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.
@@ -43,7 +43,7 @@ public class LocateFacadeFactory {
InRequest,
Out,
Error>(trans,locate,new Mapper_1_1()),
- type);
+ type);
}
}
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
index fc73047c..67107088 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacadeImpl.java
@@ -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.
@@ -65,7 +65,7 @@ import locate_local.v1_0.Api;
/**
* AuthzFacade
- *
+ *
* This Service Facade encapsulates the essence of the API Service can do, and provides
* a single created object for elements such as RosettaDF.
*
@@ -76,14 +76,14 @@ import locate_local.v1_0.Api;
* a) In the future, we may support multiple Response Formats, aka JSON or XML, based on User Request.
* 4) Log Service info, warnings and exceptions as necessary
* 5) When asked by the API layer, this will create and write Error content to the OutputStream
- *
- * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
+ *
+ * Note: This Class does NOT set the HTTP Status Code. That is up to the API layer, so that it can be
* clearly coordinated with the API Documentation
- *
+ *
* @author Jonathan
*
*/
-public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURATION,ERROR> extends FacadeImpl implements LocateFacade
+public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURATION,ERROR> extends FacadeImpl implements LocateFacade
{
private LocateService<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURATION,ERROR> service;
@@ -105,14 +105,14 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
(mepDF = env.newDataFactory(mapper().getClass(API.MGMT_ENDPOINTS))).in(dataType).out(dataType);
(confDF = env.newDataFactory(mapper().getClass(API.CONFIG))).in(dataType).out(dataType);
}
-
+
public Mapper<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURATION,ERROR> mapper() {
return service.mapper();
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#error(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, int)
- *
+ *
* Note: Conforms to AT&T TSS RESTful Error Structure
*/
@Override
@@ -128,7 +128,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
}
error(trans, response, result.status,msg,detail);
}
-
+
@Override
public void error(AuthzTrans trans, HttpServletResponse response, int status, String msg, String ... _detail) {
String[] detail = _detail;
@@ -153,7 +153,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
detail[0] = "Forbidden";
response.setStatus(/*httpstatus=*/403);
break;
-
+
case 404:
case ERR_NotFound:
msgId = "SVC1404";
@@ -167,21 +167,21 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
detail[0] = "Not Acceptable";
response.setStatus(/*httpstatus=*/406);
break;
-
+
case 409:
case ERR_ConflictAlreadyExists:
msgId = "SVC1409";
detail[0] = "Conflict Already Exists";
response.setStatus(/*httpstatus=*/409);
break;
-
+
case 501:
case ERR_NotImplemented:
msgId = "SVC1501";
- detail[0] = "Not Implemented";
+ detail[0] = "Not Implemented";
response.setStatus(/*httpstatus=*/501);
break;
-
+
default:
msgId = "SVC1500";
detail[0] = "General Service Error";
@@ -194,7 +194,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
StringBuilder holder = new StringBuilder();
ERROR em = mapper().errorFromMessage(holder,msgId,msg,detail);
trans.checkpoint(
- "ErrResp [" +
+ "ErrResp [" +
msgId +
"] " +
holder.toString(),
@@ -204,12 +204,12 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
em = mapper().errorFromMessage(holder, msgId, "Server had an issue processing this request");
}
errDF.newData(trans).load(em).to(response.getOutputStream());
-
+
} catch (Exception e) {
trans.error().log(e,"unable to send response for",msg);
}
}
-
+
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getAPI(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse)
*/
@@ -256,7 +256,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
tt.done();
}
}
-
+
public final static String API_EXAMPLE = "apiExample";
/* (non-Javadoc)
* @see com.att.authz.facade.AuthzFacade#getAPIExample(org.onap.aaf.auth.env.test.AuthzTrans, javax.servlet.http.HttpServletResponse, java.lang.String)
@@ -265,7 +265,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
public Result<Void> getAPIExample(AuthzTrans trans, HttpServletResponse resp, String nameOrContentType, boolean optional) {
TimeTaken tt = trans.start(API_EXAMPLE, Env.SUB);
try {
- String content =Examples.print(apiDF.getEnv(), nameOrContentType, optional);
+ String content =Examples.print(apiDF.getEnv(), nameOrContentType, optional);
resp.getOutputStream().print(content);
setContentType(resp,content.contains("<?xml")?TYPE.XML:TYPE.JSON);
return Result.ok();
@@ -296,7 +296,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
output = epsCache.get(key);
if ("{}".equals(output) && emptyCheck<temp) {
output = null;
- emptyCheck = temp+5000; // 5 second check
+ emptyCheck = temp+5000; // 5 second check
}
}
}
@@ -341,7 +341,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
}
Result<Void> rp = service.putMgmtEndPoints(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
synchronized(LOCK) {
cacheClear = 0L;
}
@@ -377,7 +377,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
}
Result<Void> rp = service.removeMgmtEndPoints(trans, rreq);
switch(rp.status) {
- case OK:
+ case OK:
synchronized(LOCK) {
cacheClear = 0L;
}
@@ -401,7 +401,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
try {
Result<CONFIGURATION> rp = service.getConfig(trans, id, type);
switch(rp.status) {
- case OK:
+ case OK:
setContentType(resp,mepDF.getOutType());
confDF.newData(trans).load(rp.value).to(resp.getOutputStream());
return Result.ok();
@@ -413,7 +413,7 @@ public abstract class LocateFacadeImpl<IN,OUT,ENDPOINTS,MGMT_ENDPOINTS,CONFIGURA
return Result.err(e);
} finally {
tt.done();
- }
+ }
}
-
+
} \ No newline at end of file
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java
index 8f45058f..3a1f9b83 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/facade/LocateFacade_1_1.java
@@ -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.
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java
index e2cd4bce..60c6d1f1 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper.java
@@ -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.
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
index aca71363..75652897 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/mapper/Mapper_1_1.java
@@ -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.
@@ -38,7 +38,7 @@ import locate_local.v1_0.InRequest;
import locate_local.v1_0.Out;
public class Mapper_1_1 implements Mapper<InRequest,Out,Endpoints,MgmtEndpoints,Configuration,Error> {
-
+
@Override
public Class<?> getClass(API api) {
switch(api) {
@@ -91,7 +91,7 @@ public class Mapper_1_1 implements Mapper<InRequest,Out,Endpoints,MgmtEndpoints,
}
int major=-1, minor=-1, patch=-1, pkg=-1;
if (version!=null) {
- try {
+ try {
String[] v = Split.split('.',version);
if (v.length>0) {major = Integer.parseInt(v[0]);}
if (v.length>1) {minor = Integer.parseInt(v[1]);}
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java
index 47f3b984..9a6858a3 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateService.java
@@ -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.
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
index 1ace384e..0e12ebb9 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java
@@ -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,20 +40,20 @@ import locate.v1_0.MgmtEndpoints;
import locate.v1_1.Configuration;
import locate.v1_1.Configuration.Props;
-public class LocateServiceImpl<IN,OUT,ERROR>
+public class LocateServiceImpl<IN,OUT,ERROR>
implements LocateService<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> {
private Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper;
protected LocateDAO locateDAO;
private ConfigDAO configDAO;
private boolean permToRegister;
-
+
public LocateServiceImpl(AuthzTrans trans, AAF_Locate locate, Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper){
this.mapper = mapper;
this.locateDAO = locate.locateDAO;
this.configDAO = locate.configDAO;
permToRegister = false; //TODO Setup a Configuration for this
}
-
+
public Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper() {return mapper;}
@Override
@@ -73,14 +73,14 @@ public class LocateServiceImpl<IN,OUT,ERROR>
int count = 0;
StringBuilder denied = null;
for (MgmtEndpoint me : meps.getMgmtEndpoint()) {
- if (permToRegister) {
+ if (permToRegister) {
int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName()
- AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
+ AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
if (!trans.fish(p)) {
if(denied==null) {
denied = new StringBuilder("May not register service(s):");
}
-
+
denied.append("\n\t");
denied.append(p.getKey());
denied.append(')');
@@ -111,14 +111,14 @@ public class LocateServiceImpl<IN,OUT,ERROR>
int count = 0;
StringBuilder denied = null;
for (MgmtEndpoint me : meps.getMgmtEndpoint()) {
- if (permToRegister) {
+ if (permToRegister) {
int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName()
- AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
+ AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
if (!trans.fish(p)) {
if(denied==null) {
denied = new StringBuilder("May not deregister service(s):");
}
-
+
denied.append("\n\t");
denied.append(p.getKey());
denied.append(')');
@@ -140,7 +140,7 @@ public class LocateServiceImpl<IN,OUT,ERROR>
///// ADDED v1_1
/* (non-Javadoc)
* @see org.onap.aaf.auth.locate.service.LocateService#getConfig(org.onap.aaf.auth.env.AuthzTrans, java.lang.String, java.lang.String)
- *
+ *
* Note: "id" is put in, in case we need to filter, or direct data change in the future by Permission
*/
@Override
@@ -149,7 +149,7 @@ public class LocateServiceImpl<IN,OUT,ERROR>
Configuration c = new Configuration();
c.setName(type);
Props p;
-
+
if (dr.isOKhasData()) {
for (ConfigDAO.Data data : dr.value) {
p = new Props();
diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
index 747211e1..b6ae54eb 100644
--- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
+++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/validation/LocateValidator.java
@@ -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.
@@ -32,9 +32,9 @@ import locate.v1_0.MgmtEndpoints;
/**
* Validator
* Consistently apply content rules for content (incoming)
- *
- * Note: We restrict content for usability in URLs (because RESTful service), and avoid
- * issues with Regular Expressions, and other enabling technologies.
+ *
+ * Note: We restrict content for usability in URLs (because RESTful service), and avoid
+ * issues with Regular Expressions, and other enabling technologies.
* @author Jonathan
*
*/
@@ -73,7 +73,7 @@ public class LocateValidator extends Validator {
}
return this;
}
-
+
public LocateValidator endpoints(Endpoints e, boolean emptyNotOK) {
if (e==null) {
msg("Endpoints Data is null.");
@@ -130,7 +130,7 @@ public class LocateValidator extends Validator {
nullOrBlank("Special Port Name",sp.getName());
nullOrBlank("Special Port Protocol",sp.getProtocol());
intRange("Special Port",sp.getPort(),0,1000000);
-
+
for (String s : sp.getProtocolVersions()) {
nullOrBlank("Special Port Protocol Version", s);
}
diff --git a/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java b/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java
index dd9ac7fc..c3b964bc 100644
--- a/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java
+++ b/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/api/JU_API_AAFTest.java
@@ -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.