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


Java Verbosity类代码示例

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


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

示例1: GroovyInterpreter

import org.codehaus.groovy.tools.shell.IO.Verbosity; //导入依赖的package包/类
public GroovyInterpreter(Binding binding) throws IOException {
	this.binding = binding;
	if (this.binding == null)
		this.binding = new Binding();

	is = new PipedInputStream();
	os = new PipedOutputStream();
	pis = new PipedInputStream(os);
	pos = new PipedOutputStream(is);

	System.setProperty(TerminalFactory.JLINE_TERMINAL, "none");
	AnsiConsole.systemInstall();
	Ansi.setDetector(new AnsiDetector());

	binding.setProperty("out", new ImmediateFlushingPrintWriter(pos));

	shell = new Groovysh(binding, new IO(pis, pos, pos));
	// {
	// @Override
	// public void displayWelcomeBanner(InteractiveShellRunner runner) {
	// // do nothing
	// }
	// };
	shell.getIo().setVerbosity(Verbosity.QUIET);
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:26,代码来源:GroovyInterpreter.java

示例2: main

import org.codehaus.groovy.tools.shell.IO.Verbosity; //导入依赖的package包/类
/**
 * Main entry point to the client execution.
 *
 * @param args Command line arguments
 * @throws Exception
 */
public static void main (String[] args) throws Exception {
  System.setProperty("groovysh.prompt", Constants.SQOOP_PROMPT);
  Groovysh shell = new Groovysh();

  // Install our error hook (exception handling)
  shell.setErrorHook(new MethodClosure(ThrowableDisplayer.class, "errorHook"));

  CommandRegistry registry = shell.getRegistry();
  @SuppressWarnings("unchecked")
  Iterator<Command> iterator = registry.iterator();
  while (iterator.hasNext()) {
    Command command = iterator.next();
    if (!commandsToKeep.contains(command.getName())) {
      iterator.remove();
      // remove from "names" set to avoid duplicate error.
      registry.remove(command);
    }
  }

  shell.register(new HelpCommand(shell));
  shell.register(new SetCommand(shell));
  shell.register(new ShowCommand(shell));
  shell.register(new CreateCommand(shell));
  shell.register(new DeleteCommand(shell));
  shell.register(new UpdateCommand(shell));
  shell.register(new CloneCommand(shell));
  shell.register(new StartCommand(shell));
  shell.register(new StopCommand(shell));
  shell.register(new StatusCommand(shell));
  shell.register(new EnableCommand(shell));
  shell.register(new DisableCommand(shell));
  shell.register(new GrantCommand(shell));
  shell.register(new RevokeCommand(shell));

  // Configure shared shell io object
  setIo(shell.getIo());

  // We're running in batch mode by default
  setInteractive(false);

  // Let's see if user do have resource file with initial commands that he
  // would like to apply.
  String homeDir = System.getProperty(Constants.PROP_HOMEDIR);
  File rcFile = new File(homeDir, RC_FILE);

  if(rcFile.exists()) {
    printlnResource(Constants.RES_SQOOP_PROMPT_SHELL_LOADRC, RC_FILE);
    interpretFileContent(rcFile, shell);
    printlnResource(Constants.RES_SQOOP_PROMPT_SHELL_LOADEDRC);
  }

  if (args.length == 0) {
    // Interactive mode:
    getIo().setVerbosity(Verbosity.QUIET);
    printlnResource(Constants.RES_SQOOP_SHELL_BANNER);
    println();

    // Switch to interactive mode
    setInteractive(true);
    shell.run(args);

  } else {
    // Batch mode (with a script file):
    File script = new File(args[0]);
    if (!script.isAbsolute()) {
      String userDir = System.getProperty(Constants.PROP_CURDIR);
      script = new File(userDir, args[0]);
    }

    interpretFileContent(script, shell);
  }
}
 
开发者ID:vybs,项目名称:sqoop-on-spark,代码行数:79,代码来源:SqoopShell.java

示例3: main

import org.codehaus.groovy.tools.shell.IO.Verbosity; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	System.setProperty("groovysh.prompt", "aquila");
	Groovysh shell = new Groovysh();
	shell.setErrorHook(new MethodClosure(ThrowableDisplayer.class, "errorHook"));
	CommandRegistry registry = shell.getRegistry();
	@SuppressWarnings("unchecked")
	Iterator<Command> iterator = registry.iterator();
	while (iterator.hasNext()) {
		Command command = iterator.next();
		if (!commandsToKeep.contains(command.getName())) {
			iterator.remove();
			registry.remove(command);
		}
	}

	shell.register(new HelpCommand(shell));
	shell.register(new CreateCommand(shell));
	shell.register(new ShowCommand(shell));
	shell.register(new LsCommand(shell));
	shell.register(new StartCommand(shell));
	shell.register(new DeleteCommand(shell));

	
	try{
		DerbyUtil.createTable2();	
	}catch(SQLException e){
		
	}
	
	// Configure shared shell io object
	ShellEnvironment.setIo(shell.getIo());

	// We're running in batch mode by default
	ShellEnvironment.setInteractive(false);

	if (args.length == 0) {
		ShellEnvironment.getIo().setVerbosity(Verbosity.QUIET);
		ShellEnvironment.println("@|green Aquila Shell:|@ Type '@|bold help|@' or '@|bold \\h|@' for help.");
		ShellEnvironment.println();
		ShellEnvironment.setInteractive(true);
		shell.run(args);
	} else {
		File script = new File(args[0]);
		if (!script.isAbsolute()) {
			String userDir = System.getProperty(Constants.PROP_CURDIR);
			script = new File(userDir, args[0]);
		}
		interpretFileContent(script, shell);
	}
	
	
	
}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:54,代码来源:AquilaShell.java


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