/** * Gets a {@link CloudFileShare} object with the specified name. * * @param shareName * 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. * @param snapshotID * A <code>String</code> that represents the snapshot ID of the share. * @return A reference to a {@link CloudFileShare} object. * @throws StorageException * @throws URISyntaxException * * @see <a href="http://msdn.microsoft.com/en-us/library/azure/dn167011.aspx">Naming and Referencing Shares, * Directories, Files, and Metadata</a> */ public CloudFileShare getShareReference(final String shareName, String snapshotID) throws URISyntaxException, StorageException { Utility.assertNotNullOrEmpty("shareName", shareName); return new CloudFileShare(shareName, snapshotID, this); }
/** * Gets a {@link CloudFileShare} object with the specified name. * * @param shareName * 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. * @param snapshotID * A <code>String</code> that represents the snapshot ID of the share. * @return A reference to a {@link CloudFileShare} object. * @throws StorageException * @throws URISyntaxException * * @see <a href="http://msdn.microsoft.com/en-us/library/azure/dn167011.aspx">Naming and Referencing Shares, * Directories, Files, and Metadata</a> */ public CloudFileShare getShareReference(final String shareName, String snapshotID) throws URISyntaxException, StorageException { Utility.assertNotNullOrEmpty("shareName", shareName); return new CloudFileShare(shareName, snapshotID, this); }
/** * 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 CloudFileShare preProcessResponse(CloudFileShare share, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } final String snapshotTime = FileResponse.getSnapshotTime(this.getConnection()); CloudFileShare snapshot = new CloudFileShare(share.getName(), snapshotTime, client); snapshot.setProperties(new FileShareProperties(share.properties)); // use the specified metadata if not null : otherwise share's metadata snapshot.setMetadata(metadata != null ? metadata : share.metadata); snapshot.updatePropertiesFromResponse(this.getConnection()); return snapshot; } };
@Override public CloudFileShare preProcessResponse(CloudFileShare share, CloudFileClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } final String snapshotTime = FileResponse.getSnapshotTime(this.getConnection()); CloudFileShare snapshot = new CloudFileShare(share.getName(), snapshotTime, client); snapshot.setProperties(new FileShareProperties(share.properties)); // use the specified metadata if not null : otherwise share's metadata snapshot.setMetadata(metadata != null ? metadata : share.metadata); snapshot.updatePropertiesFromResponse(this.getConnection()); return snapshot; } };
new CloudFileShare(PathUtility.addToQuery(httpUri, shareSasHttps)); assertEquals(StorageCredentialsSharedAccessSignature.class.toString(), httpShare.getServiceClient().getCredentials().getClass().toString()); new CloudFileShare(PathUtility.addToQuery(httpsUri, shareSasHttps)); assertEquals(StorageCredentialsSharedAccessSignature.class.toString(), httpsShare.getServiceClient().getCredentials().getClass().toString()); new CloudFileShare(PathUtility.addToQuery(httpUri, shareSasHttp)); assertEquals(StorageCredentialsSharedAccessSignature.class.toString(), httpShare.getServiceClient().getCredentials().getClass().toString()); new CloudFileShare(PathUtility.addToQuery(httpsUri, shareSasHttp)); assertEquals(StorageCredentialsSharedAccessSignature.class.toString(), httpsShare.getServiceClient().getCredentials().getClass().toString());
String shareSasNone = this.share.generateSharedAccessSignature(policy, null, range2, null); CloudFileShare noneShare = new CloudFileShare(PathUtility.addToQuery(this.share.getUri(), shareSasNone)); new CloudFileShare(PathUtility.addToQuery(this.share.getUri(), shareSasOne)); new CloudFileShare(PathUtility.addToQuery(this.share.getUri(), shareSasAll));
CloudFileShare sasShare = new CloudFileShare(PathUtility.addToQuery(this.share.getUri(), sasToken2));
new CloudFileShare(PathUtility.addToQuery(this.share.getUri(), shareReadListSas)); CloudFileShare shareFromUri = new CloudFileShare(PathUtility.addToQuery( readListShare.getStorageUri(), this.share.generateSharedAccessSignature(null, "readlist"))); assertEquals(StorageCredentialsSharedAccessSignature.class.toString(),
CloudFileShare snapshotRef5 = new CloudFileShare(uriBuilder.addToURI(this.share.getUri()), this.share.getServiceClient().getCredentials()); assertEquals(snapshot.snapshotID, snapshotRef5.snapshotID);
URI sasUri = sasClient.getShareReference(share.getName()).getUri(); sasUri = sasClient.getCredentials().transformUri(sasUri); final CloudFileShare sasShare = new CloudFileShare(sasUri);
share = new CloudFileShare(credentials.transformUri(share.getUri())); file = share.getRootDirectoryReference().getFileReference(file.getName());