/** * Creates an instance of the <code>CloudFileShare</code> class using the specified URI. * * @param uri * A <code>java.net.URI</code> object that represents the absolute URI of the share. * * @throws StorageException * If a storage service error occurred. */ public CloudFileShare(final URI uri) throws StorageException { this(new StorageUri(uri)); }
/** * Returns the URI for this file. * * @return A <code>java.net.URI</code> object that represents the URI for the file. */ @Override public final URI getUri() { return this.storageUri.getPrimaryUri(); }
.primaryUri(uri.getPrimaryUri().toString()) .blobName(cloudBlob.getName()) .containerName(containerName) .length(properties.getLength()); if (uri.getSecondaryUri() != null) { builder.secondaryUri(uri.getSecondaryUri().toString());
/** * Strips the Query and Fragment from the uri. * * @param inUri * the uri to alter * @return the stripped uri. * @throws StorageException */ public static StorageUri stripURIQueryAndFragment(final StorageUri inUri) throws StorageException { return new StorageUri(stripSingleURIQueryAndFragment(inUri.getPrimaryUri()), stripSingleURIQueryAndFragment(inUri.getSecondaryUri())); }
Utility.assertNotNull("completeUri", completeUri); if (!completeUri.isAbsolute()) { throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, completeUri.toString())); final HashMap<String, String[]> queryParameters = PathUtility.parseQueryString(completeUri.getQuery()); final boolean usePathStyleUris = Utility.determinePathStyleFromUri(this.storageUri.getPrimaryUri()); this.fileServiceClient = new CloudFileClient(PathUtility.getServiceClientBaseAddress( this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials); this.name = PathUtility.getShareNameFromUri(this.storageUri.getPrimaryUri(), usePathStyleUris);
Utility.assertNotNull("completeUri", completeUri); if (!completeUri.isAbsolute()) { throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, completeUri.toString())); final boolean usePathStyleUris = Utility.determinePathStyleFromUri(this.storageUri.getPrimaryUri()); this.blobServiceClient = new CloudBlobClient(PathUtility.getServiceClientBaseAddress( this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials); this.name = PathUtility.getContainerNameFromUri(this.storageUri.getPrimaryUri(), usePathStyleUris);
@Test public void testDevelopmentStorageWithTwoUris() throws URISyntaxException { CloudStorageAccount account = CloudStorageAccount.getDevelopmentStorageAccount(); URI primaryClientURI = account.getBlobStorageUri().getPrimaryUri(); URI primaryContainerURI = new URI(primaryClientURI.toString() + "/container"); URI secondaryClientURI = account.getBlobStorageUri().getSecondaryUri(); StorageUri singleURI = new StorageUri(primaryClientURI); assertTrue(primaryClientURI.equals(singleURI.getPrimaryUri())); assertNull(singleURI.getSecondaryUri()); StorageUri singleURI2 = new StorageUri(primaryClientURI); assertTrue(singleURI.equals(singleURI2)); StorageUri singleURI3 = new StorageUri(secondaryClientURI); assertFalse(singleURI.equals(singleURI3)); StorageUri multiURI = new StorageUri(primaryClientURI, secondaryClientURI); assertTrue(primaryClientURI.equals(multiURI.getPrimaryUri())); assertTrue(secondaryClientURI.equals(multiURI.getSecondaryUri())); assertFalse(multiURI.equals(singleURI)); StorageUri multiURI2 = new StorageUri(primaryClientURI, secondaryClientURI); assertTrue(multiURI.equals(multiURI2)); try { new StorageUri(primaryClientURI, primaryContainerURI); fail("StorageUri constructor should fail if both URIs do not point to the same resource"); } catch (IllegalArgumentException e) { assertEquals(SR.STORAGE_URI_MUST_MATCH, e.getMessage()); } StorageUri multiURI3 = new StorageUri(secondaryClientURI, primaryClientURI); assertFalse(multiURI.equals(multiURI3)); }
/** * Creates an instance of the <code>ServiceClient</code> class using the specified service endpoint and account * credentials. * * @param storageUri * A {@link StorageUri} object which represents the service endpoint used to create the client. * @param credentials * A {@link StorageCredentials} object which represents the account credentials. */ protected ServiceClient(final StorageUri storageUri, final StorageCredentials credentials) { Utility.assertNotNull("baseUri", storageUri); if (!storageUri.isAbsolute()) { throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, storageUri)); } this.credentials = credentials == null ? StorageCredentialsAnonymous.ANONYMOUS : credentials; this.usePathStyleUris = Utility.determinePathStyleFromUri(storageUri.getPrimaryUri()); this.storageUri = storageUri; }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileShare share, OperationContext context) throws Exception { return FileRequest.getShareStats(share.getTransformedAddress().getUri(this.getCurrentLocation()), options, context); }
session.getProvenanceReporter().receive(flowFile, cloudQueue.getStorageUri().toString());
@Test public void testCloudStorageAccountDevStoreProxyUri() throws InvalidKeyException, URISyntaxException { CloudStorageAccount account = CloudStorageAccount .parse("UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://ipv4.fiddler"); assertEquals(new URI("http://ipv4.fiddler:10000/devstoreaccount1"), account.getBlobEndpoint()); assertEquals(new URI("http://ipv4.fiddler:10001/devstoreaccount1"), account.getQueueEndpoint()); assertEquals(new URI("http://ipv4.fiddler:10002/devstoreaccount1"), account.getTableEndpoint()); assertEquals(new URI("http://ipv4.fiddler:10000/devstoreaccount1-secondary"), account.getBlobStorageUri() .getSecondaryUri()); assertEquals(new URI("http://ipv4.fiddler:10001/devstoreaccount1-secondary"), account.getQueueStorageUri() .getSecondaryUri()); assertEquals(new URI("http://ipv4.fiddler:10002/devstoreaccount1-secondary"), account.getTableStorageUri() .getSecondaryUri()); }
@Override public boolean equals(Object obj) { return this.equals((StorageUri) obj); }
/** * Sets the endpoint for the primary location of the storage account. * * @param primaryUri * A <code>java.net.URI</code> object for the primary URI. */ private void setPrimaryUri(URI primaryUri) { StorageUri.AssertAbsoluteUri(primaryUri); this.primaryUri = primaryUri; }
/** * Indicates whether a {@link StorageUri} object is equal to the current {@link StorageUri} object. * * @param other * A reference to a {@link StorageUri} object to compare. * * @return * <code>true</code> if this object is the same as the other argument; otherwise <code>false</code>. */ public boolean equals(StorageUri other) { return (other != null) && StorageUri.AreUrisEqual(this.primaryUri, other.primaryUri) && StorageUri.AreUrisEqual(this.secondaryUri, other.secondaryUri); }
/** * Parses the query parameters and populates a StorageCredentialsSharedAccessSignature object if one is present. * * @param completeUri * A {@link StorageUri} object which represents the complete Uri. * * @return The StorageCredentialsSharedAccessSignature if one is present, otherwise null. * @throws StorageException * An exception representing any error which occurred during the operation. */ public static StorageCredentialsSharedAccessSignature parseQuery(final StorageUri completeUri) throws StorageException { final HashMap<String, String[]> queryParameters = PathUtility.parseQueryString(completeUri.getQuery()); return parseQuery(queryParameters); }
/** * Strips the Query and Fragment from the uri. * * @param inUri * the uri to alter * @return the stripped uri. * @throws StorageException */ public static StorageUri stripURIQueryAndFragment(final StorageUri inUri) throws StorageException { return new StorageUri(stripSingleURIQueryAndFragment(inUri.getPrimaryUri()), stripSingleURIQueryAndFragment(inUri.getSecondaryUri())); }
Utility.assertNotNull("completeUri", completeUri); if (!completeUri.isAbsolute()) { throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, completeUri.toString())); final HashMap<String, String[]> queryParameters = PathUtility.parseQueryString(completeUri.getQuery()); final boolean usePathStyleUris = Utility.determinePathStyleFromUri(this.storageUri.getPrimaryUri()); this.blobServiceClient = new CloudBlobClient(PathUtility.getServiceClientBaseAddress( this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials); this.name = PathUtility.getBlobNameFromURI(this.storageUri.getPrimaryUri(), usePathStyleUris);
Utility.assertNotNull("completeUri", completeUri); if (!completeUri.isAbsolute()) { throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, completeUri.toString())); final boolean usePathStyleUris = Utility.determinePathStyleFromUri(this.storageUri.getPrimaryUri()); this.tableServiceClient = new CloudTableClient(PathUtility.getServiceClientBaseAddress( this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials); this.name = PathUtility.getTableNameFromUri(storageUri.getPrimaryUri(), usePathStyleUris);
new StorageUri(null, null); fail(SR.STORAGE_URI_NOT_NULL); StorageUri singleUri = new StorageUri(primaryClientUri); assertEquals(primaryClientUri, singleUri.getPrimaryUri()); assertNull(singleUri.getSecondaryUri()); StorageUri singleUri2 = new StorageUri(primaryClientUri); assertEquals(singleUri, singleUri2); StorageUri singleUri3 = new StorageUri(secondaryClientUri); assertFalse(singleUri.equals(singleUri3)); StorageUri singleSecondaryUri = new StorageUri(null, secondaryClientUri); assertEquals(secondaryClientUri, singleSecondaryUri.getSecondaryUri()); assertNull(singleSecondaryUri.getPrimaryUri()); StorageUri singleSecondarUri2 = new StorageUri(null, secondaryClientUri); assertEquals(singleSecondaryUri, singleSecondarUri2); StorageUri singleSecondarUri3 = new StorageUri(null, primaryClientUri); assertFalse(singleSecondaryUri.equals(singleSecondarUri3)); StorageUri multiUri = new StorageUri(primaryClientUri, secondaryClientUri); assertEquals(primaryClientUri, multiUri.getPrimaryUri()); assertEquals(secondaryClientUri, multiUri.getSecondaryUri()); assertFalse(multiUri.equals(singleUri)); StorageUri multiUri2 = new StorageUri(primaryClientUri, secondaryClientUri);
/** * Creates an instance of the <code>ServiceClient</code> class using the specified service endpoint and account * credentials. * * @param storageUri * A {@link StorageUri} object which represents the service endpoint used to create the client. * @param credentials * A {@link StorageCredentials} object which represents the account credentials. */ protected ServiceClient(final StorageUri storageUri, final StorageCredentials credentials) { Utility.assertNotNull("baseUri", storageUri); if (!storageUri.isAbsolute()) { throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, storageUri)); } this.credentials = credentials == null ? StorageCredentialsAnonymous.ANONYMOUS : credentials; this.usePathStyleUris = Utility.determinePathStyleFromUri(storageUri.getPrimaryUri()); this.storageUri = storageUri; }