コード例 #1
0
 CloudApplicationDeploymentProperties getDeploymentProperties() throws Exception {
   List<CloudApplicationDeploymentProperties> propsList =
       new ApplicationManifestHandler(project, cloudData, getManifest()) {
         @Override
         protected InputStream getInputStream() throws Exception {
           return new ByteArrayInputStream(getManifestContents().getBytes());
         }
       }.load(new NullProgressMonitor());
   /*
    * If "Select Manifest..." action is invoked appName is not null,
    * but we should allow for any manifest file selected for now. Hence
    * set the applicationName var to null in that case
    */
   CloudApplicationDeploymentProperties deploymentProperties = null;
   String applicationName =
       deployedApp == null ? selectedAppName.getValue() : getDeployedAppName();
   if (applicationName == null) {
     deploymentProperties = propsList.get(0);
   } else {
     for (CloudApplicationDeploymentProperties p : propsList) {
       if (applicationName.equals(p.getAppName())) {
         deploymentProperties = p;
         break;
       }
     }
   }
   return deploymentProperties;
 }
コード例 #2
0
 private String generateDefaultContent() {
   CloudApplicationDeploymentProperties props =
       CloudApplicationDeploymentProperties.getFor(project, cloudData, getDeployedApp());
   Map<Object, Object> yaml = ApplicationManifestHandler.toYaml(props, cloudData);
   DumperOptions options = new DumperOptions();
   options.setExplicitStart(true);
   options.setCanonical(false);
   options.setPrettyFlow(true);
   options.setDefaultFlowStyle(FlowStyle.BLOCK);
   return new Yaml(options).dump(yaml);
 }