|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sleep.console.ConsoleImplementation
public class ConsoleImplementation
The ConsoleImplementation is the "engine" behind the sleep console. To use the sleep console in your application use the following steps:
1. Instantiate the console implementationConsoleImplementation console;
console = new ConsoleImplementation(environment, variables, loader);
console.setProxy(new MyConsoleProxy());
console.rppl(); // starts the console
When embedding the console reusing the object of an already quitted console is not
only allowed but it is also recommended. When a user quits the console with the quit command
the console proxy is set to a dummy console that does not output anything. To restart
a quitted console just set the appropriate proxy again and call the rppl()
method.
ConsoleProxy
,
ScriptLoader
,
Variable
Constructor Summary | |
---|---|
ConsoleImplementation()
Creates an implementation of the sleep console. |
|
ConsoleImplementation(java.util.Hashtable _sharedEnvironment,
Variable _sharedVariables,
ScriptLoader _loader)
Creates an implementation of the sleep console that shares what your application is already using. |
Method Summary | |
---|---|
void |
consolePrint(java.lang.String m)
Dummy implementation, does nothing really. |
void |
consolePrintln(java.lang.Object m)
Dummy implementation, does nothing. |
java.lang.String |
consoleReadln()
Dummy implementation, always returns null. |
ConsoleProxy |
getProxy()
Returns the current console proxy being used |
void |
processScriptErrors(YourCodeSucksException ex)
a convienence method that formats and writes each syntax error to the proxy output |
void |
processScriptWarning(ScriptWarning warning)
fired when a runtime warning has occured. |
void |
rppl()
starts the console |
void |
scriptLoaded(ScriptInstance script)
called when a script is loaded |
void |
scriptUnloaded(ScriptInstance script)
called when a script is unloaded |
void |
setProxy(ConsoleProxy p)
Sets up the implementation of the consoles input/output facilities |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConsoleImplementation()
public ConsoleImplementation(java.util.Hashtable _sharedEnvironment, Variable _sharedVariables, ScriptLoader _loader)
Warning! If you choose to use the Sleep console in your application with this constructor, be aware that even if you don't specify a set of variables or an environment for scripts to share that they will all end up sharing something as the sleep console will create and install its own environment or variables if you don't specify something.
_sharedEnvironment
- the environment contains all of the bridges (functions, predicates, and environments)_sharedVariables
- the Variable class is a container for Scalar variables with global, local, and script specific scope_loader
- the Script Loader is a container for managing all of the currently loaded scriptsMethod Detail |
---|
public ConsoleProxy getProxy()
public void setProxy(ConsoleProxy p)
public void consolePrint(java.lang.String m)
consolePrint
in interface ConsoleProxy
m
- the message to printpublic java.lang.String consoleReadln()
consoleReadln
in interface ConsoleProxy
public void consolePrintln(java.lang.Object m)
consolePrintln
in interface ConsoleProxy
m
- the message to printpublic void rppl() throws java.io.IOException
java.io.IOException
public void processScriptErrors(YourCodeSucksException ex)
public void processScriptWarning(ScriptWarning warning)
RuntimeWarningWatcher
processScriptWarning
in interface RuntimeWarningWatcher
public void scriptLoaded(ScriptInstance script)
Loadable
scriptLoaded
in interface Loadable
public void scriptUnloaded(ScriptInstance script)
Loadable
scriptUnloaded
in interface Loadable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |