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