|
@@ -32,6 +32,7 @@ import com.microsoft.azure.datalake.store.DirectoryEntry;
|
|
|
import com.microsoft.azure.datalake.store.DirectoryEntryType;
|
|
|
import com.microsoft.azure.datalake.store.IfExists;
|
|
|
import com.microsoft.azure.datalake.store.LatencyTracker;
|
|
|
+import com.microsoft.azure.datalake.store.UserGroupRepresentation;
|
|
|
import com.microsoft.azure.datalake.store.oauth2.AccessTokenProvider;
|
|
|
import com.microsoft.azure.datalake.store.oauth2.ClientCredsTokenProvider;
|
|
|
import com.microsoft.azure.datalake.store.oauth2.RefreshTokenBasedTokenProvider;
|
|
@@ -80,6 +81,8 @@ public class AdlFileSystem extends FileSystem {
|
|
|
private ADLStoreClient adlClient;
|
|
|
private Path workingDirectory;
|
|
|
private boolean aclBitStatus;
|
|
|
+ private UserGroupRepresentation oidOrUpn;
|
|
|
+
|
|
|
|
|
|
// retained for tests
|
|
|
private AccessTokenProvider tokenProvider;
|
|
@@ -181,6 +184,11 @@ public class AdlFileSystem extends FileSystem {
|
|
|
if (!trackLatency) {
|
|
|
LatencyTracker.disable();
|
|
|
}
|
|
|
+
|
|
|
+ boolean enableUPN = conf.getBoolean(ADL_ENABLEUPN_FOR_OWNERGROUP_KEY,
|
|
|
+ ADL_ENABLEUPN_FOR_OWNERGROUP_DEFAULT);
|
|
|
+ oidOrUpn = enableUPN ? UserGroupRepresentation.UPN :
|
|
|
+ UserGroupRepresentation.OID;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -439,7 +447,8 @@ public class AdlFileSystem extends FileSystem {
|
|
|
@Override
|
|
|
public FileStatus getFileStatus(final Path f) throws IOException {
|
|
|
statistics.incrementReadOps(1);
|
|
|
- DirectoryEntry entry = adlClient.getDirectoryEntry(toRelativeFilePath(f));
|
|
|
+ DirectoryEntry entry =
|
|
|
+ adlClient.getDirectoryEntry(toRelativeFilePath(f), oidOrUpn);
|
|
|
return toFileStatus(entry, f);
|
|
|
}
|
|
|
|
|
@@ -456,7 +465,7 @@ public class AdlFileSystem extends FileSystem {
|
|
|
public FileStatus[] listStatus(final Path f) throws IOException {
|
|
|
statistics.incrementReadOps(1);
|
|
|
List<DirectoryEntry> entries =
|
|
|
- adlClient.enumerateDirectory(toRelativeFilePath(f));
|
|
|
+ adlClient.enumerateDirectory(toRelativeFilePath(f), oidOrUpn);
|
|
|
return toFileStatuses(entries, f);
|
|
|
}
|
|
|
|
|
@@ -749,8 +758,8 @@ public class AdlFileSystem extends FileSystem {
|
|
|
@Override
|
|
|
public AclStatus getAclStatus(final Path path) throws IOException {
|
|
|
statistics.incrementReadOps(1);
|
|
|
- com.microsoft.azure.datalake.store.acl.AclStatus adlStatus = adlClient
|
|
|
- .getAclStatus(toRelativeFilePath(path));
|
|
|
+ com.microsoft.azure.datalake.store.acl.AclStatus adlStatus =
|
|
|
+ adlClient.getAclStatus(toRelativeFilePath(path), oidOrUpn);
|
|
|
AclStatus.Builder aclStatusBuilder = new AclStatus.Builder();
|
|
|
aclStatusBuilder.owner(adlStatus.owner);
|
|
|
aclStatusBuilder.group(adlStatus.group);
|
|
@@ -963,4 +972,10 @@ public class AdlFileSystem extends FileSystem {
|
|
|
}
|
|
|
return new String(passchars);
|
|
|
}
|
|
|
+
|
|
|
+ @VisibleForTesting
|
|
|
+ public void setUserGroupRepresentationAsUPN(boolean enableUPN) {
|
|
|
+ oidOrUpn = enableUPN ? UserGroupRepresentation.UPN :
|
|
|
+ UserGroupRepresentation.OID;
|
|
|
+ }
|
|
|
}
|