use of com.microsoft.azure.storage.StorageException in project jackrabbit-oak by apache.
the class AzureBlobStoreBackend method deleteRecord.
@Override
public void deleteRecord(DataIdentifier identifier) throws DataStoreException {
if (null == identifier)
throw new NullPointerException("identifier");
String key = getKeyName(identifier);
long start = System.currentTimeMillis();
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
boolean result = getAzureContainer().getBlockBlobReference(key).deleteIfExists();
LOG.debug("Blob {}. identifier={} duration={}", result ? "deleted" : "delete requested, but it does not exist (perhaps already deleted)", key, (System.currentTimeMillis() - start));
} catch (StorageException e) {
LOG.info("Error deleting blob. identifier={}", key, e);
throw new DataStoreException(e);
} catch (URISyntaxException e) {
throw new DataStoreException(e);
} finally {
if (contextClassLoader != null) {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}
}
use of com.microsoft.azure.storage.StorageException in project elasticsearch by elastic.
the class AzureBlobStoreContainerTests method newBlobStore.
@Override
protected BlobStore newBlobStore() throws IOException {
try {
RepositoryMetaData repositoryMetaData = new RepositoryMetaData("azure", "ittest", Settings.EMPTY);
AzureStorageServiceMock client = new AzureStorageServiceMock();
return new AzureBlobStore(repositoryMetaData, Settings.EMPTY, client);
} catch (URISyntaxException | StorageException e) {
throw new IOException(e);
}
}
use of com.microsoft.azure.storage.StorageException in project druid by druid-io.
the class AzureDataSegmentKillerTest method killWithErrorTest.
@Test(expected = SegmentLoadingException.class)
public void killWithErrorTest() throws SegmentLoadingException, URISyntaxException, StorageException {
String dirPath = Paths.get(blobPath).getParent().toString();
expect(azureStorage.emptyCloudBlobDirectory(containerName, dirPath)).andThrow(new StorageException("", "", 400, null, null));
replayAll();
AzureDataSegmentKiller killer = new AzureDataSegmentKiller(azureStorage);
killer.kill(dataSegment);
verifyAll();
}
use of com.microsoft.azure.storage.StorageException in project zeppelin by apache.
the class AzureNotebookRepo method getNote.
private Note getNote(String noteId) throws IOException {
InputStream ins = null;
try {
CloudFileDirectory dir = rootDir.getDirectoryReference(noteId);
CloudFile file = dir.getFileReference("note.json");
ins = file.openRead();
} catch (URISyntaxException | StorageException e) {
String msg = String.format("Error reading notebook %s from Azure storage", noteId);
LOG.error(msg, e);
throw new IOException(msg, e);
}
String json = IOUtils.toString(ins, conf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_ENCODING));
ins.close();
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setPrettyPrinting();
Gson gson = gsonBuilder.registerTypeAdapter(Date.class, new NotebookImportDeserializer()).create();
Note note = gson.fromJson(json, Note.class);
for (Paragraph p : note.getParagraphs()) {
if (p.getStatus() == Job.Status.PENDING || p.getStatus() == Job.Status.RUNNING) {
p.setStatus(Job.Status.ABORT);
}
}
return note;
}
use of com.microsoft.azure.storage.StorageException in project zeppelin by apache.
the class AzureNotebookRepo method remove.
@Override
public void remove(String noteId, AuthenticationInfo subject) throws IOException {
try {
CloudFileDirectory dir = rootDir.getDirectoryReference(noteId);
delete(dir);
} catch (URISyntaxException | StorageException e) {
String msg = String.format("Error deleting notebook %s from Azure storage", noteId);
LOG.error(msg, e);
throw new IOException(msg, e);
}
}
Aggregations