org.crsh.lang.groovy.command
Class GroovyScriptCommand

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.lang.Script
          extended by org.crsh.lang.groovy.command.GroovyScriptCommand
All Implemented Interfaces:
groovy.lang.GroovyObject, ShellCommand

public abstract class GroovyScriptCommand
extends groovy.lang.Script
implements ShellCommand


Field Summary
private  String[] args
          .
protected  InvocationContext context
          The current context.
private  CommandInvoker<Object,Object> invoker
           
protected  RenderPrintWriter out
          The current output.
private  LinkedList<InvocationContext<?>> stack
          .
 
Constructor Summary
protected GroovyScriptCommand()
           
 
Method Summary
 CompletionMatch complete(RuntimeContext context, String line)
          Provide completions for the specified arguments.
 String describe(String line, DescriptionFormat mode)
          Returns a description of the command or null if none can be found.
 void execute(String s)
           
 Object getProperty(String property)
           
 Object invokeMethod(String name, Object args)
           
 InvocationContext<?> peekContext()
           
 InvocationContext<?> popContext()
           
 void pushContext(InvocationContext<?> context)
           
 CommandInvoker<?,?> resolveInvoker(String line)
          Provides an invoker for the command line specified as a command line to parse.
 CommandInvoker<?,?> resolveInvoker(String name, Map<String,?> options, List<?> args)
          Provides an invoker for the command line specified under the form of a command, options and arguments.
 
Methods inherited from class groovy.lang.Script
evaluate, evaluate, getBinding, print, printf, printf, println, println, run, run, setBinding, setProperty
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stack

private LinkedList<InvocationContext<?>> stack
.


context

protected InvocationContext context
The current context.


out

protected RenderPrintWriter out
The current output.


args

private String[] args
.


invoker

private final CommandInvoker<Object,Object> invoker
Constructor Detail

GroovyScriptCommand

protected GroovyScriptCommand()
Method Detail

pushContext

public final void pushContext(InvocationContext<?> context)
                       throws NullPointerException
Throws:
NullPointerException

popContext

public final InvocationContext<?> popContext()

execute

public final void execute(String s)
                   throws ScriptException,
                          IOException
Throws:
ScriptException
IOException

peekContext

public final InvocationContext<?> peekContext()

invokeMethod

public final Object invokeMethod(String name,
                                 Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject
Overrides:
invokeMethod in class groovy.lang.Script

getProperty

public final Object getProperty(String property)
Specified by:
getProperty in interface groovy.lang.GroovyObject
Overrides:
getProperty in class groovy.lang.Script

complete

public final CompletionMatch complete(RuntimeContext context,
                                      String line)
Description copied from interface: ShellCommand
Provide completions for the specified arguments.

Specified by:
complete in interface ShellCommand
Parameters:
context - the command context
line - the original command line arguments
Returns:
the completions

describe

public final String describe(String line,
                             DescriptionFormat mode)
Description copied from interface: ShellCommand
Returns a description of the command or null if none can be found.

Specified by:
describe in interface ShellCommand
Parameters:
line - the usage line
mode - the description mode
Returns:
the description

resolveInvoker

public final CommandInvoker<?,?> resolveInvoker(String line)
Description copied from interface: ShellCommand
Provides an invoker for the command line specified as a command line to parse.

Specified by:
resolveInvoker in interface ShellCommand
Parameters:
line - the command line arguments
Returns:
the command

resolveInvoker

public final CommandInvoker<?,?> resolveInvoker(String name,
                                                Map<String,?> options,
                                                List<?> args)
Description copied from interface: ShellCommand
Provides an invoker for the command line specified under the form of a command, options and arguments.

Specified by:
resolveInvoker in interface ShellCommand
Parameters:
name - the command name, might be null
options - the options
args - the arguments
Returns:
the command


Copyright © 2013 eXo Platform SAS. All Rights Reserved.