public class Core extends Object
The methods in this class tend to be lower-level, exposing all the details of the underlying operation.
To call the methods, instantiate a RequestOptions
object first. Assign any of the
member values as needed (e.g., the RetryPolicy). Then create a new OperationResponse
object. The
OperationResponse
is used for passing the call results and stats back from the call.
Failures originating in Core methods are communicated back through the OperationResponse
parameter.
Thread Safety: all static methods in this class are thread-safe
Modifier and Type | Method and Description |
---|---|
static void |
append(String path,
long offsetToAppendTo,
byte[] contents,
int offsetWithinContentsArray,
int length,
String leaseId,
String sessionId,
SyncFlag syncFlag,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
append bytes to an existing file created with
create(String, boolean, String, byte[], int, int, String, String, boolean, SyncFlag, ADLStoreClient, RequestOptions, OperationResponse) (String, boolean, String, byte[], int, int, String, String, boolean, boolean, ADLStoreClient, RequestOptions, OperationResponse) create}. |
static void |
checkAccess(String path,
String rwx,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
checks whether the calling user has the required permissions for the file.
|
static void |
concat(String path,
List<String> sources,
ADLStoreClient client,
boolean deleteSourceDirectory,
RequestOptions opts,
OperationResponse resp)
Concatenate the specified list of files into the target filename.
|
static void |
concat(String path,
List<String> sources,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Concatenate the specified list of files into the target filename.
|
static void |
concurrentAppend(String path,
byte[] contents,
int offsetWithinContentsArray,
int length,
boolean autoCreate,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
append bytes to a file.
|
static void |
create(String path,
boolean overwrite,
String octalPermission,
byte[] contents,
int offsetWithinContentsArray,
int length,
String leaseId,
String sessionId,
boolean createParent,
SyncFlag syncFlag,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
create a file and write to it.
|
static boolean |
delete(String path,
boolean recursive,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
delete a file or directory from Azure Data Lake.
|
static AclStatus |
getAclStatus(String path,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Gets the current ACLs and permissions associated with a file or directory.
|
static AclStatus |
getAclStatus(String path,
UserGroupRepresentation oidOrUpn,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Gets the current ACLs and permissions associated with a file or directory.
|
static ContentSummary |
getContentSummary(String path,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Gets the content summary of a file or directory.
|
static DirectoryEntry |
getFileStatus(String path,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Gets the directory metadata associated with a file or directory.
|
static DirectoryEntry |
getFileStatus(String path,
UserGroupRepresentation oidOrUpn,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Gets the directory metadata associated with a file or directory.
|
static boolean |
isValidOctal(String input) |
static List<DirectoryEntry> |
listStatus(String path,
String listAfter,
String listBefore,
int listSize,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
enumerates the contents of a direcotry, returning a
List of DirectoryEntry objects,
one per file or directory in the specified directory. |
static List<DirectoryEntry> |
listStatus(String path,
String listAfter,
String listBefore,
int listSize,
UserGroupRepresentation oidOrUpn,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
enumerates the contents of a direcotry, returning a
List of DirectoryEntry objects,
one per file or directory in the specified directory. |
static boolean |
mkdirs(String path,
String octalPermission,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
creates a directory, and all it's parent directories if they dont exist.
|
static void |
modifyAclEntries(String path,
List<AclEntry> aclSpec,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Modify the acl entries for a file or directory.
|
static void |
modifyAclEntries(String path,
String aclSpec,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Modify the acl entries for a file or directory.
|
static InputStream |
open(String path,
long offset,
long length,
String sessionId,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
read from a file.
|
static InputStream |
open(String path,
long offset,
long length,
String sessionId,
boolean speculativeRead,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
read from a file.
|
static void |
removeAcl(String path,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
removes all acl entries from a file or directory.
|
static void |
removeAclEntries(String path,
List<AclEntry> aclSpec,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Removes the specified ACL entries from a file or directory.
|
static void |
removeAclEntries(String path,
String aclSpec,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Removes the specified ACL entries from a file or directory.
|
static void |
removeDefaultAcl(String path,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
removes all default acl entries from a directory.
|
static boolean |
rename(String path,
String destination,
boolean overwrite,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
rename a file.
|
static void |
setAcl(String path,
List<AclEntry> aclSpec,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Sets the ACLs for a file or directory.
|
static void |
setAcl(String path,
String aclSpec,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Sets the ACLs for a file or directory.
|
static void |
setExpiryTime(String path,
ExpiryOption expiryOption,
long milliseconds,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Sets the expiry time on a file.
|
static void |
setOwner(String path,
String user,
String group,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
sets the owning user and group of the file.
|
static void |
setPermission(String path,
String octalPermissions,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
Sets the permissions of the specified file ro directory.
|
static void |
setTimes(String path,
long atime,
long mtime,
ADLStoreClient client,
RequestOptions opts,
OperationResponse resp)
sets one or both of the times (Modified and Access time) of the file or directory
|
public static void create(String path, boolean overwrite, String octalPermission, byte[] contents, int offsetWithinContentsArray, int length, String leaseId, String sessionId, boolean createParent, SyncFlag syncFlag, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file to createoverwrite
- whether to overwrite the file if it already existsoctalPermission
- permissions for the file, as octal digits (For Example, "755"
). Can be null.contents
- byte array containing the contents to be written to the file. Can be null
offsetWithinContentsArray
- offset within the byte array passed in contents
. Bytes starting
at this offset will be written to serverlength
- number of bytes from contents
to be writtenleaseId
- a String containing the lease ID (generated by client). Can be null.sessionId
- a String containing the session ID (generated by client). Can be null.createParent
- if true, then parent directories of the file are created if they are missing.syncFlag
- Use SyncFlag.DATA
when writing
more bytes to same file path. Most performant operation.
Use SyncFlag.METADATA
when metadata for the
file also needs to be updated especially file length
retrieved from
getFileStatus(String, ADLStoreClient, RequestOptions, OperationResponse)
or listStatus(String, String, String, int, ADLStoreClient, RequestOptions, OperationResponse)
API call.
Has an overhead of updating metadata operation.
Use SyncFlag.CLOSE
when no more data is
expected to be written in this path. Adl backend would
update metadata, close the stream handle and
release the lease on the
path if valid leaseId is passed.
Expensive operation and should be used only when last
bytes are written.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void append(String path, long offsetToAppendTo, byte[] contents, int offsetWithinContentsArray, int length, String leaseId, String sessionId, SyncFlag syncFlag, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
create(String, boolean, String, byte[], int, int, String, String, boolean, SyncFlag, ADLStoreClient, RequestOptions, OperationResponse)
(String, boolean, String, byte[], int, int, String, String, boolean, boolean, ADLStoreClient, RequestOptions, OperationResponse) create}.path
- the full path of the file to append to. The file must already exist.offsetToAppendTo
- offset at which to append to to file. To let the server choose offset, pass -1
.contents
- byte array containing the contents to be written to the file. Can be null
offsetWithinContentsArray
- offset within the byte array passed in contents
. Bytes starting
at this offset will be written to serverlength
- number of bytes from contents
to be writtenleaseId
- a String containing the lease ID (generated by client). Can be null.sessionId
- a String containing the session ID (generated by client). Can be null.syncFlag
- Use SyncFlag.DATA
when writing
more bytes to same file path. Most performant operation.
Use SyncFlag.METADATA
when metadata for the
file also needs to be updated especially file length
retrieved from
getFileStatus(String, ADLStoreClient, RequestOptions, OperationResponse)
or listStatus(String, String, String, int, ADLStoreClient, RequestOptions, OperationResponse)
API call.
Has an overhead of updating metadata operation.
Use SyncFlag.CLOSE
when no more data is
expected to be written in this path. Adl backend would
update metadata, close the stream handle and
release the lease on the
path if valid leaseId is passed.
Expensive operation and should be used only when last
bytes are written.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void concurrentAppend(String path, byte[] contents, int offsetWithinContentsArray, int length, boolean autoCreate, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
concurrentAppend
can only be appended
with concurrentAppend
.path
- the full path of the file to append to.contents
- byte array containing the contents to be written to the file. Can be null
offsetWithinContentsArray
- offset within the byte array passed in contents
. Bytes starting
at this offset will be written to serverlength
- number of bytes from contents
to be writtenautoCreate
- boolean specifying whether to create the file if it doesn't already existclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static InputStream open(String path, long offset, long length, String sessionId, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file to read. The file must already exist.offset
- the offset within the ADL file to read fromlength
- the number of bytes to read from filesessionId
- a String containing the session ID (generated by client). Can be null.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callADLFileInputStream
public static InputStream open(String path, long offset, long length, String sessionId, boolean speculativeRead, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file to read. The file must already exist.offset
- the offset within the ADL file to read fromlength
- the number of bytes to read from filesessionId
- a String containing the session ID (generated by client). Can be null.speculativeRead
- indicates if the read is speculative. Currently fails the read - so dont use.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callADLFileInputStream
public static boolean delete(String path, boolean recursive, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file to delete. The file must already exist.recursive
- if deleting a directory, then whether to delete all files an directories
in the directory hierarchy underneathclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the calltrue
if the delete was successful. Also check resp.successful
.public static boolean rename(String path, String destination, boolean overwrite, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the existing file to rename. (the old name)overwrite
- overwrite the destination if it already exists and is a file or an
empty directorydestination
- the new name of the fileclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the calltrue
if the rename was successful. Also check resp.successful
.public static boolean mkdirs(String path, String octalPermission, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the directory to create. Any missing parents in the path will also be created.octalPermission
- permissions for the directory, as octal digits (For Example, "755"
). Can be null.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the calltrue
if the create was successful. Also check resp.successful
.public static void setExpiryTime(String path, ExpiryOption expiryOption, long milliseconds, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- path of the file to set expiry onexpiryOption
- ExpiryOption
value specifying how to interpret the passed in timemilliseconds
- time duration in millisecondsclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static ContentSummary getContentSummary(String path, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- path of the file or directory to queryclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callContentSummary
containing summary of information about the file or directorypublic static void concat(String path, List<String> sources, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- that full path of the target file to createsources
- List
of strings containing full pathnames of the files to concatenate.
Cannot be null or empty.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void concat(String path, List<String> sources, ADLStoreClient client, boolean deleteSourceDirectory, RequestOptions opts, OperationResponse resp)
path
- that full path of the target file to createsources
- List
of strings containing full pathnames of the files to concatenate.
Cannot be null or empty.deleteSourceDirectory
- specify whether the directory containing the source files should be deleted.
If source files specified in concat include all the files in the directory,
then specifying this parameter makes the concat delete the source directory along
with all the source files. Since a directory-level operation is faster than deleting
all the files one-by-one on the server, this might provide a performance boost for
some applications.
This is a specific performance optimizations for some apps like bulk upload apps,
where the needs match the functionality offered by this flag.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static DirectoryEntry getFileStatus(String path, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the file or directory to get metadata forclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callDirectoryEntry
containing the metadata for the filepublic static DirectoryEntry getFileStatus(String path, UserGroupRepresentation oidOrUpn, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the file or directory to get metadata foroidOrUpn
- UserGroupRepresentation
enum specifying whether to return user and group information as
OID or UPNclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callDirectoryEntry
containing the metadata for the filepublic static List<DirectoryEntry> listStatus(String path, String listAfter, String listBefore, int listSize, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
List
of DirectoryEntry
objects,
one per file or directory in the specified directory.
To avoid overwhelming the client or the server, the call may return a partial list, in which case
the caller should make the call again with the last entry from the returned list specified as the
listAfter
parameter of the next call.
path
- the directory to enumeratelistAfter
- the filename after which to begin enumerationlistBefore
- the filename before which to end the enumerationlistSize
- the maximum number of entries in the returned listclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callList
<DirectoryEntry
> containing the contents of the directorypublic static List<DirectoryEntry> listStatus(String path, String listAfter, String listBefore, int listSize, UserGroupRepresentation oidOrUpn, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
List
of DirectoryEntry
objects,
one per file or directory in the specified directory.
To avoid overwhelming the client or the server, the call may return a partial list, in which case
the caller should make the call again with the last entry from the returned list specified as the
listAfter
parameter of the next call.
path
- the directory to enumeratelistAfter
- the filename after which to begin enumerationlistBefore
- the filename before which to end the enumerationlistSize
- the maximum number of entries in the returned listoidOrUpn
- UserGroupRepresentation
enum specifying whether to return user and group information as
OID or UPNclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callList
<DirectoryEntry
> containing the contents of the directorypublic static void setTimes(String path, long atime, long mtime, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file or directory to touch
atime
- Access time as a longmtime
- Modified time as a longclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void setOwner(String path, String user, String group, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
null
, then they are not changed.
It is illegal to pass both user and owner as null
.path
- the full path of the fileuser
- the ID of the user, or null
group
- the ID of the group, or null
client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void setPermission(String path, String octalPermissions, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
setAcl
call.path
- the full path of the file or directory ro set permissions foroctalPermissions
- the permissions to set, in unix octal form. For example, '644'.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static boolean isValidOctal(String input)
public static void checkAccess(String path, String rwx, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file or directory to checkrwx
- the permission to check for, in rwx string form. The call returns true if the caller has
all the requested permissions. For example, specifying "r-x"
succeeds if the caller has
read and execute permissions.client
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void modifyAclEntries(String path, String aclSpec, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the path of the file or directory whose ACLs should be modifiedaclSpec
- aclspec string containing the entries to add or modifyclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void modifyAclEntries(String path, List<AclEntry> aclSpec, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the path of the file or directory whose ACLs should be modifiedaclSpec
- List
of AclEntry
s, containing the entries to add or modifyclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void removeAclEntries(String path, String aclSpec, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the fll path of the file or directory to remove ACLs fromaclSpec
- aclspec string containing entries to removeclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void removeAclEntries(String path, List<AclEntry> aclSpec, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the fll path of the file or directory to remove ACLs fromaclSpec
- List
of AclEntry
s to removeclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void removeDefaultAcl(String path, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the directory from which to remove default ACLsclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void removeAcl(String path, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file or directory from which to remove ACLsclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void setAcl(String path, String aclSpec, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path to the file or directory to set ACLs for.aclSpec
- posix aclspec string containing the ACLs to setclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static void setAcl(String path, List<AclEntry> aclSpec, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path to the file or directory to set ACLs for.aclSpec
- List
of AclEntry
s to setclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callpublic static AclStatus getAclStatus(String path, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file or directory to get ACLs and permissions forclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callAclStatus
object containing the ACLs, permissions and owners of the file or directorypublic static AclStatus getAclStatus(String path, UserGroupRepresentation oidOrUpn, ADLStoreClient client, RequestOptions opts, OperationResponse resp)
path
- the full path of the file or directory to get ACLs and permissions foroidOrUpn
- UserGroupRepresentation
enum specifying whether to return user and group information as
OID or UPNclient
- the ADLStoreClient
opts
- options to change the behavior of the callresp
- response from the call, and any error info generated by the callAclStatus
object containing the ACLs, permissions and owners of the file or directoryCopyright © 2019 Microsoft Corporation. All rights reserved.