org.crsh.command
Class CRaSHCommand

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by org.crsh.command.GroovyCommand
          extended by org.crsh.command.CRaSHCommand
All Implemented Interfaces:
groovy.lang.GroovyObject, ShellCommand
Direct Known Subclasses:
JCRCommand

public abstract class CRaSHCommand
extends GroovyCommand
implements ShellCommand

A real CRaSH command, the most powerful kind of command.

Version:
$Revision$
Author:
Julien Viet

Field Summary
private  CommandContext context
          .
private  ClassDescriptor<?> descriptor
          .
private  boolean help
          .
private  org.slf4j.Logger log
          .
private  String unmatched
          The unmatched text, only valid during an invocation.
private  boolean unquoteArguments
          .
 
Constructor Summary
protected CRaSHCommand()
           
 
Method Summary
 CommandCompletion 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, DescriptionFormat mode)
          Returns a description of the command or null if none can be found.
protected  CommandContext getContext()
           
 ClassDescriptor<?> getDescriptor()
          Returns the command descriptor.
 String getUnmatched()
           
 boolean getUnquoteArguments()
          Returns true if the command wants its arguments to be unquoted.
protected  String readLine(String msg)
           
protected  String readLine(String msg, boolean echo)
           
 void setUnquoteArguments(boolean unquoteArguments)
           
(package private) static ScriptException toScript(Throwable cause)
           
 
Methods inherited from class org.crsh.command.GroovyCommand
getProperty, invokeMethod, 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

log

private final org.slf4j.Logger log
.


context

private CommandContext context
.


unquoteArguments

private boolean unquoteArguments
.


descriptor

private final ClassDescriptor<?> descriptor
.


unmatched

private String unmatched
The unmatched text, only valid during an invocation.


help

private boolean help
.

Constructor Detail

CRaSHCommand

protected CRaSHCommand()
                throws IntrospectionException
Throws:
IntrospectionException
Method Detail

getDescriptor

public ClassDescriptor<?> getDescriptor()
Returns the command descriptor.

Returns:
the command descriptor

getUnquoteArguments

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

Returns:
true if arguments must be unquoted

setUnquoteArguments

public final void setUnquoteArguments(boolean unquoteArguments)

readLine

protected final String readLine(String msg)

readLine

protected final String readLine(String msg,
                                boolean echo)

getUnmatched

public final String getUnmatched()

getContext

protected final CommandContext getContext()
Specified by:
getContext in class GroovyCommand

complete

public final CommandCompletion 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 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

toScript

static ScriptException toScript(Throwable cause)

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 © 2012 eXo Platform SAS. All Rights Reserved.