|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sonatype.gshell.console.ConsoleTask
public abstract class ConsoleTask
Encapsulates a console execute task.
| Nested Class Summary | |
|---|---|
static class |
ConsoleTask.AbortTaskError
Error thrown to tasks which are asked to {link #abort}. |
| Field Summary | |
|---|---|
protected static org.slf4j.Logger |
log
|
| Constructor Summary | |
|---|---|
ConsoleTask()
|
|
| Method Summary | |
|---|---|
void |
abort()
Kill the tasks execute thread via Thread.stop(). |
abstract boolean |
doExecute(String input)
Execute the custom task for the given input. |
boolean |
execute(String input)
Execute a task for the given input. |
static ConsoleTask |
get()
Get the currently running task. |
static ConsoleTask |
get(boolean allowNull)
Get the currently running task. |
Thread |
getExecuteThread()
Get the execution thread of the current task. |
boolean |
isRunning()
True if the task is running (ie. |
boolean |
isStopping()
True if stop() was invoked. |
void |
setExecuteThread(Thread thread)
Set the execution thread of the current task. |
void |
stop()
Ask the tasks execute thread to stop via Thread.interrupt(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.slf4j.Logger log
| Constructor Detail |
|---|
public ConsoleTask()
| Method Detail |
|---|
public boolean isRunning()
execute(java.lang.String) was invoked).
public void stop()
Thread.interrupt().
public boolean isStopping()
stop() was invoked.
public void abort()
Thread.stop(). Thread is given a ConsoleTask.AbortTaskError.
public boolean execute(String input)
throws Exception
input - The console input.
Exception - The console task failed.
public abstract boolean doExecute(String input)
throws Exception
input - The console input.
Exception - The console task failed.public void setExecuteThread(Thread thread)
thread - The new thread considered to be the tasks execute thread.public Thread getExecuteThread()
public static ConsoleTask get(boolean allowNull)
allowNull - False to throw an IllegalStateException if there is not current task.
public static ConsoleTask get()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||