org.crsh.shell.impl
Class GroovyScriptCommand

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.lang.Script
          extended by org.crsh.shell.impl.GroovyScriptCommand
All Implemented Interfaces:
groovy.lang.GroovyObject, CommandInvoker<Void,Void>, ShellCommand

public abstract class GroovyScriptCommand
extends groovy.lang.Script
implements ShellCommand, CommandInvoker<Void,Void>

This class provides the base class for Groovy scripts. It should not be used directly as it is rather used for configuring a Groovy CompilerConfiguration.setScriptBaseClass(String) class.

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
GroovyScriptCommand()
           
 
Method Summary
 Map<String,String> complete(CommandContext context, String line)
          Provide completions for the specified arguments.
 CommandInvoker<?,?> createInvoker(String line)
          Provides an invoker for the specified arguments.
 String describe(String line, DescriptionMode mode)
          Returns a description of the command or null if none can be found.
 Class<Void> getConsumedType()
          Returns the class of the consumed type.
 Class<Void> getProducedType()
          Returns the class of the produced type.
 Object getProperty(String property)
           
 void invoke(InvocationContext<Void,Void> context)
           
 
Methods inherited from class groovy.lang.Script
evaluate, evaluate, getBinding, invokeMethod, print, 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
 

Constructor Detail

GroovyScriptCommand

public GroovyScriptCommand()
Method Detail

getProducedType

public final Class<Void> getProducedType()
Description copied from interface: CommandInvoker
Returns the class of the produced type.

Specified by:
getProducedType in interface CommandInvoker<Void,Void>
Returns:
the produced type

getConsumedType

public final Class<Void> getConsumedType()
Description copied from interface: CommandInvoker
Returns the class of the consumed type.

Specified by:
getConsumedType in interface CommandInvoker<Void,Void>
Returns:
the consumed type

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 Map<String,String> complete(CommandContext 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 String describe(String line,
                       DescriptionMode 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

invoke

public final void invoke(InvocationContext<Void,Void> context)
                  throws ScriptException
Specified by:
invoke in interface CommandInvoker<Void,Void>
Parameters:
context - the command execution context
Throws:
ScriptException - any script exception

createInvoker

public final CommandInvoker<?,?> createInvoker(String line)
Description copied from interface: ShellCommand
Provides an invoker for the specified arguments.

Specified by:
createInvoker in interface ShellCommand
Parameters:
line - the command line arguments
Returns:
the command to provide


Copyright © 2011 eXo Platform SAS. All Rights Reserved.