当前位置: 首页>>代码示例>>Java>>正文


Java ShellException类代码示例

本文整理汇总了Java中org.springframework.shell.ShellException的典型用法代码示例。如果您正苦于以下问题:Java ShellException类的具体用法?Java ShellException怎么用?Java ShellException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ShellException类属于org.springframework.shell包,在下文中一共展示了ShellException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BootShim

import org.springframework.shell.ShellException; //导入依赖的package包/类
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(new String[] { "org.springframework.shell.converters", "org.springframework.shell.plugin.support" });
	} else {
		scanner.scan(new String[] { "org.springframework.shell.commands", "org.springframework.shell.converters",
				"org.springframework.shell.plugin.support" });
	}

}
 
开发者ID:spring-projects,项目名称:spring-data-dev-tools,代码行数:20,代码来源:BootShim.java

示例2: BootShim

import org.springframework.shell.ShellException; //导入依赖的package包/类
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(new String[]{"org.springframework.shell.converters", "org.springframework.shell.plugin.support"});
    } else {
        scanner.scan(new String[]{"org.springframework.shell.commands", "org.springframework.shell.converters", "org.springframework.shell.plugin.support"});
    }

}
 
开发者ID:jeffellin,项目名称:springshellwithboot,代码行数:19,代码来源:BootShim.java

示例3: convertFromText

import org.springframework.shell.ShellException; //导入依赖的package包/类
@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;

}
 
开发者ID:Stratio,项目名称:Decision,代码行数:18,代码来源:ColumnNameValueConverter.java

示例4: convertFromText

import org.springframework.shell.ShellException; //导入依赖的package包/类
@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;

}
 
开发者ID:Stratio,项目名称:Decision,代码行数:27,代码来源:ColumnNameTypeConverter.java

示例5: render

import org.springframework.shell.ShellException; //导入依赖的package包/类
@Override
public String render(List<StratioStream> streams) throws ShellException {
    StringBuilder queryTables = new StringBuilder();
    List<Map<String, Object>> data = new ArrayList<>();
    for (StratioStream stratioStream : streams) {
        Map<String, Object> row = new HashMap<>();
        row.put(STREAM_NAME, stratioStream.getStreamName());
        row.put(USER_DEFINED, stratioStream.getUserDefined());
        row.put(QUERIES, stratioStream.getQueries().size());
        row.put(ELEMENTS, stratioStream.getColumns().size());
        row.put(ACTIVE_ACTIONS, stratioStream.getActiveActions().toString());

        queryTables.append(renderQueriesTable(stratioStream.getQueries(), stratioStream.getStreamName()));

        data.add(row);
    }

    StringBuilder result = new StringBuilder();
    result.append(TableRenderer.renderMapDataAsTable(data, columns));
    result.append(OsUtils.LINE_SEPARATOR);
    result.append(queryTables);

    return result.toString();
}
 
开发者ID:Stratio,项目名称:Decision,代码行数:25,代码来源:StreamListRenderer.java

示例6: BootShim

import org.springframework.shell.ShellException; //导入依赖的package包/类
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");
    }
}
 
开发者ID:avast,项目名称:hdfs-shell,代码行数:16,代码来源:BootShim.java

示例7: convertFromText

import org.springframework.shell.ShellException; //导入依赖的package包/类
@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>'.");
	}
	String applicationType = value.substring(0, colonIndex);
	return new AppRegistryCommands.QualifiedApplicationName(value.substring(colonIndex + 1), applicationType);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:10,代码来源:QualifiedApplicationNameConverter.java

示例8: convertFromText

import org.springframework.shell.ShellException; //导入依赖的package包/类
@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);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:11,代码来源:QualifiedApplicationNameConverter.java

示例9: doRun

import org.springframework.shell.ShellException; //导入依赖的package包/类
private ExitShellRequest doRun() {
    this.stopWatch.start();
    try {

        String[] commandsToExecuteAndThenQuit = this.commandLine.getShellCommandsToExecute();
        ExitShellRequest exitShellRequest;
        if (null != commandsToExecuteAndThenQuit) {

            boolean successful = false;
            exitShellRequest = ExitShellRequest.FATAL_EXIT;

            for (String cmd : commandsToExecuteAndThenQuit) {
                if (!(successful = this.lineShellComponent.executeCommand(cmd).isSuccess()))
                    break;
            }

            if (successful) {
                exitShellRequest = ExitShellRequest.NORMAL_EXIT;
            }
        }
        else if (this.applicationArguments.containsOption("help")) {
            System.out.println(FileUtils.readBanner(ShellCommandLineRunner.class, "/usage.txt"));
            exitShellRequest = ExitShellRequest.NORMAL_EXIT;
        } else {
            this.lineShellComponent.start();
            this.lineShellComponent.promptLoop();
            exitShellRequest = this.lineShellComponent.getExitShellRequest();
            if (exitShellRequest == null) {
                exitShellRequest = ExitShellRequest.NORMAL_EXIT;
            }
            this.lineShellComponent.waitForComplete();
        }

        if (this.lineShellComponent.isDevelopmentMode()) {
            System.out.println("Total execution time: " + this.stopWatch
                    .getLastTaskTimeMillis() + " ms");
        }

        return exitShellRequest;
    } catch (Exception ex) {
        throw new ShellException(ex.getMessage(), ex);
    } finally {
        HandlerUtils.flushAllHandlers(this.logger);
        this.stopWatch.stop();
    }
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:47,代码来源:ShellCommandLineRunner.java

示例10: doRun

import org.springframework.shell.ShellException; //导入依赖的package包/类
private ExitShellRequest doRun() {
	this.stopWatch.start();
	try {

		String[] commandsToExecuteAndThenQuit = this.commandLine.getShellCommandsToExecute();
		ExitShellRequest exitShellRequest;
		if (null != commandsToExecuteAndThenQuit) {

			boolean successful = false;
			exitShellRequest = ExitShellRequest.FATAL_EXIT;

			for (String cmd : commandsToExecuteAndThenQuit) {
				if (!(successful = this.lineShellComponent.executeCommand(cmd).isSuccess()))
					break;
			}

			if (successful) {
				exitShellRequest = ExitShellRequest.NORMAL_EXIT;
			}
		}
		else if (this.applicationArguments.containsOption("help")) {
			System.out.println(FileUtils.readBanner(ShellCommandLineRunner.class, "/usage.txt"));
			exitShellRequest = ExitShellRequest.NORMAL_EXIT;
		}
		else {
			this.lineShellComponent.start();
			this.lineShellComponent.promptLoop();
			exitShellRequest = this.lineShellComponent.getExitShellRequest();
			if (exitShellRequest == null) {
				exitShellRequest = ExitShellRequest.NORMAL_EXIT;
			}
			this.lineShellComponent.waitForComplete();
		}

		if (this.lineShellComponent.isDevelopmentMode()) {
			System.out.println("Total execution time: " + this.stopWatch.getLastTaskTimeMillis() + " ms");
		}

		return exitShellRequest;
	}
	catch (Exception ex) {
		throw new ShellException(ex.getMessage(), ex);
	}
	finally {
		HandlerUtils.flushAllHandlers(this.logger);
		this.stopWatch.stop();
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:49,代码来源:ShellCommandLineRunner.java

示例11: render

import org.springframework.shell.ShellException; //导入依赖的package包/类
String render(POJO pojo) throws ShellException; 
开发者ID:Stratio,项目名称:Decision,代码行数:2,代码来源:Renderer.java


注:本文中的org.springframework.shell.ShellException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。