Package org.rexxla.bsf.engines.rexx
Class RexxConfiguration
java.lang.Object
org.rexxla.bsf.engines.rexx.RexxConfiguration
This class allows to configure a Rexx interpreter instance, before it gets created employing
RexxAndJava.createRexxInterpreterInstance(RexxConfiguration rc).
Cf. ooRexx' rexxpg.pdf documentation for the Rexx interpreter creation options.
All final static fields that use ooRexx names also use the ooRexx constant values from
rexxapidefs.h and oorexxapi.h.
------------------------ Apache Version 2.0 license -------------------------
Copyright (C) 2012-2022 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-20
- Version:
- 850
- Author:
- Rony G. Flatscher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringIf set, determines the name of the default Rexx address environment.protected booleanIf flag is false, then the configuration cannot be changed anymore.static final StringVersion string indicating version of this class (majorVersion*100+minorVersion concatenated with a dot and the sorted date of last change. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommandHandler(String name, RexxCommandHandler commandHandler) Allows to define an environment name and aRexxCommandHandlerto serve the given environment.voidaddExitHandler(int function, RexxExitHandler exitHandler) Allows to define aRexxExitHandlerto serve the given Rexx exit.voidaddRequiredLibrary(String libraryName) Allows to add a required native (implemented in C++) library that should be loaded when the Rexx interpreter instance gets created.Object[]Returns an array with two elements, where the first element is a String array denoting the command environment name and the second element is an array of type RexxCommandHandler and RexxDirectingCommandHandler with the matching Java command handler object.Object[]Returns an array of type Object that contains the following options: index0:INITIAL_ADDRESS_ENVIRONMENT(null or String) index1:EXTERNAL_CALL_PATH(null or String) index2:EXTERNAL_CALL_EXTENSIONS(null or String) index3:LOAD_REQUIRED_LIBRARY(null or String[]) index4:DIRECT_EXITS(null or Object[]={int[],RexxExitHandler[]}) index5:DIRECT_ENVIRONMENTS(null or Object[]={String[],RexxCommandHandler[]})getCommandHandler(String name) Returns theRexxCommandHandlerobject associated with the supplied commandnameornull, if none found.String[]Returns a String array denoting the environment names defined at the moment that are backed by a Java implemented non redirectable RexxCommandHandler.Object[]Returns an array with two elements, where the first element is a String array denoting the command environment name and the second element is an array of type RexxCommandHandler with the matching Java command handler object.Object[]Returns an array with two elements, where the first element is a String array denoting the command environment name and the second element is an array of type RexxCommandHandler with the matching Java command handler object.String[]Returns a String array where the first word represents the environment followed by a blank and the command handler's String representation.Returns a cloned BitSet object indicating which Rexx exits got defined to be handled.getExitHandler(int function) Object[]Returns an array with two elements, where the first element is an int array of exit numbers and the second element is an array of RexxExitHandler with the matching Java exit handler object (ornull, if not yet handled by the Java side).int[]Returns an an int array of exit numbers for which Java exit handlers got defined.Returns the current value of the externalCallExtensions field.Returns the current value of the externalCallPath field.Returns the default address environment ornull, if none set.String[]Returns a String array denoting the environment names defined at the moment that are backed by a Java implemented RexxRedirectableCommandHandler.Object[]Returns an array with two elements, where the first element is a String array denoting the command environment name and the second element is an array of type RexxRedirectingCommandHandler with the matching Java command handler object.String[]Returns an array of native library names.String[]Returns an array of native library names ornull, if none were defined.booleanAccess method for fieldmodifiablesetCommandHandler(String name, RexxCommandHandler commandHandler) Allows to replace a definedRexxCommandHandlerwith a new one.setExitHandler(int function, RexxExitHandler exitHandler) Allows to replace a definedRexxExitHandlerwith a new one or to remove it.voidsetExternalCallExtensions(String externalCallExtensions) Allows to set additional directories for Rexx to lookup.voidsetExternalCallPath(String externalCallPath) Allows to set additional directories for Rexx to lookup called Rexx programs.voidAllows to set the default Rexx address environment.toString()Returns a String representation of the configuration.
-
Field Details
-
version
Version string indicating version of this class (majorVersion*100+minorVersion concatenated with a dot and the sorted date of last change.- See Also:
-
initial_address_environment
If set, determines the name of the default Rexx address environment. -
modifiable
protected boolean modifiableIf flag is false, then the configuration cannot be changed anymore. It is possible however, to nullify handler objects, by using the respective methods native-code TODO: setExitHandler(), native-code TODO: setCommandHandler().
-
-
Constructor Details
-
RexxConfiguration
public RexxConfiguration()
-
-
Method Details
-
setExternalCallPath
Allows to set additional directories for Rexx to lookup called Rexx programs. Please note: on Windows the delimiter character is a semicolon (;), on Unix the colon (:).nullresets the external call path.- Throws:
org.apache.bsf.BSFException
-
getExternalCallPath
Returns the current value of the externalCallPath field.- Returns:
- the current value of the externalCallPath field
-
setExternalCallExtensions
public void setExternalCallExtensions(String externalCallExtensions) throws org.apache.bsf.BSFException Allows to set additional directories for Rexx to lookup. This field is preset to".rxj,.rxo,.rxjo,.jrexx".nullresets the external call extension.- Throws:
org.apache.bsf.BSFException
-
getExternalCallExtensions
Returns the current value of the externalCallExtensions field.- Returns:
- the current value of the externalCallExtensions field
-
addRequiredLibrary
Allows to add a required native (implemented in C++) library that should be loaded when the Rexx interpreter instance gets created.- Parameters:
libraryName- the name of the native required library as used in an ooRexx "::REQUIRES" directive- Throws:
org.apache.bsf.BSFException
-
getRequiredLibraries
Returns an array of native library names.- Returns:
- array of type String containing all required native library names that should get loaded with the creation of the Rexx interpreter instance
-
getRequiredLibraries4JNI
Returns an array of native library names ornull, if none were defined.- Returns:
- array of type String containing all required native library names that should get loaded
with the creation of the Rexx interpreter instance or
null, if none defined
-
getExitHandlers
Returns an array with two elements, where the first element is an int array of exit numbers and the second element is an array of RexxExitHandler with the matching Java exit handler object (ornull, if not yet handled by the Java side).- Returns:
- array of Object where at index
[0]anint[]and at index[1]aRexxExitHandler[]array object gets returned
-
getExitHandlers4JNI
public int[] getExitHandlers4JNI()Returns an an int array of exit numbers for which Java exit handlers got defined. If no exit handlers got defined, thennullgets returned.- Returns:
- int array containing the exit numbers or null, if no exit handlers should be defined
-
getDefinedExits
Returns a cloned BitSet object indicating which Rexx exits got defined to be handled.- Returns:
- a cloned BitSet object
-
getCommandHandlers_ori
Returns an array with two elements, where the first element is a String array denoting the command environment name and the second element is an array of type RexxCommandHandler with the matching Java command handler object.- Returns:
- array of Object where at index
[0]aString[]and at index[1]aRexxCommandHandler[]array object gets returned
-
getAllCommandHandlers
Returns an array with two elements, where the first element is a String array denoting the command environment name and the second element is an array of type RexxCommandHandler and RexxDirectingCommandHandler with the matching Java command handler object.- Returns:
- array of Object where at index
[0]aString[]and at index[1]aRexxCommandHandler[]array object gets returned
-
getCommandHandlersAsStringArray
Returns a String array where the first word represents the environment followed by a blank and the command handler's String representation.- Returns:
- String array
-
getCommandHandlers
Returns an array with two elements, where the first element is a String array denoting the command environment name and the second element is an array of type RexxCommandHandler with the matching Java command handler object.- Returns:
- array of Object where at index
[0]aString[]and at index[1]aRexxCommandHandler[]array object gets returned
-
getRedirectingCommandHandlers
Returns an array with two elements, where the first element is a String array denoting the command environment name and the second element is an array of type RexxRedirectingCommandHandler with the matching Java command handler object.- Returns:
- array of Object where at index
[0]aString[]and at index[1]aRexxCommandHandler[]array object gets returned - Since:
- 8.50 (2022-08-19)
-
getCommandHandlerNames4JNI
Returns a String array denoting the environment names defined at the moment that are backed by a Java implemented non redirectable RexxCommandHandler. If no such command handlers got defined, thennullgets returned.- Returns:
- a String array of the environment names or
nullif no non redirectable RexxCommandHandlers got defined
-
getRedirectingCommandHandlerNames4JNI
Returns a String array denoting the environment names defined at the moment that are backed by a Java implemented RexxRedirectableCommandHandler. If no such command handlers got defined, thennullgets returned.- Returns:
- a String array of the environment names or
nullif no RexxRedirectableCommandHandlers got defined
-
setInitialAddressEnvironment
Allows to set the default Rexx address environment.nullresets the external call path.- Parameters:
name- the name of the environment that Rexx should address by default, ifnull, then Rexx' default address environment (CMD) is used- Throws:
org.apache.bsf.BSFException
-
getInitialAddressEnvironment
Returns the default address environment ornull, if none set.- Returns:
- the default address environment or
null, if none set
-
isModifiable
public boolean isModifiable()Access method for fieldmodifiable- Returns:
- current setting of field
modifiable
-
addExitHandler
public void addExitHandler(int function, RexxExitHandler exitHandler) throws org.apache.bsf.BSFException Allows to define aRexxExitHandlerto serve the given Rexx exit. TheRexxExitHandlerobject may be null, which causes the Rexx exit handling to be switched on for this Rexx interpreter instance; in this case it becomes possible at runtime to change to a RexxExitHandler object usingsetExitHandler(int function, RexxExitHandler exitHandler).- Parameters:
function- the Rexx exit function numberexitHandler- aRexxExitHandlerobject- Throws:
org.apache.bsf.BSFException
-
setExitHandler
public RexxExitHandler setExitHandler(int function, RexxExitHandler exitHandler) throws org.apache.bsf.BSFException Allows to replace a definedRexxExitHandlerwith a new one or to remove it.- Parameters:
function- the Rexx exit function numberexitHandler- a RexxExitHandler object ornull, if the exit should not be served anymore- Throws:
org.apache.bsf.BSFException
-
getExitHandler
-
addCommandHandler
public void addCommandHandler(String name, RexxCommandHandler commandHandler) throws org.apache.bsf.BSFException Allows to define an environment name and aRexxCommandHandlerto serve the given environment.- Parameters:
name- the Rexx environment namecommandHandler- a RexxCommandHandler object- Throws:
org.apache.bsf.BSFException
-
setCommandHandler
public RexxCommandHandler setCommandHandler(String name, RexxCommandHandler commandHandler) throws org.apache.bsf.BSFException Allows to replace a definedRexxCommandHandlerwith a new one.- Parameters:
name- the Rexx environment namecommandHandler- a RexxCommandHandler object- Returns:
- the previous stored RexxCommandHandler object
- Throws:
org.apache.bsf.BSFException
-
getCommandHandler
Returns theRexxCommandHandlerobject associated with the supplied commandnameornull, if none found. This will be used from native code as well.- Parameters:
name- a String denoting the name of the command environment- Returns:
- the
RexxCommandHandlerobject ornullif none found
-
getArguments4JNI
Returns an array of type Object that contains the following options:- index
0:INITIAL_ADDRESS_ENVIRONMENT(null or String) - index
1:EXTERNAL_CALL_PATH(null or String) - index
2:EXTERNAL_CALL_EXTENSIONS(null or String) - index
3:LOAD_REQUIRED_LIBRARY(null or String[]) - index
4:DIRECT_EXITS(null or Object[]={int[],RexxExitHandler[]}) - index
5:DIRECT_ENVIRONMENTS(null or Object[]={String[],RexxCommandHandler[]})
- index
-
toString
Returns a String representation of the configuration.
-