Search in sources :

Example 1 with Deployment

use of com.intellij.remoteServer.runtime.Deployment in project intellij-community by JetBrains.

the class ApplicationActionBase method getApplicationRuntime.

protected T getApplicationRuntime(DeploymentNode node) {
    Deployment deployment = getDeployment(node);
    if (deployment == null) {
        return null;
    }
    DeploymentRuntime deploymentRuntime = deployment.getRuntime();
    return ObjectUtils.tryCast(deploymentRuntime, getApplicationRuntimeClass());
}
Also used : DeploymentRuntime(com.intellij.remoteServer.runtime.deployment.DeploymentRuntime) Deployment(com.intellij.remoteServer.runtime.Deployment)

Example 2 with Deployment

use of com.intellij.remoteServer.runtime.Deployment in project intellij-community by JetBrains.

the class ServerConnectionImpl method getDeployments.

@NotNull
@Override
public Collection<Deployment> getDeployments() {
    Set<Deployment> result = new LinkedHashSet<>();
    Map<Deployment, DeploymentImpl> orderedDeployments = new TreeMap<>(getServer().getType().getDeploymentComparator());
    synchronized (myLocalDeployments) {
        synchronized (myRemoteDeployments) {
            for (LocalDeploymentImpl localDeployment : myLocalDeployments.values()) {
                localDeployment.setRemoteDeployment(null);
                orderedDeployments.put(localDeployment, localDeployment);
            }
            result.addAll(orderedDeployments.keySet());
            for (DeploymentImpl remoteDeployment : myRemoteDeployments.values()) {
                DeploymentImpl deployment = orderedDeployments.get(remoteDeployment);
                if (deployment != null) {
                    if (deployment instanceof LocalDeploymentImpl) {
                        ((LocalDeploymentImpl) deployment).setRemoteDeployment(remoteDeployment);
                    }
                } else {
                    orderedDeployments.put(remoteDeployment, remoteDeployment);
                }
            }
            result.addAll(orderedDeployments.keySet());
        }
    }
    return result;
}
Also used : Deployment(com.intellij.remoteServer.runtime.Deployment) LocalDeploymentImpl(com.intellij.remoteServer.impl.runtime.deployment.LocalDeploymentImpl) DeploymentImpl(com.intellij.remoteServer.impl.runtime.deployment.DeploymentImpl) LocalDeploymentImpl(com.intellij.remoteServer.impl.runtime.deployment.LocalDeploymentImpl) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with Deployment

use of com.intellij.remoteServer.runtime.Deployment in project intellij-community by JetBrains.

the class CloudServerRuntimeInstance method computeDeployments.

@Override
public void computeDeployments(@NotNull final ComputeDeploymentsCallback callback) {
    getTaskExecutor().submit(() -> {
        try {
            for (CloudApplicationRuntime application : getApplications()) {
                Deployment deployment = callback.addDeployment(application.getApplicationName(), application, application.getStatus(), application.getStatusText());
                application.setDeploymentModel(deployment);
            }
            callback.succeeded();
        } catch (ServerRuntimeException e) {
            callback.errorOccurred(e.getMessage());
        }
    }, callback);
}
Also used : Deployment(com.intellij.remoteServer.runtime.Deployment)

Example 4 with Deployment

use of com.intellij.remoteServer.runtime.Deployment in project intellij-community by JetBrains.

the class ServerConnectionImpl method undeploy.

@Override
public void undeploy(@NotNull Deployment deployment, @NotNull final DeploymentRuntime runtime) {
    final String deploymentName = deployment.getName();
    final DeploymentImpl deploymentImpl;
    final Map<String, ? extends DeploymentImpl> deploymentsMap;
    synchronized (myLocalDeployments) {
        synchronized (myRemoteDeployments) {
            DeploymentImpl localDeployment = myLocalDeployments.get(deploymentName);
            if (localDeployment != null) {
                deploymentImpl = localDeployment;
                deploymentsMap = myLocalDeployments;
            } else {
                DeploymentImpl remoteDeployment = myRemoteDeployments.get(deploymentName);
                if (remoteDeployment != null) {
                    deploymentImpl = remoteDeployment;
                    deploymentsMap = myRemoteDeployments;
                } else {
                    deploymentImpl = null;
                    deploymentsMap = null;
                }
            }
            if (deploymentImpl != null) {
                deploymentImpl.changeState(DeploymentStatus.DEPLOYED, DeploymentStatus.UNDEPLOYING, null, null);
            }
        }
    }
    myEventDispatcher.queueDeploymentsChanged(this);
    DeploymentLogManagerImpl logManager = myLogManagers.get(deploymentName);
    final LoggingHandlerImpl loggingHandler = logManager == null ? null : logManager.getMainLoggingHandler();
    final Consumer<String> logConsumer = message -> {
        if (loggingHandler == null) {
            LOG.info(message);
        } else {
            loggingHandler.printlnSystemMessage(message);
        }
    };
    logConsumer.consume("Undeploying '" + deploymentName + "'...");
    runtime.undeploy(new DeploymentRuntime.UndeploymentTaskCallback() {

        @Override
        public void succeeded() {
            logConsumer.consume("'" + deploymentName + "' has been undeployed successfully.");
            if (deploymentImpl != null) {
                synchronized (deploymentsMap) {
                    if (deploymentImpl.changeState(DeploymentStatus.UNDEPLOYING, DeploymentStatus.NOT_DEPLOYED, null, null)) {
                        deploymentsMap.remove(deploymentName);
                    }
                }
            }
            DeploymentLogManagerImpl logManager = myLogManagers.remove(deploymentName);
            if (logManager != null) {
                logManager.disposeLogs();
            }
            myEventDispatcher.queueDeploymentsChanged(ServerConnectionImpl.this);
            computeDeployments(myRuntimeInstance, EmptyRunnable.INSTANCE);
        }

        @Override
        public void errorOccurred(@NotNull String errorMessage) {
            logConsumer.consume("Failed to undeploy '" + deploymentName + "': " + errorMessage);
            if (deploymentImpl != null) {
                synchronized (deploymentsMap) {
                    deploymentImpl.changeState(DeploymentStatus.UNDEPLOYING, DeploymentStatus.DEPLOYED, errorMessage, runtime);
                }
            }
            myEventDispatcher.queueDeploymentsChanged(ServerConnectionImpl.this);
        }
    });
}
Also used : com.intellij.remoteServer.runtime.deployment(com.intellij.remoteServer.runtime.deployment) java.util(java.util) ExecutionException(com.intellij.execution.ExecutionException) DeploymentLogManagerImpl(com.intellij.remoteServer.impl.runtime.log.DeploymentLogManagerImpl) ContainerUtil(com.intellij.util.containers.ContainerUtil) DeploymentConfiguration(com.intellij.remoteServer.configuration.deployment.DeploymentConfiguration) Deployment(com.intellij.remoteServer.runtime.Deployment) Project(com.intellij.openapi.project.Project) Logger(com.intellij.openapi.diagnostic.Logger) LocalDeploymentImpl(com.intellij.remoteServer.impl.runtime.deployment.LocalDeploymentImpl) DebugConnectionData(com.intellij.remoteServer.runtime.deployment.debug.DebugConnectionData) DebugConnector(com.intellij.remoteServer.runtime.deployment.debug.DebugConnector) ConnectionStatus(com.intellij.remoteServer.runtime.ConnectionStatus) RemoteServer(com.intellij.remoteServer.configuration.RemoteServer) LoggingHandlerImpl(com.intellij.remoteServer.impl.runtime.log.LoggingHandlerImpl) DebugConnectionDataNotAvailableException(com.intellij.remoteServer.runtime.deployment.debug.DebugConnectionDataNotAvailableException) DeploymentTaskImpl(com.intellij.remoteServer.impl.runtime.deployment.DeploymentTaskImpl) Nullable(org.jetbrains.annotations.Nullable) ServerConnection(com.intellij.remoteServer.runtime.ServerConnection) ApplicationManager(com.intellij.openapi.application.ApplicationManager) DeploymentImpl(com.intellij.remoteServer.impl.runtime.deployment.DeploymentImpl) ServerConnector(com.intellij.remoteServer.runtime.ServerConnector) NotNull(org.jetbrains.annotations.NotNull) Consumer(com.intellij.util.Consumer) EmptyRunnable(com.intellij.openapi.util.EmptyRunnable) LoggingHandlerImpl(com.intellij.remoteServer.impl.runtime.log.LoggingHandlerImpl) LocalDeploymentImpl(com.intellij.remoteServer.impl.runtime.deployment.LocalDeploymentImpl) DeploymentImpl(com.intellij.remoteServer.impl.runtime.deployment.DeploymentImpl) DeploymentLogManagerImpl(com.intellij.remoteServer.impl.runtime.log.DeploymentLogManagerImpl)

Example 5 with Deployment

use of com.intellij.remoteServer.runtime.Deployment in project intellij-community by JetBrains.

the class CloudSourceApplicationConfigurable method setupExistingApplications.

private void setupExistingApplications(Collection<Deployment> deployments) {
    JComboBox existingComboBox = getExistingComboBox();
    existingComboBox.removeAllItems();
    for (Deployment deployment : deployments) {
        existingComboBox.addItem(deployment.getName());
    }
}
Also used : Deployment(com.intellij.remoteServer.runtime.Deployment)

Aggregations

Deployment (com.intellij.remoteServer.runtime.Deployment)5 DeploymentImpl (com.intellij.remoteServer.impl.runtime.deployment.DeploymentImpl)2 LocalDeploymentImpl (com.intellij.remoteServer.impl.runtime.deployment.LocalDeploymentImpl)2 NotNull (org.jetbrains.annotations.NotNull)2 ExecutionException (com.intellij.execution.ExecutionException)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 Logger (com.intellij.openapi.diagnostic.Logger)1 Project (com.intellij.openapi.project.Project)1 EmptyRunnable (com.intellij.openapi.util.EmptyRunnable)1 RemoteServer (com.intellij.remoteServer.configuration.RemoteServer)1 DeploymentConfiguration (com.intellij.remoteServer.configuration.deployment.DeploymentConfiguration)1 DeploymentTaskImpl (com.intellij.remoteServer.impl.runtime.deployment.DeploymentTaskImpl)1 DeploymentLogManagerImpl (com.intellij.remoteServer.impl.runtime.log.DeploymentLogManagerImpl)1 LoggingHandlerImpl (com.intellij.remoteServer.impl.runtime.log.LoggingHandlerImpl)1 ConnectionStatus (com.intellij.remoteServer.runtime.ConnectionStatus)1 ServerConnection (com.intellij.remoteServer.runtime.ServerConnection)1 ServerConnector (com.intellij.remoteServer.runtime.ServerConnector)1 com.intellij.remoteServer.runtime.deployment (com.intellij.remoteServer.runtime.deployment)1 DeploymentRuntime (com.intellij.remoteServer.runtime.deployment.DeploymentRuntime)1 DebugConnectionData (com.intellij.remoteServer.runtime.deployment.debug.DebugConnectionData)1