org.crsh.command
Class BaseCommand<C,P>

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by org.crsh.command.BaseCommand<C,P>
All Implemented Interfaces:
groovy.lang.GroovyObject, ShellCommand<C,P>
Direct Known Subclasses:
ClassCommand

public abstract class BaseCommand<C,P>
extends groovy.lang.GroovyObjectSupport
implements ShellCommand<C,P>

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
protected BaseCommand()
           
 
Method Summary
protected abstract  void execute(CommandContext<C,P> context)
           
 void execute(CommandContext<C,P> context, String... args)
           
 Class<C> getConsumedType()
           
 Class<P> getProducedType()
           
 Object getProperty(String property)
           
protected  boolean getUnquoteArguments()
          Returns true if the command wants its arguments to be unquoted.
 Object invokeMethod(String name, Object args)
           
protected  String readLine(String msg)
           
protected  String readLine(String msg, boolean echo)
           
 void setProperty(String property, Object newValue)
           
 void setUnquoteArguments(boolean unquoteArguments)
           
 
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

BaseCommand

protected BaseCommand()
Method Detail

getProducedType

public Class<P> getProducedType()
Specified by:
getProducedType in interface ShellCommand<C,P>

getConsumedType

public Class<C> getConsumedType()
Specified by:
getConsumedType in interface ShellCommand<C,P>

invokeMethod

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

getProperty

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

setProperty

public final void setProperty(String property,
                              Object newValue)
Specified by:
setProperty in interface groovy.lang.GroovyObject
Overrides:
setProperty in class groovy.lang.GroovyObjectSupport

getUnquoteArguments

protected boolean getUnquoteArguments()
Returns true if the command wants its arguments to be unquoted.

Returns:
true if arguments must be unquoted

setUnquoteArguments

public void setUnquoteArguments(boolean unquoteArguments)

readLine

protected final String readLine(String msg)

readLine

protected final String readLine(String msg,
                                boolean echo)

execute

public final void execute(CommandContext<C,P> context,
                          String... args)
                   throws ScriptException
Specified by:
execute in interface ShellCommand<C,P>
Throws:
ScriptException

execute

protected abstract void execute(CommandContext<C,P> context)
                         throws ScriptException
Throws:
ScriptException


Copyright © 2010 eXo Platform SAS. All Rights Reserved.