Search in sources :

Example 1 with CloudFileShare

use of com.microsoft.azure.storage.file.CloudFileShare in project zeppelin by apache.

the class AzureNotebookRepo method init.

@Override
public void init(ZeppelinConfiguration conf) throws IOException {
    this.conf = conf;
    user = conf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_USER);
    shareName = conf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_SHARE);
    try {
        CloudStorageAccount account = CloudStorageAccount.parse(conf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING));
        CloudFileClient client = account.createCloudFileClient();
        CloudFileShare share = client.getShareReference(shareName);
        share.createIfNotExists();
        CloudFileDirectory userDir = StringUtils.isBlank(user) ? share.getRootDirectoryReference() : share.getRootDirectoryReference().getDirectoryReference(user);
        userDir.createIfNotExists();
        rootDir = userDir.getDirectoryReference("notebook");
        rootDir.createIfNotExists();
    } catch (Exception e) {
        throw new IOException(e);
    }
}
Also used : CloudFileShare(com.microsoft.azure.storage.file.CloudFileShare) CloudFileDirectory(com.microsoft.azure.storage.file.CloudFileDirectory) CloudStorageAccount(com.microsoft.azure.storage.CloudStorageAccount) CloudFileClient(com.microsoft.azure.storage.file.CloudFileClient) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) StorageException(com.microsoft.azure.storage.StorageException)

Aggregations

CloudStorageAccount (com.microsoft.azure.storage.CloudStorageAccount)1 StorageException (com.microsoft.azure.storage.StorageException)1 CloudFileClient (com.microsoft.azure.storage.file.CloudFileClient)1 CloudFileDirectory (com.microsoft.azure.storage.file.CloudFileDirectory)1 CloudFileShare (com.microsoft.azure.storage.file.CloudFileShare)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1