public class ProcedureManager
extends java.lang.Object
THIS-PROCEDURE | thisProcedure() |
SOURCE-PROCEDURE | sourceProcedure() |
TARGET-PROCEDURE | targetProcedure() |
attribute or method | API |
---|---|
SESSION:SUPER-PROCEDURES | superProcedures() |
SESSION:ADD-SUPER-PROCEDURE | |
SESSION:REMOVE-SUPER-PROCEDURE | |
SESSION:FIRST-PROCEDURE | firstProcedure() |
SESSION:LAST-PROCEDURE | lastProcedure() |
The registerFunctionHandle(String, Resolvable)
is emitted at the
beginning of an external procedure, for any function defined
IN handle
.
Modifier and Type | Class and Description |
---|---|
private static class |
ProcedureManager.CalleeInfoImpl
A container with various data about the next called program/internal-entry, needed by
ProcedureManager.WorkArea.scopeStart() . |
private static class |
ProcedureManager.ContextContainer
Simple container that stores and returns a context-local instance of
the global work area.
|
private static class |
ProcedureManager.ExternalSubscription
Contains data about a subscription from an
ExternalResource . |
private static class |
ProcedureManager.GlobalEventSubscriptions
Helper class to manage the global subscriptions.
|
private static class |
ProcedureManager.LegacySubscription
Contains data about a legacy subscription made by a certain procedure.
|
private static class |
ProcedureManager.ProcedureData
Container for various procedure data.
|
private static class |
ProcedureManager.PublishTask
Container for a PUBLISH task to be executed in the actual subscription's context.
|
static class |
ProcedureManager.SearchMode
Defines search modes for the ADD-SUPER-PROCEDURE statement.
|
private static class |
ProcedureManager.Subscription<T>
Contains data about a subscription.
|
private static class |
ProcedureManager.WorkArea
Stores global data relating to the state of the current context.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
EXTERNAL_PROGRAM
Marks the external program's root procedure - this is a P2J reserver name.
|
private static ProcedureManager.GlobalEventSubscriptions |
globalSubscriptions
Worker for managing global subscriptions.
|
private static java.util.logging.Logger |
LOG
Logger
|
static int |
SEARCH_SELF
Constant defining search mode: SEARCH-SELF
|
static int |
SEARCH_TARGET
Constant for socket search mode: SEARCH_TARGET
|
static java.lang.String |
TRIGGER_PROCEDURE
Marks the trigger block - this is what 4GL reports for triggers.
|
private static ProcedureManager.ContextContainer |
work
Stores context-local state variables.
|
Constructor and Description |
---|
ProcedureManager() |
Modifier and Type | Method and Description |
---|---|
(package private) static boolean |
_isDelayedDelete(java.lang.Object referent)
Check if this is a "delete-on-exit" procedure.
|
static boolean |
_isPersistent(java.lang.Object referent)
Check if the given referent is for a persistent procedure.
|
static java.lang.Object |
_sourceProcedure()
Get the SOURCE-PROCEDURE referent.
|
static java.lang.Object |
_thisProcedure()
Get the THIS-PROCEDURE referent.
|
(package private) static void |
addFinalizable(java.lang.Object referent,
Finalizable target)
Register the given
Finalizable to be processed when the persistent procedure gets
deleted. |
(package private) static void |
addProcedure(handle h,
java.lang.String name,
boolean persistent)
Add the
h handle as a persistent procedure. |
(package private) static void |
addScopeable(java.lang.Object referent,
Scopeable target)
Register the given
Scopeable to be processed when the persistent procedure gets
deleted. |
static logical |
addSuperProcedure(handle h)
Add the given handle as a super-procedure for the SESSION handle.
|
static logical |
addSuperProcedure(handle h,
int searchMode)
Add the given handle as a super-procedure for the SESSION handle, using
the explicit
mode . |
static logical |
addSuperProcedure(handle h,
integer searchMode)
Add the given handle as a super-procedure for the SESSION handle, using
the explicit
mode . |
static logical |
addSuperProcedure(handle h,
ProcedureManager.SearchMode mode)
Add the given handle as a super-procedure for the SESSION handle, using
the search-mode set as a string (one of the
SEARCH-TARGET
or SEARCH-SELF string literals). |
(package private) static logical |
addSuperProcedure(java.lang.Object referent,
handle h)
Add the given handle as a super-procedure for the specified referent.
|
(package private) static logical |
addSuperProcedure(java.lang.Object referent,
handle h,
int mode)
Add the given handle as a super-procedure for the specified referent,
using the search-mode set as a string (one of the
SEARCH-TARGET or SEARCH-SELF string literals). |
(package private) static logical |
addSuperProcedure(java.lang.Object referent,
handle h,
ProcedureManager.SearchMode mode)
Add the given handle as a super-procedure for the specified referent,
using the explicit
mode . |
private static logical |
addSuperProcedureImpl(handle h,
ProcedureManager.SearchMode mode,
java.lang.Object referent)
The implementation of the ADD-SUPER-PROCEDURE method.
|
static void |
cleanupPending()
Cleanup of pending resources.
|
(package private) static void |
cleanupSubscriptions(java.lang.Object resource)
Remove all subscriptions registered by the given resource.
|
(package private) static boolean |
delete(java.lang.Object referent)
Delete the given procedure handle (i.e.
|
private static void |
deleteResources(java.util.Set<WrappedResource> resources)
Delete the given resources, as long as they are still valid.
|
static void |
deregisterPendingResource(WindowWidget defaultWindow)
The
ProcedureManager should know the DEFAULT-WINDOW in order to prevent releasing /
deleting it when the top-level scope is popped out. |
static void |
deregisterRemotePersistentProcedure(java.lang.Object referent)
Deregister an external program which was ran persistent by a remote side.
|
(package private) static void |
deregisterResource(java.lang.Object referent,
HandleResource resource)
Deregister the given resource from the specified creator procedure.
|
(package private) static java.lang.Object |
findRootEnclosingInstance(java.lang.Object instance)
Find the root enclosing instance of the specified inner class instance.
|
static handle |
firstProcedure()
Get the SESSION:FIRST-PROCEDURE handle (unknown if no persistent
procedures are loaded).
|
(package private) static java.lang.String |
getAbsoluteName(java.lang.Object referent)
Get the absolute name of the external program associated with the given java instance.
|
(package private) static character |
getADMData(java.lang.Object referent)
Get the value of the ADM-DATA attribute of the specified referent.
|
static handle |
getCurrentWindow(java.lang.Object referent)
Gets the value of CURRENT-WINDOW attribute of specified procedure
|
(package private) static 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.
|
static java.lang.String |
getInstantiatingExternalProgram()
Get the name of the currently instantiated external program.
|
(package private) static handle |
getInstantiatingProcedure(java.lang.Object referent)
Gets the INSTANTIATING-PROCEDURE associated to the referent.
|
(package private) static handle |
getNextSibling(java.lang.Object referent)
Get the
NEXT-SIBLING attribute of the specified referent. |
(package private) static handle |
getPrevSibling(java.lang.Object referent)
Get the
PREV-SIBLING attribute of the specified referent. |
(package private) static character |
getPrivateData(java.lang.Object referent)
Get the
PRIVATE-DATA attribute of the specified referent. |
static java.lang.Object |
getProcessedProcedure()
Get the current external program (an application logic instance) being processed for
scopeable or finalizable notifications.
|
static java.lang.String |
getRelativeName(java.lang.Object instance)
Get the relative name used to create the given external program instance.
|
(package private) static Scopeable |
getScopeable()
Get the
Scopeable instance for this context. |
private static ProcedureManager.SearchMode |
getSearchMode(int mode)
Get the
ProcedureManager.SearchMode constant associated with the given mode, used
by ADD-SUPER-PROCEDURE calls. |
(package private) static java.lang.String |
getStackEntry(int idx)
Implementation for the PROGRAM-NAME functions.
|
static java.util.List<java.lang.String> |
getStackTrace()
Get the Progress stack trace
|
(package private) static 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) static java.util.List<handle> |
getSuperProcedures()
Get a handle list of super-procedures for the session handle.
|
(package private) static java.util.List<handle> |
getSuperProcedures(java.lang.Object referent)
Get a handle list of super-procedures for the given referent.
|
(package private) static integer |
getUniqueID(java.lang.Object referent)
Gets the the unique ID number associated to the referent.
|
(package private) static boolean |
hasReferent(java.lang.Object referent)
Check if the given referent has been (or is still) registered with the
ProcedureManager in the procedure map. |
static void |
initialize()
API executed on client startup, to initialize this class.
|
(package private) static boolean |
inNotifications()
Check if we are executing finalizable or scopeable notifications.
|
(package private) static logical |
isPersistent(java.lang.Object referent)
Check if the given referent is for a persistent procedure.
|
static boolean |
isProcedure(handle h)
Check if the handle's referent is a procedure or not.
|
(package private) static boolean |
isProxy(handle h)
Check if the given handle is a proxy procedure.
|
static boolean |
isRemotePersistentProcedure(java.lang.Object referent)
Check if an external program was ran persistent by a remote side.
|
(package private) static boolean |
isTopLevel(java.lang.Object referent)
Check if the given referent is the top-level procedure (the startup procedure).
|
static handle |
lastProcedure()
Get the SESSION:LAST-PROCEDURE handle (unknown if no persistent
procedures are loaded).
|
(package private) static void |
load()
Ensure all the context-local data has initialized (to be able to listen
for scope notifications).
|
private static ProcedureManager.ProcedureData |
locateProcedure(java.lang.Object referent)
Locate the
ProcedureManager.ProcedureData instance associated with the given external program
instance. |
static CalleeInfo |
peekCalleeInfo()
Return the last callee info from the stack.
|
static void |
popCalleeInfo()
Pop the last callee info from the stack.
|
private static void |
prepareSearches(java.util.Collection<?>[] queues,
java.lang.Object ref)
Remove elements from the end of each queue until the specified referent is found.
|
static void |
processResource(WrappedResource res,
boolean dynamic)
Process the given resource by either setting its INSTANTIATING-PROCEDURE attribute
immediately (in case of non-static resources) or add the static resource to the
ProcedureManager.WorkArea.pendingResources set, to be processed when the next scope is entered. |
(package private) static void |
publish(character event,
handle publisher,
java.lang.String modes,
java.lang.Object[] param)
Notify all subscribers (to the given event) that the event has occurred.
|
(package private) static void |
publishExternal(java.lang.String event,
handle publisher,
java.lang.String[] args)
Notify all subscribers (to the given event) that the event has occurred.
|
static void |
pushCalleeInfo(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.
|
private static void |
pushInternalEntry(java.lang.Object instance,
java.lang.String iename,
boolean function)
Push an internal entry to the stack.
|
static void |
registerFunctionHandle(java.lang.String pname,
Resolvable handleExpr)
Register the handle expression for the given function.
|
static void |
registerRemotePersistentProcedure(java.lang.Object referent)
Register an external program which was ran persistent by a remote side.
|
(package private) static void |
registerResource(java.lang.Object referent,
HandleResource resource)
Register the given resource as being created by the specified procedure.
|
(package private) static void |
removePersistentProcedure(handle h)
Remove the given handle from the list of persistent procedures.
|
private static void |
removeProcedureImpl(handle h,
java.util.Collection<java.lang.Object> ppList)
Removes the given procedure handle from the given procedure instances list.
|
static logical |
removeSuperProcedure(handle h)
Remove the given handle from the SESSION's list of super-procedures.
|
(package private) static logical |
removeSuperProcedure(java.lang.Object referent,
handle h)
Remove the given handle from the specified referent's list of
super-procedures.
|
static java.lang.String |
resolveClosestMethod(java.lang.Object referent,
boolean function,
boolean externalProc)
Resolve the closest business logic method in the stack trace.
|
(package private) static handle |
resolveInstantiatingProcedure(handle hproc)
Resolve the instantiating procedure from the given handle: if the handle contains a valid
procedure, return a copy of it; else, return an unknown handle.
|
(package private) static void |
setADMData(java.lang.Object referent,
java.lang.String value)
Set the value of the ADM-DATA attribute for the specified referent.
|
static void |
setCurrentWindow(java.lang.Object referent,
handle winHandle)
Sets the value of CURRENT-WINDOW attribute of specified procedure
|
(package private) static void |
setInstantingExternalProgram(java.lang.String name)
Set the name of the 4GL program currently being instantiated, into the
ProcedureManager.WorkArea.initiatingExtProg field. |
(package private) static void |
setPrivateData(java.lang.Object referent,
character data) |
(package private) static void |
setProcessedProcedure(java.lang.Object referent)
Set the external procedure beeing processed for scopeable or finalizable notifications.
|
static handle |
sourceProcedure()
Get the SOURCE-PROCEDURE system handle.
|
(package private) static void |
subscribe(boolean global,
handle subscriber,
character event,
handle publisher,
character method)
Create a new subscription to the given event for a specified program.
|
(package private) static void |
subscribe(handle subscriber,
character event,
handle publisher,
character method)
Create a new subscription to the given event for a specified program.
|
(package private) static void |
subscribeAnywhere(handle subscriber,
character event,
character method)
Create a new subscription to the given event for any program.
|
(package private) static handle |
subscribeExternal(boolean global,
handle subscriber,
java.lang.String event,
handle publisher)
Create a new subscription to the given event for a specified external resource.
|
static character |
superProcedures()
Get the SESSION:SUPER-PROCEDURES attribute.
|
(package private) static character |
superProcedures(java.lang.Object referent)
Get the
SUPER-PROCEDURES attribute of the specified
external procedure instance. |
private static character |
superProceduresImpl(java.util.Collection<ProcedureManager.ProcedureData> superProcs)
Implementation for the SUPER-PROCEDURES attribute.
|
(package private) static boolean |
systemHandle(java.lang.Object referent)
Check if the given referent is for a system handle (i.e.
|
static handle |
targetProcedure()
Get the TARGET-PROCEDURE system handle.
|
static handle |
thisProcedure()
Get the THIS-PROCEDURE system handle.
|
(package private) static void |
unsubscribe(boolean global,
handle subscriber,
character event,
handle publisher)
Delete a subscription to the given event for the specified program.
|
(package private) static void |
unsubscribe(handle subscriber,
character event,
handle publisher)
Delete a subscription to the given event for the specified program.
|
(package private) static void |
unsubscribeAll(handle subscriber,
handle publisher)
Delete a subscription to ALL events for the specified program.
|
(package private) static void |
unsubscribeExternal(boolean global,
handle subscriber,
java.lang.String event,
handle publisher)
Delete a subscription to the given event for the specified external resource.
|
public static final int SEARCH_SELF
public static final int SEARCH_TARGET
public static final java.lang.String EXTERNAL_PROGRAM
public static final java.lang.String TRIGGER_PROCEDURE
private static final java.util.logging.Logger LOG
private static ProcedureManager.GlobalEventSubscriptions globalSubscriptions
private static ProcedureManager.ContextContainer work
public static void initialize()
public static void registerFunctionHandle(java.lang.String pname, Resolvable handleExpr)
pname
- The function's legacy 4GL name.handleExpr
- The Resolvable
instance used to determine its IN
handle target.public static handle thisProcedure()
public static handle targetProcedure()
public static handle sourceProcedure()
public static handle lastProcedure()
public static handle firstProcedure()
public static character superProcedures()
public static logical addSuperProcedure(handle h)
h
- The handle to be added as a super-procedure.true
if h
is a valid procedure
handle.public static logical addSuperProcedure(handle h, int searchMode)
mode
.h
- The handle to be added as a super-procedure.searchMode
- The ProcedureManager.SearchMode
to be set for the h
handle.true
if h
is a valid procedure
handle.public static logical addSuperProcedure(handle h, integer searchMode)
mode
.h
- The handle to be added as a super-procedure.searchMode
- The ProcedureManager.SearchMode
to be set for the h
handle.true
if h
is a valid procedure
handle.public static logical addSuperProcedure(handle h, ProcedureManager.SearchMode mode)
SEARCH-TARGET
or SEARCH-SELF
string literals).h
- The handle to be added as a super-procedure.mode
- The search-mode to be set for the h
handle.true
if h
is a valid procedure
handle.public static logical removeSuperProcedure(handle h)
h
- The procedure handle to be removed.true
if h
is a valid procedure
handle.public static void processResource(WrappedResource res, boolean dynamic)
ProcedureManager.WorkArea.pendingResources
set, to be processed when the next scope is entered.res
- The resource to be processed.dynamic
- Flag indicating if this is a dynamic or static resource.public static void deregisterPendingResource(WindowWidget defaultWindow)
ProcedureManager
should know the DEFAULT-WINDOW in order to prevent releasing /
deleting it when the top-level scope is popped out.
The DEFAULT-WINDOW was eventually added in processResource(WrappedResource,
boolean)
but, at that time, we were not able to distinct it. The LogicalTerminal
must call this as soon as the internal variable has been set.
defaultWindow
- The default window for this session.public static void cleanupPending()
public static java.lang.Object getProcessedProcedure()
public static void pushCalleeInfo(boolean superCall, java.lang.Object target, java.lang.Object destination, java.lang.String iename, java.lang.String pname, boolean function, boolean persistentProc)
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
EXTERNAL_PROGRAM
and 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 static void popCalleeInfo()
public static CalleeInfo peekCalleeInfo()
CalleeInfo
instance.public static java.lang.Object _thisProcedure()
thisProcedure()
.public static java.lang.Object _sourceProcedure()
sourceProcedure()
.public static boolean _isPersistent(java.lang.Object referent)
referent
- An instance of a converted external procedure class.true
if the referent is a persistent procedure.public static void registerRemotePersistentProcedure(java.lang.Object referent)
referent
- The external program instance.public static void deregisterRemotePersistentProcedure(java.lang.Object referent)
referent
- The external program instance.public static boolean isRemotePersistentProcedure(java.lang.Object referent)
referent
- The external program instance.true
if the referent is part of the
ProcedureManager.WorkArea.remotePersistentProcedures
map.public static boolean isProcedure(handle h)
ExternalProgramWrapper
. The enclosed referent may or may
not be registered with the ProcedureManager
.h
- handle object to check.public static handle getCurrentWindow(java.lang.Object referent)
referent
- Procedure wrapperpublic static void setCurrentWindow(java.lang.Object referent, handle winHandle)
referent
- Procedure wrapperwinHandle
- New value for the attribute.public static java.lang.String getRelativeName(java.lang.Object instance)
instance
- The external program instance.public static java.lang.String resolveClosestMethod(java.lang.Object referent, boolean function, boolean externalProc)
referent
- The external program to which the method must belong.function
- Flag indicating if a function or internal procedure will be searched.externalProc
- Flag indicating if we are looking for an external procedure.public static java.lang.String getInstantiatingExternalProgram()
null
if this is
not the case.static Scopeable getScopeable()
Scopeable
instance for this context.static boolean inNotifications()
static void setProcessedProcedure(java.lang.Object referent)
referent
- The external procedure instance.static void publish(character event, handle publisher, java.lang.String modes, java.lang.Object[] param)
All processing is done with silent error mode implicitly enabled.
The subscriptions are fired in the order they were subscribed. Although 4GL documentation specifically states, that "If a named event has multiple subscribers, the order in which the AVM notifies subscribers is undefined.", the actual 4GL implementation (OpenEdge 10.2B) does fire the events in the order the subscriptions get subscribed.
event
- The name of the event which is being published.publisher
- The procedure handle representing the program that is the source of the event.
Must not be null
.modes
- The mode for each parameter, encoded in a string. When null
,
the parameter modes will not be checked against the procedure definition.param
- The parameters passed to the subscriber. May be null
to represent no
parameters. When null
, it means that no parameters were specified for
this call.static void subscribe(handle subscriber, character event, handle publisher, character method)
subscriber
- The program to notify when the specified event is published. Must not be
null
. The specified program must have a method that corresponds to
the given Progress 4GL internal procedure name (method
).event
- The name of the event which is being published.publisher
- The procedure handle representing the program that is the source of the event.
If specified, the named event will only cause a notification if the event source
matches this handle. null
represents the ANYWHERE
option
which means that the events will not be filtered by source.method
- The Progress 4GL internal procedure name which will be translated into a method
name and invoked on the subscriber
instance. When null
,
it means that no method was specified for this call and the event name will be
used as the method name.static void subscribe(boolean global, handle subscriber, character event, handle publisher, character method)
global
- Flag indicating if the subscription is for global (cross-session) events.subscriber
- The program to notify when the specified event is published. Must not be
null
. The specified program must have a method that corresponds to
the given Progress 4GL internal procedure name (method
).event
- The name of the event which is being published.publisher
- The procedure handle representing the program that is the source of the event.
If specified, the named event will only cause a notification if the event source
matches this handle. null
represents the ANYWHERE
option
which means that the events will not be filtered by source.method
- The Progress 4GL internal procedure name which will be translated into a method
name and invoked on the subscriber
instance. When null
,
it means that no method was specified for this call and the event name will be
used as the method name.static void subscribeAnywhere(handle subscriber, character event, character method)
subscriber
- The program to notify when the specified event is published. Must not be
null
. The specified program must have a method that corresponds to
the given Progress 4GL internal procedure name (method
).event
- The name of the event which is being published.method
- The Progress 4GL internal procedure name which will be translated into a method
name and invoked on the subscriber
instance. When null
,
it means that no method was specified for this call and the event name will be
used as the method name.static handle subscribeExternal(boolean global, handle subscriber, java.lang.String event, handle publisher)
global
- Flag indicating if the subscription is for global (cross-session) events.subscriber
- The resource to notify when the specified event is published. If null
,
a ExternalResource
will be built and its ID return.event
- The name of the event which is being published.publisher
- The handle representing the program or resource that is the source of the event.
If specified, the named event will only cause a notification if the event source
matches this handle. null
represents the ANYWHERE
option
which means that the events will not be filtered by source.static void unsubscribeExternal(boolean global, handle subscriber, java.lang.String event, handle publisher)
ErrorManager.silentErrorEnable()
/ErrorManager.silentErrorDisable()
bracket, as the UNSUBSCRIBE
statement is executed with a default NO-ERROR
clause.global
- Flag indicating if the search is done in the global (cross-session) event register.subscriber
- The resource whose subscription is to be deleted. Must not be null
.event
- The name of the event which is being published. If this is null
, then
subscriptions to all events will be deleted.publisher
- The procedure or resource handle representing the source of the event.
If specified, the subscription will only be deleted if the event source matches
this handle. null
represents the ALL
option which means
that the events will not be filtered by source. When null
, it means
that the publisher was not set.static void publishExternal(java.lang.String event, handle publisher, java.lang.String[] args)
All processing is done with silent error mode implicitly enabled.
The subscriptions are fired in the order they were subscribed. Although 4GL documentation specifically states, that "If a named event has multiple subscribers, the order in which the AVM notifies subscribers is undefined.", the actual 4GL implementation (OpenEdge 10.2B) does fire the events in the order the subscriptions get subscribed.
event
- The name of the event which is being published.publisher
- The procedure or resource handle representing the program that is the source of
the event. Must not be null
.args
- The parameters passed to the subscriber. May be null
to represent no
parameters. When null
, it means that no parameters were specified for
this call.static void cleanupSubscriptions(java.lang.Object resource)
ExternalResource
.resource
- All subscriptions for this resource will be removed.static void unsubscribe(handle subscriber, character event, handle publisher)
ErrorManager.silentErrorEnable()
/ErrorManager.silentErrorDisable()
bracket, as the UNSUBSCRIBE
statement is executed with a default NO-ERROR
clause.subscriber
- The program whose subscription is to be deleted. Must not be null
.event
- The name of the event which is being published. If this is null
, then
subscriptions to all events will be deleted.publisher
- The procedure handle representing the program that is the source of the event.
If specified, the subscription will only be deleted if the event source matches
this handle. null
represents the ALL
option which means
that the events will not be filtered by source. When null
, it means
that the publisher was not set.static void unsubscribe(boolean global, handle subscriber, character event, handle publisher)
ErrorManager.silentErrorEnable()
/ErrorManager.silentErrorDisable()
bracket, as the UNSUBSCRIBE
statement is executed with a default NO-ERROR
clause.global
- Flag indicating if the search is done in the global (cross-session) event register.subscriber
- The program whose subscription is to be deleted. Must not be null
.event
- The name of the event which is being published. If this is null
, then
subscriptions to all events will be deleted.publisher
- The procedure handle representing the program that is the source of the event.
If specified, the subscription will only be deleted if the event source matches
this handle. null
represents the ALL
option which means
that the events will not be filtered by source. When null
, it means
that the publisher was not set.static void unsubscribeAll(handle subscriber, handle publisher)
subscriber
- The program whose subscription is to be deleted. Must not be null
.publisher
- The procedure handle representing the program that is the source of the event.
If specified, the subscription will only be deleted if the event source matches
this handle. null
represents the ALL
option which means
that the events will not be filtered by source. When null
, it means
that the publisher was not set.static void load()
static 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.static void removePersistentProcedure(handle h)
ControlFlowOps.invokePersistent(character, Object...)
and
ControlFlowOps.invokePersistentSet(String, handle, Object...)
in
cases when errors were encountered while invoking the procedure.h
- The procedure handle to be added to the list of persistent
procedures.static java.lang.String getStackEntry(int idx)
idx
- The stack entry index.null
if outside of stack.public static java.util.List<java.lang.String> getStackTrace()
static java.lang.String getAbsoluteName(java.lang.Object referent)
This is used internally by P2J, as we need absolute names when resolving a program's signature, events, etc.
For the name associated with the procedure's NAME and FILE-NAME attributes, and returned by
the PROGRAM-NAME function or used in 4GL error messages, see getRelativeName(java.lang.Object)
, which
returns the real name used when the external procedure was instantiated first.
referent
- The referent for which the name is needed.static 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.static boolean delete(java.lang.Object referent)
referent
- The persistent procedure instance to be deleted.true
if this procedure handle can be deleted.static handle getHandleForFunction(handle phandle, java.lang.String fname)
phandle
- The procedure handle where the function was defined.fname
- The function's legacy name.static 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.static logical isPersistent(java.lang.Object referent)
referent
- An instance of an converted external procedure class.true
if the referent is a persistent procedure.static 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.static boolean isTopLevel(java.lang.Object referent)
referent
- The instance to be verified.true
if the referent is the startup procedure.static boolean isProxy(handle h)
h
- The handle to check.true
if the handle is a proxy procedure.static character superProcedures(java.lang.Object referent)
SUPER-PROCEDURES
attribute of the specified
external procedure instance.referent
- An instance of an converted external procedure class.static logical addSuperProcedure(java.lang.Object referent, handle h)
referent
- An instance of an converted external procedure class.h
- The handle to be added as a super-procedure.true
if h
is a valid procedure
handle.static logical addSuperProcedure(java.lang.Object referent, handle h, ProcedureManager.SearchMode mode)
mode
.referent
- An instance of an converted external procedure class.h
- The handle to be added as a super-procedure.mode
- The ProcedureManager.SearchMode
to be set for the h
handle.true
if h
is a valid procedure
handle.static logical addSuperProcedure(java.lang.Object referent, handle h, int mode)
SEARCH-TARGET
or SEARCH-SELF
string literals).referent
- An instance of an converted external procedure class.h
- The handle to be added as a super-procedure.mode
- The search-mode to be set for the h
handle.true
if h
is a valid procedure
handle.static logical removeSuperProcedure(java.lang.Object referent, handle h)
referent
- An instance of an converted external procedure class.h
- The procedure handle to be removed.true
if h
is a valid procedure
handle.static handle getNextSibling(java.lang.Object referent)
NEXT-SIBLING
attribute of the specified referent.referent
- An instance of an converted external procedure class.static handle getPrevSibling(java.lang.Object referent)
PREV-SIBLING
attribute of the specified referent.referent
- An instance of an converted external procedure class.static void setPrivateData(java.lang.Object referent, character data)
static character getPrivateData(java.lang.Object referent)
PRIVATE-DATA
attribute of the specified referent.referent
- An instance of an converted external procedure class.static character getADMData(java.lang.Object referent)
referent
- An instance of an converted external procedure class.static void setADMData(java.lang.Object referent, java.lang.String value)
referent
- An instance of an converted external procedure class.value
- The new value.static integer getUniqueID(java.lang.Object referent)
referent
- An instance of an converted external procedure class.static java.util.List<handle> getSuperProcedures(java.lang.Object referent)
referent
- An instance of an converted external procedure class.static java.util.List<handle> getSuperProcedures()
static boolean systemHandle(java.lang.Object referent)
referent
- An instance of an converted external procedure class.static 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.static 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.static handle getInstantiatingProcedure(java.lang.Object referent)
referent
- The external program.static handle resolveInstantiatingProcedure(handle hproc)
hproc
- The handle instance representing an instantiating procedure.static java.lang.Object findRootEnclosingInstance(java.lang.Object instance)
this$
fields inserted by the
compiler; it returns the instance refered by the this$0
fields, when reached.instance
- The inner class instance.static void registerResource(java.lang.Object referent, HandleResource resource)
referent
- The procedure which creates the resource.resource
- The resource being created.static void deregisterResource(java.lang.Object referent, HandleResource resource)
referent
- The procedure which creates the resource.resource
- The resource being created.static void setInstantingExternalProgram(java.lang.String name)
ProcedureManager.WorkArea.initiatingExtProg
field.name
- The 4GL external program name.private static void pushInternalEntry(java.lang.Object instance, java.lang.String iename, boolean function)
Use EXTERNAL_PROGRAM
for the name of the root external procedure block and
TRIGGER_PROCEDURE
for the root trigger block.
instance
- The external program instance.iename
- The legacy internal-entry name.function
- Flag indicating if the internal entry is a user-defined function.private static character superProceduresImpl(java.util.Collection<ProcedureManager.ProcedureData> superProcs)
superProcs
- A list of ProcedureManager.ProcedureData
objects, in the order in
which they were added.private static logical addSuperProcedureImpl(handle h, ProcedureManager.SearchMode mode, java.lang.Object referent)
referent
is null, this call is for the SESSION handle.h
- A handle to be added as super-procedure.mode
- The ProcedureManager.SearchMode
for the passed handle.referent
- When null
add to the SESSION:SUPER-PROCEDURES
list. Else, add to the procedure associated with this
referent.true
if h
is a valid procedure
handle.private static void removeProcedureImpl(handle h, java.util.Collection<java.lang.Object> ppList)
h
- The procedure handle to be removed.ppList
- The collection from which the procedure must be removed.private static ProcedureManager.SearchMode getSearchMode(int mode)
ProcedureManager.SearchMode
constant associated with the given mode, used
by ADD-SUPER-PROCEDURE calls. If the mode is not one of the SEARCH-SELF
or SEARCH-TARGET values, or an IllegalArgumentException
will be
thrown.
The given mode
is not compatible with the mode returned by
Enum.toString()
.
mode
- The string representation of the search-mode.ProcedureManager.SearchMode.SEARCH_TARGET
will be returned. For SEARCH-SELF value,
ProcedureManager.SearchMode.SEARCH_SELF
will be returned.java.lang.IllegalArgumentException
- If the mode is not of a known value.private static ProcedureManager.ProcedureData locateProcedure(java.lang.Object referent)
ProcedureManager.ProcedureData
instance associated with the given external program
instance.
This will find any persistent procedure or any procedure active on the stack.
referent
- The external program instance.private static void deleteResources(java.util.Set<WrappedResource> resources)
resources
- The resources to be deleted.private static void prepareSearches(java.util.Collection<?>[] queues, java.lang.Object ref)
queues
- The queues which need to be prepared.ref
- The referent on which removing will stop. This will be also removed, if found.