@Override public AppRegistryCommands.QualifiedApplicationName convertFromText(String value, Class<?> targetType, String optionContext) { int colonIndex = value.indexOf(':'); if (colonIndex == -1) { throw new ShellException("Incorrect syntax. Valid syntax is '<ApplicationType>:<ApplicationName>'."); } ApplicationType applicationType = ApplicationType.valueOf(value.substring(0, colonIndex)); return new AppRegistryCommands.QualifiedApplicationName(value.substring(colonIndex + 1), applicationType); }
@Override public AbstractAppRegistryCommands.QualifiedApplicationName convertFromText(String value, Class<?> targetType, String optionContext) { int colonIndex = value.indexOf(':'); if (colonIndex == -1) { throw new ShellException("Incorrect syntax. Valid syntax is '<ApplicationType>:<ApplicationName>'."); } ApplicationType applicationType = ApplicationType.valueOf(value.substring(0, colonIndex)); return new AbstractAppRegistryCommands.QualifiedApplicationName(value.substring(colonIndex + 1), applicationType); }
@Override public ColumnNameValueList convertFromText(String shellValue, Class<?> targetType, String optionContext) { String[] keyValueArray = shellValue.split(","); ColumnNameValueList result = new ColumnNameValueList(); for (String keyValueString : keyValueArray) { String[] nameValueArray = keyValueString.split("\\."); if (nameValueArray.length != 2) { throw new ShellException("Error processing (".concat(keyValueString).concat(")")); } String name = nameValueArray[0].trim(); String value = nameValueArray[1].trim(); result.add(new ColumnNameValue(name, value)); } return result; }
@Override public ColumnNameTypeList convertFromText(String value, Class<?> targetType, String optionContext) { String[] keyValueArray = value.split(","); ColumnNameTypeList result = new ColumnNameTypeList(); for (String keyValueString : keyValueArray) { String[] keyTypeArray = keyValueString.split("\\."); if (keyTypeArray.length != 2) { throw new ShellException("Error processing (".concat(keyValueString).concat(")")); } String key = keyTypeArray[0].trim(); String type = keyTypeArray[1].trim(); try { result.add(new ColumnNameType(key, ColumnType.valueOf(type.toUpperCase()))); } catch (IllegalArgumentException e) { StringBuilder sb = new StringBuilder(); sb.append("Type not found"); sb.append(" (".concat(type).concat(") ")); sb.append(" Available types: ".concat(Arrays.asList(ColumnType.values()).toString())); throw new ShellException(sb.toString()); } } return result; }
public BootShim(String[] args, ConfigurableApplicationContext context) { this.ctx = context; try { commandLine = SimpleShellCommandLineOptions.parseCommandLine(args); } catch (IOException var5) { throw new ShellException(var5.getMessage(), var5); } this.configureApplicationContext(this.ctx); ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner((BeanDefinitionRegistry) this.ctx); if (commandLine.getDisableInternalCommands()) { scanner.scan("org.springframework.shell.converters", "org.springframework.shell.plugin.support"); } else { scanner.scan("org.springframework.shell.commands", "org.springframework.shell.converters", "org.springframework.shell.plugin.support"); } }
return "Done!"; } catch (IOException e) { throw new ShellException(e); } finally { pool.shutdown();
public Bootstrap(String[] args, String[] contextPath) { try { commandLine = SimpleShellCommandLineOptions.parseCommandLine(args); } catch (IOException e) { throw new ShellException(e.getMessage(), e); } ctx = new GenericApplicationContext(); ctx.registerShutdownHook(); configureApplicationContext(ctx); // built-in commands and converters ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(ctx); if (commandLine.getDisableInternalCommands()) { scanner.scan("org.springframework.shell.converters", "org.springframework.shell.plugin.support"); } else { scanner.scan("org.springframework.shell.commands", "org.springframework.shell.converters", "org.springframework.shell.plugin.support"); } // user contributed commands XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(ctx); reader.loadBeanDefinitions(contextPath); ctx.refresh(); }
throw new ShellException(ex.getMessage(), ex);
throw new ShellException(ex.getMessage(), ex);