public CloudBlobContainer getCloudBlobContainer(final String containerName) throws StorageException, URISyntaxException { CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName); cloudBlobContainer.createIfNotExists(); return cloudBlobContainer; }
@Override public void run() { try { CloudBlobContainer container = blobClient.getContainerReference(azureContainer); container.createIfNotExists(); CloudBlockBlob blob = container.getBlockBlobReference(azureKey); blob.upload(new java.io.FileInputStream(localFile), localFile.length()); } catch (URISyntaxException e) { throw new RuntimeException(e); } catch (StorageException e) { throw new RuntimeException(e); } catch (FileNotFoundException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } });
@Override public InputStream getStream(UUID jobId, String key) { try { CloudBlobContainer reference = blobClient.getContainerReference(BLOB_CONTAINER); CloudBlockBlob blob = reference.getBlockBlobReference(createRowKey(jobId, key)); return blob.openInputStream(); } catch (StorageException | URISyntaxException e) { throw new MicrosoftStorageException("Error returning stream for job: " + jobId, e); } }
@Override public void create(UUID jobId, String key, InputStream stream) { try { CloudBlobContainer reference = blobClient.getContainerReference(BLOB_CONTAINER); CloudBlockBlob blob = reference.getBlockBlobReference(createRowKey(jobId, key)); blob.upload(stream, UNKNOWN_LENGTH); } catch (StorageException | URISyntaxException | IOException e) { throw new MicrosoftStorageException("Error creating stream for job: " + jobId, e); } }
try { CloudBlobClient blobClient = AzureStorageUtils.createCloudBlobClient(context, getLogger(), flowFile); CloudBlobContainer container = blobClient.getContainerReference(containerName);
try { CloudBlobClient blobClient = AzureStorageUtils.createCloudBlobClient(context, getLogger(), flowFile); CloudBlobContainer container = blobClient.getContainerReference(containerName);
public void init() { try { String endpoint = String.format(ENDPOINT_TEMPLATE, configuration.getAccountName()); CloudStorageAccount cosmosAccount = CloudStorageAccount.parse( String.format( COSMOS_CONNECTION_TEMPLATE, configuration.getAccountName(), configuration.getAccountKey(), endpoint)); tableClient = cosmosAccount.createCloudTableClient(); // Create the tables if the do not exist tableClient.getTableReference(JOB_TABLE).createIfNotExists(); tableClient.getTableReference(JOB_DATA_TABLE).createIfNotExists(); CloudStorageAccount blobAccount = CloudStorageAccount.parse( String.format( BLOB_CONNECTION_TEMPLATE, configuration.getAccountName(), configuration.getBlobKey())); blobClient = blobAccount.createCloudBlobClient(); blobClient.getContainerReference(BLOB_CONTAINER).createIfNotExists(); } catch (StorageException | URISyntaxException | InvalidKeyException e) { throw new MicrosoftStorageException(e); } }
CloudBlobContainer container = blobClient.getContainerReference(containerName); CloudBlob blob = container.getBlockBlobReference(blobPath);
try { CloudBlobClient blobClient = AzureStorageUtils.createCloudBlobClient(context, getLogger(), null); CloudBlobContainer container = blobClient.getContainerReference(containerName);
@Override public CloudBlobContainerWrapper getContainerReference(String uri) throws URISyntaxException, StorageException { return new CloudBlobContainerWrapperImpl( serviceClient.getContainerReference(uri)); }
public CloudBlobContainer getCloudBlobContainer(final String containerName) throws StorageException, URISyntaxException { CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName); cloudBlobContainer.createIfNotExists(); return cloudBlobContainer; }
public static CloudBlobContainer getBlobContainer(final String connectionString, final String containerName) throws DataStoreException { try { CloudBlobClient client = Utils.getBlobClient(connectionString); return client.getContainerReference(containerName); } catch (InvalidKeyException | URISyntaxException | StorageException e) { throw new DataStoreException(e); } }
public Iterable<ListBlobItem> listBlobs(final String containerName, final String prefix, final boolean useFlatBlobListing) throws URISyntaxException, StorageException, InvalidKeyException { CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient(); CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName); return cloudBlobContainer.listBlobs(prefix, useFlatBlobListing, EnumSet.noneOf(BlobListingDetails.class), null, AzureStorageUtils.getTalendOperationContext()); }
/** * This method delete the container if exist */ public boolean deleteContainerIfExist(final String containerName) throws StorageException, URISyntaxException, InvalidKeyException { CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient(); CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName); return cloudBlobContainer.deleteIfExists(null, null, AzureStorageUtils.getTalendOperationContext()); }
public static CloudBlobDirectory cloudBlobDirectoryFrom(String connection, String containerName, String dir) throws InvalidKeyException, URISyntaxException, StorageException { CloudStorageAccount cloud = CloudStorageAccount.parse(connection); CloudBlobContainer container = cloud.createCloudBlobClient().getContainerReference(containerName); container.createIfNotExists(); return container.getDirectoryReference(dir); }
public void upload(final String containerName, final String blobName, final InputStream sourceStream, final long length) throws StorageException, IOException, URISyntaxException, InvalidKeyException { CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient(); CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName); CloudBlockBlob blob = cloudBlobContainer.getBlockBlobReference(blobName); blob.upload(sourceStream, length, null, null, AzureStorageUtils.getTalendOperationContext()); }
public static CloudBlobContainer getRandomContainerReference() throws URISyntaxException, StorageException { String containerName = generateRandomContainerName(); CloudBlobClient bClient = TestHelper.createCloudBlobClient(); CloudBlobContainer container = bClient.getContainerReference(containerName); return container; }
public static CloudBlobContainer getRandomPremiumBlobContainerReference() throws URISyntaxException, StorageException { String containerName = generateRandomContainerName(); CloudBlobClient bClient = TestHelper.createPremiumCloudBlobClient(); CloudBlobContainer container = bClient.getContainerReference(containerName); return container; }
public static CloudBlobContainer getRandomContainerReference() throws URISyntaxException, StorageException { String containerName = generateRandomContainerName(); CloudBlobClient blobClient = TestHelper.createCloudBlobClient(); CloudBlobContainer container = blobClient.getContainerReference(containerName); return container; }
@Test public void testNullRetryPolicy() throws URISyntaxException, StorageException { CloudBlobClient blobClient = TestHelper.createCloudBlobClient(); CloudBlobContainer container = blobClient.getContainerReference("container1"); blobClient.getDefaultRequestOptions().setRetryPolicyFactory(null); container.exists(); }