use of com.microsoft.azure.storage.blob.BlockBlobURL in project geowebcache by GeoWebCache.
the class AzureBlobStore method delete.
@Override
public boolean delete(String layerName) throws StorageException {
checkNotNull(layerName, "layerName");
final String metadataKey = keyBuilder.layerMetadata(layerName);
final String layerPrefix = keyBuilder.forLayer(layerName);
// this might not be there, tolerant delete
try {
BlockBlobURL metadata = client.getBlockBlobURL(metadataKey);
int statusCode = metadata.delete().blockingGet().statusCode();
if (!HttpStatus.valueOf(statusCode).is2xxSuccessful()) {
return false;
}
} catch (RestException e) {
return false;
}
boolean layerExists = deleteManager.scheduleAsyncDelete(layerPrefix);
if (layerExists) {
listeners.sendLayerDeleted(layerName);
}
return layerExists;
}
use of com.microsoft.azure.storage.blob.BlockBlobURL in project geowebcache by GeoWebCache.
the class TemporaryAzureFolder method delete.
public void delete() {
checkState(isConfigured(), "client not configured.");
if (temporaryPrefix == null) {
return;
}
List<BlobItem> blobs = client.listBlobs(temporaryPrefix, Integer.MAX_VALUE);
for (BlobItem blob : blobs) {
BlockBlobURL blockBlobURL = client.getBlockBlobURL(blob.name());
int status = blockBlobURL.delete().blockingGet().statusCode();
assertTrue("Expected success but got " + status + " while deleting " + blob.name(), HttpStatus.valueOf(status).is2xxSuccessful());
}
}
Aggregations