@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { return FileRequest.getDirectoryProperties( directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, accessCondition, directory.getShare().snapshotID); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { return FileRequest.getDirectoryProperties( directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, accessCondition, directory.getShare().snapshotID); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { return FileRequest.getDirectoryProperties( directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, accessCondition, directory.getShare().snapshotID); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { return FileRequest.getDirectoryProperties( directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, accessCondition, directory.getShare().snapshotID); }
/** * Returns a reference to a {@link CloudFile} object that represents a file in this directory. * * @param fileName * A <code>String</code> that represents the name of the file. * * @return A {@link CloudFile} object that represents a reference to the specified file. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */ public CloudFile getFileReference(final String fileName) throws URISyntaxException, StorageException { Utility.assertNotNullOrEmpty("fileName", fileName); StorageUri subdirectoryUri = PathUtility.appendPathToUri(this.storageUri, fileName); return new CloudFile(subdirectoryUri, fileName, this.getShare()); }
/** * Returns a reference to a {@link CloudFileDirectory} object that represents a directory in this directory. * * @param itemName * A <code>String</code> that represents the name of the directory. * * @return A {@link CloudFileDirectory} object that represents a reference to the specified directory. * * @throws URISyntaxException * If the resource URI is invalid. * @throws StorageException */ public CloudFileDirectory getDirectoryReference(final String itemName) throws URISyntaxException, StorageException { Utility.assertNotNullOrEmpty("itemName", itemName); StorageUri subdirectoryUri = PathUtility.appendPathToUri(this.storageUri, itemName); return new CloudFileDirectory(subdirectoryUri, itemName, this.getShare()); }
/** * Returns a reference to a {@link CloudFile} object that represents a file in this directory. * * @param fileName * A <code>String</code> that represents the name of the file. * * @return A {@link CloudFile} object that represents a reference to the specified file. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */ public CloudFile getFileReference(final String fileName) throws URISyntaxException, StorageException { Utility.assertNotNullOrEmpty("fileName", fileName); StorageUri subdirectoryUri = PathUtility.appendPathToUri(this.storageUri, fileName); return new CloudFile(subdirectoryUri, fileName, this.getShare()); }
/** * Returns a reference to a {@link CloudFileDirectory} object that represents a directory in this directory. * * @param itemName * A <code>String</code> that represents the name of the directory. * * @return A {@link CloudFileDirectory} object that represents a reference to the specified directory. * * @throws URISyntaxException * If the resource URI is invalid. * @throws StorageException */ public CloudFileDirectory getDirectoryReference(final String itemName) throws URISyntaxException, StorageException { Utility.assertNotNullOrEmpty("itemName", itemName); StorageUri subdirectoryUri = PathUtility.appendPathToUri(this.storageUri, itemName); return new CloudFileDirectory(subdirectoryUri, itemName, this.getShare()); }
/** * Returns the {@link CloudFileDirectory} parent directory associated with this directory. * * @return An {@link CloudFileDirectory} object that represents the parent directory associated with the directory. * @throws StorageException * @throws URISyntaxException */ @Override public CloudFileDirectory getParent() throws URISyntaxException, StorageException { if (this.parent == null) { final String parentName = CloudFile.getParentNameFromURI(this.getStorageUri(), this.getShare()); if (parentName != null) { StorageUri parentURI = PathUtility.appendPathToUri(this.getShare().getStorageUri(), parentName); this.parent = new CloudFileDirectory(parentURI, this.getServiceClient().getCredentials()); } } return this.parent; }
/** * Returns the {@link CloudFileDirectory} parent directory associated with this directory. * * @return An {@link CloudFileDirectory} object that represents the parent directory associated with the directory. * @throws StorageException * @throws URISyntaxException */ @Override public CloudFileDirectory getParent() throws URISyntaxException, StorageException { if (this.parent == null) { final String parentName = CloudFile.getParentNameFromURI(this.getStorageUri(), this.getShare()); if (parentName != null) { StorageUri parentURI = PathUtility.appendPathToUri(this.getShare().getStorageUri(), parentName); this.parent = new CloudFileDirectory(parentURI, this.getServiceClient().getCredentials()); } } return this.parent; }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { listingContext.setMarker(segmentedRequest.getToken() != null ? segmentedRequest.getToken() .getNextMarker() : null); return FileRequest.listFilesAndDirectories( directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, listingContext, directory.getShare().snapshotID); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { listingContext.setMarker(segmentedRequest.getToken() != null ? segmentedRequest.getToken() .getNextMarker() : null); return FileRequest.listFilesAndDirectories( directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, listingContext, directory.getShare().snapshotID); }
/** * Creates the directory using the specified options and operation context. * * @param options * A {@link FileRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudFileClient}). * @param opContext * An {@link 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. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException */ @DoesServiceRequest public void create(FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException { if (opContext == null) { opContext = new OperationContext(); } this.getShare().assertNoSnapshot(); opContext.initialize(); options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient); ExecutionEngine.executeWithRetry(this.fileServiceClient, this, createDirectoryImpl(options), options.getRetryPolicyFactory(), opContext); }
/** * Creates the directory using the specified options and operation context. * * @param options * A {@link FileRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudFileClient}). * @param opContext * An {@link 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. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException */ @DoesServiceRequest public void create(FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException { if (opContext == null) { opContext = new OperationContext(); } this.getShare().assertNoSnapshot(); opContext.initialize(); options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient); ExecutionEngine.executeWithRetry(this.fileServiceClient, this, createDirectoryImpl(options), options.getRetryPolicyFactory(), opContext); }
this.getShare().assertNoSnapshot();
/** * Deletes the directory using the specified request options and operation context. * * @param accessCondition * An {@link AccessCondition} object that represents the access conditions for the directory. * @param options * A {@link FileRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudFileClient}). * @param opContext * An {@link 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. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException */ @DoesServiceRequest public void delete(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException { if (opContext == null) { opContext = new OperationContext(); } this.getShare().assertNoSnapshot(); opContext.initialize(); options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient); ExecutionEngine.executeWithRetry(this.fileServiceClient, this, deleteDirectoryImpl(accessCondition, options), options.getRetryPolicyFactory(), opContext); }
/** * Deletes the directory using the specified request options and operation context. * * @param accessCondition * An {@link AccessCondition} object that represents the access conditions for the directory. * @param options * A {@link FileRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudFileClient}). * @param opContext * An {@link 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. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException */ @DoesServiceRequest public void delete(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException { if (opContext == null) { opContext = new OperationContext(); } this.getShare().assertNoSnapshot(); opContext.initialize(); options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient); ExecutionEngine.executeWithRetry(this.fileServiceClient, this, deleteDirectoryImpl(accessCondition, options), options.getRetryPolicyFactory(), opContext); }
this.getShare().assertNoSnapshot();
/** * Validate share references * * @throws StorageException * @throws URISyntaxException */ @Test public void testCloudFileShareReference() throws StorageException, URISyntaxException { CloudFileClient client = FileTestHelper.createCloudFileClient(); CloudFileShare share = client.getShareReference("share"); CloudFileDirectory directory = share.getRootDirectoryReference().getDirectoryReference("directory3"); CloudFileDirectory directory2 = directory.getDirectoryReference("directory4"); assertEquals(share.getStorageUri().toString(), directory.getShare().getStorageUri().toString()); assertEquals(share.getStorageUri().toString(), directory2.getShare().getStorageUri().toString()); assertEquals(share.getStorageUri().toString(), directory2.getParent().getShare().getStorageUri().toString()); }
/** * Tests the CloudFileDirectory constructor. * * @throws URISyntaxException * @throws StorageException */ @Test @Category({ DevFabricTests.class, DevStoreTests.class, CloudTests.class }) public void testCloudFileDirectoryConstructor() throws URISyntaxException, StorageException { CloudFileDirectory directory = this.share.getRootDirectoryReference().getDirectoryReference("directory1"); CloudFileDirectory directory2 = new CloudFileDirectory(directory.getStorageUri(), this.share.getServiceClient().getCredentials()); assertEquals(directory.getName(), directory2.getName()); assertEquals(directory.getStorageUri(), directory2.getStorageUri()); assertEquals(directory.getShare().getStorageUri(), directory2.getShare().getStorageUri()); assertEquals(FileTestHelper.ensureTrailingSlash(directory.getServiceClient().getStorageUri()), FileTestHelper.ensureTrailingSlash(directory2.getServiceClient().getStorageUri())); }