From 65ed02984f004ce736744e56540bc04324f311c4 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Thu, 14 Feb 2013 22:54:45 +0100 Subject: Fold script console environment into Script. Add support for 'textFiles/consoleScript.lang.txt' console function declarations in kernel and modules. Use that context for ScriptConsole network consoles and new ShellConsole client process. --- src/main/resources/textFiles/consoleHelp.txt | 15 +++++++++++++++ .../resources/textFiles/consoleScript.javascript.txt | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/main/resources/textFiles/consoleHelp.txt create mode 100644 src/main/resources/textFiles/consoleScript.javascript.txt (limited to 'src/main/resources/textFiles') diff --git a/src/main/resources/textFiles/consoleHelp.txt b/src/main/resources/textFiles/consoleHelp.txt new file mode 100644 index 0000000..57a0655 --- /dev/null +++ b/src/main/resources/textFiles/consoleHelp.txt @@ -0,0 +1,15 @@ +Cristal console +--------------- +Commands entered here are directly parsed by the beanshell engine. You can call methods directly on these pre-loaded objects: +proxy - the EntityProxyManager +storage - the TransactionManager +db - the ClusterStorageManager +lookup - the LDAPLookup (server context) +orb - the ORB +user - the current logged in user, or the system user if connected to the server console + +Built-in commands: +log(level) - Change the log level of your stream. +help() - View this message. +version() - View kernel and module versions. +shutdown() - Stop this CRISTAL instance. diff --git a/src/main/resources/textFiles/consoleScript.javascript.txt b/src/main/resources/textFiles/consoleScript.javascript.txt new file mode 100644 index 0000000..9c68553 --- /dev/null +++ b/src/main/resources/textFiles/consoleScript.javascript.txt @@ -0,0 +1,19 @@ +function log(level) { + com.c2kernel.utils.Logger.removeLogStream(output); + com.c2kernel.utils.Logger.addLogStream(output, level); +} +function help() { + var help = com.c2kernel.utils.Resource.getAllTextResources("textFiles/consoleHelp.txt").values().iterator(); + while (help.hasNext()) + println(help.next()); +} +function version() { + print("Kernel version: "+com.c2kernel.utils.Resource.getKernelVersion()); + print("Modules loaded: "+com.c2kernel.process.Gateway.getModuleManager().getModuleVersions()); +} +function shutdown() { + if (com.c2kernel.process.AbstractMain.runningAsWrapper) + org.tanukisoftware.wrapper.WrapperManager.stop(0); + else + com.c2kernel.process.StandardClient.close(); +} -- cgit v1.2.3