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());
}
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;
}
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);
}
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);
}
});
}
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());
}
}
Aggregations