mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remote servers: CloudBees migrated to new api
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
package com.intellij.remoteServer.configuration;
|
||||
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public abstract class ServerConfigurationBase<Self extends ServerConfigurationBase<Self>> extends ServerConfiguration implements PersistentStateComponent<Self> {
|
||||
@Override
|
||||
public PersistentStateComponent<?> getSerializer() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Self getState() {
|
||||
return (Self)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(Self state) {
|
||||
XmlSerializerUtil.copyBean(state, this);
|
||||
}
|
||||
}
|
||||
+8
@@ -18,10 +18,14 @@ package com.intellij.remoteServer.configuration.deployment;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.module.ModulePointer;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactPointer;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
@@ -33,6 +37,10 @@ public abstract class DeploymentSourceUtil {
|
||||
@NotNull
|
||||
public abstract ArtifactDeploymentSource createArtifactDeploymentSource(@NotNull ArtifactPointer artifactPointer);
|
||||
|
||||
@NotNull
|
||||
public abstract List<DeploymentSource> createArtifactDeploymentSources(@NotNull Project project,
|
||||
@NotNull Collection<? extends Artifact> artifacts);
|
||||
|
||||
@NotNull
|
||||
public abstract ModuleDeploymentSource createModuleDeploymentSource(@NotNull ModulePointer modulePointer);
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
public abstract class ServerConnector<D extends DeploymentConfiguration> {
|
||||
public abstract void connect(@NotNull ConnectionCallback<D> callback);
|
||||
|
||||
public abstract void disconnect();
|
||||
|
||||
public interface ConnectionCallback<D extends DeploymentConfiguration> extends RemoteOperationCallback {
|
||||
void connected(@NotNull ServerRuntimeInstance<D> serverRuntimeInstance);
|
||||
}
|
||||
|
||||
+2
@@ -22,6 +22,8 @@ public abstract class ServerRuntimeInstance<D extends DeploymentConfiguration> {
|
||||
return source.getPresentableName();
|
||||
}
|
||||
|
||||
public abstract void disconnect();
|
||||
|
||||
public interface DeploymentOperationCallback extends RemoteOperationCallback {
|
||||
void succeeded(@NotNull DeploymentRuntime deployment);
|
||||
}
|
||||
|
||||
+17
@@ -18,6 +18,7 @@ package com.intellij.remoteServer.impl.configuration.deployment;
|
||||
import com.intellij.openapi.module.ModulePointer;
|
||||
import com.intellij.openapi.module.ModulePointerManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactPointer;
|
||||
import com.intellij.packaging.artifacts.ArtifactPointerManager;
|
||||
import com.intellij.remoteServer.configuration.deployment.ArtifactDeploymentSource;
|
||||
@@ -27,6 +28,10 @@ import com.intellij.remoteServer.configuration.deployment.ModuleDeploymentSource
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
@@ -37,6 +42,18 @@ public class DeploymentSourceUtilImpl extends DeploymentSourceUtil {
|
||||
return new ArtifactDeploymentSourceImpl(artifactPointer);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DeploymentSource> createArtifactDeploymentSources(@NotNull Project project,
|
||||
@NotNull Collection<? extends Artifact> artifacts) {
|
||||
List<DeploymentSource> sources = new ArrayList<DeploymentSource>();
|
||||
ArtifactPointerManager pointerManager = ArtifactPointerManager.getInstance(project);
|
||||
for (Artifact artifact : artifacts) {
|
||||
sources.add(createArtifactDeploymentSource(pointerManager.createPointer(artifact)));
|
||||
}
|
||||
return sources;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ModuleDeploymentSource createModuleDeploymentSource(@NotNull ModulePointer modulePointer) {
|
||||
|
||||
+4
-2
@@ -85,8 +85,10 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
|
||||
private void doDisconnect() {
|
||||
if (myStatus == ConnectionStatus.CONNECTED) {
|
||||
myRuntimeInstance = null;
|
||||
myConnector.disconnect();
|
||||
if (myRuntimeInstance != null) {
|
||||
myRuntimeInstance.disconnect();
|
||||
myRuntimeInstance = null;
|
||||
}
|
||||
setStatus(ConnectionStatus.DISCONNECTED);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-12
@@ -22,7 +22,6 @@ import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactPointerManager;
|
||||
import com.intellij.remoteServer.ServerType;
|
||||
import com.intellij.remoteServer.configuration.deployment.*;
|
||||
import com.intellij.remoteServer.runtime.Deployment;
|
||||
@@ -38,7 +37,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -134,12 +132,7 @@ public class AppEngineCloudType extends ServerType<AppEngineServerConfiguration>
|
||||
@Override
|
||||
public List<DeploymentSource> getAvailableDeploymentSources() {
|
||||
List<Artifact> artifacts = AppEngineUtil.collectWebArtifacts(myProject, true);
|
||||
List<DeploymentSource> sources = new ArrayList<DeploymentSource>();
|
||||
ArtifactPointerManager pointerManager = ArtifactPointerManager.getInstance(myProject);
|
||||
for (Artifact artifact : artifacts) {
|
||||
sources.add(DeploymentSourceUtil.getInstance().createArtifactDeploymentSource(pointerManager.createPointer(artifact)));
|
||||
}
|
||||
return sources;
|
||||
return DeploymentSourceUtil.getInstance().createArtifactDeploymentSources(myProject, artifacts);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -165,10 +158,6 @@ public class AppEngineCloudType extends ServerType<AppEngineServerConfiguration>
|
||||
public void connect(@NotNull final ConnectionCallback<DummyDeploymentConfiguration> callback) {
|
||||
callback.connected(new AppEngineRuntimeInstance(myConfiguration));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnect() {
|
||||
}
|
||||
}
|
||||
|
||||
private static class AppEngineRuntimeInstance extends ServerRuntimeInstance<DummyDeploymentConfiguration> {
|
||||
@@ -193,5 +182,9 @@ public class AppEngineCloudType extends ServerType<AppEngineServerConfiguration>
|
||||
public void computeDeployments(@NotNull ComputeDeploymentsCallback deployments) {
|
||||
deployments.succeeded(ContainerUtil.<Deployment>emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnect() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-21
@@ -15,16 +15,13 @@
|
||||
*/
|
||||
package com.intellij.appengine.cloud;
|
||||
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.remoteServer.configuration.ServerConfiguration;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import com.intellij.remoteServer.configuration.ServerConfigurationBase;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class AppEngineServerConfiguration extends ServerConfiguration implements PersistentStateComponent<AppEngineServerConfiguration> {
|
||||
public class AppEngineServerConfiguration extends ServerConfigurationBase<AppEngineServerConfiguration> {
|
||||
private String myEmail;
|
||||
|
||||
@Attribute("email")
|
||||
@@ -35,20 +32,4 @@ public class AppEngineServerConfiguration extends ServerConfiguration implements
|
||||
public void setEmail(String email) {
|
||||
myEmail = email;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AppEngineServerConfiguration getState() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(AppEngineServerConfiguration state) {
|
||||
XmlSerializerUtil.copyBean(state, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistentStateComponent<?> getSerializer() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user