public class MemoryWarpScriptStack extends java.lang.Object implements WarpScriptStack, org.apache.hadoop.util.Progressable
| Modifier and Type | Class and Description |
|---|---|
static class |
MemoryWarpScriptStack.StackContext |
WarpScriptStack.Macro, WarpScriptStack.Mark, WarpScriptStack.SignalATTRIBUTE_ALLOW_REDEFINED, ATTRIBUTE_CREATION_TIME, ATTRIBUTE_DEBUG_DEPTH, ATTRIBUTE_ELAPSED, ATTRIBUTE_EXPORTED_SYMBOLS, ATTRIBUTE_FETCH_COUNT, ATTRIBUTE_FETCH_LIMIT, ATTRIBUTE_FETCH_LIMIT_HARD, ATTRIBUTE_GTS_COUNT, ATTRIBUTE_GTS_LIMIT, ATTRIBUTE_GTS_LIMIT_HARD, ATTRIBUTE_HADOOP_PROGRESSABLE, ATTRIBUTE_HEADERS, ATTRIBUTE_IMPORT_RULES, ATTRIBUTE_IN_SECURE_MACRO, ATTRIBUTE_IN_XEVAL, ATTRIBUTE_INFOMODE, ATTRIBUTE_INTERACTIVE_ECHO, ATTRIBUTE_INTERACTIVE_JSON, ATTRIBUTE_INTERACTIVE_TIME, ATTRIBUTE_INTERACTIVE_WRITER, ATTRIBUTE_JSON_MAXSIZE, ATTRIBUTE_JSON_MAXSIZE_HARD, ATTRIBUTE_JSON_PRETTY, ATTRIBUTE_JSON_STRICT, ATTRIBUTE_LAST_ERROR, ATTRIBUTE_LINENO, ATTRIBUTE_LOOP_MAXDURATION, ATTRIBUTE_LOOP_MAXDURATION_HARD, ATTRIBUTE_MACRO_NAME, ATTRIBUTE_MACRO_TTL, ATTRIBUTE_MAX_BUCKETS, ATTRIBUTE_MAX_BUCKETS_HARD, ATTRIBUTE_MAX_DEPTH, ATTRIBUTE_MAX_DEPTH_HARD, ATTRIBUTE_MAX_GEOCELLS, ATTRIBUTE_MAX_GEOCELLS_HARD, ATTRIBUTE_MAX_OPS, ATTRIBUTE_MAX_OPS_HARD, ATTRIBUTE_MAX_PIXELS, ATTRIBUTE_MAX_PIXELS_HARD, ATTRIBUTE_MAX_SYMBOLS, ATTRIBUTE_MAX_SYMBOLS_HARD, ATTRIBUTE_NAME, ATTRIBUTE_OPS, ATTRIBUTE_PARSING_ERRORS, ATTRIBUTE_RECURSION_MAXDEPTH, ATTRIBUTE_RECURSION_MAXDEPTH_HARD, ATTRIBUTE_RUNNER_RESCHEDULE_PERIOD, ATTRIBUTE_RUNNER_RESCHEDULE_TIMESTAMP, ATTRIBUTE_SECTION_NAME, ATTRIBUTE_SECURE_KEY, ATTRIBUTE_TIMEBOXED, ATTRIBUTE_TIMINGS, CAPABILITIES_ATTR, CAPABILITIES_PREFIX, CAPABILITY_DEBUG, CAPABILITY_HTTP, CAPABILITY_INVENTORY, CAPABILITY_LEVELDB, CAPABILITY_LEVELDB_ADMIN, CAPABILITY_LEVELDB_CLOSE, CAPABILITY_LEVELDB_COMPACT, CAPABILITY_LEVELDB_FIND, CAPABILITY_LEVELDB_INFO, CAPABILITY_LEVELDB_OPEN, CAPABILITY_LEVELDB_PURGE, CAPABILITY_LEVELDB_REPAIR, CAPABILITY_LEVELDB_REPORT, CAPABILITY_LEVELDB_SNAPSHOT, CAPABILITY_LEVELDB_TIMESTAMP, CAPABILITY_LIMIT, CAPABILITY_LIMITS, CAPABILITY_MANAGER, CAPABILITY_MAXBUCKETS, CAPABILITY_MAXDEPTH, CAPABILITY_MAXGEOCELLS, CAPABILITY_MAXGTS, CAPABILITY_MAXJSON, CAPABILITY_MAXLOOP, CAPABILITY_MAXOPS, CAPABILITY_MAXPIXELS, CAPABILITY_MAXRECURSION, CAPABILITY_MAXSYMBOLS, CAPABILITY_REPORT, CAPABILITY_SETMACROCONFIG, CAPABILITY_SLEEP_MAXTIME, CAPABILITY_TIMEBOX_MAXTIME, CAPABILITY_WFGET, CAPABILITY_WFSET, CAPNAME_RUNNER_RESCHEDULE_MIN_PERIOD, COMMENT_END, COMMENT_START, COUNTER_RETURN_DEPTH, DEFAULT_FETCH_LIMIT, DEFAULT_GTS_LIMIT, DEFAULT_MAX_BUCKETS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_GEOCELLS, DEFAULT_MAX_JSON, DEFAULT_MAX_LOOP_DURATION, DEFAULT_MAX_OPS, DEFAULT_MAX_PIXELS, DEFAULT_MAX_RECURSION_LEVEL, DEFAULT_MAX_SYMBOLS, DEFAULT_REGISTERS, MACRO_END, MACRO_START, MULTILINE_END, MULTILINE_START, SECURE_SCRIPT_END, SECURE_SCRIPT_START, TOP_LEVEL_SECTION| Constructor and Description |
|---|
MemoryWarpScriptStack(StoreClient storeClient,
DirectoryClient directoryClient) |
MemoryWarpScriptStack(StoreClient storeClient,
DirectoryClient directoryClient,
java.util.Properties properties) |
MemoryWarpScriptStack(StoreClient storeClient,
DirectoryClient directoryClient,
java.util.Properties properties,
boolean init) |
| Modifier and Type | Method and Description |
|---|---|
void |
auditMode(boolean auditMode)
Turn on/off auditMode.
|
void |
checkBalanced()
Perform a final check to ensure balancing constructs are balanced.
|
void |
checkOps() |
void |
clear()
Empty the stack
|
void |
define(java.lang.String stmt,
WarpScriptStack.Macro macro)
(re)define a statement
If 'macro' is null, clear the (re)definition of 'stmt'
|
int |
depth()
Return the depth (i.e.
|
void |
drop()
Remove the top of the stack.
|
void |
dropn()
Remove the top 'N' objects of the stack.
|
java.lang.String |
dump(int n)
Produces a String representation of the top 'n' levels of the stack
|
void |
dup()
Duplicate the object on top of the stack.
|
void |
dupn()
Duplicate the top 'N' objects of the stack.
|
void |
exec(java.lang.String line)
Execute a serie of statements against the stack.
|
void |
exec(java.lang.String line,
long lineNumber)
Execute a series of statements against the stack.
|
void |
exec(WarpScriptStack.Macro macro)
Execute a macro against the stack.
|
void |
execMulti(java.lang.String script) |
WarpScriptStack.Macro |
find(java.lang.String symbol)
Find a macro by name
|
java.lang.Object |
findFunction(java.lang.String stmt)
Find a function by name
|
void |
forget(java.lang.String symbol)
Forget the given symbol
|
java.lang.Object |
get(int n)
Return the object at level 'level' on the stack.
|
java.lang.Object |
getAttribute(java.lang.String key)
Return the value of an attribute.
|
java.util.concurrent.atomic.AtomicLong |
getCounter(int i)
Return the ith counter associated with the stack
|
java.util.Map<java.lang.String,WarpScriptStackFunction> |
getDefined()
Return the current map of redefined functions
|
DirectoryClient |
getDirectoryClient()
Retrieve the DirectoryClient instance associated with this stack
|
int |
getMacroDepth() |
long |
getRecursionLevel() |
java.lang.Object[] |
getRegisters()
Return the current registers.
|
StoreClient |
getStoreClient()
Retrieve the StoreClient instance associated with this stack.
|
MemoryWarpScriptStack |
getSubStack()
Create a 'sub' stack of the current one.
|
java.util.Map<java.lang.String,java.lang.Object> |
getSymbolTable()
Return the current symbol table.
|
java.lang.String |
getUUID()
Return a UUID for the instance of WarpScriptStack
|
void |
handleSignal()
Throw the exception associated with the current signal sent to the stack
|
int |
hide()
Hide all stack levels
|
int |
hide(int count)
Hide the deepest 'count' stack levels
|
void |
incOps()
Increment the operation count and check for limit.
|
boolean |
isInComment() |
boolean |
isInMultiline() |
boolean |
isInSecureScript() |
java.lang.Object |
load(int regidx)
Return the content associated with the given register
|
java.lang.Object |
load(java.lang.String symbol)
Return the content associated with the given symbol.
|
void |
macroClose()
Closes the currently open macro (after macroOpen was called) and
push it onto the stack.
|
void |
macroOpen()
Force the stack to create a macro with all following statements.
|
void |
maxLimits() |
java.lang.Object |
peek()
Return the object on top of the stack without removing
it from the stack.
|
java.lang.Object |
peekn()
Return the object at 'distance' from the top of the stack.
|
void |
pick()
Copy the object at level 'N' on top of the stack.
|
java.lang.Object |
pop()
Remove and return the object on top of the stack.
|
java.lang.Object[] |
popn()
Remove and return 'N' objects from the top of the
stack.
|
java.lang.Object[] |
popn(int n)
Remove and return 'N' objects from the top of the
stack.
|
void |
progress() |
void |
push(java.lang.Object o)
Push an object onto the stack
|
protected void |
recurseIn() |
protected void |
recurseOut() |
void |
reset(int depth)
Reset the stack to the given depth
|
void |
restore()
Restore the stack context from that on top of the stack
|
void |
restore(WarpScriptStack.StackContext ctxt)
Restore the given stack context
|
void |
roll()
Rotate up the top 'N' objects of the stack.
|
void |
rolld()
Rotate down the top 'N' objects of the stack.
|
void |
rot()
Rotate the top 3 objects of the stack, pushing
the top of the stack down
D D
C -> B
B A
A (top) C (top)
|
void |
run(java.lang.String symbol)
Execute a macro known by name.
|
void |
save()
Push the current stack context (symbols + redefined statements) onto the stack.
|
java.lang.Object |
setAttribute(java.lang.String key,
java.lang.Object value)
Set a stack attribute.
|
void |
setFunctionMetrics(boolean state) |
void |
show()
Show all previously hidden stack levels.
|
void |
show(int count)
Show some stack levels previously hidden.
|
void |
signal(WarpScriptStack.Signal signal)
Signal the stack, i.e.
|
void |
store(int regidx,
java.lang.Object value)
Stores the given value in register 'regidx'
|
void |
store(java.lang.String symbol,
java.lang.Object value)
Store the given object under 'symbol'.
|
void |
swap()
Swap the top 2 objects of the stack.
|
public MemoryWarpScriptStack(StoreClient storeClient, DirectoryClient directoryClient)
public MemoryWarpScriptStack(StoreClient storeClient, DirectoryClient directoryClient, java.util.Properties properties)
public MemoryWarpScriptStack(StoreClient storeClient, DirectoryClient directoryClient, java.util.Properties properties, boolean init)
public StoreClient getStoreClient()
WarpScriptStackgetStoreClient in interface WarpScriptStackpublic DirectoryClient getDirectoryClient()
WarpScriptStackgetDirectoryClient in interface WarpScriptStackpublic void maxLimits()
public int depth()
WarpScriptStackdepth in interface WarpScriptStackpublic void reset(int depth)
throws WarpScriptException
WarpScriptStackreset in interface WarpScriptStackWarpScriptExceptionpublic void clear()
WarpScriptStackclear in interface WarpScriptStackpublic void drop()
throws java.util.EmptyStackException
WarpScriptStackdrop in interface WarpScriptStackInformativeEmptyStackException - If the stack is empty.java.util.EmptyStackExceptionpublic void dropn()
throws java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException
WarpScriptStackdropn in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.lang.IndexOutOfBoundsException - If 'N' is not present on the top of the stack,
is not a number
or if the stack has fewer than 'N' objects after consuming 'N'.java.util.EmptyStackExceptionpublic void dup()
throws java.util.EmptyStackException,
WarpScriptException
WarpScriptStackdup in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.util.EmptyStackExceptionWarpScriptExceptionpublic void dupn()
throws java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException,
WarpScriptException
WarpScriptStackdupn in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.lang.IndexOutOfBoundsException - if the stack contains less than 'N' objects.java.util.EmptyStackExceptionWarpScriptExceptionpublic java.lang.Object pop()
throws java.util.EmptyStackException
WarpScriptStackpop in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.util.EmptyStackExceptionpublic java.lang.Object[] popn()
throws java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException
WarpScriptStackpopn in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.lang.IndexOutOfBoundsException - If 'N' is not present or if
'N' is invalid or if the stack is not deep enough.java.util.EmptyStackExceptionpublic java.lang.Object[] popn(int n)
throws java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException
WarpScriptStackpopn in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.lang.IndexOutOfBoundsException - If 'N' is invalid or if
the stack is not deep enough.java.util.EmptyStackExceptionpublic void push(java.lang.Object o)
throws WarpScriptException
WarpScriptStackpush in interface WarpScriptStacko - Object to push onto the stackWarpScriptExceptionpublic void swap()
throws WarpScriptException,
java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException
WarpScriptStackswap in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.lang.IndexOutOfBoundsException - if the stack is empty or
contains a single element.WarpScriptExceptionjava.util.EmptyStackExceptionpublic java.lang.Object peek()
throws java.util.EmptyStackException
WarpScriptStackpeek in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.util.EmptyStackExceptionpublic void rot()
throws java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException
WarpScriptStackrot in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.lang.IndexOutOfBoundsException - if the stack contains less than 3 objectsjava.util.EmptyStackExceptionpublic void roll()
throws java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException
WarpScriptStackroll in interface WarpScriptStackInformativeEmptyStackException - if the stack is empty.java.lang.IndexOutOfBoundsException - if 'N' is not present on top of the stack,
is not a number or if the stack does not have enough elements for the
operation.java.util.EmptyStackExceptionpublic java.lang.Object peekn()
throws WarpScriptException
WarpScriptStackpeekn in interface WarpScriptStackWarpScriptException - if no valid 'distance' is on top of the stack or if the
requested distance is passed the bottom of the stack.public java.lang.Object get(int n)
throws WarpScriptException
WarpScriptStackget in interface WarpScriptStackn - Level of the object to returnWarpScriptException - if the stack contains less than 'level' levelspublic void auditMode(boolean auditMode)
auditMode in interface WarpScriptStackpublic void execMulti(java.lang.String script)
throws WarpScriptException
execMulti in interface WarpScriptStackWarpScriptExceptionpublic void exec(java.lang.String line)
throws WarpScriptException
WarpScriptStackexec in interface WarpScriptStackline - String containing a space separated list of statements to executeWarpScriptExceptionpublic void exec(java.lang.String line,
long lineNumber)
throws WarpScriptException
WarpScriptStackexec in interface WarpScriptStackline - String containing a space separated list of statements to executelineNumber - is the WarpScript line number, when known by exec() caller. Default value is -1.WarpScriptExceptionpublic void exec(WarpScriptStack.Macro macro) throws WarpScriptException
WarpScriptStackexec in interface WarpScriptStackmacro - Macro instance to executeWarpScriptExceptionpublic java.lang.Object findFunction(java.lang.String stmt)
throws WarpScriptException
WarpScriptStackfindFunction in interface WarpScriptStackstmt - Name of function to findWarpScriptException - if macro is not foundpublic void run(java.lang.String symbol)
throws WarpScriptException
WarpScriptStackrun in interface WarpScriptStackWarpScriptExceptionpublic WarpScriptStack.Macro find(java.lang.String symbol) throws WarpScriptException
WarpScriptStackfind in interface WarpScriptStacksymbol - Name of macro to findWarpScriptException - if macro is not foundpublic java.lang.String dump(int n)
WarpScriptStackdump in interface WarpScriptStackn - Number of stack levels to display at mostpublic void pick()
throws java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException,
WarpScriptException
WarpScriptStackpick in interface WarpScriptStackInformativeEmptyStackExceptionjava.lang.IndexOutOfBoundsExceptionjava.util.EmptyStackExceptionWarpScriptExceptionpublic void rolld()
throws java.util.EmptyStackException,
java.lang.IndexOutOfBoundsException
WarpScriptStackrolld in interface WarpScriptStackInformativeEmptyStackException - if the stack is emptyjava.lang.IndexOutOfBoundsException - if 'N' is not present on top of the stack,
is not a number or if the stack does not have enough elements for the
operation.java.util.EmptyStackExceptionpublic java.lang.Object load(java.lang.String symbol)
WarpScriptStackload in interface WarpScriptStacksymbol - Name of symbol to retrievepublic void store(java.lang.String symbol,
java.lang.Object value)
throws WarpScriptException
WarpScriptStackstore in interface WarpScriptStacksymbol - Name under which to store a value.value - Value to store.WarpScriptExceptionpublic java.lang.Object load(int regidx)
throws WarpScriptException
WarpScriptStackload in interface WarpScriptStackregidx - Index of the register to readWarpScriptExceptionpublic void store(int regidx,
java.lang.Object value)
throws WarpScriptException
WarpScriptStackstore in interface WarpScriptStackWarpScriptExceptionpublic void forget(java.lang.String symbol)
WarpScriptStackforget in interface WarpScriptStacksymbol - Name of the symbol to forget.public java.util.Map<java.lang.String,java.lang.Object> getSymbolTable()
WarpScriptStackgetSymbolTable in interface WarpScriptStackpublic java.lang.Object[] getRegisters()
WarpScriptStackgetRegisters in interface WarpScriptStackpublic java.util.Map<java.lang.String,WarpScriptStackFunction> getDefined()
WarpScriptStackgetDefined in interface WarpScriptStackpublic java.lang.String getUUID()
WarpScriptStackgetUUID in interface WarpScriptStackpublic java.lang.Object setAttribute(java.lang.String key,
java.lang.Object value)
WarpScriptStacksetAttribute in interface WarpScriptStackkey - Key under which the attribute should be stored.value - Value of the attribute. If null, remove the attribute.public java.lang.Object getAttribute(java.lang.String key)
WarpScriptStackgetAttribute in interface WarpScriptStackkey - Name of the attribute to retrieve.public void incOps()
throws WarpScriptException
WarpScriptExceptionpublic void checkOps()
throws WarpScriptException
WarpScriptExceptionpublic java.util.concurrent.atomic.AtomicLong getCounter(int i)
throws WarpScriptException
WarpScriptStackgetCounter in interface WarpScriptStackWarpScriptExceptionpublic void progress()
progress in interface org.apache.hadoop.util.Progressablepublic void checkBalanced()
throws WarpScriptException
WarpScriptStackcheckBalanced in interface WarpScriptStackWarpScriptException - if the stack is currently unbalanced.public void define(java.lang.String stmt,
WarpScriptStack.Macro macro)
define in interface WarpScriptStackpublic void save()
throws WarpScriptException
WarpScriptStacksave in interface WarpScriptStackWarpScriptExceptionpublic void restore(WarpScriptStack.StackContext ctxt) throws WarpScriptException
WarpScriptStackrestore in interface WarpScriptStackWarpScriptExceptionpublic void restore()
throws WarpScriptException
WarpScriptStackrestore in interface WarpScriptStackWarpScriptExceptionprotected void recurseIn()
throws WarpScriptException
WarpScriptExceptionprotected void recurseOut()
public long getRecursionLevel()
public int getMacroDepth()
public boolean isInMultiline()
public boolean isInComment()
public boolean isInSecureScript()
public MemoryWarpScriptStack getSubStack()
public void signal(WarpScriptStack.Signal signal)
WarpScriptStacksignal in interface WarpScriptStackpublic void handleSignal()
throws WarpScriptATCException
WarpScriptStackhandleSignal in interface WarpScriptStackWarpScriptATCExceptionpublic void setFunctionMetrics(boolean state)
public int hide()
WarpScriptStackhide in interface WarpScriptStackpublic int hide(int count)
WarpScriptStackhide in interface WarpScriptStackcount - Number of levels to hidepublic void show()
WarpScriptStackshow in interface WarpScriptStackpublic void show(int count)
WarpScriptStackshow in interface WarpScriptStackcount - Number of levels to showpublic void macroOpen()
throws WarpScriptException
WarpScriptStackmacroOpen in interface WarpScriptStackWarpScriptExceptionpublic void macroClose()
throws WarpScriptException
WarpScriptStackmacroClose in interface WarpScriptStackWarpScriptException