List of usage examples for org.springframework.ide.eclipse.boot.dash BootDashActivator logWarning
@Deprecated public static void logWarning(String message)
From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.ApplicationManifestHandler.java
/** * Creates a new manifest.yml file. If one already exists, the existing one * will not be replaced.// w ww .j av a 2s . co m * * @return true if new file created with content. False otherwise * @throws Exception * if error occurred during file creation or serialising * manifest content */ public boolean create(IProgressMonitor monitor, CloudApplicationDeploymentProperties properties) throws Exception { if (properties == null) { return false; } File file = getManifestFile(); if (file != null) { BootDashActivator.logWarning( "Manifest.yml file already found at: " + manifestPath + ". New content will not be written."); return false; } String appName = properties.getAppName(); Map<Object, Object> deploymentInfoYaml = new LinkedHashMap<Object, Object>(); Object applicationsObj = deploymentInfoYaml.get(APPLICATIONS_PROP); List<Map<Object, Object>> applicationsList = null; if (applicationsObj == null) { applicationsList = new ArrayList<Map<Object, Object>>(); deploymentInfoYaml.put(APPLICATIONS_PROP, applicationsList); } else if (applicationsObj instanceof List<?>) { applicationsList = (List<Map<Object, Object>>) applicationsObj; } Map<Object, Object> application = new LinkedHashMap<Object, Object>(); applicationsList.add(application); application.put(NAME_PROP, appName); String memory = getMemoryAsString(properties.getMemory()); if (memory != null) { application.put(MEMORY_PROP, memory); } List<String> urls = properties.getUrls(); if (urls != null && !urls.isEmpty()) { // Persist only the first URL String url = urls.get(0); CloudApplicationURL cloudUrl = CloudApplicationURL.getCloudApplicationURL(url, domains); String subdomain = cloudUrl.getSubdomain(); String domain = cloudUrl.getDomain(); if (subdomain != null) { application.put(SUB_DOMAIN_PROP, subdomain); } if (domain != null) { application.put(DOMAIN_PROP, domain); } } else { // If URL is not present, remove any exiting ones application.remove(SUB_DOMAIN_PROP); application.remove(DOMAIN_PROP); } if (deploymentInfoYaml.isEmpty()) { return false; } DumperOptions options = new DumperOptions(); options.setExplicitStart(true); options.setCanonical(false); options.setPrettyFlow(true); options.setDefaultFlowStyle(FlowStyle.BLOCK); Yaml yaml = new Yaml(options); String manifestValue = yaml.dump(deploymentInfoYaml); if (manifestValue == null) { throw BootDashActivator.asCoreException("Failed to generate manifesty.yml for: " + appName + " Unknown problem trying to serialise content of manifest into: " + deploymentInfoYaml); } createFile(project, manifestPath, manifestValue, monitor); return true; }