use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class AddHDInsightAdditionalClusterImpl method getStorageAccountsFromResponseMessage.
//not using for now.
private static List<ClientStorageAccount> getStorageAccountsFromResponseMessage(String responseMessage) throws StorageAccountResolveException {
responseMessage = responseMessage.replace(" ", "");
Matcher matcher = PATTERN_DEFAULT_STORAGE.matcher(responseMessage);
String defaultStorageName = "";
try {
if (matcher.find()) {
String str = matcher.group();
defaultStorageName = str.split("[@.]")[2];
}
} catch (Exception e) {
throw new StorageAccountResolveException();
}
matcher = PATTER_STORAGE_KEY.matcher(responseMessage);
HashMap<String, String> storageKeysMap = new HashMap<String, String>();
while (matcher.find()) {
String str = matcher.group();
String[] strs = str.replace("\"", "").split(":");
String storageName = strs[0].split("\\.")[4];
storageKeysMap.put(storageName, strs[1]);
}
if (StringHelper.isNullOrWhiteSpace(defaultStorageName) || !storageKeysMap.containsKey(defaultStorageName)) {
throw new StorageAccountResolveException();
}
List<ClientStorageAccount> storageAccounts = new ArrayList<ClientStorageAccount>();
storageAccounts.add(new HDStorageAccount(null, defaultStorageName, storageKeysMap.get(defaultStorageName), false, null));
for (String storageName : storageKeysMap.keySet()) {
if (!storageName.equals(defaultStorageName)) {
storageAccounts.add(new HDStorageAccount(null, storageName, storageKeysMap.get(storageName), false, null));
}
}
return storageAccounts;
}
use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class ExternalStorageAccountForm method populateFullStorageAccount.
public void populateFullStorageAccount() {
ClientStorageAccount clientStorageAccount = new ClientStorageAccount(accountNameTextField.getText());
clientStorageAccount.setPrimaryKey(accountKeyTextField.getText());
clientStorageAccount.setUseCustomEndpoints(specifyCustomEndpointsRadioButton.getSelection());
if (specifyCustomEndpointsRadioButton.getSelection()) {
clientStorageAccount.setBlobsUri(blobURLTextField.getText());
clientStorageAccount.setQueuesUri(queueURLTextField.getText());
clientStorageAccount.setTablesUri(tableURLTextField.getText());
} else {
clientStorageAccount.setProtocol(useHTTPRadioButton.getSelection() ? HTTP : HTTPS);
}
fullStorageAccount = clientStorageAccount;
}
use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class BlobExplorerFileEditorProvider method accept.
@Override
public boolean accept(@NotNull Project project, @NotNull VirtualFile virtualFile) {
StorageAccount storageAccount = virtualFile.getUserData(UIHelperImpl.STORAGE_KEY);
ClientStorageAccount clientStorageAccount = virtualFile.getUserData(UIHelperImpl.CLIENT_STORAGE_KEY);
BlobContainer blobContainer = virtualFile.getUserData(CONTAINER_KEY);
return ((storageAccount != null || clientStorageAccount != null) && blobContainer != null);
}
use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class AttachExternalStorageAccountAction method actionPerformed.
@Override
public void actionPerformed(NodeActionEvent e) {
final ExternalStorageAccountForm form = new ExternalStorageAccountForm((Project) storageModule.getProject());
form.setTitle("Attach External Storage Account");
form.setOnFinish(new Runnable() {
@Override
public void run() {
ClientStorageAccount storageAccount = form.getStorageAccount();
ClientStorageAccount fullStorageAccount = form.getFullStorageAccount();
for (ClientStorageAccount clientStorageAccount : ExternalStorageHelper.getList(storageModule.getProject())) {
String name = storageAccount.getName();
if (clientStorageAccount.getName().equals(name)) {
JOptionPane.showMessageDialog(form.getContentPane(), "Storage account with name '" + name + "' already exists.", "Azure Explorer", JOptionPane.ERROR_MESSAGE);
return;
}
}
ExternalStorageNode node = new ExternalStorageNode(storageModule, fullStorageAccount);
storageModule.addChildNode(node);
ExternalStorageHelper.add(storageAccount);
}
});
form.show();
}
use of com.microsoft.tooling.msservices.model.storage.ClientStorageAccount in project azure-tools-for-java by Microsoft.
the class ExternalStorageAccountForm method populateStorageAccount.
public void populateStorageAccount() {
ClientStorageAccount clientStorageAccount = new ClientStorageAccount(accountNameTextField.getText());
clientStorageAccount.setUseCustomEndpoints(specifyCustomEndpointsRadioButton.getSelection());
if (rememberAccountKeyCheckBox.getSelection()) {
clientStorageAccount.setPrimaryKey(accountKeyTextField.getText());
}
if (specifyCustomEndpointsRadioButton.getSelection()) {
clientStorageAccount.setBlobsUri(blobURLTextField.getText());
clientStorageAccount.setQueuesUri(queueURLTextField.getText());
clientStorageAccount.setTablesUri(tableURLTextField.getText());
} else {
clientStorageAccount.setProtocol(useHTTPRadioButton.getSelection() ? HTTP : HTTPS);
}
storageAccount = clientStorageAccount;
}
Aggregations