Package com.killcoding.jsplus
Class ScriptConsole
java.lang.Object
com.killcoding.jsplus.ScriptConsole
- All Implemented Interfaces:
ConsoleImpl
- Direct Known Subclasses:
CmdConsole,JdbcConsole
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static ConfigPropertiesprivate CacheDriverExecutorprotected Runnableprotected Runnableprotected CmdConsoleprotected static final Map<Integer,ScriptConsole> protected ConfigPropertiesprivate static DriverDataSourceprotected ConfigPropertiesprotected Stringprivate Stringprivate static ExecutorServiceprivate booleanprotected booleanprotected CacheArrayprivate Stringstatic final Stringprotected JsPlusContextprivate Stringprotected Loggerprivate longprivate static final longprotected booleanprivate static Pathprivate booleanprivate booleanprivate booleanFields inherited from interface com.killcoding.jsplus.ConsoleImpl
CALL_REGEX, CONSOLE_FUN_REGEX, CONSOLE_VAR_REGEX, DEFAULT_AutoCommit, DEFAULT_BatchSize, DEFAULT_CallStoredProcedureFun, DEFAULT_ColumnCut, DEFAULT_ColumnWidth, DEFAULT_CommandCancel, DEFAULT_CommandEnd, DEFAULT_CommandHistory, DEFAULT_Config_Cipher_AesKey, DEFAULT_DateFormat, DEFAULT_DateTimeFormat, DEFAULT_ExportCursorStart, DEFAULT_ExportMaxFileSize, DEFAULT_ExportMaxRows, DEFAULT_ExportOrderBy, DEFAULT_ExportSplit, DEFAULT_ExportTimer, DEFAULT_ExportUpperOrLowerCase, DEFAULT_ImportSplit, DEFAULT_Jdbc_Cipher_AesKey, DEFAULT_Name, DEFAULT_QueryCursorStart, DEFAULT_QueryMaxRows, DEFAULT_Quote, DEFAULT_Script_Cipher_AesKey, DEFAULT_ScriptEngine, DEFAULT_ShowResultBody, DEFAULT_ShowResultFooter, DEFAULT_ShowResultHeader, DEFAULT_ShowTaskLog, DEFAULT_Task, DEFAULT_TaskTimer, DEFAULT_TimeFormat, DEFAULT_WriteHistory, SELECT_REGEX, VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()private voidvoidaddExitRunnable(Runnable exitRun) voidaddHistory(String command) voidvoidcallbackBatch(Runnable callbackBatch) voidvoidclear()private voidvoidclearLastSelectCommand(List<String> params) voidclose()private voidvoidvoidcommit()private voidvoidconnect(int consoleHashCode) converToSqlFromMap(String schema, String tableName, List<String> columns) protected CacheArrayFiltercreateCacheArrayFilter(long filterTimer, long filterLoopTimer) decryptScript(File scriptPath) private static booleanstatic Stringstatic StringvoidevalScript(String script) booleanexecuteBatch(String batchFile) protected StringexecuteCmdBatch(String _batchFile) protected StringexecuteJdbcBatch(String _batchFile) booleanexecuteViaCmd(boolean enableSystemOut, String commands) booleanexecuteViaCmd(boolean enableSystemOut, String commands, Runnable successfullyRun, Runnable faiiledRun) booleanexecuteViaCmd(Boolean enableSystemOut, String commands, Runnable successfullyRun, Runnable faiiledRun) booleanexecuteViaCmd(String commands) booleanexecuteViaJdbc(Boolean enableSystemOut, String commands) booleanexecuteViaJdbc(String commands) booleanexecuteViaScript(String commands) static Stringexit()exportTables(String schema, String exportToFolder) exportTables(List<String> params) voidvoidvoidvoidexportTo(String _lastSelectCommand, File folder, String filePrefix, Runnable completedRun, Runnable terminatedRun) voidformatCommand(String command) formatForExport(Object objValue) formatForExport(String tableObjectFolder, Object objValue) formatObjectValue(boolean useEncrypt, boolean single, Object objValue, String tableObjectFolder) genCreateTable(String schema, String tableName) genCreateTable(List<String> params) genCreateTables(String schema, String sqlFilePath) genCreateTables(List<String> params) static ConfigPropertiesgetCacheArrayFilter(Boolean enableSystemOut) getCacheArrayFilterForExport(boolean showTaskLog, String file) getCacheArrayFilterForExport(boolean showTaskLog, String file, Runnable completedRun, Runnable terminatedRun) getCacheDriverExecutor(boolean refreshConnection) protected ScriptConsolegetDataType(boolean isId, String javaType, int precision) protected StringgetGlobalCacheArray(long filterTimer, int filterLoopTimer) static Stringstatic Stringhelp()hostname()importFrom(String schema, String tableName, String csv) importFrom(List<String> params) importTables(String schema, String folder) importTables(List<String> params) private voidinitEnv()voidinitGlobalCacheArray(long filterTimer, long filterLoopTimer) static voidinitPool()voidvoidinitScriptEngineManager(boolean allowAllAccess) voidbooleanisCommandCancel(String command) booleanisCommandEnd(String command) booleanbooleanbooleanvoiddoubledoublememoryUsage(long using) longnewBuilder(boolean allowAllAccess) newBuilder(String _engineName) newBuilder(String _engineName, boolean allowAllAccess) booleanopen()private booleanvoidreset()voidrollback()private voidsetAutoCommit(Boolean autoCommit) setAutoCommit(List<String> params) static voidsetCacheApi(String apiClass) setCacheApi(List<String> params) voidsetConsoleVariables(ConfigProperties consoleVariables) voidsetDataSource(DriverDataSource datasource) voidsetIntoValue(Object value) voidsetLastSelectCommand(String lastSelectCommand) static voidsetStaticDataSource(DriverDataSource datasource) voidvoidvoidvoidvoidshowAll()showColumnClasses(String tableName) showColumnClasses(List<String> params) showColumnTypes(String tableName) showColumnTypes(List<String> params) voidshowHistory(String hiscmd) showTables(String schema) showTables(List<String> params) voidvoidvoidstopTask()protected voidtask()protected voidvoidbyte[]toByteArray(Blob blobValue) byte[]toByteArray(Clob clobValue) toResultList(List<Map<String, Object>> list) static StringunescapeCsv(String input) version()
-
Field Details
-
log
-
CONNECT_CONSOLES
-
datasource
-
datasourceVariables
-
consoleVariables
-
appenvCp
-
taskExecuted
-
firstOpen
-
useScriptEnv
-
useJdbcEnv
-
useCmdEnv
-
engineName
-
preExecuteTime
-
cacheDriverExecutor
-
lastSelectCommand
-
intoValue
-
exportedCompleted
-
cmdConsole
-
jsPlusContext
-
displayEngineName
-
exitRuns
-
startedTimeMs
-
tmpPath
-
exitExecute
-
JS_PLUS_PATH_KEY
- See Also:
-
globalCacheArray
-
callback
-
callbackBatch
-
-
Constructor Details
-
ScriptConsole
public ScriptConsole()
-
-
Method Details
-
getJsPlusPath
-
initEnv
-
loadAppenv
-
getAppenv
-
detectSystemExit
- Throws:
IOException
-
initPool
-
setStaticDataSource
-
setDataSource
-
getDataSource
- Throws:
IOException
-
getIntoValue
-
getLastSelectCommand
-
getCacheDriverExecutor
-
getCacheDriverExecutor
-
getConsoleVariables
-
setConsoleVariables
-
setLastSelectCommand
-
clearLastSelectCommand
-
into
-
sleep
- Throws:
Exception
-
hostname
- Throws:
Exception
-
startTask
-
stopTask
-
callback
- Throws:
Exception
-
callbackBatch
- Throws:
Exception
-
getGlobalCacheArray
-
getGlobalCacheArray
-
createCacheArrayFilter
-
initGlobalCacheArray
-
initScriptEngineManager
- Throws:
Exception
-
initScriptEngineManager
- Throws:
Exception
-
getContext
-
eval
- Throws:
Exception
-
eval
- Throws:
Exception
-
eval
- Throws:
Exception
-
closeContext
- Throws:
Exception
-
newBuilder
- Throws:
Exception
-
newBuilder
- Throws:
Exception
-
newBuilder
- Throws:
Exception
-
newBuilder
- Throws:
Exception
-
desc
- Throws:
Exception
-
showTables
- Throws:
Exception
-
showTables
- Throws:
Exception
-
showColumnTypes
- Throws:
Exception
-
showColumnClasses
- Throws:
Exception
-
set
-
show
-
showAll
-
setAutoCommit
- Throws:
Exception
-
genCreateTables
-
genCreateTable
- Throws:
Exception
-
getDataType
-
setCacheApi
- Throws:
Exception
-
reset
-
converToSqlFromMap
-
conver
public Object conver(String tableObjectFolder, String javaType, String encryptCell) throws Exception - Throws:
Exception
-
getJarPath
-
exportTo
- Throws:
Exception
-
exportTo
- Throws:
Exception
-
exportTo
- Throws:
Exception
-
exportTo
- Throws:
Exception
-
getCacheArrayFilterForExport
-
exportTo
public void exportTo(String _lastSelectCommand, File folder, String filePrefix, Runnable completedRun, Runnable terminatedRun) throws Exception - Throws:
Exception
-
getCacheArrayFilterForExport
public CacheArrayFilter getCacheArrayFilterForExport(boolean showTaskLog, String file, Runnable completedRun, Runnable terminatedRun) -
format
-
formatForExport
-
formatForExport
-
formatObjectValue
public String formatObjectValue(boolean useEncrypt, boolean single, Object objValue, String tableObjectFolder) -
toByteArray
-
toByteArray
-
columnCut
-
toSingle
-
clear
-
clear
-
open
-
close
-
commit
-
rollback
-
abort
-
abort
- Throws:
SQLException
-
rollback
- Throws:
SQLException
-
commit
- Throws:
SQLException
-
close
- Throws:
SQLException
-
open
-
executeBatch
- Throws:
Exception
-
executeCmdBatch
- Throws:
Exception
-
executeJdbcBatch
- Throws:
Exception
-
evalScript
- Throws:
Exception
-
executeViaCmd
-
executeViaCmd
public boolean executeViaCmd(boolean enableSystemOut, String commands, Runnable successfullyRun, Runnable faiiledRun) -
executeViaScript
-
execute
-
executeViaJdbc
-
executeViaCmd
-
executeViaCmd
public boolean executeViaCmd(Boolean enableSystemOut, String commands, Runnable successfullyRun, Runnable faiiledRun) -
executeViaJdbc
-
getCacheArrayFilter
-
checkHistory
-
addHistory
-
showHistory
-
toResultList
-
isCommandEnd
-
isCommandCancel
-
parseArgs
-
task
- Throws:
Exception
-
task
- Throws:
Exception
-
setTask
-
setTask
-
taskExecute
-
importFrom
- Throws:
Exception
-
importTables
-
exportTables
-
quote
-
setIntoValue
-
formatCommand
-
exportUpperOrLowerCase
-
getCmdConsole
-
error
-
exit
-
memoryUsing
-
memoryUsage
-
memoryUsage
-
addExitRunnable
-
version
-
setUseJdbcEnv
-
setUseScriptEnv
-
setUseCmdEnv
-
isUseJdbcEnv
-
isUseScriptEnv
-
isUseCmdEnv
-
help
-
connect
-
getConsole
-
getDisplayEngineName
-
getConsoles
-
decryptScript
- Throws:
Exception
-
version
-
help
-
exit
-
reset
-
setCacheApi
-
when
-
into
-
batch
-
sleep
-
hostname
-
startTask
-
stopTask
-
set
-
show
-
showAll
-
importTables
-
clearLastSelectCommand
-
exportTables
-
desc
-
showTables
-
showColumnTypes
-
showColumnClasses
-
exportTo
-
importFrom
-
setAutoCommit
-
genCreateTables
-
genCreateTable
-
escapeCsv
-
unescapeCsv
-