|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.roo.shell.event.AbstractShellStatusPublisher
org.springframework.roo.shell.AbstractShell
public abstract class AbstractShell
Provides a base Shell
implementation.
Field Summary | |
---|---|
static String |
completionKeys
|
protected ExitShellRequest |
exitShellRequest
|
protected boolean |
inBlockComment
|
protected Logger |
logger
|
static String |
shellPrompt
|
Fields inherited from class org.springframework.roo.shell.event.AbstractShellStatusPublisher |
---|
shellStatus, shellStatusListeners |
Constructor Summary | |
---|---|
AbstractShell()
|
Method Summary | |
---|---|
void |
blockCommentBegin()
|
void |
blockCommentFinish()
|
String |
date()
|
boolean |
executeCommand(String line)
Runs the specified command. |
protected boolean |
executeScriptLine(String line)
Execute the single line from a script. |
protected abstract org.osgi.service.component.ComponentContext |
getContext()
|
ExitShellRequest |
getExitShellRequest()
|
File |
getHome()
Obtains the home directory for the current shell instance. |
protected abstract String |
getHomeAsString()
|
protected Parser |
getParser()
|
String |
getShellPrompt()
|
void |
inlineComment()
|
protected void |
logCommandIfRequired(String line,
boolean successful)
Allows a subclass to log the execution of a well-formed command. |
protected void |
logCommandToOutput(String processedLine)
Allows a subclass to actually write the resulting logged command to some form of output. |
String |
props()
|
void |
script(File resource,
boolean lineNumbers)
|
void |
setPromptPath(String path)
Base implementation of the Shell.setPromptPath(String) method, designed for simple shell
implementations. |
String |
version(String extra)
|
static String |
versionInfo()
|
Methods inherited from class org.springframework.roo.shell.event.AbstractShellStatusPublisher |
---|
addShellStatusListener, getShellStatus, removeShellStatusListener, setShellStatus |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.roo.shell.Shell |
---|
isDevelopmentMode, promptLoop, setDevelopmentMode |
Methods inherited from interface org.springframework.roo.shell.event.ShellStatusProvider |
---|
addShellStatusListener, getShellStatus, removeShellStatusListener |
Field Detail |
---|
protected final Logger logger
protected boolean inBlockComment
protected ExitShellRequest exitShellRequest
public static String shellPrompt
public static String completionKeys
Constructor Detail |
---|
public AbstractShell()
Method Detail |
---|
public void script(File resource, boolean lineNumbers)
protected boolean executeScriptLine(String line)
This method can be overridden by sub-classes to pre-process script lines.
public boolean executeCommand(String line)
Shell
executeCommand
in interface Shell
line
- to execute (required)
protected void logCommandIfRequired(String line, boolean successful)
Implementations should consider specially handling the "script" commands, and also
indicating whether a command was successful or not. Implementations that wish to behave
consistently with other AbstractShell
subclasses are encouraged to simply override
logCommandToOutput(String)
instead, and only override this method if you actually
need to fine-tune the output logic.
line
- the parsed line (any comments have been removed; never null)successful
- if the command was successful or notprotected void logCommandToOutput(String processedLine)
logCommandIfRequired(String, boolean)
.
Implementations should invoke getExitShellRequest()
to monitor any attempts to exit the shell and
release resources such as output log files.
processedLine
- the line that should be appended to some type of output (excluding the \n character)public void setPromptPath(String path)
Shell.setPromptPath(String)
method, designed for simple shell
implementations. Advanced implementations (eg those that support ANSI codes etc) will likely want
to override this method and set the shellPrompt
variable directly.
setPromptPath
in interface Shell
path
- to set (can be null or empty; must NOT be formatted in any special way eg ANSI codes)public ExitShellRequest getExitShellRequest()
getExitShellRequest
in interface Shell
public void inlineComment()
public void blockCommentBegin()
public void blockCommentFinish()
public String props()
public String date()
public String version(String extra)
public static String versionInfo()
public String getShellPrompt()
getShellPrompt
in interface ShellPromptAccessor
public File getHome()
Note: calls the getHomeAsString()
method to allow subclasses to provide the home directory location as
string using different environment-specific strategies.
If the path indicated by getHomeAsString()
exists and refers to a directory, that directory
is returned.
If the path indicated by getHomeAsString()
exists and refers to a file, an exception is thrown.
If the path indicated by getHomeAsString()
does not exist, it will be created as a directory.
If this fails, an exception will be thrown.
getHome
in interface Shell
protected abstract String getHomeAsString()
protected abstract org.osgi.service.component.ComponentContext getContext()
protected final Parser getParser()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |