Package org.rexxla.bsf.engines.rexx
Interface RexxHandler
- All Known Subinterfaces:
RexxCommandHandler,RexxExitHandler,RexxRedirectingCommandHandler
- All Known Implementing Classes:
AbstractDirectCommandHandler,AbstractExitHandler,AbstractRedirectingCommandHandler,JavaDrawingHandler
public interface RexxHandler
Abstract class to allow Rexx exit and command handlers implemented in Java to use
some of the ooRexx exit APIs directly.
Please note: these methods allow interfacing with the running instance
of the Rexx interpreter instance on the same (!) thread in which the Rexx command
or Rexx exit Java handler got invoked on.
It is necessary to supply the opaque argument named slot from the Java handler
methods unaltered.
If neither of these two restrictions holds, then the results of executing any of these
static methods will be undefined, mostlikely tearing down ooRexx and Java!
------------------------ Apache Version 2.0 license -------------------------
Copyright (C) 2012-2024 Rony G. Flatscher
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
----------------------------------------------------------------------------- - Since:
- 2022-08-22
- Version:
- 850.20220901
- Author:
- Rony G. Flatscher
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault booleancheckCondition(Object slot) Checks to see if any conditions have resulted from a call to a Rexx API (cf "rexxapi.pdf").default voidclearCondition(Object slot) Clears any pending condition status (cf "rexxapi.pdf").default voiddropContextVariable(Object slot, String variableName) Drops a Rexx variable from the context.default ObjectgetAllContextVariables(Object slot) Fetches and returns a Rexx directory containing all context variables.default ObjectgetCallerContext(Object slot) Returns the Rexx context object.contextthat can be analyzed to learn about the context of the command/exit.default ObjectgetConditionInfo(Object slot) Returns a directory object containing the condition information; this is equivalent to callingcondition('O')from within Rexx code (cf "rexxapi.pdf").default ObjectgetContextVariable(Object slot, String variableName) Fetches and returns the Rexx variable value in the Rexx program for which the handler runs.default ObjectgetGlobalEnvironment(Object slot) Returns a reference to the Rexx interpreter global.environmentdirectory.default longgetInterpreterVersion(Object slot) (Copied from the ooRexx rexxapi.pdf documentation) "Returns the version of the interpreter." "The returned version is encoded in the 3 least significant bytes of the returned value, using 1 byte each for the interpreter version, release, and revision values." "For example, on a 32-bit platform, this value would be0x00050000for version 5.0.0."default longgetLanguageLevel(Object slot) (Copied from the ooRexx rexxapi.pdf documentation) "Returns the language level of the interpreter." "The returned language level is encoded in the 2 least significant bytes of the returned value, using 1 byte each for the interpreter version, release, and revision values.default ObjectgetLocalEnvironment(Object slot) Returns a reference to this Rexx interpreter instance.localenvironment directory.default ObjectReturns a reference to the Rexx sentinel value.nil.default voidhaltThread(Object slot) Raises aHALTcondition on the current (Rexx) thread.default ObjectReturns a newly created ooRexxArraycollection object.default ObjectnewDirectory(Object slot) Returns a newly created ooRexxDirectorycollection object.default ObjectReturns a newly created ooRexxStemcollection object.default ObjectnewStringTable(Object slot) Returns a newly created ooRexxStringTablecollection object.default voidraiseCondition(Object slot, String conditionName, String description, Object[] additional, Object result) Raises a condition in the current Rexx thread, pass-through method to the Rexx API, which should be called immediately before returning to Rexx.default voidraiseException(Object slot, long definedErrorNumber, Object[] substitutions) Raises a Rexx syntax condition of the given error number, call immediately before returning from Java to Rexx.default voidraiseException0(Object slot, long definedErrorNumber) Raises a Rexx error without substitution values of the given error number, call immediately before returning from Java.default voidraiseException1(Object slot, long definedErrorNumber, String substitution1) Raises a Rexx error of the given error number, call immediately before returning from Java.default voidraiseException2(Object slot, long definedErrorNumber, String substitution1, String substitution2) Raises a Rexx error of the given error number, call immediately before returning from Java.default voidsetContextVariable(Object slot, String variableName, Object variableValue) Allows to set a variable with a value in the Rexx program for which the handler runs.default voidsetContextVariableToNil(Object slot, String variableName) Allows to set a variable to.nilin the Rexx program for which the handler runs.default voidsetThreadTrace(Object slot, boolean state) Sets the interactive trace state for the current thread.
-
Field Details
-
version
Version string indicating version of this class (majorVersion*100+minorVersion concatenated with a dot and the sorted date of last change), e.g. 850.20240620.- See Also:
-
-
Method Details
-
raiseCondition
default void raiseCondition(Object slot, String conditionName, String description, Object[] additional, Object result) Raises a condition in the current Rexx thread, pass-through method to the Rexx API, which should be called immediately before returning to Rexx. Cf. the ooRexx documentation inrexxapi.pdf, 1.17.148. RaiseCondition.- Parameters:
slot- opaque argument supplied to the handler methods by the Rexx native code interfaceconditionName- Rexx condition name, usually"ERROR"or"FAILURE"description- optional String describing the conditionadditional- optional additional objectresult- optional result object, if routine or method does not trap the condition; may contain the error or failure number
-
raiseException
Raises a Rexx syntax condition of the given error number, call immediately before returning from Java to Rexx. Please note: the value ofdefinedErrorNumberhas to be calculated aserrorNumber*1000+subcode. Cf. the ooRexx reference manual (rexxref.pdf), "Appendix C. Error Numbers and Messages".- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectdefinedErrorNumber-errorNumber*1000+subcodesubstitutions- an Object array containing substitution values for the error message (if more entries than needed by the secondary message get added, then they can be retrieved by ooRexx using the additional method of the condition object)
-
raiseException0
Raises a Rexx error without substitution values of the given error number, call immediately before returning from Java. Please note: the value ofdefinedErrorNumberhas to be calculated aserrorNumber*1000+subcode. Cf. the ooRexx reference manual (rexxref.pdf), "Appendix C. Error Numbers and Messages".- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectdefinedErrorNumber-errorNumber*1000+subcode
-
raiseException1
Raises a Rexx error of the given error number, call immediately before returning from Java. Please note: the value ofdefinedErrorNumberhas to be calculated aserrorNumber*1000+subcode. Cf. the ooRexx reference manual (rexxref.pdf), "Appendix C. Error Numbers and Messages".- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectdefinedErrorNumber-errorNumber*1000+subcodesubstitution1- String used as the first substition value for the error message
-
raiseException2
default void raiseException2(Object slot, long definedErrorNumber, String substitution1, String substitution2) Raises a Rexx error of the given error number, call immediately before returning from Java. Please note: the value ofdefinedErrorNumberhas to be calculated aserrorNumber*1000+subcode. Cf. the ooRexx reference manual (rexxref.pdf), "Appendix C. Error Numbers and Messages".- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectdefinedErrorNumber-errorNumber*1000+subcodesubstitution1- String used as the first substition value for the error messagesubstitution2- String used as the second substition value for the error message
-
getAllContextVariables
Fetches and returns a Rexx directory containing all context variables.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- a
RexxProxyrepresenting a Rexx directory with the currently defined context variables
-
getContextVariable
Fetches and returns the Rexx variable value in the Rexx program for which the handler runs.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectvariableName- name of the Rexx variable- Returns:
- value of the Rexx variable
-
setContextVariable
Allows to set a variable with a value in the Rexx program for which the handler runs.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectvariableName- name of the Rexx variablevariableValue- the Rexx variable should be set to
-
setContextVariableToNil
Allows to set a variable to.nilin the Rexx program for which the handler runs.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectvariableName- name of the Rexx variable
-
dropContextVariable
Drops a Rexx variable from the context.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectvariableName- name of the Rexx variable
-
newArray
Returns a newly created ooRexxArraycollection object.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- the newly created ooRexx collection object
-
newDirectory
Returns a newly created ooRexxDirectorycollection object.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- the newly created ooRexx collection object
-
newStem
Returns a newly created ooRexxStemcollection object.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectstemName- the stem's base name- Returns:
- the newly created ooRexx collection object
-
newStringTable
Returns a newly created ooRexxStringTablecollection object.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- the newly created ooRexx collection object
-
checkCondition
Checks to see if any conditions have resulted from a call to a Rexx API (cf "rexxapi.pdf").- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
true, if Rexx condition is set,falseelse
-
clearCondition
Clears any pending condition status (cf "rexxapi.pdf").- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject
-
getConditionInfo
Returns a directory object containing the condition information; this is equivalent to callingcondition('O')from within Rexx code (cf "rexxapi.pdf").- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- returns a
RexxProxyfor a Rexx Directory object orNULL, if no pending Rexx condition
-
getCallerContext
Returns the Rexx context object.contextthat can be analyzed to learn about the context of the command/exit.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- returns a
RexxProxyfor the Rexx.contextobject
-
setThreadTrace
Sets the interactive trace state for the current thread.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobjectstate- new state for interactive trace
-
haltThread
Raises aHALTcondition on the current (Rexx) thread.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject
-
getLocalEnvironment
Returns a reference to this Rexx interpreter instance.localenvironment directory.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- a
RexxProxyfor the Rexx.localobject
-
getGlobalEnvironment
Returns a reference to the Rexx interpreter global.environmentdirectory.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- a
RexxProxyfor the Rexx.environmentobject
-
getNil
Returns a reference to the Rexx sentinel value.nil.- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- a
RexxProxyreferring to the.nilobject
-
getInterpreterVersion
(Copied from the ooRexx rexxapi.pdf documentation) "Returns the version of the interpreter." "The returned version is encoded in the 3 least significant bytes of the returned value, using 1 byte each for the interpreter version, release, and revision values." "For example, on a 32-bit platform, this value would be0x00050000for version 5.0.0."- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- the ooRexx interpreter version
-
getLanguageLevel
(Copied from the ooRexx rexxapi.pdf documentation) "Returns the language level of the interpreter." "The returned language level is encoded in the 2 least significant bytes of the returned value, using 1 byte each for the interpreter version, release, and revision values. For example, on a 32-bit platform, this value would be0x00000603for language level 6.03."- Parameters:
slot- an opaque Object array as passed to theRexxExitHandlerorRexxCommandHandlerobject- Returns:
- the ooRexx language level
-