/** * Returns the canonical name of the file in the format of * <i>/<service-name>/<account-name>/<share-name>/<file-name></i>. * <p> * This format is used for Shared Access operations. * * @return The canonical name in the format of <i>/<service-name>/<account-name> * /<share-name>/<file-name></i>. */ String getCanonicalName() { StringBuilder canonicalName = new StringBuilder("/"); canonicalName.append(SR.FILE); String rawPath = this.getUri().getRawPath(); if (this.fileServiceClient.isUsePathStyleUris()) { canonicalName.append(rawPath); } else { canonicalName.append(PathUtility.getCanonicalPathFromCredentials( this.getServiceClient().getCredentials(), rawPath)); } return canonicalName.toString(); }
/** * Returns the canonical name of the file in the format of * <i>/<service-name>/<account-name>/<share-name>/<file-name></i>. * <p> * This format is used for Shared Access operations. * * @return The canonical name in the format of <i>/<service-name>/<account-name> * /<share-name>/<file-name></i>. */ String getCanonicalName() { StringBuilder canonicalName = new StringBuilder("/"); canonicalName.append(SR.FILE); String rawPath = this.getUri().getRawPath(); if (this.fileServiceClient.isUsePathStyleUris()) { canonicalName.append(rawPath); } else { canonicalName.append(PathUtility.getCanonicalPathFromCredentials( this.getServiceClient().getCredentials(), rawPath)); } return canonicalName.toString(); }
/** * Returns the share for this directory. * * @return A {@link CloudFileShare} that represents the share for this directory. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */ @Override public CloudFileShare getShare() throws StorageException, URISyntaxException { if (this.share == null) { this.share = this.fileServiceClient.getShareReference(PathUtility.getShareNameFromUri(this.getUri(), this.fileServiceClient.isUsePathStyleUris())); } return this.share; }
/** * Returns the share for this directory. * * @return A {@link CloudFileShare} that represents the share for this directory. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */ @Override public CloudFileShare getShare() throws StorageException, URISyntaxException { if (this.share == null) { this.share = this.fileServiceClient.getShareReference(PathUtility.getShareNameFromUri(this.getUri(), this.fileServiceClient.isUsePathStyleUris())); } return this.share; }
/** * Returns the file's share. * * @return A {@link CloudFileShare} object that represents the share of the file. * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */ @Override public final CloudFileShare getShare() throws StorageException, URISyntaxException { if (this.share == null) { final StorageUri shareUri = PathUtility.getShareURI(this.getStorageUri(), this.fileServiceClient.isUsePathStyleUris()); this.share = new CloudFileShare(shareUri, this.fileServiceClient.getCredentials()); } return this.share; }
/** * Returns the file's share. * * @return A {@link CloudFileShare} object that represents the share of the file. * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */ @Override public final CloudFileShare getShare() throws StorageException, URISyntaxException { if (this.share == null) { final StorageUri shareUri = PathUtility.getShareURI(this.getStorageUri(), this.fileServiceClient.isUsePathStyleUris()); this.share = new CloudFileShare(shareUri, this.fileServiceClient.getCredentials()/*, null*/); } return this.share; }
@Override public Boolean preProcessResponse(CloudFileShare share, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_OK) { share.updatePropertiesFromResponse(this.getConnection()); final FileShareAttributes attributes = FileResponse.getFileShareAttributes(this.getConnection(), client.isUsePathStyleUris()); share.metadata = attributes.getMetadata(); share.properties = attributes.getProperties(); return Boolean.valueOf(true); } else if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Boolean.valueOf(false); } else { this.setNonExceptionedRetryableFailure(true); // return false instead of null to avoid SCA issues return false; } } };
@Override public Boolean preProcessResponse(CloudFileShare share, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_OK) { share.updatePropertiesFromResponse(this.getConnection()); final FileShareAttributes attributes = FileResponse.getFileShareAttributes(this.getConnection(), client.isUsePathStyleUris()); share.metadata = attributes.getMetadata(); share.properties = attributes.getProperties(); return Boolean.valueOf(true); } else if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Boolean.valueOf(false); } else { this.setNonExceptionedRetryableFailure(true); // return false instead of null to avoid SCA issues return false; } } };
@Override public Void preProcessResponse(CloudFileShare share, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final FileShareAttributes attributes = FileResponse.getFileShareAttributes(this.getConnection(), client.isUsePathStyleUris()); share.metadata = attributes.getMetadata(); share.properties = attributes.getProperties(); return null; } };
@Override public Void preProcessResponse(CloudFileShare share, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final FileShareAttributes attributes = FileResponse.getFileShareAttributes(this.getConnection(), client.isUsePathStyleUris()); share.metadata = attributes.getMetadata(); share.properties = attributes.getProperties(); return null; } };
@Override public Boolean preProcessResponse(CloudFileDirectory directory, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_OK) { directory.updatePropertiesFromResponse(this.getConnection()); // Set properties final FileDirectoryAttributes attributes = FileResponse.getFileDirectoryAttributes(this.getConnection(), client.isUsePathStyleUris()); directory.setMetadata(attributes.getMetadata()); directory.setProperties(attributes.getProperties()); return Boolean.valueOf(true); } else if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Boolean.valueOf(false); } else { this.setNonExceptionedRetryableFailure(true); // return false instead of null to avoid SCA issues return false; } } };
@Override public Boolean preProcessResponse(CloudFileDirectory directory, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_OK) { directory.updatePropertiesFromResponse(this.getConnection()); // Set properties final FileDirectoryAttributes attributes = FileResponse.getFileDirectoryAttributes(this.getConnection(), client.isUsePathStyleUris()); directory.setMetadata(attributes.getMetadata()); directory.setProperties(attributes.getProperties()); return Boolean.valueOf(true); } else if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Boolean.valueOf(false); } else { this.setNonExceptionedRetryableFailure(true); // return false instead of null to avoid SCA issues return false; } } };
@Override public Void preProcessResponse(CloudFileShare share, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final FileShareAttributes attributes = FileResponse.getFileShareAttributes(this.getConnection(), client.isUsePathStyleUris()); // The response from the service does not include the share quota. // Instead, we keep the existing value. Integer oldShareQuota = share.properties.getShareQuota(); share.properties = attributes.getProperties(); share.properties.setShareQuota(oldShareQuota); return null; } };
@Override public Void preProcessResponse(CloudFileShare share, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final FileShareAttributes attributes = FileResponse.getFileShareAttributes(this.getConnection(), client.isUsePathStyleUris()); // The response from the service does not include the share quota. // Instead, we keep the existing value. Integer oldShareQuota = share.properties.getShareQuota(); share.properties = attributes.getProperties(); share.properties.setShareQuota(oldShareQuota); return null; } };
@Override public Void preProcessResponse(CloudFileDirectory directory, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } // Set properties final FileDirectoryAttributes attributes = FileResponse.getFileDirectoryAttributes(this.getConnection(), client.isUsePathStyleUris()); directory.setMetadata(attributes.getMetadata()); directory.setProperties(attributes.getProperties()); return null; } };
@Override public Void preProcessResponse(CloudFileDirectory directory, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } // Set properties final FileDirectoryAttributes attributes = FileResponse.getFileDirectoryAttributes(this.getConnection(), client.isUsePathStyleUris()); directory.setMetadata(attributes.getMetadata()); directory.setProperties(attributes.getProperties()); return null; } };
@Override public Void preProcessResponse(CloudFileDirectory directory, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final FileDirectoryAttributes attributes = FileResponse .getFileDirectoryAttributes(this.getConnection(), client.isUsePathStyleUris()); directory.setProperties(attributes.getProperties()); this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection())); return null; } };
@Override public Void preProcessResponse(CloudFileDirectory directory, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final FileDirectoryAttributes attributes = FileResponse .getFileDirectoryAttributes(this.getConnection(), client.isUsePathStyleUris()); directory.setProperties(attributes.getProperties()); this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection())); return null; } };