diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-10-15 08:19:50 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-10-15 08:35:35 -0500 |
commit | 1296352d8eafee57f982a4342ad79ada4aa56d28 (patch) | |
tree | 355cdb89d85530a861319f892b0f24236e6adc50 /auth/auth-cmd/src/main | |
parent | bdce7667a6e272e2fa32e298d957a0d9090c5bc9 (diff) |
Sonar Fixes, Formatting
Issue-ID: AAF-1019
Change-Id: Ica49d9e7323aad9622ff9d95cc21b87430c22c54
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-cmd/src/main')
67 files changed, 468 insertions, 468 deletions
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java index 51986b92..2c084428 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java @@ -9,9 +9,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. @@ -232,7 +232,7 @@ public class AAFcli { continue; // Sleep, typically for reports, to allow DB to update // Milliseconds - + } else if ("sleep".equalsIgnoreCase(largs[idx])) { Integer t = Integer.parseInt(largs[++idx]); pw.println("sleep " + t); @@ -298,8 +298,8 @@ public class AAFcli { // Allow Script to indicate if Failure is what is expected } - } - + } + if ("REQUEST".equalsIgnoreCase(largs[idx])) { request=true; ++idx; @@ -416,7 +416,7 @@ public class AAFcli { System.out.println("For instance, C-b means hold ctrl key and press b, M-b means hold alt and press b\n"); System.out.println("Basic Keybindings:"); - System.out.println("\tC-l - clear screen"); + System.out.println("\tC-l - clear screen"); System.out.println("\tC-a - beginning of line"); System.out.println("\tC-e - end of line"); System.out.println("\tC-b - backward character (left arrow also works)"); @@ -441,7 +441,7 @@ public class AAFcli { */ public static void main(String[] args) { int rv = 0; - + try { AAFSSO aafsso = new AAFSSO(args); String noexit = aafsso.access().getProperty("no_exit"); @@ -451,7 +451,7 @@ public class AAFcli { if (aafsso.ok()) { Define.set(access); AuthzEnv env = new AuthzEnv(access); - + Reader rdr = null; boolean exitOnFailure = true; /* @@ -489,15 +489,15 @@ public class AAFcli { sb.append(args[i]); } } - + AAFConHttp aafcon = new AAFConHttp(access); -// +// // SecurityInfoC<?> si = aafcon.securityInfo(); // Locator<URI> loc; - + aafsso.setLogDefault(); aafsso.setStdErrDefault(); - + // Note, with AAF Locator, this may not longer be necessary 3/2018 Jonathan if (!aafsso.loginOnly()) { // try { @@ -509,16 +509,16 @@ public class AAFcli { // // Other Access is done writing to StdOut and StdErr, reset Std out // aafsso.setLogDefault(); // } - + TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)); // HMangr hman = new HMangr(access, loc).readTimeout(TIMEOUT).apiVersion(Config.AAF_DEFAULT_API_VERSION); - + if (access.getProperty(Config.AAF_DEFAULT_REALM)==null) { access.setProperty(Config.AAF_DEFAULT_REALM, "people.osaaf.org"); aafsso.addProp(Config.AAF_DEFAULT_REALM, "people.osaaf.org"); } - - AAFcli aafcli = new AAFcli(access,env, new OutputStreamWriter(System.out), + + AAFcli aafcli = new AAFcli(access,env, new OutputStreamWriter(System.out), aafcon.hman(), aafcon.securityInfo(), aafcon.securityInfo().defSS); // new HBasicAuthSS(si,aafsso.user(), access.decrypt(aafsso.enc_pass(),false))); // } @@ -540,18 +540,18 @@ public class AAFcli { System.out.println("Type 'help' for short help or 'help -d' for detailed help with aafcli commands"); System.out.println("Type '?' for help with command line editing"); System.out.println("Type 'q', 'quit', or 'exit' to quit aafcli\n"); - + ConsoleReader reader = new ConsoleReader(); try { reader.setPrompt("aafcli > "); - + String line; while ((line = reader.readLine()) != null) { showDetails = (line.contains("-d")); - + if (line.equalsIgnoreCase("quit") || line.equalsIgnoreCase("q") || line.equalsIgnoreCase("exit")) { break; - } else if (line.equalsIgnoreCase("--help -d") || line.equalsIgnoreCase("help -d") + } else if (line.equalsIgnoreCase("--help -d") || line.equalsIgnoreCase("help -d") || line.equalsIgnoreCase("help")) { line = "--help"; } else if (line.equalsIgnoreCase("cls")) { @@ -592,10 +592,10 @@ public class AAFcli { } rv = aafcli.eval(sb.toString()) ? 0 : 1; } - + } finally { aafcli.close(); - + // Don't close if No Reader, or it's a Reader of Standard In if (rdr != null && !(rdr instanceof InputStreamReader)) { rdr.close(); @@ -629,7 +629,7 @@ public class AAFcli { public boolean isTest() { return AAFcli.isTest; } - + public boolean isDetailed() { return AAFcli.showDetails; } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java index 77d1894f..6978e9e2 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.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. @@ -36,13 +36,13 @@ public class BaseCmd<CMD extends Cmd> extends Cmd { super(aafcli, null, name, params); cmds = new ArrayList<>(); } - + public BaseCmd(CMD parent, String name, Param ... params) { super(parent.aafcli, parent, name, params); cmds = new ArrayList<>(); } - + @Override public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException { if (args.length-idx<1) { @@ -53,7 +53,7 @@ public class BaseCmd<CMD extends Cmd> extends Cmd { Cmd empty = null; for (Cmd c: cmds) { name = c.getName(); - if (name==null && empty==null) { // Mark with Command is null, and take the first one. + if (name==null && empty==null) { // Mark with Command is null, and take the first one. empty = c; } else if (s.equalsIgnoreCase(c.getName())) return c.exec(idx+1, args); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java index 6ca09213..0ae4ce99 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.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. @@ -67,7 +67,7 @@ public abstract class Cmd { public static final String STARTDATE = "startdate"; public static final String ENDDATE = "enddate"; - + private String name; private final Param[] params; private int required; @@ -104,7 +104,7 @@ public abstract class Cmd { ++required; } } - + String temp = access.getProperty(Config.AAF_DEFAULT_REALM,null); if (temp!=null && !temp.startsWith("@")) { defaultRealm = '@' + temp; @@ -112,16 +112,16 @@ public abstract class Cmd { defaultRealm="<Set Default Realm>"; } } - + public final int exec(int idx, String ... args) throws CadiException, APIException, LocatorException { if (args.length-idx<required) { throw new CadiException(build(new StringBuilder("Too few args: "),null).toString()); } return _exec(idx,args); } - + protected abstract int _exec(int idx, final String ... args) throws CadiException, APIException, LocatorException; - + public void detailedHelp(int indent,StringBuilder sb) { } @@ -179,7 +179,7 @@ public abstract class Cmd { sb.append(p.tag); sb.append(p.required?"> ": "] "); } - + boolean first = true; for (Cmd child : children) { if (!(child instanceof DeprecatedCMD)) { @@ -222,7 +222,7 @@ public abstract class Cmd { } return sb; } - + protected void error(Future<?> future) { StringBuilder sb = new StringBuilder("Failed"); String desc = future.body(); @@ -275,7 +275,7 @@ public abstract class Cmd { pw().println(sb); } - + private void withCode(StringBuilder sb, Integer code) { sb.append(" with code "); sb.append(code); @@ -303,7 +303,7 @@ public abstract class Cmd { if ((str = access.getProperty(Cmd.STARTDATE,null))!=null) { req.setStart(Chrono.timeStamp(Date.valueOf(str))); } - + if ((str = access.getProperty(Cmd.ENDDATE,null))!=null) { req.setEnd(Chrono.timeStamp(Date.valueOf(str))); } @@ -311,7 +311,7 @@ public abstract class Cmd { /** * For Derived classes, who have ENV in this parent - * + * * @param cls * @return * @throws APIException @@ -349,17 +349,17 @@ public abstract class Cmd { pw().print('-'); } pw().println(); - + pw().format(hformat,"Date","Table","User","Memo"); for (int i=0;i<lineLength;++i) { pw().print('-'); } pw().println(); - + // Save Server time by Sorting locally List<Item> items = history.getItem(); java.util.Collections.sort(items, (Comparator<Item>) (o1, o2) -> o2.getTimestamp().compare(o1.getTimestamp())); - + for (History.Item item : items) { GregorianCalendar gc = item.getTimestamp().toGregorianCalendar(); pw().format(hformat, @@ -370,7 +370,7 @@ public abstract class Cmd { } } } - + /** * Turn String Array into a | delimited String * @param options @@ -389,12 +389,12 @@ public abstract class Cmd { } return sb.toString(); } - + /** * return which index number the Option matches. - * + * * throws an Exception if not part of this Option Set - * + * * @param options * @param test * @return @@ -420,9 +420,9 @@ public abstract class Cmd { retryable.item(aafcli.prevCall.item()); retryable.lastClient=aafcli.prevCall.lastClient; } - + RET ret = aafcli.hman.same(aafcli.ss,retryable); - + // Store last call in AAFcli, because Cmds are all different instances. aafcli.prevCall = retryable; return ret; @@ -445,7 +445,7 @@ public abstract class Cmd { public String getName() { return name; } - + public void reportHead(String ... str) { pw().println(); boolean first = true; @@ -467,7 +467,7 @@ public abstract class Cmd { pw().println(); reportLine(); } - + public String reportColHead(String format, String ... args) { pw().format(format,(Object[])args); reportLine(); @@ -480,7 +480,7 @@ public abstract class Cmd { } pw().println(); } - + protected void setQueryParamsOn(Rcli<?> rcli) { StringBuilder sb=null; String force; @@ -502,7 +502,7 @@ public abstract class Cmd { // // /** // * If Force is set, will return True once only, then revert to "FALSE". -// * +// * // * @return // */ // protected String checkForce() { @@ -525,7 +525,7 @@ public abstract class Cmd { /** * Appends shortID with Realm, but only when allowed by Organization - * @throws OrganizationException + * @throws OrganizationException */ public String fullID(String id) { if (id != null) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.java index 6082fac8..cb9eb7ce 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/DeprecatedCMD.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. @@ -29,7 +29,7 @@ import org.onap.aaf.misc.env.APIException; /** * Use this class to deprecate methods and features, by pointing to the new * usages. - * + * * These commands will not show up in Help * @author Jonathan * diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java index 49ffb51b..52439046 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.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. @@ -31,7 +31,7 @@ public class Help extends Cmd { private List<Cmd> cmds; public Help(AAFcli aafcli, List<Cmd> cmds) { - super(aafcli, "help", + super(aafcli, "help", new Param("-d (more details)", false), new Param("command",false)); this.cmds = cmds; @@ -83,7 +83,7 @@ public class Help extends Cmd { pw().println(sb.toString()); return 200 /*HttpStatus.OK_200*/; } - + @Override public void detailedHelp(int indentValue, StringBuilder sb) { int indent = indentValue; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.java index 934212ca..bca337e3 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/MessageException.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. @@ -20,19 +20,19 @@ */ /** - * + * */ package org.onap.aaf.auth.cmd; /** * An Exception designed simply to give End User message, no stack trace - * + * * @author Jonathan * */ public class MessageException extends Exception { /** - * + * */ private static final long serialVersionUID = 8143933588878259048L; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.java index 8e485528..dfcf4ed5 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Param.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. @@ -24,9 +24,9 @@ package org.onap.aaf.auth.cmd; public class Param { public final String tag; public final boolean required; - + /** - * + * * @param t * @param b */ diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java index 9bfb77f9..c6ff3bd9 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.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-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.java index ab9758ae..29b74a8d 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Cache.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-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java index 83bf57c0..6b958108 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.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. @@ -54,7 +54,7 @@ public class Clear extends Cmd { public Integer code(Rcli<?> client) throws APIException, CadiException { int rv = 409; Future<Void> fp = client.delete( - "/mgmt/cache/"+name, + "/mgmt/cache/"+name, Void.class ); if (fp.get(AAFcli.timeout())) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java index bc7f91f8..3ab26cbd 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.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. @@ -41,7 +41,7 @@ public class Deny extends BaseCmd<Mgmt> { cmds.add(new DenySomething(this,"ip","ipv4or6[,ipv4or6]*")); cmds.add(new DenySomething(this,"id","identity[,identity]*")); } - + public class DenySomething extends Cmd { private boolean isID; @@ -84,7 +84,7 @@ public class Deny extends BaseCmd<Mgmt> { pw().println(name + append + resp + " on " + client); rv=fp.code(); } else { - if (rv==409) { + if (rv==409) { rv = fp.code(); }; error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java index 6289032d..df9f520c 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.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. @@ -42,7 +42,7 @@ public class Log extends BaseCmd<Mgmt> { new Param(optionsToString(options),true), new Param("id[,id]*",true)); } - + @Override public int _exec(int idxValue, String ... args) throws CadiException, APIException, LocatorException { int rv=409; @@ -56,7 +56,7 @@ public class Log extends BaseCmd<Mgmt> { } else { fname = name; } - + rv = all(new Retryable<Integer>() { @Override public Integer code(Rcli<?> client) throws APIException, CadiException { @@ -65,7 +65,7 @@ public class Log extends BaseCmd<Mgmt> { String str = "/mgmt/log/id/"+fname; String msg; switch(option) { - case 0: + case 0: fp = client.create(str,Void.class); msg = "Added"; break; @@ -77,7 +77,7 @@ public class Log extends BaseCmd<Mgmt> { fp = null; msg = "Ignored"; } - + if (fp!=null) { if (fp.get(AAFcli.timeout())) { pw().println(msg + " Special Log for " + fname + " on " + client); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java index a1c83ee0..43dfc85a 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Mgmt.java @@ -9,9 +9,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-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java index 9ca01a39..ef139aef 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.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. @@ -53,14 +53,14 @@ public class SessClear extends Cmd { public Integer code(Rcli<?> client) throws APIException, CadiException { int rv = 409; Future<Void> fp = client.delete( - "/mgmt/dbsession", + "/mgmt/dbsession", Void.class ); if (fp.get(AAFcli.timeout())) { pw().println("Cleared DBSession on " + client); rv=200; } else { - if (rv==409) { + if (rv==409) { rv = fp.code(); }; error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.java index c70234ed..e543e238 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Session.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-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java index 9d2843bc..0afa73b8 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.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. @@ -52,24 +52,24 @@ public class Admin extends BaseCmd<NS> { return same(new Retryable<Integer>() { @Override - public Integer code(Rcli<?> client) throws CadiException, APIException { + public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Void> fp = null; for (String id : ids) { id = fullID(id); String verb; switch(option) { - case 0: + case 0: fp = client.create("/authz/ns/"+ns+"/admin/"+id,Void.class); verb = " added to "; break; - case 1: + case 1: fp = client.delete("/authz/ns/"+ns+"/admin/"+id,Void.class); verb = " deleted from "; break; default: throw new CadiException("Bad Argument"); }; - + if (fp.get(AAFcli.timeout())) { pw().append("Admin "); pw().append(id); @@ -79,7 +79,7 @@ public class Admin extends BaseCmd<NS> { error(fp); return fp.code(); } - + } return fp==null?500:fp.code(); } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java index feade450..63089e45 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java @@ -9,9 +9,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. @@ -62,24 +62,24 @@ public class Attrib extends BaseCmd<NS> { } else { value = ""; } - + return same(new Retryable<Integer>() { @Override - public Integer code(Rcli<?> client) throws CadiException, APIException { + public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Void> fp = null; String message; switch(option) { - case 0: + case 0: fp = client.create(authzString+ns+atrributeString+key+'/'+value,Void.class); message = String.format("Add Attrib %s=%s to %s", key,value,ns); break; - case 1: + case 1: fp = client.update(authzString+ns+atrributeString+key+'/'+value); message = String.format("Update Attrib %s=%s for %s", key,value,ns); break; - case 2: + case 2: fp = client.delete(authzString+ns+atrributeString+key,Void.class); message = String.format("Attrib %s deleted from %s", key,ns); @@ -95,8 +95,8 @@ public class Attrib extends BaseCmd<NS> { } else { error(fp); } - - return fp.code(); + + return fp.code(); } } }); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java index 05d66881..6e6b40b4 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.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. @@ -42,9 +42,9 @@ public class Create extends Cmd { private static final String COMMA = ","; public Create(NS parent) { - super(parent,"create", + super(parent,"create", new Param("ns-name",true), - new Param("owner (id[,id]*)",true), + new Param("owner (id[,id]*)",true), new Param("admin (id[,id]*)",false)); } @@ -53,7 +53,7 @@ public class Create extends Cmd { int idx = _idx; final NsRequest nr = new NsRequest(); - + nr.setName(args[idx++]); String[] responsible = args[idx++].split(COMMA); for (String s : responsible) { @@ -68,17 +68,17 @@ public class Create extends Cmd { for (String s : admin) { nr.getAdmin().add(fullID(s)); } - + // Set Start/End commands setStartEnd(nr); - + return same(new Retryable<Integer>() { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { // Requestable setQueryParamsOn(client); Future<NsRequest> fp = client.create( - "/authz/ns", + "/authz/ns", getDF(NsRequest.class), nr ); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java index 7da6c26b..7e6b1422 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.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,8 +39,8 @@ import org.onap.aaf.misc.env.APIException; */ public class Delete extends Cmd { public Delete(NS parent) { - super(parent,"delete", - new Param("ns-name",true)); + super(parent,"delete", + new Param("ns-name",true)); } @Override @@ -51,11 +51,11 @@ public class Delete extends Cmd { int index = idx; StringBuilder path = new StringBuilder("/authz/ns/"); path.append(args[index++]); - + // Send "Force" if set setQueryParamsOn(client); Future<Void> fp = client.delete(path.toString(),Void.class); - + if (fp.get(AAFcli.timeout())) { pw().println("Deleted Namespace"); } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java index e521d616..68532c9b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.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. @@ -37,9 +37,9 @@ import aaf.v2_0.NsRequest; public class Describe extends Cmd { private static final String NS_PATH = "/authz/ns"; public Describe(NS parent) { - super(parent,"describe", + super(parent,"describe", new Param("ns-name",true), - new Param("description",true)); + new Param("description",true)); } @Override @@ -53,14 +53,14 @@ public class Describe extends Cmd { while (idx < args.length) { desc.append(args[idx++] + ' '); } - + NsRequest nsr = new NsRequest(); nsr.setName(name); nsr.setDescription(desc.toString()); - + // Set Start/End commands setStartEnd(nsr); - + Future<NsRequest> fn = null; int rv; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java index e1252d87..ef25f75a 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.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. @@ -47,9 +47,9 @@ public class List extends BaseCmd<NS> { public List(NS parent) { super(parent,"list"); cmds.add(new ListByName(this)); - -// TODO: uncomment when on cassandra 2.1.2 if we like cli command to get all ns's -// a user is admin or responsible for + +// TODO: uncomment when on cassandra 2.1.2 if we like cli command to get all ns's +// a user is admin or responsible for cmds.add(new ListAdminResponsible(this)); cmds.add(new DeprecatedCMD<List>(this,"responsible","'responsible' is deprecated. use 'owner'")); // deprecated cmds.add(new ListActivity(this)); @@ -57,13 +57,13 @@ public class List extends BaseCmd<NS> { cmds.add(new ListChildren(this)); cmds.add(new ListNsKeysByAttrib(this)); } - + public void report(Future<Nss> fp, String ... str) { reportHead(str); if (fp==null) { pw().println(" *** Namespace Not Found ***"); } - + if (fp!=null && fp.value!=null) { for (Ns ns : fp.value.getNs()) { pw().println(ns.getName()); @@ -93,12 +93,12 @@ public class List extends BaseCmd<NS> { } pw().format(sformat,sb.toString()); } - + } } } } - + public void reportName(Future<Nss> fp, String ... str) { reportHead(str); if (fp!=null && fp.value!=null) { @@ -109,7 +109,7 @@ public class List extends BaseCmd<NS> { return ns1.getName().compareTo(ns2.getName()); } }); - + for (Ns ns : nss) { pw().println(ns.getName()); if (this.aafcli.isDetailed() && ns.getDescription() != null) { @@ -136,9 +136,9 @@ public class List extends BaseCmd<NS> { } } } - - public void reportCred(Future<Users> fc) { + + public void reportCred(Future<Users> fc) { if (fc!=null && fc.value!=null && !(fc.value.getUser().isEmpty())) { pw().println(" Credentials"); java.util.List<User> users = fc.value.getUser(); @@ -162,9 +162,9 @@ public class List extends BaseCmd<NS> { Integer type; if ((type=u.getType())==null) { type = 9999; - } + } return Define.getCredType(type); } - + } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java index f8f82466..ae80fd8d 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.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,9 +40,9 @@ import aaf.v2_0.History; */ public class ListActivity extends Cmd { private static final String HEADER = "List Activity of Namespace"; - + public ListActivity(List parent) { - super(parent,"activity", + super(parent,"activity", new Param("ns-name",true)); } @@ -50,15 +50,15 @@ public class ListActivity extends Cmd { public int _exec(int _idx, final String ... args) throws CadiException, APIException, LocatorException { int idx = _idx; final String ns = args[idx++]; - + return same(new Retryable<Integer>() { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<History> fp = client.read( - "/authz/hist/ns/"+ns, + "/authz/hist/ns/"+ns, getDF(History.class) ); - + if (fp.get(AAFcli.timeout())) { activity(fp.value, HEADER + " [ " + ns + " ]"); } else { @@ -68,7 +68,7 @@ public class ListActivity extends Cmd { } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java index 3e3a0ea6..1f833d9c 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.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. @@ -37,11 +37,11 @@ import aaf.v2_0.Nss; public class ListAdminResponsible extends Cmd { private static final String HEADER="List Namespaces with "; private static final String[] options = {"admin","owner"}; - + public ListAdminResponsible(List parent) { - super(parent,null, + super(parent,null, new Param(optionsToString(options),true), - new Param("user",true)); + new Param("user",true)); } @Override @@ -54,21 +54,21 @@ public class ListAdminResponsible extends Cmd { String title = args[idx++]; String user = fullID(args[idx++]); String apipart = "owner".equals(title)?"responsible":title; - + Future<Nss> fn = client.read("/authz/nss/"+apipart+"/"+user,getDF(Nss.class)); if (fn.get(AAFcli.timeout())) { ((List)parent).reportName(fn,HEADER + title + " privileges for ",user); } else if (fn.code()==404) { ((List)parent).report(null,HEADER + title + " privileges for ",user); return 200; - } else { + } else { error(fn); } return fn.code(); } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER + "admin or owner privileges for user"); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java index b4cca87e..8151b19b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.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. @@ -45,9 +45,9 @@ import aaf.v2_0.Users; */ public class ListByName extends Cmd { private static final String HEADER="List Namespaces by Name"; - + public ListByName(List parent) { - super(parent,"name", + super(parent,"name", new Param("ns-name",true)); } @@ -84,7 +84,7 @@ public class ListByName extends Cmd { } else if (fn.code()==404) { ((List)parent).report(null,HEADER,ns); return 200; - } else { + } else { error(fn); } return fn.code(); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java index 96baa324..9a9f47ff 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.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. @@ -42,9 +42,9 @@ import aaf.v2_0.Nss.Ns; */ public class ListChildren extends Cmd { private static final String HEADER="List Child Namespaces"; - + public ListChildren(List parent) { - super(parent,"children", + super(parent,"children", new Param("ns-name",true)); } @@ -64,7 +64,7 @@ public class ListChildren extends Cmd { } else if (fn.code()==404) { ((List)parent).report(null,HEADER,ns); return 200; - } else { + } else { error(fn); } return fn.code(); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java index 01b0f21c..14bc3313 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.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. @@ -45,10 +45,10 @@ import aaf.v2_0.Users; */ public class ListNsKeysByAttrib extends Cmd { private static final String HEADER="List Namespace Names by Attribute"; - + public ListNsKeysByAttrib(List parent) { - super(parent,"keys", - new Param("attrib",true)); + super(parent,"keys", + new Param("attrib",true)); } @Override @@ -67,7 +67,7 @@ public class ListNsKeysByAttrib extends Cmd { parent.reportHead(HEADER); pw().println(" *** No Namespaces Found ***"); return 200; - } else { + } else { error(fn); } return fn.code(); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java index ba2f88dc..a89c8497 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsers.java @@ -9,9 +9,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. @@ -58,7 +58,7 @@ public class ListUsers extends BaseCmd<List> { }; private static final String uformat = "%s%-50s expires:%02d/%02d/%04d\n"; - + public ListUsers(List parent) { super(parent,"user"); cmds.add(new ListUsersWithPerm(this)); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java index d6eb9b30..3ebafc23 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.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. @@ -49,10 +49,10 @@ import aaf.v2_0.Users.User; */ public class ListUsersContact extends Cmd { private static final String HEADER="List Contacts of Namespace "; - + public ListUsersContact(ListUsers parent) { - super(parent,"contact", - new Param("ns-name",true)); + super(parent,"contact", + new Param("ns-name",true)); } @Override @@ -76,7 +76,7 @@ public class ListUsersContact extends Cmd { ((ListUsers)parent).report(r.getName()); } Future<Users> fus = client.read( - "/authz/users/role/"+r.getName(), + "/authz/users/role/"+r.getName(), getDF(Users.class) ); if (fus.get(AAFcli.timeout())) { @@ -102,7 +102,7 @@ public class ListUsersContact extends Cmd { } } else if (fn.code()==404) { return 200; - } else { + } else { error(fn); } return fn.code(); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java index b33f506d..5cda15bc 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.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. @@ -49,10 +49,10 @@ import aaf.v2_0.Users.User; */ public class ListUsersInRole extends Cmd { private static final String HEADER="List Users in Roles of Namespace "; - + public ListUsersInRole(ListUsers parent) { - super(parent,"role", - new Param("ns-name",true)); + super(parent,"role", + new Param("ns-name",true)); } @Override @@ -76,7 +76,7 @@ public class ListUsersInRole extends Cmd { ((ListUsers)parent).report(r.getName()); } Future<Users> fus = client.read( - "/authz/users/role/"+r.getName(), + "/authz/users/role/"+r.getName(), getDF(Users.class) ); if (fus.get(AAFcli.timeout())) { @@ -102,7 +102,7 @@ public class ListUsersInRole extends Cmd { } } else if (fn.code()==404) { return 200; - } else { + } else { error(fn); } return fn.code(); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java index 96ca95ee..cbd21a71 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.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. @@ -49,10 +49,10 @@ import aaf.v2_0.Users.User; */ public class ListUsersWithPerm extends Cmd { private static final String HEADER="List Users of Permissions of Namespace "; - + public ListUsersWithPerm(ListUsers parent) { - super(parent,"perm", - new Param("ns-name",true)); + super(parent,"perm", + new Param("ns-name",true)); } @Override @@ -68,7 +68,7 @@ public class ListUsersWithPerm extends Cmd { if (fn.get(AAFcli.timeout())) { if (fn.value!=null) { Set<String> uset = detail?null:new HashSet<>(); - + for (Ns n : fn.value.getNs()) { Future<Perms> fp = client.read("/authz/perms/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":"") , getDF(Perms.class)); @@ -77,14 +77,14 @@ public class ListUsersWithPerm extends Cmd { String perm = p.getType()+'/'+p.getInstance()+'/'+p.getAction(); if (detail)((ListUsers)parent).report(perm); Future<Users> fus = client.read( - "/authz/users/perm/"+perm, + "/authz/users/perm/"+perm, getDF(Users.class) ); if (fus.get(AAFcli.timeout())) { for (User u : fus.value.getUser()) { if (detail) ((ListUsers)parent).report(" ",u); - else + else uset.add(u.getId()); } } else if (fn.code()==404) { @@ -102,7 +102,7 @@ public class ListUsersWithPerm extends Cmd { } } else if (fn.code()==404) { return 200; - } else { + } else { error(fn); } return fn.code(); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java index 092610c5..505417ec 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/NS.java @@ -9,9 +9,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. @@ -31,7 +31,7 @@ public class NS extends BaseCmd<NS> { public NS(AAFcli aafcli) { super(aafcli, "ns"); - + cmds.add(new Create(this)); cmds.add(new Delete(this)); cmds.add(new Admin(this)); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java index 9ca3d21f..fd43e8da 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.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. @@ -59,18 +59,18 @@ public class Owner extends BaseCmd<NS> { id=fullID(id); String verb; switch(option) { - case 0: + case 0: fp = client.create("/authz/ns/"+ns+"/responsible/"+id,Void.class); verb = " is now "; break; - case 1: + case 1: fp = client.delete("/authz/ns/"+ns+"/responsible/"+id,Void.class); verb = " is no longer "; break; default: throw new CadiException("Bad Argument"); }; - + if (fp.get(AAFcli.timeout())) { pw().append(id); pw().append(verb); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java index be49cf28..559ae070 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.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. @@ -36,14 +36,14 @@ import aaf.v2_0.PermRequest; import aaf.v2_0.RoleRequest; /** - * + * * @author Jonathan * */ public class Create extends Cmd { public Create(Perm parent) { - super(parent,"create", - new Param("type",true), + super(parent,"create", + new Param("type",true), new Param("instance",true), new Param("action", true), new Param("role[,role]* (to Grant to)", false) @@ -56,7 +56,7 @@ public class Create extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { int idx = index; - final PermRequest pr = new PermRequest(); + final PermRequest pr = new PermRequest(); pr.setType(args[idx++]); pr.setInstance(args[idx++]); pr.setAction(args[idx++]); @@ -64,7 +64,7 @@ public class Create extends Cmd { String[] roles = roleCommas==null?null:roleCommas.split("\\s*,\\s*"); boolean force = aafcli.forceString()!=null; int rv; - + if (roles!=null && force) { // Make sure Roles are Created RoleRequest rr = new RoleRequest(); for (String role : roles) { @@ -81,7 +81,7 @@ public class Create extends Cmd { break; case 409: break; - default: + default: pw().println("Role [" + role + "] does not exist, and cannot be created."); return 206 /*HttpStatus.PARTIAL_CONTENT_206*/; } @@ -113,14 +113,14 @@ public class Create extends Cmd { switch(fr.code()){ case 201: case 409:break; - default: - + default: + } } } - + try { - if (201!=(rv=((Perm)parent)._exec(0, + if (201!=(rv=((Perm)parent)._exec(0, new String[] {"grant",pr.getType(),pr.getInstance(),pr.getAction(),roleCommas}))) { rv = 206 /*HttpStatus.PARTIAL_CONTENT_206*/; } @@ -144,7 +144,7 @@ public class Create extends Cmd { } }); } - + @Override public void detailedHelp(int _indent, StringBuilder sb) { int indent = _indent; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java index feffbdb0..fc1f9363 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.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. @@ -41,8 +41,8 @@ import aaf.v2_0.PermRequest; */ public class Delete extends Cmd { public Delete(Perm parent) { - super(parent,"delete", - new Param("type",true), + super(parent,"delete", + new Param("type",true), new Param("instance",true), new Param("action", true)); } @@ -58,7 +58,7 @@ public class Delete extends Cmd { pk.setType(args[idx++]); pk.setInstance(args[idx++]); pk.setAction(args[idx++]); - + if(pk.getType().contains("@")) { // User Perm deletion... Must remove from hidden role client.setQueryParams("force"); } else { @@ -66,7 +66,7 @@ public class Delete extends Cmd { setQueryParamsOn(client); } Future<PermRequest> fp = client.delete( - "/authz/perm", + "/authz/perm", getDF(PermRequest.class), pk); if (fp.get(AAFcli.timeout())) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java index bb894ca7..02c57bd1 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.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. @@ -37,11 +37,11 @@ import aaf.v2_0.PermRequest; public class Describe extends Cmd { private static final String PERM_PATH = "/authz/perm"; public Describe(Perm parent) { - super(parent,"describe", + super(parent,"describe", new Param("type",true), new Param("instance", true), new Param("action", true), - new Param("description",true)); + new Param("description",true)); } @Override @@ -57,16 +57,16 @@ public class Describe extends Cmd { while (idx < args.length) { desc.append(args[idx++] + ' '); } - + PermRequest pr = new PermRequest(); pr.setType(type); pr.setInstance(instance); pr.setAction(action); pr.setDescription(desc.toString()); - + // Set Start/End commands setStartEnd(pr); - + Future<PermRequest> fp = null; int rv; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java index f27a2609..eb206970 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java @@ -9,9 +9,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 aaf.v2_0.Pkey; import aaf.v2_0.RolePermRequest; /** - * + * * @author Jonathan * */ @@ -52,7 +52,7 @@ public class Grant extends Cmd { new Param("instance",true), new Param("action",true), new Param("role[,role]*",false) - ); + ); } @Override @@ -63,7 +63,7 @@ public class Grant extends Cmd { int idx = index; String action = args[idx++]; int option = whichOption(options, action); - + RolePermRequest rpr = new RolePermRequest(); Pkey pk = new Pkey(); pk.setType(args[idx++]); @@ -71,9 +71,9 @@ public class Grant extends Cmd { pk.setAction(args[idx++]); rpr.setPerm(pk); setStartEnd(rpr); - + Future<RolePermRequest> frpr = null; - + String[] roles = args[idx++].split(","); String strA; String strB; @@ -83,7 +83,7 @@ public class Grant extends Cmd { // You can request to Grant Permission to a Role setQueryParamsOn(client); frpr = client.create( - "/authz/role/perm", + "/authz/role/perm", getDF(RolePermRequest.class), rpr ); @@ -93,7 +93,7 @@ public class Grant extends Cmd { // You can request to UnGrant Permission to a Role setQueryParamsOn(client); frpr = client.delete( - "/authz/role/" + role + "/perm", + "/authz/role/" + role + "/perm", getDF(RolePermRequest.class), rpr ); @@ -101,7 +101,7 @@ public class Grant extends Cmd { strB = "] from Role ["; } if (frpr.get(AAFcli.timeout())) { - pw().println(strA + pk.getType() + '|' + pk.getInstance() + '|' + pk.getAction() + pw().println(strA + pk.getType() + '|' + pk.getInstance() + '|' + pk.getAction() + strB + role +']'); } else { if (frpr.code()==202) { @@ -111,7 +111,7 @@ public class Grant extends Cmd { } else { error(frpr); idx=Integer.MAX_VALUE; - } + } } } return frpr==null?0:frpr.code(); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java index 8ff2763a..2af8d45a 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java @@ -9,9 +9,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. @@ -61,7 +61,7 @@ public class List extends BaseCmd<Perm> { // Package Level on purpose abstract class ListPerms extends Retryable<Integer> { protected int list(Future<Perms> fp,String header, String parentPerm) throws CadiException { - if (fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { report(fp,header, parentPerm); } else { error(fp); @@ -69,10 +69,10 @@ public class List extends BaseCmd<Perm> { return fp.code(); } } - + void report(Future<Perms> fp, String ... str) { reportHead(str); - if (this.aafcli.isDetailed()) { + if (this.aafcli.isDetailed()) { String format = "%-36s %-30s %-15s\n"; String descFmt = " %-75s\n"; reportColHead(format + descFmt,"[PERM NS].Type","Instance","Action", "Description"); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java index c96220a5..6400aad3 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.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,9 +40,9 @@ import aaf.v2_0.History; */ public class ListActivity extends Cmd { private static final String HEADER = "List Activity of Permission"; - + public ListActivity(List parent) { - super(parent,"activity", + super(parent,"activity", new Param("type",true)); } @@ -54,7 +54,7 @@ public class ListActivity extends Cmd { int idx = index; String type = args[idx++]; Future<History> fp = client.read( - "/authz/hist/perm/"+type, + "/authz/hist/perm/"+type, getDF(History.class) ); if (fp.get(AAFcli.timeout())) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.java index 7469eed5..e4b0cdb1 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByNS.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. @@ -34,16 +34,16 @@ import aaf.v2_0.Perms; /** * Return Perms by NS - * + * * @author Jeremiah * */ public class ListByNS extends Cmd { private static final String HEADER = "List Perms by NS "; - + public ListByNS(List parent) { - super(parent,"ns", - new Param("name",true)); + super(parent,"ns", + new Param("name",true)); } public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException { @@ -53,14 +53,14 @@ public class ListByNS extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Perms> fp = client.read( - "/authz/perms/ns/"+ns+(aafcli.isDetailed()?"?ns":""), + "/authz/perms/ns/"+ns+(aafcli.isDetailed()?"?ns":""), getDF(Perms.class) ); return list(fp, HEADER, ns); } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.java index 099fb5f8..e13bbede 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByName.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. @@ -33,16 +33,16 @@ import org.onap.aaf.misc.env.APIException; import aaf.v2_0.Perms; /** - * + * * @author Jonathan * */ public class ListByName extends Cmd { private static final String HEADER = "List Child Permissions"; - + public ListByName(List parent) { - super(parent,"name", - new Param("root perm name",true)); + super(parent,"name", + new Param("root perm name",true)); } public int _exec(final int index, final String ... args) throws CadiException, APIException, LocatorException { @@ -50,10 +50,10 @@ public class ListByName extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { String parentPerm=args[index]; - + Future<Perms> fp = client.read( - "/authz/perms/"+parentPerm+(aafcli.isDetailed()?"?ns":""), - getDF(Perms.class) + "/authz/perms/"+parentPerm+(aafcli.isDetailed()?"?ns":""), + getDF(Perms.class) ); return list(fp,HEADER,parentPerm); } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.java index 32b78a6b..294f6ad1 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByRole.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. @@ -34,16 +34,16 @@ import aaf.v2_0.Perms; /** * Return Perms by Role - * + * * @author Jeremiah * */ public class ListByRole extends Cmd { private static final String HEADER = "List Perms by Role "; - + public ListByRole(List parent) { - super(parent,"role", - new Param("name",true)); + super(parent,"role", + new Param("name",true)); } public int _exec(final int idx, final String ... args) throws CadiException, APIException, LocatorException { @@ -54,14 +54,14 @@ public class ListByRole extends Cmd { public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Perms> fp = client.read( - "/authz/perms/role/"+role+(aafcli.isDetailed()?"?ns":""), + "/authz/perms/role/"+role+(aafcli.isDetailed()?"?ns":""), getDF(Perms.class) ); return list(fp, HEADER, role); } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java index 00972a18..6b1fe35e 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.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. @@ -33,20 +33,20 @@ import org.onap.aaf.misc.env.APIException; import aaf.v2_0.Perms; /** - * + * * @author Jonathan * */ public class ListByUser extends Cmd { private static final String HEADER = "List Permissions by User"; public ListByUser(List parent) { - super(parent,"user", - new Param("id",true)); + super(parent,"user", + new Param("id",true)); } public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException { final String user=fullID(args[idx]); - + return same(((List)parent).new ListPerms() { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { @@ -64,14 +64,14 @@ public class ListByUser extends Cmd { sb.append("ns"); } Future<Perms> fp = client.read( - "/authz/perms/user/"+user+(sb==null?"":sb), + "/authz/perms/user/"+user+(sb==null?"":sb), getDF(Perms.class) ); return list(fp,HEADER, user); } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java index 40a07f4e..499ce736 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Perm.java @@ -9,9 +9,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-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java index 5a7b5dee..d868a7c8 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.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. @@ -41,16 +41,16 @@ import aaf.v2_0.PermRequest; public class Rename extends Cmd { public Rename(Perm parent) { - super(parent,"rename", - new Param("type",true), + super(parent,"rename", + new Param("type",true), new Param("instance",true), new Param("action", true), - new Param("new type",true), + new Param("new type",true), new Param("new instance",true), new Param("new action", true) ); } - + @Override public int _exec(final int index, final String ... args) throws CadiException, APIException, LocatorException { return same(new Retryable<Integer>() { @@ -60,13 +60,13 @@ public class Rename extends Cmd { String origType = args[idx++]; String origInstance = args[idx++]; String origAction = args[idx++]; - + //Create new permission PermRequest pr = new PermRequest(); pr.setType(args[idx++]); pr.setInstance(args[idx++]); pr.setAction(args[idx++]); - + // Set Start/End commands setStartEnd(pr); try { @@ -96,9 +96,9 @@ public class Rename extends Cmd { } } }); - + } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,"Rename a Permission from:"); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java index e44185ec..a41256be 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java @@ -9,9 +9,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. @@ -37,7 +37,7 @@ import org.onap.aaf.misc.env.APIException; import aaf.v2_0.RoleRequest; /** - * + * * @author Jonathan * */ @@ -45,9 +45,9 @@ public class CreateDelete extends Cmd { private static final String ROLE_PATH = "/authz/role"; private static final String[] options = {"create","delete"}; public CreateDelete(Role parent) { - super(parent,null, + super(parent,null, new Param(optionsToString(options),true), - new Param("name",true)); + new Param("name",true)); } @Override @@ -58,13 +58,13 @@ public class CreateDelete extends Cmd { int idx = index; String action = args[idx++]; int option = whichOption(options, action); - + RoleRequest rr = new RoleRequest(); rr.setName(args[idx++]); - + // Set Start/End commands setStartEnd(rr); - + Future<RoleRequest> fp = null; String verb = null; int rv; @@ -81,7 +81,7 @@ public class CreateDelete extends Cmd { // Send "Force" if set setQueryParamsOn(client); fp = client.delete( - ROLE_PATH, // +args[idx++], + ROLE_PATH, // +args[idx++], getDF(RoleRequest.class), rr ); @@ -89,11 +89,11 @@ public class CreateDelete extends Cmd { break; default: // note, if not an option, whichOption throws Exception break; - + } boolean rolesSupplied = (args.length>idx); if (fp == null) {// This useless code brought to you by Sonar. - throw new CadiException("No call made."); + throw new CadiException("No call made."); } if (fp.get(AAFcli.timeout())) { rv=fp.code(); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java index f4d24fb1..5341a7ce 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.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. @@ -37,9 +37,9 @@ import aaf.v2_0.RoleRequest; public class Describe extends Cmd { private static final String ROLE_PATH = "/authz/role"; public Describe(Role parent) { - super(parent,"describe", + super(parent,"describe", new Param("name",true), - new Param("description",true)); + new Param("description",true)); } @Override @@ -53,14 +53,14 @@ public class Describe extends Cmd { while (idx < args.length) { desc.append(args[idx++] + ' '); } - + RoleRequest rr = new RoleRequest(); rr.setName(role); rr.setDescription(desc.toString()); - + // Set Start/End commands setStartEnd(rr); - + Future<RoleRequest> fp = null; int rv; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java index 37d328bd..2e3d1757 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java @@ -9,9 +9,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. @@ -59,7 +59,7 @@ public class List extends BaseCmd<Role> { cmds.add(new ListByPerm(this)); cmds.add(new ListActivity(this)); } - + // Package Level on purpose abstract class ListRoles extends Retryable<Integer> { protected int list(Future<Roles> fr,Rcli<?> client, String header) throws APIException, CadiException { @@ -68,7 +68,7 @@ public class List extends BaseCmd<Role> { if (aafcli.isDetailed()) { for (aaf.v2_0.Role r : fr.value.getRole()) { Future<Perms> fp = client.read( - "/authz/perms/role/"+r.getName()+(aafcli.isDetailed()?"?ns":""), + "/authz/perms/role/"+r.getName()+(aafcli.isDetailed()?"?ns":""), getDF(Perms.class) ); if (fp.get(AAFcli.timeout())) { @@ -93,7 +93,7 @@ public class List extends BaseCmd<Role> { private static final String roleExpiredFormat = "%-53s !!! EXPIRED !!! %s\n"; private static final String permFormat = " %-30s %-30s %-15s\n"; - + private static final Comparator<aaf.v2_0.Role> roleCompare = new Comparator<aaf.v2_0.Role>() { @Override public int compare(aaf.v2_0.Role a, aaf.v2_0.Role b) { @@ -152,13 +152,13 @@ public class List extends BaseCmd<Role> { for (Pkey pkey : r.getPerms()) { Perm perm = get(pkey,perms); if (perm==null || perm.getNs()==null) { - pw().format(permFormat, + pw().format(permFormat, pkey.getType(), pkey.getInstance(), pkey.getAction()); } else { String ns1 = perm.getNs(); - pw().format(permFormat, + pw().format(permFormat, '['+ns1+"]"+perm.getType().substring(ns1.length()), perm.getInstance(), perm.getAction()); @@ -185,7 +185,7 @@ public class List extends BaseCmd<Role> { } else { pw().format(roleFormatNoDate, r.getName()); for (Pkey perm : r.getPerms()) { - pw().format(permFormat, + pw().format(permFormat, perm.getType(), perm.getInstance(), perm.getAction()); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java index 603ec33b..b6a8a0da 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.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. @@ -42,7 +42,7 @@ public class ListActivity extends Cmd { private static final String HEADER = "List Activity of Role"; public ListActivity(List parent) { - super(parent,"activity", + super(parent,"activity", new Param("name",true)); } @@ -54,7 +54,7 @@ public class ListActivity extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<History> fp = client.read( - "/authz/hist/role/"+role, + "/authz/hist/role/"+role, getDF(History.class) ); if (fp.get(AAFcli.timeout())) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.java index 361676a4..02a34f78 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNS.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. @@ -34,16 +34,16 @@ import aaf.v2_0.Roles; /** * Return Roles by NS - * + * * @author Jonathan * */ public class ListByNS extends Cmd { private static final String HEADER = "List Roles by NS "; - + public ListByNS(List parent) { - super(parent,"ns", - new Param("name",true)); + super(parent,"ns", + new Param("name",true)); } @Override @@ -54,14 +54,14 @@ public class ListByNS extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Roles> fp = client.read( - "/authz/roles/ns/"+ns+(aafcli.isDetailed()?"?ns":""), + "/authz/roles/ns/"+ns+(aafcli.isDetailed()?"?ns":""), getDF(Roles.class) ); return list(fp,client, HEADER+"["+ns+"]"); } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.java index 4d77c460..6e5a5622 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByNameOnly.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. @@ -34,16 +34,16 @@ import aaf.v2_0.Roles; /** * Return Roles by NS - * + * * @author Jonathan * */ public class ListByNameOnly extends Cmd { private static final String HEADER = "List Roles by Name "; - + public ListByNameOnly(List parent) { - super(parent,"name", - new Param("name",true)); + super(parent,"name", + new Param("name",true)); } @Override @@ -54,14 +54,14 @@ public class ListByNameOnly extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Roles> fp = client.read( - "/authz/roles/name/"+name+(aafcli.isDetailed()?"?ns":""), + "/authz/roles/name/"+name+(aafcli.isDetailed()?"?ns":""), getDF(Roles.class) ); return list(fp,client, HEADER+"["+name+"]"); } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java index 5d291ace..3d3e5e41 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java @@ -8,9 +8,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,18 +39,18 @@ import aaf.v2_0.Roles; /** * Return Roles by NS - * + * * @author Jonathan * */ public class ListByPerm extends Cmd { private static final String HEADER = "List Roles by Perm "; - + public ListByPerm(List parent) { - super(parent,"perm", + super(parent,"perm", new Param("type",true), new Param("instance", true), - new Param("action", true)); + new Param("action", true)); } @Override @@ -59,15 +59,15 @@ public class ListByPerm extends Cmd { final String type=args[idx]; final String instance=args[++idx]; final String action = args[++idx]; - + return same(((List)parent).new ListRoles() { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { try { Future<Roles> fp = client.read( - "/authz/roles/perm/"+type+'/' + + "/authz/roles/perm/"+type+'/' + URLEncoder.encode(instance,Config.UTF_8)+'/'+ - action, + action, getDF(Roles.class) ); return list(fp,client, HEADER+type+'|'+instance+'|'+action); @@ -77,7 +77,7 @@ public class ListByPerm extends Cmd { } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.java index 761df695..6520140f 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByRole.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. @@ -33,16 +33,16 @@ import org.onap.aaf.misc.env.APIException; import aaf.v2_0.Roles; /** - * + * * @author Jonathan * */ public class ListByRole extends Cmd { private static final String HEADER="List Roles for Role"; - + public ListByRole(List parent) { - super(parent,"role", - new Param("role",true)); + super(parent,"role", + new Param("role",true)); } @Override @@ -50,16 +50,16 @@ public class ListByRole extends Cmd { return same(((List)parent).new ListRoles() { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { - String role=args[idx]; + String role=args[idx]; Future<Roles> fp = client.read( - "/authz/roles/"+role+(aafcli.isDetailed()?"?ns":""), - getDF(Roles.class) + "/authz/roles/"+role+(aafcli.isDetailed()?"?ns":""), + getDF(Roles.class) ); return list(fp,client,HEADER+"["+role+"]"); } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java index 8111fedc..9657721a 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.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. @@ -50,17 +50,17 @@ import aaf.v2_0.UserRoles; */ public class ListByUser extends Cmd { private static final String HEADER = "List Roles for User "; - + public ListByUser(List parent) { - super(parent,"user", + super(parent,"user", new Param("id",true), - new Param("detail", false)); + new Param("detail", false)); } @Override public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException { final String user=fullID(args[idx]); - + return same(new Retryable<Integer>() { @Override @@ -84,7 +84,7 @@ public class ListByUser extends Cmd { if (aafcli.isDetailed()) { roles = new Roles(); Future<Perms> fp = client.read( - "/authz/perms/user/"+user+"?ns&force", + "/authz/perms/user/"+user+"?ns&force", getDF(Perms.class) ); if (fp.get(AAFcli.timeout())) { @@ -108,7 +108,7 @@ public class ListByUser extends Cmd { r.getPerms().add(p); } } - } + } code = fp.code(); } else { roles = new Roles(); @@ -120,14 +120,14 @@ public class ListByUser extends Cmd { lr.add(r); } } - - + + ((List)parent).report(roles,perms,urs,HEADER,user); return code; } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,HEADER); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java index c49df031..b06bc5e5 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Role.java @@ -9,9 +9,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-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java index 45361a3f..4641ade7 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.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. @@ -42,10 +42,10 @@ import aaf.v2_0.UserRoleRequest; public class User extends Cmd { private final static String[] options = {"add","del","extend"}; public User(Role parent) { - super(parent,"user", + super(parent,"user", new Param(optionsToString(options),true), new Param("role",true), - new Param("id[,id]*",false)); + new Param("id[,id]*",false)); } @Override @@ -60,9 +60,9 @@ public class User extends Cmd { urr.setRole(args[idx++]); // Set Start/End commands setStartEnd(urr); - + Future<?> fp = null; - + String[] ids = args[idx++].split(","); String verb=null,participle=null; // You can request to be added or removed from role. @@ -74,15 +74,15 @@ public class User extends Cmd { switch(option) { case 0: fp = client.create( - "/authz/userRole", - getDF(UserRoleRequest.class), + "/authz/userRole", + getDF(UserRoleRequest.class), urr); verb = "Added"; participle = "] to Role [" ; break; case 1: fp = client.delete( - "/authz/userRole/"+urr.getUser()+'/'+urr.getRole(), + "/authz/userRole/"+urr.getUser()+'/'+urr.getRole(), Void.class); verb = "Removed"; participle = "] from Role [" ; @@ -124,7 +124,7 @@ public class User extends Cmd { } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { detailLine(sb,indent,"Add OR Delete a User to/from a Role OR extend Expiration"); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java index 1613b2f9..1a410088 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java @@ -9,9 +9,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. @@ -72,7 +72,7 @@ public class Cred extends Cmd { if (args.length>idx) { cr.setEntry(args[idx]); } - + // Set Start/End commands setStartEnd(cr); Integer ret = same(new Retryable<Integer>() { @@ -83,8 +83,8 @@ public class Cred extends Cmd { switch(option) { case 0: fp = client.create( - CRED_PATH, - getDF(CredRequest.class), + CRED_PATH, + getDF(CredRequest.class), cr ); verb = "Added Credential ["; @@ -129,7 +129,7 @@ public class Cred extends Cmd { Error err = em.getError(fp); String text = err.getText(); List<String> vars = err.getVariables(); - + // IMPORTANT! We do this backward, because it is looking for string // %1 or %13. If we replace %1 first, that messes up %13 for(int i=vars.size()-1;i>0;--i) { @@ -153,7 +153,7 @@ public class Cred extends Cmd { } return ret; } - + @Override public void detailedHelp(int indentVar, StringBuilder sb) { int indent = indentVar; @@ -169,7 +169,7 @@ public class Cred extends Cmd { sb.append('\n'); detailLine(sb,indent,"NOTE: AAF does support multiple creds with the same ID. Check with your org if you"); detailLine(sb,indent+2,"have this implemented. (For example, this is implemented for MechIDs at AT&T)"); - sb.append('\n'); + sb.append('\n'); detailLine(sb,indent,"*NOTE: com.att.csp is a reserved Domain for Global Sign On"); detailLine(sb,indent,"Delegates can be listed by the User or by the Delegate"); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java index 3d226f7e..f5cb4499 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java @@ -9,9 +9,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. @@ -62,7 +62,7 @@ public class Delg extends BaseCmd<User> { int idx = index; DelgRequest dr = new DelgRequest(); setStartEnd(dr); - + int option= whichOption(options, args[idx++]); String user = fullID(args[idx++]); dr.setUser(user); @@ -79,29 +79,29 @@ public class Delg extends BaseCmd<User> { dr.setEnd(Chrono.timeStamp(date)); } } - + Future<DelgRequest> fp; RosettaDF<DelgRequest> df = getDF(DelgRequest.class); String verb; setQueryParamsOn(client); switch(option) { - case 0: + case 0: fp = client.create(AUTHZ_DELG, df, dr); verb = "Added"; break; - case 1: - fp = client.update(AUTHZ_DELG, df, dr); + case 1: + fp = client.update(AUTHZ_DELG, df, dr); verb = "Updated"; break; - case 2: - fp = client.delete(AUTHZ_DELG, df, dr); + case 2: + fp = client.delete(AUTHZ_DELG, df, dr); verb = "Deleted"; break; default: throw new CadiException("Bad Argument"); }; - + if (fp.get(AAFcli.timeout())) { pw().append("Delegate "); pw().println(verb); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java index 71d61f79..2c88e9fe 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.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. @@ -45,7 +45,7 @@ public class ID extends Cmd { } @Override - public int _exec(int _idx, final String ... args) throws CadiException, APIException, LocatorException { + public int _exec(int _idx, final String ... args) throws CadiException, APIException, LocatorException { int idx = _idx; String key = args[idx++]; final int option = whichOption(options,key); @@ -55,7 +55,7 @@ public class ID extends Cmd { cr.setType(10); if (args.length>idx) cr.setEntry(args[idx]); - + // Set Start/End commands setStartEnd(cr); Integer ret = same(new Retryable<Integer>() { @@ -66,8 +66,8 @@ public class ID extends Cmd { switch(option) { case 0: fp = client.create( - CRED_PATH, - getDF(CredRequest.class), + CRED_PATH, + getDF(CredRequest.class), cr ); verb = "Added ID ["; @@ -105,7 +105,7 @@ public class ID extends Cmd { if (ret==null)ret = -1; return ret; } - + @Override public void detailedHelp(int _indent, StringBuilder sb) { int indent = _indent; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java index 212df8ab..b3011369 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.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. @@ -45,7 +45,7 @@ public class List extends BaseCmd<User> { cmds.add(new ListActivity(this)); } - + void report(Users users, boolean count, String ... str) { reportHead(str); java.util.List<aaf.v2_0.Users.User> sorted = users.getUser(); @@ -68,7 +68,7 @@ public class List extends BaseCmd<User> { } else if(type!=null && type>=200) { tag = "\n\tfingerprint: " + tag; } - pw().format(format, + pw().format(format, user.getId(), org.onap.aaf.auth.cmd.ns.List.getType(user), date, @@ -107,9 +107,9 @@ public class List extends BaseCmd<User> { String format = reportColHead(" %-25s %-25s %-10s\n","User","Delegate","Expires"); String date = "XXXX-XX-XX"; for (Delg delg : delgs.getDelgs()) { - if (!this.aafcli.isTest()) + if (!this.aafcli.isTest()) date = Chrono.dateOnlyStamp(delg.getExpires()); - pw().printf(format, + pw().printf(format, delg.getUser(), delg.getDelegate(), date diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java index 162dadac..30c71e55 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.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. @@ -42,7 +42,7 @@ public class ListActivity extends Cmd { private static final String HEADER = "List Activity of User"; public ListActivity(List parent) { - super(parent,"activity", + super(parent,"activity", new Param("user",true)); } @@ -53,9 +53,9 @@ public class ListActivity extends Cmd { return same(new Retryable<Integer>() { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { - + Future<History> fp = client.read( - "/authz/hist/user/"+user, + "/authz/hist/user/"+user, getDF(History.class) ); if (fp.get(AAFcli.timeout())) { @@ -67,7 +67,7 @@ public class ListActivity extends Cmd { } }); } - + @Override public void detailedHelp(int indent, StringBuilder sb) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java index 068aacb1..828cdcbf 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.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. @@ -35,17 +35,17 @@ import org.onap.aaf.misc.env.APIException; import aaf.v2_0.Approvals; /** - * + * * @author Jonathan * */ public class ListApprovals extends Cmd { - private static final String HEADER = "List Approvals"; + private static final String HEADER = "List Approvals"; private final static String[] options = {"user","approver","ticket"}; public ListApprovals(List parent) { - super(parent,"approvals", + super(parent,"approvals", new Param(optionsToString(options),true), - new Param("value",true)); + new Param("value",true)); } @Override @@ -64,7 +64,7 @@ public class ListApprovals extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Approvals> fp = client.read( - "/authz/approval/"+type+'/'+fullValue, + "/authz/approval/"+type+'/'+fullValue, getDF(Approvals.class) ); if (fp.get(AAFcli.timeout())) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java index 28b5c9e7..788f1c77 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.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,10 +39,10 @@ import aaf.v2_0.Delgs; * */ public class ListDelegates extends Cmd { - private static final String HEADER = "List Delegates"; + private static final String HEADER = "List Delegates"; private static final String[] options = {"user","delegate"}; public ListDelegates(List parent) { - super(parent,"delegates", + super(parent,"delegates", new Param(optionsToString(options),true), new Param("id",true)); } @@ -56,9 +56,9 @@ public class ListDelegates extends Cmd { return same(new Retryable<Integer>() { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { - + Future<Delgs> fp = client.read( - "/authz/delegates/" + key + '/' + id, + "/authz/delegates/" + key + '/' + id, getDF(Delgs.class) ); if (fp.get(AAFcli.timeout())) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java index 176787ea..07a19d36 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java @@ -9,9 +9,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. @@ -52,7 +52,7 @@ public class ListForCreds extends Cmd { public ListForCreds(List parent) { super(parent,"cred", new Param(optionsToString(options),true), - new Param("value",true)); + new Param("value",true)); } @Override @@ -65,7 +65,7 @@ public class ListForCreds extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Users> fp = client.read( - "/authn/creds/"+which+'/'+value, + "/authn/creds/"+which+'/'+value, getDF(Users.class) ); if (fp.get(AAFcli.timeout())) { @@ -74,7 +74,7 @@ public class ListForCreds extends Cmd { @Override public int compare(User u1, User u2) { return u1.getId().compareTo(u2.getId()); - } + } }); ((org.onap.aaf.auth.cmd.user.List)parent).report(fp.value,option==1,HEADER+which,value); if (fp.code()==404) { @@ -87,7 +87,7 @@ public class ListForCreds extends Cmd { } }); } - + @Override public void detailedHelp(int indentParam, StringBuilder sb) { int indent = indentParam; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java index b40c96ce..0ab24900 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.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. @@ -49,10 +49,10 @@ import aaf.v2_0.Users.User; public class ListForPermission extends Cmd { private static final String HEADER = "List Users for Permission"; public ListForPermission(List parent) { - super(parent,"perm", + super(parent,"perm", new Param("type",true), new Param("instance",true), - new Param("action",true)); + new Param("action",true)); } @Override @@ -68,10 +68,10 @@ public class ListForPermission extends Cmd { if ("\\*".equals(action))action="*"; try { Future<Users> fp = client.read( - "/authz/users/perm/" + + "/authz/users/perm/" + type + '/' + - URLEncoder.encode(instance,Config.UTF_8) + '/' + - action, + URLEncoder.encode(instance,Config.UTF_8) + '/' + + action, getDF(Users.class) ); if (fp.get(AAFcli.timeout())) { @@ -89,7 +89,7 @@ public class ListForPermission extends Cmd { } }); } - + @Override public void detailedHelp(int _indent, StringBuilder sb) { int indent = _indent; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java index 4e539ac2..6fdf1628 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.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. @@ -42,7 +42,7 @@ import aaf.v2_0.Users; public class ListForRoles extends Cmd { private static final String HEADER = "List Users for Role"; public ListForRoles(List parent) { - super(parent,"role", new Param("role",true)); + super(parent,"role", new Param("role",true)); } @Override @@ -53,7 +53,7 @@ public class ListForRoles extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Users> fp = client.read( - "/authz/users/role/"+role, + "/authz/users/role/"+role, getDF(Users.class) ); if (fp.get(AAFcli.timeout())) { @@ -66,7 +66,7 @@ public class ListForRoles extends Cmd { } }); } - + @Override public void detailedHelp(int _indent, StringBuilder sb) { int indent = _indent; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java index b177778e..4261df67 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.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. @@ -36,7 +36,7 @@ import aaf.v2_0.UserRoleRequest; /** * p - * + * * @author Jonathan * */ @@ -65,7 +65,7 @@ public class Role extends Cmd { Future<?> fp = null; if (args.length < 5) { - throw new CadiException(build(new StringBuilder("Too few args: "), null).toString()); + throw new CadiException(build(new StringBuilder("Too few args: "), null).toString()); } String[] roles = args[idx++].split(","); for (String role : roles) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.java index 746f9c22..7176cbef 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/User.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. |