public static AclStatus getAclStatus()

in src/main/java/com/microsoft/azure/datalake/store/Core.java [1392:1458]


    public static AclStatus getAclStatus(String path,
                                         UserGroupRepresentation oidOrUpn,
                                         ADLStoreClient client,
                                         RequestOptions opts,
                                         OperationResponse resp) {
        QueryParams qp = new QueryParams();

        if (oidOrUpn == null) oidOrUpn = UserGroupRepresentation.OID;
        String tooid = (oidOrUpn == UserGroupRepresentation.OID)? "true" : "false";
        qp.add("tooid", tooid);

        HttpTransport.makeCall(client, Operation.GETACLSTATUS, path, qp, null, 0, 0, opts, resp);

        if (resp.successful) {
            AclStatus status = new AclStatus();
            ArrayList<AclEntry> list = new ArrayList<AclEntry>();
            status.aclSpec = list;
            try {
                JsonFactory jf = new JsonFactory();
                JsonParser jp = jf.createParser(resp.responseStream);
                String fieldName, fieldValue;

                jp.nextToken();  // START_OBJECT - {
                jp.nextToken();  // FIELD_NAME - "AclStatus":
                jp.nextToken();  // START_OBJECT - {
                jp.nextToken();
                while (jp.hasCurrentToken()) {
                    if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
                        fieldName = jp.getCurrentName();
                        if (fieldName.equals("entries")) {
                            jp.nextToken();  // START_ARRAY - [
                            jp.nextToken();
                            while (jp.hasCurrentToken() && jp.getCurrentToken() != JsonToken.END_ARRAY) {
                                String aclEntryString = jp.getText();
                                AclEntry aclEntry = AclEntry.parseAclEntry(aclEntryString);
                                list.add(aclEntry);
                                jp.nextToken();
                            }
                            jp.nextToken();  // current token is END_ARRAY, go to next token to continue with loop
                            continue;
                        }
                        jp.nextToken();  // get the value of the field
                        fieldValue = jp.getText();
                        if (fieldName.equals("group")) status.group = fieldValue;
                        if (fieldName.equals("owner")) status.owner = fieldValue;
                        if (fieldName.equals("permission")) status.octalPermissions = fieldValue;
                        if (fieldName.equals("stickyBit")) status.stickyBit = Boolean.valueOf(fieldValue);
                    }
                    jp.nextToken();
                }
                jp.close();
                return status;
            } catch (IOException ex) {
                resp.successful = false;
                resp.message = "Unexpected error happened reading response stream or parsing JSon from getAclStatus";
                return null;
            } finally {
                try {
                    resp.responseStream.close();
                } catch (IOException ex) {
                    //swallow since it is only the closing of the stream
                }
            }
        } else {
            return null;
        }
    }