public static class ProcedureManager.ProcedureHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ProcedureManager.WorkArea |
wa
The
ProcedureManager.WorkArea instance. |
Modifier | Constructor and Description |
---|---|
private |
ProcedureHelper(ProcedureManager.WorkArea wa)
Create a new instance and associate the given WorkArea instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
_isDelayedDelete(java.lang.Object referent)
Check if this is a "delete-on-exit" procedure.
|
boolean |
_isPersistent(java.lang.Object referent)
Check if the given referent is for a persistent procedure.
|
java.lang.Object |
_sourceProcedure()
Get the SOURCE-PROCEDURE referent.
|
java.lang.Object |
_thisProcedure()
Get the THIS-PROCEDURE referent.
|
(package private) void |
addFinalizable(java.lang.Object referent,
Finalizable target)
Register the given
Finalizable to be processed when the persistent procedure gets
deleted. |
(package private) void |
addProcedure(handle h,
java.lang.String name,
boolean persistent)
Add the
h handle as a persistent procedure. |
(package private) void |
addProcedure(handle h,
java.lang.String name,
boolean singleton,
boolean singleRun)
Add the
h handle as a persistent procedure. |
(package private) void |
addProcedure(handle h,
java.lang.String name,
boolean persistent,
boolean singleton,
boolean singleRun,
boolean legacyClass)
Add the
h handle as a persistent procedure. |
(package private) void |
addScopeable(java.lang.Object referent,
Scopeable target)
Register the given
Scopeable to be processed when the persistent procedure gets
deleted. |
boolean |
addStaleReferent(java.lang.Object referent)
Mark that the selected referent is stale.
|
void |
cleanupPending()
Cleanup of pending resources.
|
(package private) java.lang.String |
currentInternalEntry()
Get the currently executing internal entry name.
|
(package private) boolean |
delete(java.lang.Object referent,
boolean letStaleProcedure)
Delete the given procedure handle (i.e.
|
java.util.Iterator<java.lang.Object> |
destinationIterator()
Get an iterator over the stack of currently destination resolved code.
|
java.util.Iterator<java.lang.Class<?>> |
executingIterator()
Get an iterator over the stack of currently executing code.
|
java.lang.Class<?> |
getExecuting()
Get the Java class associated with the currently executing code.
|
(package private) handle |
getHandleForFunction(handle phandle,
java.lang.String fname)
Using the name of a function defined IN handle and a procedure handle
to which this function definition belongs, resolve the target handle,
to be able to invoke it.
|
java.lang.String |
getInstantiatingExternalProgram()
ProcedureHelper
Get the name of the currently instantiated external program.
|
java.lang.Class<?> |
getInstantiatingExternalProgramClass()
Get the source class of the currently instantiating external program or OE class.
|
Stack<BlockDefinition> |
getPersistentProcStack(java.lang.Object referent)
Obtains the stack snapshot of one persistent procedure.
|
java.lang.Object |
getProcessedProcedure()
Get the current external program (an application logic instance) being processed for
scopeable or finalizable notifications.
|
java.lang.String |
getRelativeName(java.lang.Object instance)
Get the relative name used to create the given external program instance.
|
(package private) java.lang.String |
getStackEntry(int idx)
Implementation for the PROGRAM-NAME functions.
|
(package private) handle |
getSuperHandle(java.lang.String iename,
boolean function)
For procedures or functions defined IN SUPER, this computes the target procedure handle
where the procedure's or function's body resides.
|
(package private) java.util.List<handle> |
getSuperProcedures()
Get a handle list of super-procedures for the session handle.
|
(package private) java.util.List<handle> |
getSuperProcedures(java.lang.Object referent)
Get a handle list of super-procedures for the given referent.
|
boolean |
hasReferent(java.lang.Object referent)
Check if the given referent has been (or is still) registered with the
ProcedureManager in the procedure map. |
boolean |
hasStaleReferent(java.lang.Object referent)
Check if a provided referent is stale or not.
|
(package private) boolean |
isBlockLevelUndoThrow()
Check if current THIS-PROCEDURE is marked as BLOCK-LEVEL UNDO, THROW.
|
boolean |
isExecuted(java.lang.Object referent)
Check whether the specified referent (procedure) has been executed or not.
|
boolean |
isRemotePersistentProcedure(java.lang.Object referent)
Check if an external program was ran persistent by a remote side.
|
(package private) boolean |
isRoutineLevelUndoThrow()
Check if current THIS-PROCEDURE is marked as ROUTINE-LEVEL UNDO, THROW or
BLOCK-LEVEL UNDO, THROW (as BLOCK-LEVEL includes the ROUTINE-LEVEL blocks).
|
(package private) void |
markBlockLevelUndoThrow()
Mark current THIS-PROCEDURE as BLOCK-LEVEL UNDO, THROW.
|
(package private) void |
markRoutineLevelUndoThrow()
Mark current THIS-PROCEDURE as ROUTINE-LEVEL UNDO, THROW.
|
void |
notifyStaticRecordWasLoaded(RecordBuffer recordBuffer)
A system which notifies the ProcedureManager when a static record buffer is changed.
|
CalleeInfo |
peekCalleeInfo()
Return the last callee info from the stack.
|
void |
popCalleeInfo()
Pop the last callee info from the stack.
|
void |
pushCalleeInfo(java.lang.Class<?> def,
boolean superCall,
java.lang.Object target,
java.lang.Object destination,
java.lang.String iename,
java.lang.String pname,
boolean function,
boolean persistentProc)
Save the information about the program being called, to be used on the top-level scope
start notification: at that time, the info about the callee (this, source- and target-
procedures and other info) will be resolved.
|
void |
pushCalleeInfo(java.lang.Class<?> def,
boolean superCall,
java.lang.Object target,
java.lang.Object destination,
java.lang.String iename,
java.lang.String pname,
boolean function,
boolean persistentProc,
boolean singletonProc,
boolean singleRunProc)
Save the information about the program being called, to be used on the top-level scope
start notification: at that time, the info about the callee (this, source- and target-
procedures and other info) will be resolved.
|
void |
registerRemotePersistentProcedure(java.lang.Object referent)
Register an external program which was ran persistent by a remote side.
|
void |
removeStaleProcedure(java.lang.Object referent)
Removes the referent information from the persistent procedure stack mapping
and stale set.
|
java.lang.Object |
searchInStack(java.util.function.Function<java.lang.Object,java.lang.Object> search)
Walk the
THIS-PROCEDURE stack and apply the search function;
return the first value given by the search function, once it returns a non-null value. |
(package private) void |
setInstantingExternalProgram(java.lang.String name)
Set the name of the 4GL program currently being instantiated, into the
ProcedureManager.WorkArea.initiatingExtProg field. |
(package private) void |
setInstantingExternalProgramClass(java.lang.Class<?> cls)
Set the Java class of the currently instantiating external program or OE class.
|
void |
setProcessedProcedure(java.lang.Object referent)
Set the external procedure beeing processed for scopeable or finalizable notifications.
|
handle |
thisProcedure()
Get the THIS-PROCEDURE system handle.
|
private final ProcedureManager.WorkArea wa
ProcedureManager.WorkArea
instance.private ProcedureHelper(ProcedureManager.WorkArea wa)
wa
- The ProcedureManager.WorkArea
instance.public java.util.Iterator<java.lang.Class<?>> executingIterator()
public java.util.Iterator<java.lang.Object> destinationIterator()
handle getSuperHandle(java.lang.String iename, boolean function)
In case when no super procedure is found, it will throw proper error messages and return
null
.
iename
- Internal-entry's name (this may be a procedure or function).function
- true
if this is a function.null
of none found.public java.lang.Class<?> getExecuting()
public java.lang.Object searchInStack(java.util.function.Function<java.lang.Object,java.lang.Object> search)
THIS-PROCEDURE
stack and apply the search function;
return the first value given by the search function, once it returns a non-null value.search
- The search function.public boolean isRemotePersistentProcedure(java.lang.Object referent)
referent
- The external program instance.true
if the referent is part of the
ProcedureManager.WorkArea.remotePersistentProcedures
map.public void registerRemotePersistentProcedure(java.lang.Object referent)
referent
- The external program instance.public handle thisProcedure()
public java.lang.Object _thisProcedure()
thisProcedure()
.public java.lang.Object _sourceProcedure()
ProcedureManager.sourceProcedure()
.public boolean _isPersistent(java.lang.Object referent)
referent
- An instance of a converted external procedure class.true
if the referent is a persistent procedure.public java.lang.String getInstantiatingExternalProgram()
null
if this is
not the case.public java.lang.Class<?> getInstantiatingExternalProgramClass()
public void setProcessedProcedure(java.lang.Object referent)
referent
- The external procedure instance.public java.lang.Object getProcessedProcedure()
public void cleanupPending()
public boolean _isDelayedDelete(java.lang.Object referent)
referent
- An instance of a converted external procedure class.true
if the referent is a "delete-on-exit" procedure.public void pushCalleeInfo(java.lang.Class<?> def, boolean superCall, java.lang.Object target, java.lang.Object destination, java.lang.String iename, java.lang.String pname, boolean function, boolean persistentProc)
def
- The currently executing OE class or external program.superCall
- Flag indicating if the destination is in a super-procedure.target
- The target procedure, which was targeted by the caller.destination
- The procedure where the internal entry was resolved.iename
- The internal entry name. In case of triggers or external programs, use the
ProcedureManager.EXTERNAL_PROGRAM
and ProcedureManager.TRIGGER_PROCEDURE
constants.pname
- The external program name; will be non-null only when we are invoking an external
program.function
- Flag indicating we are calling a user-defined function.persistentProc
- Flag indicating the external program was ran persistent.public void pushCalleeInfo(java.lang.Class<?> def, boolean superCall, java.lang.Object target, java.lang.Object destination, java.lang.String iename, java.lang.String pname, boolean function, boolean persistentProc, boolean singletonProc, boolean singleRunProc)
def
- The currently executing OE class or external program.superCall
- Flag indicating if the destination is in a super-procedure.target
- The target procedure, which was targeted by the caller.destination
- The procedure where the internal entry was resolved.iename
- The internal entry name. In case of triggers or external programs, use the
ProcedureManager.EXTERNAL_PROGRAM
and ProcedureManager.TRIGGER_PROCEDURE
constants.pname
- The external program name; will be non-null only when we are invoking an external
program.function
- Flag indicating we are calling a user-defined function.persistentProc
- Flag indicating the external program was ran persistent.singletonProc
- Flag indicating the external program was ran singleton.singleRunProc
- Flag indicating the external program was ran single-run.public void popCalleeInfo()
public CalleeInfo peekCalleeInfo()
CalleeInfo
instance.public java.lang.String getRelativeName(java.lang.Object instance)
instance
- The external program instance.public boolean hasReferent(java.lang.Object referent)
ProcedureManager
in the procedure
map.referent
- The referent to be checked if is still loaded.true
if the referent was found.public boolean hasStaleReferent(java.lang.Object referent)
referent
- The referent for which the checking will be donetrue
if the referent is stale.public boolean isExecuted(java.lang.Object referent)
referent
- The referent which is checked for stalenesstrue
if the procedure has been executed or was not found (i.e., is assumed to have
executed and been deleted/discarded); else false
.public void notifyStaticRecordWasLoaded(RecordBuffer recordBuffer)
recordBuffer
- The record buffer which was loaded and triggered this notification.public void removeStaleProcedure(java.lang.Object referent)
referent
- The persistent procedure for which the entry should be removed.public Stack<BlockDefinition> getPersistentProcStack(java.lang.Object referent)
referent
- The persistent procedure for which the stack should be retrieved.public boolean addStaleReferent(java.lang.Object referent)
referent
- The referent which should be marked as stale.void setInstantingExternalProgram(java.lang.String name)
ProcedureManager.WorkArea.initiatingExtProg
field.name
- The 4GL external program name.void setInstantingExternalProgramClass(java.lang.Class<?> cls)
cls
- The Java class for the currently executing code.handle getHandleForFunction(handle phandle, java.lang.String fname)
phandle
- The procedure handle where the function was defined.fname
- The function's legacy name.void addProcedure(handle h, java.lang.String name, boolean persistent)
h
handle as a persistent procedure. Used by
ControlFlowOps.invokePersistent(character, Object...)
and
ControlFlowOps.invokePersistentSet(String, handle, Object...)
.h
- The procedure handle to be added to the list of persistent
procedures.name
- The name of this procedure, used at the RUN statement.persistent
- Flag indicating if this is a persistent procedure.void addProcedure(handle h, java.lang.String name, boolean persistent, boolean singleton, boolean singleRun, boolean legacyClass)
h
handle as a persistent procedure. Used by
ControlFlowOps.invokePersistent(character, Object...)
and
ControlFlowOps.invokePersistentSet(String, handle, Object...)
.h
- The procedure handle to be added to the list of persistent
procedures.name
- The name of this procedure, used at the RUN statement.persistent
- Flag indicating if this is a persistent procedure.singleton
- Flag indicating if this is a singleton procedure.singleRun
- Flag indicating if this is a single-run procedure.legacyClass
- Set to true
if the method is called as a result of
legacy class initialization. false
otherwise.void addProcedure(handle h, java.lang.String name, boolean singleton, boolean singleRun)
h
handle as a persistent procedure. Used by
ControlFlowOps.invokePersistent(character, Object...)
and
ControlFlowOps.invokePersistentSet(String, handle, Object...)
.h
- The procedure handle to be added to the list of persistent
procedures.name
- The name of this procedure, used at the RUN statement.singleton
- Flag indicating if this is a singleton procedure.singleRun
- Flag indicating if this is a singleton procedure.java.lang.String getStackEntry(int idx)
idx
- The stack entry index.null
if outside of stack.java.lang.String currentInternalEntry()
ProcedureManager.WorkArea.internalEntryStack
.boolean delete(java.lang.Object referent, boolean letStaleProcedure)
referent
- The persistent procedure instance to be deleted.letStaleProcedure
- Flag to indicate if the procedure should go in an stale state.true
if this procedure handle can be deleted.boolean isRoutineLevelUndoThrow()
boolean isBlockLevelUndoThrow()
void markRoutineLevelUndoThrow()
void markBlockLevelUndoThrow()
void addScopeable(java.lang.Object referent, Scopeable target)
Scopeable
to be processed when the persistent procedure gets
deleted.referent
- The external program.target
- The Scopeable
instance which needs delayed notification.void addFinalizable(java.lang.Object referent, Finalizable target)
Finalizable
to be processed when the persistent procedure gets
deleted.referent
- The external program.target
- The Finalizable
instance which needs delayed notification.java.util.List<handle> getSuperProcedures(java.lang.Object referent)
referent
- An instance of an converted external procedure class.java.util.List<handle> getSuperProcedures()