While working and testing direct and redirecting command handlers for BSF4ooRexx I developed an external function named BsfCommandHandler() with the following invocation possibilities for the ooRexx side:

 * BsfCommandHandler "add", "environmentName", jhandler
   adds a command handler for "environmentName" and a Java/NetRexx implemented 
Rexx direct or
   redirecting command jhandler

 * BsfCommandHandler('list')
   returns an array of currently known Java/NetRexx jhandler, indicating for 
each jhandler whether
   it can be used for redirection or not

The "add" version uses the AddCommandEnvironment()-API.

The "list" version is only able to supply the Java-side known handlers (either from the Rexx instance configuration or/and from using the BsfCommandHandler-"add" subfunction).

However, currently it is not possible to list those command handlers that are not implemented in Java and added through BSF4ooRexx, but by others using AddCommandEnvironment() directly. So, if native command handlers get added with AddCommandEnvironment() and denote e.g. an existing environment name serviced by a Java handler, the native one will replace the Java handler. Yet, the BsfCommandHandler-"list"-subfunction will currently still return the list of known Java handlers, not being able to realize that one of the Java handlers got replaced by a native one. The reason is that there is no API currently available that would return the necessary information.

Therefore suggesting an additional command handler related API that would return the current list of Rexx command handlers in a way that allows native programmers to learn whether the handlers are known to them or from others. This could be achieved e.g. by returning a two or three dimensional RexxArrayObject with index=1 "environmentName", index=2 RexxPointerObjectForHandler [, index=3 isRedirectingHandler].

Having a RexxPointerObject (for the respective handler) one can identify on the native side whether the handler is from one own's package or not, thereby updating/correcting the package known list of registered command handlers. Using a three dimensional array as return value would allow for indicating whether the command handler is direct or redirectable, which would allow for incorporating this information e.g. in the BsfCommandHandler-"list" (and also removing the replaced Java handler in such a case).

Maybe the name for such an API could be something like 
"GetAllCommandHandlers()".

Without such an API one is not able to return a list of *all* currently defined command handlers correctly and determine whether one own's handlers got replaced by others during the program's life time (becoming able to remove Java handlers in such a case, thinking of 7/24 deployments).

Would that be a sensible addition?

---rony

_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to