Yair Zaslavsky has posted comments on this change. Change subject: aaa: using the new extensions API in InternalDirectory ......................................................................
Patch Set 4: (8 comments) http://gerrit.ovirt.org/#/c/26477/4/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/internal/InternalDirectory.java File backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/internal/InternalDirectory.java: Line 23: private ExtMap context; Line 24: Line 25: private ExtMap adminUser; Line 26: Line 27: private Opaque opaque; > you should not store it. Done Line 28: Line 29: private static class Opaque { Line 30: public boolean isFirstCall() { Line 31: return firstCall; Line 25: private ExtMap adminUser; Line 26: Line 27: private Opaque opaque; Line 28: Line 29: private static class Opaque { > this is private... you can use data only :) Done Line 30: public boolean isFirstCall() { Line 31: return firstCall; Line 32: } Line 33: Line 50: Line 51: @Override Line 52: public void invoke(ExtMap input, ExtMap output) { Line 53: try { Line 54: ExtUUID commandType = input.<ExtUUID> get(Base.InvokeKeys.COMMAND); > why commandType? what's wrong with the same term of command? Done Line 55: if (commandType.equals(Base.InvokeCommands.INITIALIZE)) { Line 56: doInit(input, output); Line 57: } else if (commandType.equals(Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD)) { Line 58: doFetchPrincipalRecord(input, output); Line 62: fillOpaque(output, commandType); Line 63: } else if (commandType.equals(Authz.InvokeCommands.QUERY_PRINCIPALS_OPEN)) { Line 64: fillOpaque(output, commandType); Line 65: } else if (commandType.equals(Authz.InvokeCommands.QUERY_GROUPS_BY_IDS_OPEN)) { Line 66: fillOpaque(output, commandType); > why not: Done Line 67: } else if (commandType.equals(Authz.InvokeCommands.QUERY_EXECUTE)) { Line 68: doQueryExecute(input, output); Line 69: } else { Line 70: output.put(Base.InvokeKeys.COMMAND, Base.InvokeResult.UNSUPPORTED); Line 67: } else if (commandType.equals(Authz.InvokeCommands.QUERY_EXECUTE)) { Line 68: doQueryExecute(input, output); Line 69: } else { Line 70: output.put(Base.InvokeKeys.COMMAND, Base.InvokeResult.UNSUPPORTED); Line 71: } > same here about result, best to handle it at one place. Done Line 72: } catch (Exception ex) { Line 73: output.mput( Line 74: Base.InvokeKeys.RESULT, Base.InvokeResult.FAILED Line 75: ).mput( Line 79: } Line 80: Line 81: Line 82: private void doQueryExecute(ExtMap input, ExtMap output) { Line 83: opaque = input.<Opaque> get(Authz.InvokeKeys.QUERY_OPAQUE); > you should not store it as member. Done Line 84: ExtUUID queryType = opaque.getQueryType(); Line 85: boolean firstCall = opaque.isFirstCall(); Line 86: if (queryType.equals(InvokeCommands.QUERY_PRINCIPALS_BY_IDS_OPEN) || queryType.equals(InvokeCommands.QUERY_PRINCIPALS_OPEN)) { Line 87: List<ExtMap> users = null; Line 81: Line 82: private void doQueryExecute(ExtMap input, ExtMap output) { Line 83: opaque = input.<Opaque> get(Authz.InvokeKeys.QUERY_OPAQUE); Line 84: ExtUUID queryType = opaque.getQueryType(); Line 85: boolean firstCall = opaque.isFirstCall(); > no need for temp variables... Done Line 86: if (queryType.equals(InvokeCommands.QUERY_PRINCIPALS_BY_IDS_OPEN) || queryType.equals(InvokeCommands.QUERY_PRINCIPALS_OPEN)) { Line 87: List<ExtMap> users = null; Line 88: // Since there is a single user in the directory, execute Line 89: if (firstCall) { Line 127: output.mput( Line 128: Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS Line 129: ).mput( Line 130: Authz.InvokeKeys.Status, Authz.Status.SUCCESS Line 131: ); > you can always put success in invoke. also the result should be handled at Done Line 132: } Line 133: -- To view, visit http://gerrit.ovirt.org/26477 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I958443292da0455e0a12039fac98eebb9b17dee2 Gerrit-PatchSet: 4 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches