Search in sources :

Example 1 with Queue

use of com.microsoft.tooling.msservices.model.storage.Queue in project azure-tools-for-java by Microsoft.

the class QueueExplorerFileEditorProvider method accept.

@Override
public boolean accept(@NotNull Project project, @NotNull VirtualFile virtualFile) {
    StorageAccount storageAccount = virtualFile.getUserData(UIHelperImpl.STORAGE_KEY);
    Queue queue = virtualFile.getUserData(QUEUE_KEY);
    return (storageAccount != null && queue != null);
}
Also used : StorageAccount(com.microsoft.azure.management.storage.StorageAccount) ClientStorageAccount(com.microsoft.tooling.msservices.model.storage.ClientStorageAccount) Queue(com.microsoft.tooling.msservices.model.storage.Queue)

Example 2 with Queue

use of com.microsoft.tooling.msservices.model.storage.Queue in project azure-tools-for-java by Microsoft.

the class CreateQueueForm method okPressed.

@Override
protected void okPressed() {
    final String name = nameTextField.getText();
    if (name.length() < NAME_MIN || name.length() > NAME_MAX || !name.matches(NAME_REGEX)) {
        DefaultLoader.getUIHelper().showError("Queue names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.\n" + "Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not permitted in container names.\n" + "All letters in a container name must be lowercase.\n" + "Queue names must be from 3 through 63 characters long.", "Azure Explorer");
        return;
    }
    DefaultLoader.getIdeHelper().runInBackground(null, "Creating queue...", false, true, "Creating queue...", new Runnable() {

        public void run() {
            //                try {
            /*for (Queue queue : StorageClientSDKManager.getManager().getQueues(storageAccount)) {
                        if (queue.getName().equals(name)) {
                            DefaultLoader.getIdeHelper().invokeLater(new Runnable() {
                                @Override
                                public void run() {
                                    DefaultLoader.getUIHelper().showError("A queue with the specified name already exists.", "Azure Explorer");
                                }
                            });

                            return;
                        }
                    }
*/
            Queue queue = new Queue(name, "", 0);
            if (onCreate != null) {
                DefaultLoader.getIdeHelper().invokeLater(onCreate);
            }
        //                } catch (AzureCmdException e) {
        //                    DefaultLoader.getUIHelper().showException("Error creating table", e, "Azure explorer", false, true);
        //                }
        }
    });
    super.okPressed();
}
Also used : Queue(com.microsoft.tooling.msservices.model.storage.Queue)

Example 3 with Queue

use of com.microsoft.tooling.msservices.model.storage.Queue in project azure-tools-for-java by Microsoft.

the class StorageClientSDKManager method getQueues.

@NotNull
public List<Queue> getQueues(@NotNull StorageAccount storageAccount) throws AzureCmdException {
    List<Queue> qList = new ArrayList<Queue>();
    try {
        CloudQueueClient client = getCloudQueueClient(storageAccount);
        for (CloudQueue cloudQueue : client.listQueues(null, QueueListingDetails.ALL, null, null)) {
            String uri = cloudQueue.getUri() != null ? cloudQueue.getUri().toString() : "";
            qList.add(new Queue(Strings.nullToEmpty(cloudQueue.getName()), uri, cloudQueue.getApproximateMessageCount()));
        }
        return qList;
    } catch (Throwable t) {
        throw new AzureCmdException("Error retrieving the Queue list", t);
    }
}
Also used : CloudQueueClient(com.microsoft.azure.storage.queue.CloudQueueClient) AzureCmdException(com.microsoft.azuretools.azurecommons.helpers.AzureCmdException) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue) Queue(com.microsoft.tooling.msservices.model.storage.Queue) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull)

Example 4 with Queue

use of com.microsoft.tooling.msservices.model.storage.Queue in project azure-tools-for-java by Microsoft.

the class QueueExplorerFileEditorProvider method createEditor.

@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile virtualFile) {
    QueueFileEditor queueFileEditor = new QueueFileEditor(project);
    StorageAccount storageAccount = virtualFile.getUserData(UIHelperImpl.STORAGE_KEY);
    Queue queue = virtualFile.getUserData(QUEUE_KEY);
    queueFileEditor.setQueue(queue);
    //        queueFileEditor.setStorageAccount(storageAccount);
    queueFileEditor.fillGrid();
    return queueFileEditor;
}
Also used : StorageAccount(com.microsoft.azure.management.storage.StorageAccount) ClientStorageAccount(com.microsoft.tooling.msservices.model.storage.ClientStorageAccount) Queue(com.microsoft.tooling.msservices.model.storage.Queue) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Queue (com.microsoft.tooling.msservices.model.storage.Queue)4 StorageAccount (com.microsoft.azure.management.storage.StorageAccount)2 ClientStorageAccount (com.microsoft.tooling.msservices.model.storage.ClientStorageAccount)2 CloudQueue (com.microsoft.azure.storage.queue.CloudQueue)1 CloudQueueClient (com.microsoft.azure.storage.queue.CloudQueueClient)1 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)1 NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)1 NotNull (org.jetbrains.annotations.NotNull)1