@Override public CloudBlobDirectoryWrapper getDirectoryReference(String relativePath) throws URISyntaxException, StorageException { CloudBlobDirectory dir = container.getDirectoryReference(relativePath); return new SASCloudBlobDirectoryWrapperImpl(dir); }
@Override public CloudBlobDirectoryWrapper getDirectoryReference(String relativePath) throws URISyntaxException, StorageException { CloudBlobDirectory dir = container.getDirectoryReference(relativePath); return new CloudBlobDirectoryWrapperImpl(dir); }
public static CloudBlobDirectory cloudBlobDirectoryFrom(StorageCredentials credentials, String uri, String dir) throws URISyntaxException, StorageException { StorageUri storageUri = new StorageUri(new URI(uri)); CloudBlobContainer container = new CloudBlobContainer(storageUri, credentials); return container.getDirectoryReference(dir); }
public static CloudBlobDirectory cloudBlobDirectoryFrom(StorageCredentials credentials, String uri, String dir) throws URISyntaxException, StorageException { StorageUri storageUri = new StorageUri(new URI(uri)); CloudBlobContainer container = new CloudBlobContainer(storageUri, credentials); return container.getDirectoryReference(dir); }
/** * Gets the {@link CloudBlobDirectory} object for the logs for a specific storage service. * * @param service * A {@link StorageService} enumeration value that indicates which storage service to use. * @return * A {@link CloudBlobDirectory} object. * @throws URISyntaxException * @throws StorageException */ public CloudBlobDirectory getLogDirectory(StorageService service) throws URISyntaxException, StorageException { Utility.assertNotNull("service", service); return this.blobClient.getContainerReference(this.LogContainer).getDirectoryReference( service.toString().toLowerCase(Locale.US)); }
/** * Gets the {@link CloudBlobDirectory} object for the logs for a specific storage service. * * @param service * A {@link StorageService} enumeration value that indicates which storage service to use. * @return * A {@link CloudBlobDirectory} object. * @throws URISyntaxException * @throws StorageException */ public CloudBlobDirectory getLogDirectory(StorageService service) throws URISyntaxException, StorageException { Utility.assertNotNull("service", service); return this.blobClient.getContainerReference(this.LogContainer).getDirectoryReference( service.toString().toLowerCase(Locale.US)); }
@Override protected SegmentNodeStorePersistence getPersistence() throws IOException { try { return new AzurePersistence(container.getDirectoryReference("oak")); } catch (URISyntaxException e) { throw new IOException(e); } } }
@Override public void clean() throws IOException { try { AzureUtilities.deleteAllEntries(container.getDirectoryReference(dir)); } catch (URISyntaxException e) { throw new IOException(e); } }
@Override protected SegmentNodeStorePersistence getPersistence() throws Exception { return new AzurePersistence(container.getDirectoryReference("oak")); }
private void addMetadataRecordImpl(final InputStream input, String name, long recordLength) throws DataStoreException { try { CloudBlobDirectory metaDir = getAzureContainer().getDirectoryReference(META_DIR_NAME); CloudBlockBlob blob = metaDir.getBlockBlobReference(name); blob.upload(input, recordLength); } catch (StorageException e) { LOG.info("Error adding metadata record. metadataName={} length={}", name, recordLength, e); throw new DataStoreException(e); } catch (URISyntaxException | IOException e) { throw new DataStoreException(e); } }
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 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); }
@Before public void setup() throws StorageException, InvalidKeyException, URISyntaxException { container = azurite.getContainer("oak-test"); journal = new AzureJournalFile(container.getDirectoryReference("journal"), "journal.log", 10); }
@NotNull public BlobDirectory getRootDirectory(@NotNull String connectionString, @NotNull BlobContainer blobContainer) throws AzureCmdException { try { CloudBlobClient client = getCloudBlobClient(connectionString); CloudBlobContainer container = client.getContainerReference(blobContainer.getName()); CloudBlobDirectory directory = container.getDirectoryReference(""); String uri = directory.getUri() != null ? directory.getUri().toString() : ""; return new BlobDirectory("", uri, blobContainer.getName(), ""); } catch (Throwable t) { throw new AzureCmdException("Error retrieving the root Blob Directory", t); } }
@Test public void testManifest() throws URISyntaxException, IOException { ManifestFile manifestFile = new AzurePersistence(container.getDirectoryReference("oak")).getManifestFile(); assertFalse(manifestFile.exists()); Properties props = new Properties(); props.setProperty("xyz", "abc"); props.setProperty("version", "123"); manifestFile.save(props); Properties loaded = manifestFile.load(); assertEquals(props, loaded); }
private void testGetDirectoryAbsoluteUriAppended(String delimiter, CloudBlobContainer container) throws URISyntaxException { CloudBlobDirectory dir = container.getDirectoryReference(container.getUri().toString()); assertEquals(PathUtility.appendPathToSingleUri(container.getUri(), container.getUri().toString() + delimiter), dir.getUri()); dir = container.getDirectoryReference(container.getUri().toString() + "/" + "TopDir1" + delimiter); assertEquals( PathUtility.appendPathToSingleUri(container.getUri(), container.getUri().toString() + "/" + "TopDir1" + delimiter), dir.getUri()); }
@Before @Override public void setUp() throws IOException { try { container = azurite.getContainer("oak-test"); archiveManager = new AzurePersistence(container.getDirectoryReference("oak")).createArchiveManager(true, false, new IOMonitorAdapter(), new FileStoreMonitorAdapter()); } catch (StorageException | InvalidKeyException | URISyntaxException e) { throw new IOException(e); } }
protected JournalReader createJournalReader(String s) throws IOException { try { CloudAppendBlob blob = container.getAppendBlobReference("journal/journal.log.001"); blob.createOrReplace(); blob.appendText(s); return new JournalReader(new AzureJournalFile(container.getDirectoryReference("journal"), "journal.log")); } catch (StorageException | URISyntaxException e) { throw new IOException(e); } } }
@Before @Override public void setUp() throws IOException { try { monitor = new TestFileStoreMonitor(); container = azurite.getContainer("oak-test"); archiveManager = new AzurePersistence(container.getDirectoryReference("oak")).createArchiveManager(true, false, new IOMonitorAdapter(), monitor); } catch (StorageException | InvalidKeyException | URISyntaxException e) { throw new IOException(e); } } }
private void testGetSubdirectoryAndTraverseBackToParent(String delimiter, CloudBlobContainer container) throws URISyntaxException, StorageException { CloudBlobDirectory directory = container.getDirectoryReference("TopDir1" + delimiter); CloudBlobDirectory subDirectory = directory.getDirectoryReference("MidDir1" + delimiter); CloudBlobDirectory parent = subDirectory.getParent(); assertEquals(parent.getPrefix(), directory.getPrefix()); assertEquals(parent.getUri(), directory.getUri()); }