* 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.
*/
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));
}
@Override
- public int _exec(int _idx, final String ... args) throws CadiException, APIException, LocatorException {
- int idx = _idx;
+ public int _exec(int idxValue, final String ... args) throws CadiException, APIException, LocatorException {
+ int idx = idxValue;
final String ns=args[idx++];
return same(new Retryable<Integer>() {
@Override
public Integer code(Rcli<?> client) throws CadiException, APIException {
Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class));
- if(fn.get(AAFcli.timeout())) {
+ if (fn.get(AAFcli.timeout())) {
((List)parent).report(fn,HEADER,ns);
- if(fn.value!=null) {
- for(Ns n : fn.value.getNs()) {
+ if (fn.value!=null) {
+ for (Ns n : fn.value.getNs()) {
Future<Roles> fr = client.read("/authz/roles/ns/"+n.getName(), getDF(Roles.class));
- if(fr.get(AAFcli.timeout())) {
+ if (fr.get(AAFcli.timeout())) {
((List)parent).reportRole(fr);
}
}
- for(Ns n : fn.value.getNs()) {
+ for (Ns n : fn.value.getNs()) {
Future<Perms> fp = client.read("/authz/perms/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":""), getDF(Perms.class));
- if(fp.get(AAFcli.timeout())) {
+ if (fp.get(AAFcli.timeout())) {
((List)parent).reportPerm(fp);
}
}
- for(Ns n : fn.value.getNs()) {
+ for (Ns n : fn.value.getNs()) {
Future<Users> fu = client.read("/authn/creds/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":""), getDF(Users.class));
- if(fu.get(AAFcli.timeout())) {
+ if (fu.get(AAFcli.timeout())) {
((List)parent).reportCred(fu);
}
}
}
- } else if(fn.code()==404) {
+ } else if (fn.code()==404) {
((List)parent).report(null,HEADER,ns);
return 200;
- } else {
+ } else {
error(fn);
}
return fn.code();