Class GrouperGroovysh
java.lang.Object
org.codehaus.groovy.tools.shell.Shell
org.codehaus.groovy.tools.shell.Groovysh
edu.internet2.middleware.grouper.app.gsh.GrouperGroovysh
- All Implemented Interfaces:
groovy.lang.GroovyObject
public class GrouperGroovysh
extends org.codehaus.groovy.tools.shell.Groovysh
-
Nested Class Summary
Nested classes/interfaces inherited from class org.codehaus.groovy.tools.shell.Groovysh
org.codehaus.groovy.tools.shell.Groovysh._closure1, org.codehaus.groovy.tools.shell.Groovysh._closure2
-
Field Summary
Fields inherited from class org.codehaus.groovy.tools.shell.Groovysh
AUTOINDENT_PREFERENCE_KEY, COLLECTED_BOUND_VARS_MAP_VARNAME, COLORS_PREFERENCE_KEY, INTERPRETER_MODE_PREFERENCE_KEY, METACLASS_COMPLETION_PREFIX_LENGTH_PREFERENCE_KEY, SANITIZE_PREFERENCE_KEY, SHOW_LAST_RESULT_PREFERENCE_KEY
Fields inherited from class org.codehaus.groovy.tools.shell.Shell
log
-
Constructor Summary
ConstructorDescriptionGrouperGroovysh
(org.codehaus.groovy.tools.shell.IO io, org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration, boolean exitOnError) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addImports
(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration) dont call this, too much of a performance penaltyprotected void
displayError
(Throwable cause) static int
how many lines are in the lightweight profilestatic int
how many lines are in the normal profilestatic Throwable
handleGshException
(boolean isLightWeight, int scriptPrependHeaders, String scriptString, Throwable scriptException) static void
runScript
(GrouperGroovyInput grouperGroovyInput, GrouperGroovysh.GrouperGroovyResult grouperGroovyResult) run a script and return the result.run a script and return the result.run a script and return the result.Deprecated.since sendErrToOut doesnt make sensestatic boolean
scriptLineExit
(int lineNumber, String it) if running through a script, need to exit scriptstatic boolean
scriptLineIgnore
(int lineNumber, String it) if running through a script, need to ignore linestatic GrouperSession
see if there's a grouper session running; return if it's there otherwise start root session and return that.Methods inherited from class org.codehaus.groovy.tools.shell.Groovysh
displayBuffer, displayWelcomeBanner, execute, executeCommand, formatLineNumber, getBuffers, getDefaultErrorHook, getDefaultResultHook, getErrorHook, getEvictedLine, getHistory, getHistoryFull, getImports, getImportStatements, getIndentPrefix, getIndentSize, getInterp, getPackageHelper, getParser, getPreference, getResultHook, getRunner, getUserStateDirectory, isHistoryFull, isTypeOrMethodDeclaration, loadUserScript, maybeRecordError, maybeRecordInput, maybeRecordResult, renderPrompt, run, run, setErrorHook, setEvictedLine, setHistory, setHistoryFull, setIndentSize, setPackageHelper, setResultHook, setRunner
Methods inherited from class org.codehaus.groovy.tools.shell.Shell
findCommand, findCommand, getIo, getRegistry, isExecutable, leftShift, leftShift, register
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface groovy.lang.GroovyObject
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty
-
Constructor Details
-
GrouperGroovysh
public GrouperGroovysh(org.codehaus.groovy.tools.shell.IO io, org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration, boolean exitOnError) - Parameters:
io
-compilerConfiguration
-exitOnError
-
-
-
Method Details
-
scriptLineExit
if running through a script, need to exit script- Parameters:
lineNumber
-line
-- Returns:
- true if exit script
-
scriptLineIgnore
if running through a script, need to ignore line- Parameters:
lineNumber
-line
-- Returns:
- true if skip line
-
runScript
run a script and return the result. Note, check for exception and rethrow. Note this uses- Parameters:
script
-- Returns:
- the result
-
runScript
run a script and return the result. Note, check for exception and rethrow. Note this uses- Parameters:
script
-lightWeight
- will use an abbreviated groovysh.profile for faster speed. built in commands arent there and imports largely arent there- Returns:
- the result
-
runScript
public static GrouperGroovysh.GrouperGroovyResult runScript(String script, boolean lightWeight, boolean sendErrToOut) Deprecated.since sendErrToOut doesnt make senserun a script and return the result. Note, check for exception and rethrow. Note this uses- Parameters:
script
-lightWeight
- will use an abbreviated groovysh.profile for faster speed. built in commands arent there and imports largely arent there- Returns:
- the result
-
getLightWeightLines
public static int getLightWeightLines()how many lines are in the lightweight profile- Returns:
-
getNormalLines
public static int getNormalLines()how many lines are in the normal profile- Returns:
-
runScript
public static void runScript(GrouperGroovyInput grouperGroovyInput, GrouperGroovysh.GrouperGroovyResult grouperGroovyResult) run a script and return the result. Note, check for exception and rethrow. Note this uses- Parameters:
script
-lightWeight
- will use an abbreviated groovysh.profile for faster speed. built in commands arent there and imports largely arent there
-
addImports
public static void addImports(org.codehaus.groovy.control.CompilerConfiguration compilerConfiguration) dont call this, too much of a performance penalty -
getThrowable
- Returns:
- the throwable
-
displayError
-
startRootSessionIfNoSessionRunning
see if there's a grouper session running; return if it's there otherwise start root session and return that.- Returns:
-
handleGshException
-