summaryrefslogtreecommitdiffstats
path: root/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
diff options
context:
space:
mode:
authorRavi Mantena <rx908f@att.com>2020-12-21 11:31:55 -0500
committerRavi Mantena <rx908f@att.com>2020-12-21 11:32:34 -0500
commita520d00e005db1b232b9dae0c70d4dc5d73b33e1 (patch)
tree9c0e16ce5fab9bc12da138c4d8c613bcff54516b /mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
parent2f551ba584dbb70568a69144b39e6da7c55c517f (diff)
BpGen refactor Code Quality Issue-ID: DCAEGEN2-2502
Issue-ID: DCAEGEN2-2502 Change-Id: If6e08f0bb88c9039fb27898d50d2645f79175ba4 Signed-off-by: Ravi Mantena <rx908f@att.com>
Diffstat (limited to 'mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java')
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java51
1 files changed, 33 insertions, 18 deletions
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
index 3b9dd49..d680919 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator;
-
import org.onap.blueprintgenerator.model.base.Blueprint;
import org.onap.blueprintgenerator.model.common.Input;
import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
@@ -43,12 +42,10 @@ import static java.lang.System.exit;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP - Blueprint Generator Main Application to create Policy Models or Blueprints
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP - Blueprint Generator Main
+ * Application to create Policy Models or Blueprints
*/
-
-@ComponentScan({"org.onap.blueprintgenerator","org.onap.policycreate"})
+@ComponentScan({"org.onap.blueprintgenerator", "org.onap.policycreate"})
@SpringBootApplication
public class BlueprintGeneratorMainApplication implements CommandLineRunner {
@@ -76,35 +73,53 @@ public class BlueprintGeneratorMainApplication implements CommandLineRunner {
@Autowired
private DmaapBlueprintService dmaapBlueprintService;
+ /**
+ * Main Application to run BPGen to generate Policies/Blueprint based on Input Arguments values
+ *
+ * @param args Input Arguments
+ */
public static void main(String[] args) {
SpringApplication.run(BlueprintGeneratorMainApplication.class, args);
}
+ /**
+ * Creates Policies/Blueprint based on Input Arguments values
+ *
+ * @param args Input Arguments
+ */
@Override
public void run(String... args) {
- if (args.length >=2 && args[0].equals("app") && args[1].equals("ONAP")) {
+ if (args.length >= 2 && args[0].equals("app") && args[1].equals("ONAP")) {
onapCommonUtils.printInstructions();
- if(args.length >=4 && args[2].equals("-type") && args[3].equals("policycreate")){
+ if (args.length >= 4 && args[2].equals("-type") && args[3].equals("policycreate")) {
Input input = onapCommonUtils.parseInputs(args);
- ComponentSpec componentSpec = componentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
- onapPolicyModelNodeService.createPolicyModels(componentSpec.getParameters(), input.getOutputPath());
- }
- else {
+ ComponentSpec componentSpec =
+ componentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ onapPolicyModelNodeService.createPolicyModels(
+ componentSpec.getParameters(), input.getOutputPath());
+ } else {
Input input = onapCommonUtils.parseInputs(args);
- OnapComponentSpec onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ OnapComponentSpec onapComponentSpec =
+ onapComponentSpecService
+ .createComponentSpecFromFile(input.getComponentSpecPath());
if (input.getBpType().equals("o")) {
- Blueprint blueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ Blueprint blueprint = onapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
onapBlueprintService.blueprintToYaml(onapComponentSpec, blueprint, input);
- System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, blueprint, input));
+ System.out.println(
+ onapBlueprintService
+ .blueprintToString(onapComponentSpec, blueprint, input));
} else if (input.getBpType().equals("d")) {
- Blueprint blueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ Blueprint blueprint = dmaapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
dmaapBlueprintService.blueprintToYaml(onapComponentSpec, blueprint, input);
- System.out.println(dmaapBlueprintService.blueprintToString(onapComponentSpec, blueprint, input));
+ System.out.println(
+ dmaapBlueprintService
+ .blueprintToString(onapComponentSpec, blueprint, input));
}
}
}
exit(0);
}
-
}