public final class CloudFileShare extends Object
Shares hold directories, which are encapsulated as CloudFileDirectory objects, and directories hold files.
Directories can also contain sub-directories.
| Modifier and Type | Field and Description |
|---|---|
protected HashMap<String,String> |
metadata
Represents the share metadata.
|
| Constructor and Description |
|---|
CloudFileShare(StorageUri storageUri,
CloudFileClient client)
Creates an instance of the
CloudFileShare class using the specified URI and client. |
CloudFileShare(String shareName,
CloudFileClient client)
Creates an instance of the
CloudFileShare class using the specified name and client. |
CloudFileShare(URI uri,
CloudFileClient client)
Creates an instance of the
CloudFileShare class using the specified URI and client. |
| Modifier and Type | Method and Description |
|---|---|
void |
create()
Creates the share.
|
void |
create(FileRequestOptions options,
OperationContext opContext)
Creates the share using the specified options and operation context.
|
boolean |
createIfNotExists()
Creates the share if it does not exist.
|
boolean |
createIfNotExists(FileRequestOptions options,
OperationContext opContext)
Creates the share if it does not exist, using the specified request options and operation context.
|
void |
delete()
Deletes the share.
|
void |
delete(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Deletes the share using the specified request options and operation context.
|
boolean |
deleteIfExists()
Deletes the share if it exists.
|
boolean |
deleteIfExists(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Deletes the share if it exists using the specified request options and operation context.
|
void |
downloadAttributes()
Downloads the share's attributes, which consist of metadata and properties.
|
void |
downloadAttributes(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Downloads the share's attributes, which consist of metadata and properties, using the specified request
options and operation context.
|
boolean |
exists()
Returns a value that indicates whether the share exists.
|
boolean |
exists(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Returns a value that indicates whether the share exists, using the specified request options and operation
context.
|
HashMap<String,String> |
getMetadata()
Returns the metadata for the share.
|
String |
getName()
Returns the name of the share.
|
FileShareProperties |
getProperties()
Returns the properties for the share.
|
CloudFileDirectory |
getRootDirectoryReference()
Returns a reference to a
CloudFileDirectory object that represents the root file directory within this
share. |
CloudFileClient |
getServiceClient()
Returns the File service client associated with this share.
|
StorageUri |
getStorageUri()
Returns the list of URIs for all locations.
|
URI |
getUri()
Returns the URI for this share.
|
void |
setMetadata(HashMap<String,String> metadata)
Sets the metadata collection of name-value pairs to be set on the share with an
uploadMetadata() call. |
protected void |
setProperties(FileShareProperties properties)
Sets the properties for the share.
|
void |
uploadMetadata()
Uploads the share's metadata.
|
void |
uploadMetadata(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Uploads the share's metadata using the specified request options and operation context.
|
public CloudFileShare(String shareName, CloudFileClient client) throws URISyntaxException, StorageException
CloudFileShare class using the specified name and client.shareName - A String which represents the name of the share, which must adhere to share
naming rules.
The share name should not include any path separator characters (/).
Share names must be lowercase, between 3-63 characters long and must start with a letter or
number. Share names may contain only letters, numbers, and the dash (-) character.client - A CloudFileClient object that represents the associated service client, and that specifies the
endpoint for the File service.StorageException - If a storage service error occurred.URISyntaxException - If the resource URI constructed based on the shareName is invalid.public CloudFileShare(URI uri, CloudFileClient client) throws StorageException, URISyntaxException
CloudFileShare class using the specified URI and client.uri - A java.net.URI object that represents the absolute URI of the share.client - A CloudFileClient object that represents the associated service client, and that specifies the
endpoint for the File service.StorageException - If a storage service error occurred.URISyntaxExceptionpublic CloudFileShare(StorageUri storageUri, CloudFileClient client) throws StorageException, URISyntaxException
CloudFileShare class using the specified URI and client.storageUri - A StorageUri object which represents the absolute URI of the share.client - A CloudFileClient object that represents the associated service client, and that specifies the
endpoint for the File service.StorageException - If a storage service error occurred.URISyntaxException@DoesServiceRequest public void create() throws StorageException
StorageException - If a storage service error occurred.@DoesServiceRequest public void create(FileRequestOptions options, OperationContext opContext) throws StorageException
options - A FileRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudFileClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException - If a storage service error occurred.@DoesServiceRequest public boolean createIfNotExists() throws StorageException
true if the share did not already exist and was created; otherwise, false.StorageException - If a storage service error occurred.@DoesServiceRequest public boolean createIfNotExists(FileRequestOptions options, OperationContext opContext) throws StorageException
options - A FileRequestOptions object that specifies any additional options for the request.
Specifying null will use the default request options from the associated service client
(CloudFileClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true if the share did not already exist and was created; otherwise, false.StorageException - If a storage service error occurred.@DoesServiceRequest public void delete() throws StorageException
StorageException - If a storage service error occurred.@DoesServiceRequest public void delete(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException
accessCondition - An AccessCondition object that represents the access conditions for the share.options - A FileRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudFileClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException - If a storage service error occurred.@DoesServiceRequest public boolean deleteIfExists() throws StorageException
true if the share existed and was deleted; otherwise, false.StorageException - If a storage service error occurred.@DoesServiceRequest public boolean deleteIfExists(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException
accessCondition - An AccessCondition object that represents the access conditions for the share.options - A FileRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudFileClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true if the share existed and was deleted; otherwise, false.StorageException - If a storage service error occurred.@DoesServiceRequest public void downloadAttributes() throws StorageException
StorageException - If a storage service error occurred.@DoesServiceRequest public void downloadAttributes(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException
accessCondition - An AccessCondition object that represents the access conditions for the share.options - A FileRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudFileClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException - If a storage service error occurred.@DoesServiceRequest public boolean exists() throws StorageException
true if the share exists, otherwise false.StorageException - If a storage service error occurred.@DoesServiceRequest public boolean exists(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException
accessCondition - An AccessCondition object that represents the access conditions for the share.options - A FileRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudFileClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true if the share exists, otherwise false.StorageException - If a storage service error occurred.@DoesServiceRequest public void uploadMetadata() throws StorageException
StorageException - If a storage service error occurred.@DoesServiceRequest public void uploadMetadata(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException
accessCondition - An AccessCondition object that represents the access conditions for the share.options - A FileRequestOptions object that specifies any additional options for the request. Specifying
null will use the default request options from the associated service client (
CloudFileClient).opContext - An OperationContext object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException - If a storage service error occurred.public CloudFileDirectory getRootDirectoryReference() throws StorageException, URISyntaxException
CloudFileDirectory object that represents the root file directory within this
share.CloudFileDirectory reference to the root directory for this share.StorageExceptionURISyntaxExceptionpublic CloudFileClient getServiceClient()
CloudFileClient object that represents the service client associated with this share.public URI getUri()
public StorageUri getStorageUri()
StorageUri object which represents the list of URIs for all locations.public String getName()
String that represents the name of the share.public HashMap<String,String> getMetadata()
downloadAttributes(), and is set on the queue with a call to uploadMetadata().java.util.HashMap object that represents the metadata for the share.public FileShareProperties getProperties()
FileShareProperties object that represents the properties for the share.public void setMetadata(HashMap<String,String> metadata)
uploadMetadata() call.
This collection will overwrite any existing share metadata. If this is set to an empty collection, the
share metadata will be cleared on an uploadMetadata() call.metadata - A java.util.HashMap object that represents the metadata being assigned to the share.protected void setProperties(FileShareProperties properties)
properties - A FileShareProperties object that represents the properties being assigned to the
share./**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/