2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.asdctool.main;
23 import java.util.Scanner;
25 import org.openecomp.sdc.asdctool.configuration.ConfigurationUploader;
26 import org.openecomp.sdc.asdctool.configuration.CsarGeneratorConfiguration;
27 import org.openecomp.sdc.asdctool.impl.internal.tool.CsarGenerator;
28 import org.openecomp.sdc.asdctool.utils.ConsoleWriter;
29 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
31 public class CsarGeneratorTool extends SdcInternalTool {
33 public static void main(String[] args) {
35 ConsoleWriter.dataLine("Usage: <configuration dir> ");
38 String appConfigDir = args[0];
42 ConfigurationUploader.uploadConfigurationFiles(appConfigDir);
43 AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CsarGeneratorConfiguration.class);
44 CsarGenerator csarGenerator = context.getBean(CsarGenerator.class);
45 ConsoleWriter.dataLine("STARTED... ");
48 Scanner scanner = new Scanner(System.in);
50 ConsoleWriter.dataLine("Enter next service UUID or exit: ");
51 input = scanner.nextLine();
52 if (!input.equals("exit")) {
53 if (!input.isEmpty()) {
54 ConsoleWriter.dataLine("Your UUID is ", input);
55 csarGenerator.generateCsar(input, scanner);
57 ConsoleWriter.dataLine("Your UUID is empty. Try again.");
60 } while (!input.equals("exit"));
61 csarGenerator.closeAll();
62 ConsoleWriter.dataLine("CsarGeneratorTool exit...");