Search in sources :

Example 1 with JavaVersion

use of com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion in project azure-tools-for-java by Microsoft.

the class WebAppBasePropertyViewPresenter method generateProperty.

protected <T extends AppServiceBaseEntity> WebAppProperty generateProperty(@Nonnull final IAppService<T> appService, @Nonnull final IAppServicePlan plan) {
    final AppServiceBaseEntity appServiceEntity = appService.entity();
    final AppServicePlanEntity planEntity = plan.entity();
    final Map<String, String> appSettingsMap = appServiceEntity.getAppSettings();
    final Map<String, Object> propertyMap = new HashMap<>();
    propertyMap.put(KEY_NAME, appServiceEntity.getName());
    propertyMap.put(KEY_RESOURCE_GRP, appServiceEntity.getResourceGroup());
    propertyMap.put(KEY_LOCATION, appServiceEntity.getRegion().getLabel());
    propertyMap.put(KEY_SUB_ID, appService.subscriptionId());
    propertyMap.put(KEY_STATUS, appService.state());
    propertyMap.put(KEY_PLAN, plan.name());
    propertyMap.put(KEY_URL, appService.hostName());
    final PricingTier pricingTier = planEntity.getPricingTier();
    propertyMap.put(KEY_PRICING, String.format("%s_%s", pricingTier.getTier(), pricingTier.getSize()));
    final Runtime runtime = appService.getRuntime();
    final JavaVersion javaVersion = runtime.getJavaVersion();
    if (javaVersion != null && ObjectUtils.notEqual(javaVersion, JavaVersion.OFF)) {
        propertyMap.put(KEY_JAVA_VERSION, javaVersion.getValue());
        propertyMap.put(KEY_JAVA_CONTAINER, runtime.getWebContainer().getValue());
    }
    propertyMap.put(KEY_OPERATING_SYS, runtime.getOperatingSystem());
    propertyMap.put(KEY_APP_SETTING, appSettingsMap);
    return new WebAppProperty(propertyMap);
}
Also used : PricingTier(com.microsoft.azure.toolkit.lib.appservice.model.PricingTier) Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) AppServiceBaseEntity(com.microsoft.azure.toolkit.lib.appservice.entity.AppServiceBaseEntity) AppServicePlanEntity(com.microsoft.azure.toolkit.lib.appservice.entity.AppServicePlanEntity) HashMap(java.util.HashMap) JavaVersion(com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion) WebAppProperty(com.microsoft.azuretools.core.mvp.ui.webapp.WebAppProperty)

Example 2 with JavaVersion

use of com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion in project azure-tools-for-java by Microsoft.

the class AppServiceCreateDialog method fillWebContainers.

protected void fillWebContainers() {
    try {
        if (MavenUtils.isMavenProject(project)) {
            packaging = MavenUtils.getPackaging(project);
        }
    } catch (Exception e) {
        LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "fillWebContainers@AppServiceCreateDialog", e));
    }
    final boolean isJarPacking = packaging.equals("jar");
    final JavaVersion jdkModel = getSelectedJavaVersion();
    final List<WebContainer> webContainers = isJarPacking ? Arrays.asList(WebContainer.JAVA_SE) : listWindowsWebContainersForWarFile(jdkModel);
    comboWebContainer.removeAll();
    binderWebConteiners = new ArrayList<>();
    for (int i = 0; i < webContainers.size(); i++) {
        WebContainer webContainerMod = webContainers.get(i);
        comboWebContainer.add(webContainerMod.toString());
        binderWebConteiners.add(webContainerMod);
        if (i == 0 || webContainerMod == DEFAULT_WEB_CONTAINER) {
            comboWebContainer.select(i);
        }
    }
    String webContainer = CommonUtils.getPreference(CommonUtils.RUNTIME_WEBCONTAINER);
    CommonUtils.selectComboIndex(comboWebContainer, webContainer);
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) WebContainer(com.microsoft.azure.toolkit.lib.appservice.model.WebContainer) JavaVersion(com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion) PartInitException(org.eclipse.ui.PartInitException) MalformedURLException(java.net.MalformedURLException) Point(org.eclipse.swt.graphics.Point)

Example 3 with JavaVersion

use of com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion in project azure-tools-for-java by Microsoft.

the class AppServiceCreateDialog method fillJavaVersion.

protected void fillJavaVersion() {
    binderJavaVersions = new ArrayList<JavaVersion>();
    for (JavaVersion javaVersion : JavaVersion.values()) {
        cbJavaVersion.add(javaVersion.toString());
        binderJavaVersions.add(javaVersion);
        if (Objects.equals(javaVersion, DEFAULT_JAVA_VERSION)) {
            cbJavaVersion.select(binderJavaVersions.size() - 1);
        }
    }
    String javaversion = CommonUtils.getPreference(CommonUtils.RUNTIME_JAVAVERSION);
    CommonUtils.selectComboIndex(cbJavaVersion, javaversion);
}
Also used : JavaVersion(com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion)

Aggregations

JavaVersion (com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion)3 AppServiceBaseEntity (com.microsoft.azure.toolkit.lib.appservice.entity.AppServiceBaseEntity)1 AppServicePlanEntity (com.microsoft.azure.toolkit.lib.appservice.entity.AppServicePlanEntity)1 PricingTier (com.microsoft.azure.toolkit.lib.appservice.model.PricingTier)1 Runtime (com.microsoft.azure.toolkit.lib.appservice.model.Runtime)1 WebContainer (com.microsoft.azure.toolkit.lib.appservice.model.WebContainer)1 WebAppProperty (com.microsoft.azuretools.core.mvp.ui.webapp.WebAppProperty)1 MalformedURLException (java.net.MalformedURLException)1 HashMap (java.util.HashMap)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Point (org.eclipse.swt.graphics.Point)1 PartInitException (org.eclipse.ui.PartInitException)1