Example usage for org.apache.hadoop.fs.permission AclEntry.Builder AclEntry.Builder

List of usage examples for org.apache.hadoop.fs.permission AclEntry.Builder AclEntry.Builder

Introduction

In this page you can find the example usage for org.apache.hadoop.fs.permission AclEntry.Builder AclEntry.Builder.

Prototype

AclEntry.Builder

Source Link

Usage

From source file:org.apache.sentry.hdfs.SentryINodeAttributesProvider.java

License:Apache License

private static void addToACLMap(Map<String, AclEntry> map, Collection<AclEntry> entries) {
    for (AclEntry ent : entries) {
        String key = (ent.getName() == null ? "" : ent.getName()) + ent.getScope() + ent.getType();
        AclEntry aclEntry = map.get(key);
        if (aclEntry == null) {
            map.put(key, ent);//w  ww.ja  v  a2 s .  c  o  m
        } else {
            map.put(key,
                    new AclEntry.Builder().setName(ent.getName()).setScope(ent.getScope())
                            .setType(ent.getType())
                            .setPermission(ent.getPermission().or(aclEntry.getPermission())).build());
        }
    }
}

From source file:org.apache.sentry.hdfs.SentryINodeAttributesProvider.java

License:Apache License

private static List<AclEntry> createAclEntries(String user, String group, FsPermission permission) {
    List<AclEntry> list = new ArrayList<AclEntry>();
    AclEntry.Builder builder = new AclEntry.Builder();
    FsPermission fsPerm = new FsPermission(permission);
    builder.setName(user);/*from w  w  w.j a va 2 s  .  co m*/
    builder.setType(AclEntryType.USER);
    builder.setScope(AclEntryScope.ACCESS);
    builder.setPermission(fsPerm.getUserAction());
    list.add(builder.build());
    builder.setName(group);
    builder.setType(AclEntryType.GROUP);
    builder.setScope(AclEntryScope.ACCESS);
    builder.setPermission(fsPerm.getGroupAction());
    list.add(builder.build());
    builder.setName(null);
    return list;
}

From source file:org.trustedanalytics.servicebroker.hdfs.plans.provisioning.HdfsProvisioningClient.java

License:Apache License

@Override
public void addTapUserAcl(String path, String orgId) throws ServiceBrokerException {
    try {//w ww  .  j a  v  a2s.c om
        AclEntry.Builder builder = new AclEntry.Builder().setType(AclEntryType.USER).setPermission(FsAction.ALL)
                .setName("tap");

        AclEntry tapDefaultUserAcl = builder.setScope(AclEntryScope.DEFAULT).build();
        AclEntry tapUserAcl = builder.setScope(AclEntryScope.ACCESS).build();

        setAclRecursively(path, tapUserAcl);
        setAclRecursively(path, tapDefaultUserAcl);
    } catch (IOException e) {
        throw new ServiceBrokerException("Unable to add system users groups ACL for path: " + path, e);
    }
}

From source file:org.trustedanalytics.servicebroker.hdfs.plans.provisioning.HdfsProvisioningClient.java

License:Apache License

@Override
public void addHiveUserGroupAcl(String path, String orgId) throws ServiceBrokerException {
    try {//  w w w.  ja  va2 s  .c  om
        AclEntry.Builder builder = new AclEntry.Builder().setType(AclEntryType.GROUP)
                .setPermission(FsAction.ALL).setName("hive");

        AclEntry hiveDefaultUserAcl = builder.setScope(AclEntryScope.DEFAULT).build();
        AclEntry hiveUserAcl = builder.setScope(AclEntryScope.ACCESS).build();

        setAclRecursively(path, hiveUserAcl);
        setAclRecursively(path, hiveDefaultUserAcl);
    } catch (IOException e) {
        throw new ServiceBrokerException("Unable to add system users groups ACL for path: " + path, e);
    }
}