Parse Plan information from our own alone file. Definitions/plans.yaml
authorYuanHu <yuan.hu1@zte.com.cn>
Fri, 30 Sep 2016 03:46:32 +0000 (11:46 +0800)
committerYuanHu <yuan.hu1@zte.com.cn>
Fri, 30 Sep 2016 03:46:32 +0000 (11:46 +0800)
Change-Id: Ic300ff92bc8063cad33a372f3f31ecc5941c3b1a
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
12 files changed:
catalog-core/catalog-mgr/pom.xml
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/common/TemplateUtils.java
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/AbstractModelParser.java
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/AriaModelParser.java
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/EntrySchema.java [new file with mode: 0644]
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/Input.java [new file with mode: 0644]
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/Plan.java [new file with mode: 0644]
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/ServiceTemplate.java [new file with mode: 0644]
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/YAMLElement.java [new file with mode: 0644]
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/zte/ToscaYamlModelParser.java
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/resources/TemplateResource.java
catalog-parent/catalogparent/pom.xml

index 3253326..3851601 100644 (file)
                        <artifactId>httpmime</artifactId>
                        <version>${httpclient.version}</version>
                </dependency>
+        <dependency>
+            <groupId>com.esotericsoftware.yamlbeans</groupId>
+            <artifactId>yamlbeans</artifactId>
+            <version>${yamlbeans.version}</version>
+        </dependency>
     </dependencies>
 </project>
index 945cc92..03352f7 100644 (file)
  */
 package org.openo.commontosca.catalog.model.common;
 
-import org.openo.commontosca.catalog.db.exception.CatalogResourceException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
 import java.io.File;
@@ -27,13 +23,63 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 import java.util.zip.ZipInputStream;
 
+import org.openo.commontosca.catalog.db.exception.CatalogResourceException;
+import org.openo.commontosca.catalog.model.parser.yaml.yamlmodel.Plan;
+import org.openo.commontosca.catalog.model.parser.yaml.yamlmodel.ServiceTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.esotericsoftware.yamlbeans.YamlConfig;
+import com.esotericsoftware.yamlbeans.YamlException;
+import com.esotericsoftware.yamlbeans.YamlReader;
+
 public class TemplateUtils {
   private static final Logger logger = LoggerFactory.getLogger(TemplateUtils.class);
   
+  public static Map<String, Plan> loadPlan(String yamlString) throws CatalogResourceException {
+    ServiceTemplate st = loadServiceTemplate(yamlString);
+    return st.getPlans();
+  }
+  
+  /**
+   * @param yamlString
+   * @return
+   * @throws CatalogResourceException
+   */
+  public static ServiceTemplate loadServiceTemplate(String yamlString) throws CatalogResourceException {
+    if (yamlString == null || yamlString.isEmpty()) {
+      return new ServiceTemplate();
+    }
+    final YamlReader reader = new YamlReader(yamlString);
+    adjustConfig(reader.getConfig());
+    try {
+        return reader.read(ServiceTemplate.class);
+    } catch (final YamlException e) {
+        throw new CatalogResourceException("Load plan information failed.", e);
+    } finally {
+      if (reader != null) {
+        try {
+            reader.close();
+        } catch (IOException e) {
+        }
+      }
+    }
+}
+  
+  
+  /**
+   * @param config
+   */
+  private static void adjustConfig(YamlConfig config) {
+    config.setPropertyElementType(ServiceTemplate.class, "plans", Plan.class);
+  }
+
+
   /**
    * @param zipFileName
    * @param zipEntryName
@@ -67,7 +113,7 @@ public class TemplateUtils {
       ZipEntry zipEntry;
       while ((zipEntry = zipIns.getNextEntry()) != null) {
         if (zipEntryName.equals(zipEntry.getName())
-            || (zipEntryName.replaceAll("/", File.separator)).equals(zipEntry.getName())) {
+            || (zipEntryName.replaceAll("/", "\\\\")).equals(zipEntry.getName())) {
           zipEntryBr = new BufferedReader(new InputStreamReader(zipFile.getInputStream(zipEntry)));
           List<String> lineList = new ArrayList<>();
           String line;
index 11c50a9..d1c3905 100644 (file)
@@ -19,14 +19,22 @@ import org.openo.commontosca.catalog.common.Config;
 import org.openo.commontosca.catalog.common.ToolUtil;
 import org.openo.commontosca.catalog.db.exception.CatalogResourceException;
 import org.openo.commontosca.catalog.model.common.TemplateUtils;
+import org.openo.commontosca.catalog.model.entity.InputParameter;
 import org.openo.commontosca.catalog.model.entity.NodeTemplate;
+import org.openo.commontosca.catalog.model.entity.ServiceTemplateOperation;
+import org.openo.commontosca.catalog.model.parser.yaml.yamlmodel.Input;
+import org.openo.commontosca.catalog.model.parser.yaml.yamlmodel.Plan;
+import org.openo.commontosca.catalog.model.plan.wso2.Wso2ServiceConsumer;
+import org.openo.commontosca.catalog.model.plan.wso2.entity.DeployPackageResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 public abstract class AbstractModelParser {
   private static final Logger logger = LoggerFactory.getLogger(AbstractModelParser.class);
@@ -112,7 +120,93 @@ public abstract class AbstractModelParser {
 
     return toscaMeta;
   }
+  
+  /**
+   * @param fileLocation
+   * @return
+   * @throws CatalogResourceException
+   */
+  protected ServiceTemplateOperation[] parseOperations(String fileLocation) throws CatalogResourceException {
+    String sPlan = TemplateUtils.readStringFromZipFile(fileLocation, "Definitions/plans.yaml");
+    Map<String, Plan> plans = TemplateUtils.loadPlan(sPlan);
+    return parseAndDeployPlans(plans, fileLocation);
+  }
+  
+  /**
+   * @param plans
+   * @param fileLocation
+   * @return
+   * @throws CatalogResourceException 
+   */
+  private ServiceTemplateOperation[] parseAndDeployPlans(Map<String, Plan> plans,
+      String zipFileLocation) throws CatalogResourceException {
+    if (plans == null || plans.isEmpty()) {
+      return new ServiceTemplateOperation[0];
+    }
+
+    List<ServiceTemplateOperation> opList = new ArrayList<>();
+    for (Entry<String, Plan> plan : plans.entrySet()) {
+      ServiceTemplateOperation op = new ServiceTemplateOperation();
+      op.setName(plan.getKey());
+      op.setDescription(plan.getValue().getDescription());
+      checkPlanLanguage(plan.getValue().getPlanLanguage());
+      DeployPackageResponse response =
+          Wso2ServiceConsumer.deployPackage(zipFileLocation, plan.getValue().getReference());
+      op.setPackageName(parsePackageName(response));
+      op.setProcessId(response.getProcessId());
+      op.setInputs(parsePlanInputs(plan.getValue().getInputs()));
 
+      opList.add(op);
+    }
+    
+    return opList.toArray(new ServiceTemplateOperation[0]);
+  }
   
+  private String parsePackageName(DeployPackageResponse response) {
+    String packageName = response.getPackageName();
+    if (packageName != null && packageName.indexOf("-") > 0) {
+      packageName = packageName.substring(0, packageName.lastIndexOf("-"));
+    }
+    return packageName;
+  }
 
+  private void checkPlanLanguage(String planLanguage) throws CatalogResourceException {
+    if (planLanguage == null || planLanguage.isEmpty()) {
+      throw new CatalogResourceException("Plan Language is empty.");
+    }
+    if (planLanguage.equalsIgnoreCase("bpel")) {
+      return;
+    }
+    if (planLanguage.equalsIgnoreCase("bpmn")) {
+      return;
+    }
+    if (planLanguage.equalsIgnoreCase("bpmn4tosca")) {
+      return;
+    }
+    throw new CatalogResourceException(
+        "Plan Language is not supported. Language = " + planLanguage);
+  }
+
+  /**
+   * @param inputs
+   * @return
+   */
+  private InputParameter[] parsePlanInputs(
+      Map<String, Input> inputs) {
+    if (inputs == null || inputs.isEmpty()) {
+      return new InputParameter[0];
+    }
+
+    List<InputParameter> retList = new ArrayList<>();
+    for (Entry<String, Input> input : inputs.entrySet()) {
+      retList.add(new InputParameter(
+          input.getKey(),
+          input.getValue().getType(),
+          input.getValue().getDescription(),
+          input.getValue().getDefault(),
+          input.getValue().isRequired()));
+    }
+    return retList.toArray(new InputParameter[0]);
+  }
+  
 }
index 205ddf0..3cf16bd 100644 (file)
@@ -24,6 +24,7 @@ import org.openo.commontosca.catalog.model.entity.NodeTemplate;
 import org.openo.commontosca.catalog.model.entity.OutputParameter;
 import org.openo.commontosca.catalog.model.entity.RelationShip;
 import org.openo.commontosca.catalog.model.entity.ServiceTemplate;
+import org.openo.commontosca.catalog.model.entity.ServiceTemplateOperation;
 import org.openo.commontosca.catalog.model.entity.SubstitutionMapping;
 import org.openo.commontosca.catalog.model.parser.AbstractModelParser;
 import org.openo.commontosca.catalog.model.parser.yaml.aria.entity.AriaParserResult;
@@ -57,6 +58,9 @@ public class AriaModelParser extends AbstractModelParser {
     // service template
     ServiceTemplate st = parseServiceTemplate(
         result, packageId, parseServiceTemplateFileName(packageId, fileLocation));
+    // workflow
+    ServiceTemplateOperation[] operations = parseOperations(fileLocation);
+    st.setOperations(operations);
     // node templates
     List<NodeTemplate> ntList = parseNodeTemplates(packageId, st.getServiceTemplateId(), result);
     st.setType(getTemplateType(getSubstitutionType(result), ntList).toString());
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/EntrySchema.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/EntrySchema.java
new file mode 100644 (file)
index 0000000..42542c6
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2016 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.commontosca.catalog.model.parser.yaml.yamlmodel;
+
+/**
+ * @author 10090474
+ *
+ */
+public class EntrySchema {
+  private String type = "";
+  
+  public EntrySchema() {
+    
+  }
+
+  public EntrySchema(String type) {
+    super();
+    this.type = type;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+  
+}
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/Input.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/Input.java
new file mode 100644 (file)
index 0000000..87483ff
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2016 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.commontosca.catalog.model.parser.yaml.yamlmodel;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class Input extends YAMLElement {
+
+  private String type = "";
+  private String defaultValue = "";
+  private boolean required = false;
+  private List<Map<String, Object>> constraints = new ArrayList<Map<String, Object>>();
+  private EntrySchema entry_schema;
+
+  public String getType() {
+    return this.type;
+  }
+
+  public void setType(String type) {
+    if (type != null) {
+      this.type = type;
+    }
+  }
+
+  public String getDefault() {
+    return this.defaultValue;
+  }
+
+  public void setDefault(String defaultValue) {
+    if (defaultValue != null) {
+      this.defaultValue = defaultValue;
+    }
+  }
+
+  public List<Map<String, Object>> getConstraints() {
+    return this.constraints;
+  }
+
+  public void setConstraints(List<Map<String, Object>> constraints) {
+    if (constraints != null) {
+      this.constraints = constraints;
+    }
+  }
+
+  public boolean isRequired() {
+    return required;
+  }
+
+  public void setRequired(boolean required) {
+    this.required = required;
+  }
+
+  public EntrySchema getEntry_schema() {
+    return entry_schema;
+  }
+
+  public void setEntry_schema(EntrySchema entry_schema) {
+    if (entry_schema != null) {
+      this.entry_schema = entry_schema;
+    }
+  }
+
+}
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/Plan.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/Plan.java
new file mode 100644 (file)
index 0000000..c59a81c
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2016 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.commontosca.catalog.model.parser.yaml.yamlmodel;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 
+ */
+public class Plan extends YAMLElement {
+    private String reference = "";
+    private String planLanguage = "";
+    private Map<String, Input> inputs = new HashMap<String, Input>();
+    public String getReference() {
+      return reference;
+    }
+    public void setReference(String reference) {
+      this.reference = reference;
+    }
+    public String getPlanLanguage() {
+      return planLanguage;
+    }
+    public void setPlanLanguage(String planLanguage) {
+      this.planLanguage = planLanguage;
+    }
+    public Map<String, Input> getInputs() {
+      return inputs;
+    }
+    public void setInputs(Map<String, Input> inputs) {
+      this.inputs = inputs;
+    }
+
+}
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/ServiceTemplate.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/ServiceTemplate.java
new file mode 100644 (file)
index 0000000..c92e3c5
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2016 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.commontosca.catalog.model.parser.yaml.yamlmodel;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author 10090474
+ *
+ */
+public class ServiceTemplate extends YAMLElement {
+  private Map<String, Plan> plans = new HashMap<>();
+
+  public Map<String, Plan> getPlans() {
+    return plans;
+  }
+
+  public void setPlans(Map<String, Plan> plans) {
+    if (plans != null) {
+      this.plans = plans;
+    }
+  }
+}
\ No newline at end of file
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/YAMLElement.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/yamlmodel/YAMLElement.java
new file mode 100644 (file)
index 0000000..0572f2f
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2016 ZTE Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openo.commontosca.catalog.model.parser.yaml.yamlmodel;
+
+public abstract class YAMLElement {
+
+       private String description = "";
+
+       public void setDescription(String description) {
+               if (description != null) {
+                       this.description = description;
+               }
+       }
+
+       public String getDescription() {
+               return this.description;
+       }
+
+       @Override
+       public boolean equals(Object o) {
+               if (this == o) return true;
+               if (o == null || getClass() != o.getClass()) return false;
+
+               YAMLElement element = (YAMLElement) o;
+
+               if (!description.equals(element.description)) return false;
+
+               return true;
+       }
+
+       @Override
+       public int hashCode() {
+               return description.hashCode();
+       }
+}
\ No newline at end of file
index 2465bea..e22d840 100644 (file)
@@ -30,14 +30,10 @@ import org.openo.commontosca.catalog.model.parser.AbstractModelParser;
 import org.openo.commontosca.catalog.model.parser.yaml.zte.entity.EnumYamlServiceTemplateInfo;
 import org.openo.commontosca.catalog.model.parser.yaml.zte.entity.ParseYamlRequestParemeter;
 import org.openo.commontosca.catalog.model.parser.yaml.zte.entity.ParseYamlResult;
-import org.openo.commontosca.catalog.model.parser.yaml.zte.entity.ParseYamlResult.Plan;
-import org.openo.commontosca.catalog.model.parser.yaml.zte.entity.ParseYamlResult.Plan.PlanValue.PlanInput;
 import org.openo.commontosca.catalog.model.parser.yaml.zte.entity.ParseYamlResult.TopologyTemplate.Input;
 import org.openo.commontosca.catalog.model.parser.yaml.zte.entity.ParseYamlResult.TopologyTemplate.NodeTemplate.Relationship;
 import org.openo.commontosca.catalog.model.parser.yaml.zte.entity.ParseYamlResult.TopologyTemplate.Output;
 import org.openo.commontosca.catalog.model.parser.yaml.zte.service.YamlParseServiceConsumer;
-import org.openo.commontosca.catalog.model.plan.wso2.Wso2ServiceConsumer;
-import org.openo.commontosca.catalog.model.plan.wso2.entity.DeployPackageResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,7 +53,7 @@ public class ToscaYamlModelParser extends AbstractModelParser {
     ServiceTemplate st = parseServiceTemplate(
         packageId, result, parseServiceTemplateFileName(packageId, fileLocation));
     // workflow
-    ServiceTemplateOperation[] operations = parseOperations(result.getPlanList(), fileLocation);
+    ServiceTemplateOperation[] operations = parseOperations(fileLocation);
     st.setOperations(operations);
     // node templates
     List<NodeTemplate> ntList = parseNodeTemplates(packageId, st.getServiceTemplateId(), result);
@@ -149,68 +145,6 @@ public class ToscaYamlModelParser extends AbstractModelParser {
     return retList.toArray(new OutputParameter[0]);
   }
 
-  private ServiceTemplateOperation[] parseOperations(List<Plan> planList, String zipFileLocation)
-      throws CatalogResourceException {
-    if (planList == null || planList.isEmpty()) {
-      return new ServiceTemplateOperation[0];
-    }
-
-    List<ServiceTemplateOperation> opList = new ArrayList<>();
-    for (Plan plan : planList) {
-      ServiceTemplateOperation op = new ServiceTemplateOperation();
-      op.setName(plan.getName());
-      op.setDescription(plan.getDescription());
-      checkPlanLanguage(plan.getPlanLanguage());
-      DeployPackageResponse response =
-          Wso2ServiceConsumer.deployPackage(zipFileLocation, plan.getReference());
-      op.setPackageName(parsePackageName(response));
-      op.setProcessId(response.getProcessId());
-      op.setInputs(parsePlanInputs(plan.getInputList()));
-
-      opList.add(op);
-
-    }
-    return opList.toArray(new ServiceTemplateOperation[0]);
-  }
-
-  private String parsePackageName(DeployPackageResponse response) {
-    String packageName = response.getPackageName();
-    if (packageName != null && packageName.indexOf("-") > 0) {
-      packageName = packageName.substring(0, packageName.lastIndexOf("-"));
-    }
-    return packageName;
-  }
-
-  private void checkPlanLanguage(String planLanguage) throws CatalogResourceException {
-    if (planLanguage == null || planLanguage.isEmpty()) {
-      throw new CatalogResourceException("Plan Language is empty.");
-    }
-    if (planLanguage.equalsIgnoreCase("bpel")) {
-      return;
-    }
-    if (planLanguage.equalsIgnoreCase("bpmn")) {
-      return;
-    }
-    if (planLanguage.equalsIgnoreCase("bpmn4tosca")) {
-      return;
-    }
-    throw new CatalogResourceException(
-        "Plan Language is not supported. Language = " + planLanguage);
-  }
-
-  private InputParameter[] parsePlanInputs(List<PlanInput> inputList) {
-    if (inputList == null || inputList.isEmpty()) {
-      return new InputParameter[0];
-    }
-
-    List<InputParameter> retList = new ArrayList<>();
-    for (PlanInput input : inputList) {
-      retList.add(new InputParameter(input.getName(), input.getType(),
-          input.getDescription(), input.getDefault(), input.isRequired()));
-    }
-    return retList.toArray(new InputParameter[0]);
-  }
-
   private List<NodeTemplate> parseNodeTemplates(String csarId, String templateId,
       ParseYamlResult result) {
     List<ParseYamlResult.TopologyTemplate.NodeTemplate> nodetemplateList =
index 1708edd..73ae9d7 100644 (file)
@@ -436,10 +436,10 @@ public class TemplateResource {
   public Response test() {
     try {
       AbstractModelParser parser1 = new ToscaYamlModelParser();
-//      parser1.parse("pk11111", "C:\\Users\\10090474\\Desktop\\1\\bm\\bm.zip");
+      parser1.parse("pk11111", "C:\\Users\\10090474\\Downloads\\OpenO.csar");
       
-      AbstractModelParser parser = new AriaModelParser();
-      parser.parse("pk11111", "/home/b/common-tosca-aria/blueprints/tosca/node-cellar.yaml");
+//      AbstractModelParser parser = new AriaModelParser();
+//      parser.parse("pk11111", "/home/b/common-tosca-aria/blueprints/tosca/node-cellar.yaml");
 
       ModelService.getInstance().delete("pk11111");
 
index d995550..f298361 100644 (file)
@@ -37,6 +37,7 @@
         <jaxrs.consumer.version>5.0</jaxrs.consumer.version>
         <jackson-version>2.5.1</jackson-version>
         <gson.version>2.2.4</gson.version>
+        <yamlbeans.version>1.08</yamlbeans.version>
         <dom4j.version>1.6</dom4j.version>
         <cometd.version>3.0.7</cometd.version>
         <commons-net.version>3.3</commons-net.version>