Search in sources :

Example 1 with AzureArtifactManager

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.

the class WebAppConfiguration method saveArtifact.

public void saveArtifact(AzureArtifact azureArtifact) {
    final AzureArtifactManager azureArtifactManager = AzureArtifactManager.getInstance(getProject());
    webAppSettingModel.setArtifactIdentifier(azureArtifact == null ? null : azureArtifactManager.getArtifactIdentifier(azureArtifact));
    webAppSettingModel.setAzureArtifactType(azureArtifact == null ? null : azureArtifact.getType());
    webAppSettingModel.setPackaging(azureArtifact == null ? null : azureArtifactManager.getPackaging(azureArtifact));
}
Also used : AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager)

Example 2 with AzureArtifactManager

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.

the class SpringCloudDeploymentConfiguration method readExternal.

@Override
public void readExternal(Element element) throws InvalidDataException {
    super.readExternal(element);
    final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.getProject());
    this.appConfig = Optional.ofNullable(element.getChild("SpringCloudAppConfig")).map(e -> XmlSerializer.deserialize(e, SpringCloudAppConfig.class)).orElse(SpringCloudAppConfig.builder().deployment(SpringCloudDeploymentConfig.builder().build()).build());
    Optional.ofNullable(element.getChild("Artifact")).map(e -> e.getAttributeValue("identifier")).map(manager::getAzureArtifactById).map(a -> new WrappedAzureArtifact(a, this.getProject())).ifPresent(a -> this.appConfig.getDeployment().setArtifact(a));
}
Also used : XmlSerializer(com.intellij.util.xmlb.XmlSerializer) Setter(lombok.Setter) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) SpringCloudDeploymentConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig) Getter(lombok.Getter) ConfigurationType(com.intellij.execution.configurations.ConfigurationType) SpringCloudAppConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig) InvalidDataException(com.intellij.openapi.util.InvalidDataException) RunProfileState(com.intellij.execution.configurations.RunProfileState) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) Project(com.intellij.openapi.project.Project) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) LocatableConfiguration(com.intellij.execution.configurations.LocatableConfiguration) SettingsEditor(com.intellij.openapi.options.SettingsEditor) LocatableConfigurationBase(com.intellij.execution.configurations.LocatableConfigurationBase) Executor(com.intellij.execution.Executor) IArtifact(com.microsoft.azure.toolkit.lib.common.model.IArtifact) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) AzureValidationInfo(com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo) Objects(java.util.Objects) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) Optional(java.util.Optional) ConfigurationException(com.intellij.openapi.options.ConfigurationException) WriteExternalException(com.intellij.openapi.util.WriteExternalException) NotNull(org.jetbrains.annotations.NotNull) Element(org.jdom.Element) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) javax.swing(javax.swing) SpringCloudAppConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager)

Example 3 with AzureArtifactManager

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.

the class AppServiceInfoBasicPanel method getData.

@SneakyThrows
@Override
public T getData() {
    final String name = this.textName.getValue();
    final Runtime platform = this.selectorRuntime.getValue();
    final AzureArtifact artifact = this.selectorApplication.getValue();
    final T result = (T) (this.config == null ? initConfig() : this.config).toBuilder().build();
    result.setName(name);
    result.setRuntime(platform);
    if (Objects.nonNull(artifact)) {
        final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
        final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
        result.setApplication(Paths.get(path));
    }
    this.config = result;
    return result;
}
Also used : Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) SneakyThrows(lombok.SneakyThrows)

Example 4 with AzureArtifactManager

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.

the class AppServiceInfoAdvancedPanel method getData.

@Override
public T getData() {
    final Subscription subscription = this.selectorSubscription.getValue();
    final ResourceGroup resourceGroup = this.selectorGroup.getValue();
    final String name = this.textName.getValue();
    final Runtime runtime = this.selectorRuntime.getValue();
    final Region region = this.selectorRegion.getValue();
    final AppServicePlanEntity servicePlan = this.selectorServicePlan.getValue();
    final AzureArtifact artifact = this.selectorApplication.getValue();
    final T config = supplier.get();
    config.setSubscription(subscription);
    config.setResourceGroup(resourceGroup);
    config.setName(name);
    config.setRuntime(runtime);
    config.setRegion(region);
    config.setServicePlan(servicePlan);
    if (Objects.nonNull(artifact)) {
        final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
        final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
        config.setApplication(Paths.get(path));
    }
    return config;
}
Also used : Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) AppServicePlanEntity(com.microsoft.azure.toolkit.lib.appservice.entity.AppServicePlanEntity) Region(com.microsoft.azure.toolkit.lib.common.model.Region) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) ResourceGroup(com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)

Example 5 with AzureArtifactManager

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager in project azure-tools-for-java by Microsoft.

the class SpringCloudDeploymentConfiguration method writeExternal.

@Override
public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);
    final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.getProject());
    final Element appConfigElement = XmlSerializer.serialize(this.appConfig, (accessor, o) -> !"artifact".equalsIgnoreCase(accessor.getName()));
    final IArtifact artifact = this.appConfig.getDeployment().getArtifact();
    Optional.ofNullable(this.appConfig).map(config -> XmlSerializer.serialize(config, (accessor, o) -> !"artifact".equalsIgnoreCase(accessor.getName()))).ifPresent(element::addContent);
    Optional.ofNullable(this.appConfig).map(config -> (WrappedAzureArtifact) config.getDeployment().getArtifact()).map((a) -> manager.getArtifactIdentifier(a.getArtifact())).map(id -> new Element("Artifact").setAttribute("identifier", id)).ifPresent(element::addContent);
}
Also used : XmlSerializer(com.intellij.util.xmlb.XmlSerializer) Setter(lombok.Setter) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) SpringCloudDeploymentConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig) Getter(lombok.Getter) ConfigurationType(com.intellij.execution.configurations.ConfigurationType) SpringCloudAppConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig) InvalidDataException(com.intellij.openapi.util.InvalidDataException) RunProfileState(com.intellij.execution.configurations.RunProfileState) AzureTask(com.microsoft.azure.toolkit.lib.common.task.AzureTask) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) Project(com.intellij.openapi.project.Project) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) LocatableConfiguration(com.intellij.execution.configurations.LocatableConfiguration) SettingsEditor(com.intellij.openapi.options.SettingsEditor) LocatableConfigurationBase(com.intellij.execution.configurations.LocatableConfigurationBase) Executor(com.intellij.execution.Executor) IArtifact(com.microsoft.azure.toolkit.lib.common.model.IArtifact) SpringCloudApp(com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) AzureValidationInfo(com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo) Objects(java.util.Objects) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) Optional(java.util.Optional) ConfigurationException(com.intellij.openapi.options.ConfigurationException) WriteExternalException(com.intellij.openapi.util.WriteExternalException) NotNull(org.jetbrains.annotations.NotNull) Element(org.jdom.Element) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) javax.swing(javax.swing) Element(org.jdom.Element) IArtifact(com.microsoft.azure.toolkit.lib.common.model.IArtifact) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager)

Aggregations

AzureArtifactManager (com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager)6 Project (com.intellij.openapi.project.Project)3 AzureArtifact (com.microsoft.azure.toolkit.intellij.common.AzureArtifact)3 SpringCloudApp (com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp)3 SpringCloudAppConfig (com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig)3 SpringCloudDeploymentConfig (com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig)3 List (java.util.List)3 Objects (java.util.Objects)3 Optional (java.util.Optional)3 javax.swing (javax.swing)3 Getter (lombok.Getter)3 Setter (lombok.Setter)3 Executor (com.intellij.execution.Executor)2 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)2 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)2 LocatableConfiguration (com.intellij.execution.configurations.LocatableConfiguration)2 LocatableConfigurationBase (com.intellij.execution.configurations.LocatableConfigurationBase)2 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)2 RunProfileState (com.intellij.execution.configurations.RunProfileState)2 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)2