1 package org.openecomp.sdc.asdctool.cli;
3 import org.apache.commons.cli.Options;
4 import org.openecomp.sdc.asdctool.configuration.ConfigurationUploader;
5 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
8 * abstract class to extend when implementing a spring and sdc configuration based command line tool
10 public abstract class SpringCLITool extends CLITool {
13 public CLIToolData init(String[] args) {
14 CLIToolData cliToolData = super.init(args);
15 String appConfigDir = cliToolData.getCommandLine().getOptionValue(CLIUtils.CONFIG_PATH_SHORT_OPT);
16 ConfigurationUploader.uploadConfigurationFiles(appConfigDir);
17 AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(getSpringConfigurationClass());
18 cliToolData.setSpringApplicationContext(context);
23 protected Options buildCmdLineOptions() {
24 return new Options().addOption(CLIUtils.getConfigurationPathOption());
29 * @return the {@code Class} which holds all the spring bean declaration needed by this cli tool
31 protected abstract Class<?> getSpringConfigurationClass();