org.sonatype.gshell.execute
Class CommandExecutorImpl

java.lang.Object
  extended by org.sonatype.gshell.execute.CommandExecutorImpl
All Implemented Interfaces:
CommandExecutor

public class CommandExecutorImpl
extends Object
implements CommandExecutor

The default CommandExecutor component.

Since:
2.0
Author:
Jason Dillon

Constructor Summary
CommandExecutorImpl(AliasRegistry aliases, CommandResolver resolver, CommandLineParser parser)
           
 
Method Summary
 Object execute(Shell shell, Object... args)
          Execute a pre-processed command-line.
 Object execute(Shell shell, String line)
          Execute a command-line, parsing out valid recognized syntax.
 Object execute(Shell shell, String name, Object[] args)
          Execute command name/path with the given arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandExecutorImpl

@Inject
public CommandExecutorImpl(AliasRegistry aliases,
                                  CommandResolver resolver,
                                  CommandLineParser parser)
Method Detail

execute

public Object execute(Shell shell,
                      String line)
               throws Exception
Description copied from interface: CommandExecutor
Execute a command-line, parsing out valid recognized syntax.

Specified by:
execute in interface CommandExecutor
Parameters:
shell - The executing shell.
line - Raw command-line to parse and execute.
Returns:
Command execution result.
Throws:
Exception - Command-line execution failed.

execute

public Object execute(Shell shell,
                      Object... args)
               throws Exception
Description copied from interface: CommandExecutor
Execute a pre-processed command-line.

Specified by:
execute in interface CommandExecutor
Parameters:
shell - The executing shell.
args - Command arguments, first argument is expected to be the command/path to execute.
Returns:
Command execution result.
Throws:
Exception - Command-line execution failed.

execute

public Object execute(Shell shell,
                      String name,
                      Object[] args)
               throws Exception
Description copied from interface: CommandExecutor
Execute command name/path with the given arguments.

Specified by:
execute in interface CommandExecutor
Parameters:
shell - The executing shell.
name - Name of the command/path to execute.
args - Command arguments.
Returns:
Command execution result.
Throws:
Exception - Command-line execution failed.


Copyright © 2008-2011 Sonatype. All Rights Reserved.