Search in sources :

Example 1 with DockerContainer

use of com.microsoft.azure.docker.model.DockerContainer in project azure-tools-for-java by Microsoft.

the class DockerContainerNode method refreshItems.

@Override
protected void refreshItems() throws AzureCmdException {
    try {
        Map<String, DockerImage> dockerImages = AzureDockerImageOps.getImages(dockerHost);
        Map<String, DockerContainer> dockerContainers = AzureDockerContainerOps.getContainers(dockerHost);
        AzureDockerContainerOps.setContainersAndImages(dockerContainers, dockerImages);
        dockerHost.dockerImages = dockerImages;
        if (dockerContainers != null) {
            DockerContainer updatedDockerContainer = dockerContainers.get(dockerContainer.name);
            if (updatedDockerContainer != null) {
                dockerContainer = updatedDockerContainer;
                setDockerContainerIconPath();
            }
        }
    } catch (Exception e) {
        DefaultLoader.getUIHelper().logError(e.getMessage(), e);
    }
}
Also used : DockerContainer(com.microsoft.azure.docker.model.DockerContainer) DockerImage(com.microsoft.azure.docker.model.DockerImage) AzureCmdException(com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)

Example 2 with DockerContainer

use of com.microsoft.azure.docker.model.DockerContainer in project azure-tools-for-java by Microsoft.

the class DockerHostNode method refreshDockerHostInstance.

private void refreshDockerHostInstance(VirtualMachine vm) {
    if (vm != null) {
        DockerHost updatedDockerHost = AzureDockerVMOps.getDockerHost(vm, dockerManager.getDockerVaultsMap());
        if (updatedDockerHost != null) {
            updatedDockerHost.sid = dockerHost.sid;
            updatedDockerHost.hostVM.sid = dockerHost.hostVM.sid;
            if (updatedDockerHost.certVault == null) {
                updatedDockerHost.certVault = dockerHost.certVault;
                updatedDockerHost.hasPwdLogIn = dockerHost.hasPwdLogIn;
                updatedDockerHost.hasSSHLogIn = dockerHost.hasSSHLogIn;
                updatedDockerHost.isTLSSecured = dockerHost.isTLSSecured;
            }
            dockerManager.updateDockerHost(updatedDockerHost);
            dockerHost = updatedDockerHost;
            if (dockerHost.certVault != null) {
                try {
                    // it might throw here if the credentials are invalid
                    Map<String, DockerImage> dockerImages = AzureDockerImageOps.getImages(dockerHost);
                    Map<String, DockerContainer> dockerContainers = AzureDockerContainerOps.getContainers(dockerHost);
                    AzureDockerContainerOps.setContainersAndImages(dockerContainers, dockerImages);
                    dockerHost.dockerImages = dockerImages;
                } catch (Exception e) {
                    DefaultLoader.getUIHelper().logError(e.getMessage(), e);
                }
            }
            setIconPath(getDockerHostIcon());
            for (DockerImage dockerImage : updatedDockerHost.dockerImages.values()) {
                try {
                    addChildNode(new DockerImageNode(this, dockerManager, updatedDockerHost, dockerImage));
                } catch (Exception ignored) {
                }
            }
        }
    }
}
Also used : DockerContainer(com.microsoft.azure.docker.model.DockerContainer) DockerHost(com.microsoft.azure.docker.model.DockerHost) DockerImage(com.microsoft.azure.docker.model.DockerImage) AzureCmdException(com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)

Example 3 with DockerContainer

use of com.microsoft.azure.docker.model.DockerContainer in project azure-tools-for-java by Microsoft.

the class DockerImageNode method refreshItems.

@Override
protected void refreshItems() {
    try {
        Map<String, DockerContainer> dockerContainers = AzureDockerContainerOps.getContainers(dockerHost);
        AzureDockerContainerOps.setContainersAndImages(dockerContainers, dockerHost.dockerImages);
        if (dockerHost.dockerImages != null) {
            dockerImage = dockerHost.dockerImages.get(AzureDockerImageOps.getDockerImageMapKey(dockerImage));
            if (dockerImage != null) {
                for (DockerContainer dockerContainer : dockerImage.containers.values()) {
                    addChildNode(new DockerContainerNode(this, dockerManager, dockerHost, dockerContainer));
                }
            }
        }
    } catch (Exception e) {
        DefaultLoader.getUIHelper().logError(e.getMessage(), e);
    }
}
Also used : DockerContainer(com.microsoft.azure.docker.model.DockerContainer) AzureCmdException(com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)

Aggregations

DockerContainer (com.microsoft.azure.docker.model.DockerContainer)3 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)3 DockerImage (com.microsoft.azure.docker.model.DockerImage)2 DockerHost (com.microsoft.azure.docker.model.DockerHost)1