@@ -97,7 +97,7 @@ public Tuple<CloudBlobClient, Supplier<OperationContext>> client(String clientNa
97
97
}
98
98
}
99
99
100
- protected CloudBlobClient buildClient (AzureStorageSettings azureStorageSettings ) throws InvalidKeyException , URISyntaxException {
100
+ private static CloudBlobClient buildClient (AzureStorageSettings azureStorageSettings ) throws InvalidKeyException , URISyntaxException {
101
101
final CloudBlobClient client = createClient (azureStorageSettings );
102
102
// Set timeout option if the user sets cloud.azure.storage.timeout or
103
103
// cloud.azure.storage.xxx.timeout (it's negative by default)
@@ -115,12 +115,12 @@ protected CloudBlobClient buildClient(AzureStorageSettings azureStorageSettings)
115
115
return client ;
116
116
}
117
117
118
- protected CloudBlobClient createClient (AzureStorageSettings azureStorageSettings ) throws InvalidKeyException , URISyntaxException {
118
+ private static CloudBlobClient createClient (AzureStorageSettings azureStorageSettings ) throws InvalidKeyException , URISyntaxException {
119
119
final String connectionString = azureStorageSettings .buildConnectionString ();
120
120
return CloudStorageAccount .parse (connectionString ).createCloudBlobClient ();
121
121
}
122
122
123
- protected OperationContext buildOperationContext (AzureStorageSettings azureStorageSettings ) {
123
+ private static OperationContext buildOperationContext (AzureStorageSettings azureStorageSettings ) {
124
124
final OperationContext context = new OperationContext ();
125
125
context .setProxy (azureStorageSettings .getProxy ());
126
126
return context ;
@@ -146,24 +146,6 @@ public boolean doesContainerExist(String account, String container) throws URISy
146
146
return SocketAccess .doPrivilegedException (() -> blobContainer .exists (null , null , client .v2 ().get ()));
147
147
}
148
148
149
- public void deleteFiles (String account , String container , String path ) throws URISyntaxException , StorageException {
150
- final Tuple <CloudBlobClient , Supplier <OperationContext >> client = client (account );
151
- // container name must be lower case.
152
- logger .trace (() -> new ParameterizedMessage ("delete files container [{}], path [{}]" , container , path ));
153
- SocketAccess .doPrivilegedVoidException (() -> {
154
- // list the blobs using a flat blob listing mode
155
- final CloudBlobContainer blobContainer = client .v1 ().getContainerReference (container );
156
- for (final ListBlobItem blobItem : blobContainer .listBlobs (path , true , EnumSet .noneOf (BlobListingDetails .class ), null ,
157
- client .v2 ().get ())) {
158
- final String blobName = blobNameFromUri (blobItem .getUri ());
159
- logger .trace (() -> new ParameterizedMessage ("removing blob [{}] full URI was [{}]" , blobName , blobItem .getUri ()));
160
- // don't call {@code #deleteBlob}, use the same client
161
- final CloudBlockBlob azureBlob = blobContainer .getBlockBlobReference (blobName );
162
- azureBlob .delete (DeleteSnapshotsOption .NONE , null , null , client .v2 ().get ());
163
- }
164
- });
165
- }
166
-
167
149
/**
168
150
* Extract the blob name from a URI like https://myservice.azure.net/container/path/to/myfile
169
151
* It should remove the container part (first part of the path) and gives path/to/myfile
0 commit comments