Package org.rexxla.bsf.engines.rexx
Class RexxProxy
java.lang.Object
org.rexxla.bsf.engines.rexx.RexxProxy
- All Implemented Interfaces:
InvocationHandler
This class allows RexxProxy objects to be created from native (JNI) code and will be
registered in the BSFRegistry using the String retrievable by
getBsfRegistryKey().
It allows ooRexx objects to be addressed by Java, as well as creating any number
of java.lang.reflect.Proxy objects from it(cf. newJavaProxyInstance(Object[] interfaces))
which forward any method invocation to the proxied ooRexx object.
The class is public, such that any Java program can define variables of type RexxProxy. However, only
native code is capable of instantiating this class.
------------------------ Apache Version 2.0 license -------------------------
Copyright (C) 2009-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.
----------------------------------------------------------------------------- - Version:
- 1.0.6, 2009-05-03 - 2022-08-11
- Author:
- Rony G. Flatscher
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe string value that was used as the key for storing this object in the BSFRegistry.protected RexxEngineThe RexxEngine instance that creates this proxy and which will be used for callbacks.protected StringThe string value of the RexxInstance C++ pointer.protected StringThe string value of the identity hash value of the ooRexx object, which is used as the key in the proxied ooRexx directory in the JNI code.protected StringThe string value of the identity hash value of the optional "userData" ooRexx object, which - if it is not null - will be submitted as part of the callback directory argument to the Rexx object.static final StringVersion information on this class. -
Method Summary
Modifier and TypeMethodDescriptionGetter method.Getter method.Getter method.Getter method.Getter method.Implements theInvocationHandler's method.Invokes the given method with the given arguments using a callback to ooRexx using the RexxEngine instance.Invokes the given method with the given arguments using a callback to ooRexx using the RexxEngine instance.newExtendedProxyInstance(Object[] arguments) Creates a new class from a supplied abstract class on the fly with all abstract methods being implemented such that they forward their invocations to a RexxProxy.newJavaProxyInstance(Object[] interfaces) Creates an instance of java.lang.reflect.Proxy using the supplied list of interfaces; will use the RexxProxy as the target object.protected BooleanproxyEquals(Object proxy, Object other) protected IntegerproxyHashCode(Object proxy) protected StringproxyToString(Object proxy) sendMessage(String messageName, Object[] args) Sends the given message with the given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object[] args) Sends the given message with the given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage(RexxEngine re, String messageName, Object[] args) Sends the given message with the given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage0(String messageName) Sends the given message using a callback to ooRexx using the RexxEngine instance.sendMessage0(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName) Sends the given message using a callback to ooRexx using the RexxEngine instance.sendMessage0(RexxEngine re, String messageName) Sends the given message using a callback to ooRexx using the RexxEngine instance.sendMessage1(String messageName, Object arg1) Sends the given message with the given argument using a callback to ooRexx using the RexxEngine instance.sendMessage1(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1) Sends the given message with the given argument using a callback to ooRexx using the RexxEngine instance.sendMessage1(RexxEngine re, String messageName, Object arg1) Sends the given message with the given argument using a callback to ooRexx using the RexxEngine instance.sendMessage2(String messageName, Object arg1, Object arg2) Sends the given message with the two given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage2(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1, Object arg2) Sends the given message with the two given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage2(RexxEngine re, String messageName, Object arg1, Object arg2) Sends the given message with the two given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage3(String messageName, Object arg1, Object arg2, Object arg3) Sends the given message with the three given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage3(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1, Object arg2, Object arg3) Sends the given message with the three given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage3(RexxEngine re, String messageName, Object arg1, Object arg2, Object arg3) Sends the given message with the three given arguments using a callback to ooRexx using the RexxEngine instance.Sends the given message with the four given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage4(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1, Object arg2, Object arg3, Object arg4) Sends the given message with the four given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage4(RexxEngine re, String messageName, Object arg1, Object arg2, Object arg3, Object arg4) Sends the given message with the four given arguments using a callback to ooRexx using the RexxEngine instance.Sends the given message with the five given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage5(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) Sends the given message with the five given arguments using a callback to ooRexx using the RexxEngine instance.sendMessage5(RexxEngine re, String messageName, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) Sends the given message with the five given arguments using a callback to ooRexx using the RexxEngine instance.sendMessageScoped(String messageName, Object scope, Object[] args) Sends the given message, with the given scope and arguments using a callback to ooRexx using the RexxEngine instance.sendMessageScoped(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object scope, Object[] args) Sends the given message with the given scope and arguments using a callback to ooRexx using the RexxEngine instance.sendMessageScoped(RexxEngine re, String messageName, Object scope, Object[] args) Sends the given message with the given scope and arguments using a callback to ooRexx using the supplied RexxEngine instance.
-
Field Details
-
version
Version information on this class.- See Also:
-
rexxInterpreterID
The string value of the RexxInstance C++ pointer. The RexxProxy object can only be deployed via the RexxInstance in which it got created; note: if the original Rexx interpreter instance was terminated in between its .local directory got garbage collected. -
rexxObjectID
The string value of the identity hash value of the ooRexx object, which is used as the key in the proxied ooRexx directory in the JNI code. -
rexxUserDataID
The string value of the identity hash value of the optional "userData" ooRexx object, which - if it is not null - will be submitted as part of the callback directory argument to the Rexx object. -
bsfRegistryKey
The string value that was used as the key for storing this object in the BSFRegistry. -
rexxEngine
The RexxEngine instance that creates this proxy and which will be used for callbacks.
-
-
Method Details
-
proxyHashCode
-
proxyEquals
-
proxyToString
-
getRexxInterpreterID
Getter method.- Returns:
- the ooRexx Interpreter ID
-
getRexxObjectID
Getter method.- Returns:
- the ooRexx object ID
-
getRexxUserDataID
Getter method.- Returns:
- the ooRexx object ID
-
getBsfRegistryKey
Getter method.- Returns:
- string value that was used as the key for storing this object in the BSFRegistry
-
getRexxEngineInstance
Getter method.- Returns:
- the RexxEngine instance that gets used to dispatch methods to ooRexx objects
-
sendMessageScoped
public Object sendMessageScoped(String messageName, Object scope, Object[] args) throws org.apache.bsf.BSFException Sends the given message, with the given scope and arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
messageName- name of the method to invokescope- a String or a RexxProxy denoting the Rexx object's superclass to start looking for the method by the name of messageNameargs- array of Objects serving as arguments- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage
Sends the given message with the given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
messageName- name of the method to invokeargs- array of Objects serving as arguments- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage0
Sends the given message using a callback to ooRexx using the RexxEngine instance.- Parameters:
messageName- name of the method to invoke- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage1
Sends the given message with the given argument using a callback to ooRexx using the RexxEngine instance.- Parameters:
messageName- name of the method to invokearg1- single argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage2
public Object sendMessage2(String messageName, Object arg1, Object arg2) throws org.apache.bsf.BSFException Sends the given message with the two given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
messageName- name of the method to invokearg1- argumentarg2- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage3
public Object sendMessage3(String messageName, Object arg1, Object arg2, Object arg3) throws org.apache.bsf.BSFException Sends the given message with the three given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
messageName- name of the method to invokearg1- argumentarg2- argumentarg3- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage4
public Object sendMessage4(String messageName, Object arg1, Object arg2, Object arg3, Object arg4) throws org.apache.bsf.BSFException Sends the given message with the four given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
messageName- name of the method to invokearg1- argumentarg2- argumentarg3- argumentarg4- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage5
public Object sendMessage5(String messageName, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws org.apache.bsf.BSFException Sends the given message with the five given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
messageName- name of the method to invokearg1- argumentarg2- argumentarg3- argumentarg4- argumentarg5- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessageScoped
public Object sendMessageScoped(RexxEngine re, String messageName, Object scope, Object[] args) throws org.apache.bsf.BSFException Sends the given message with the given scope and arguments using a callback to ooRexx using the supplied RexxEngine instance.- Parameters:
re- RexxEngine object to use for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokescope- a String or a RexxProxy denoting the Rexx object's superclass to start looking for the method by the name of messageNameargs- array of Objects serving as arguments- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage
public Object sendMessage(RexxEngine re, String messageName, Object[] args) throws org.apache.bsf.BSFException Sends the given message with the given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
re- RexxEngine object to use for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokeargs- array of Objects serving as arguments- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage0
Sends the given message using a callback to ooRexx using the RexxEngine instance.- Parameters:
re- RexxEngine object to use for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invoke- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage1
public Object sendMessage1(RexxEngine re, String messageName, Object arg1) throws org.apache.bsf.BSFException Sends the given message with the given argument using a callback to ooRexx using the RexxEngine instance.- Parameters:
re- RexxEngine object to use for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- single argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage2
public Object sendMessage2(RexxEngine re, String messageName, Object arg1, Object arg2) throws org.apache.bsf.BSFException Sends the given message with the two given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
re- RexxEngine object to use for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- argumentarg2- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage3
public Object sendMessage3(RexxEngine re, String messageName, Object arg1, Object arg2, Object arg3) throws org.apache.bsf.BSFException Sends the given message with the three given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
re- RexxEngine object to use for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- argumentarg2- argumentarg3- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage4
public Object sendMessage4(RexxEngine re, String messageName, Object arg1, Object arg2, Object arg3, Object arg4) throws org.apache.bsf.BSFException Sends the given message with the four given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
re- RexxEngine object to use for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- argumentarg2- argumentarg3- argumentarg4- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage5
public Object sendMessage5(RexxEngine re, String messageName, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws org.apache.bsf.BSFException Sends the given message with the five given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
re- RexxEngine object to use for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- argumentarg2- argumentarg3- argumentarg4- argumentarg5- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessageScoped
public Object sendMessageScoped(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object scope, Object[] args) throws org.apache.bsf.BSFException Sends the given message with the given scope and arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
raj- RexxAndJava object which RexxEngine will be used for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokescope- a String or a RexxProxy denoting the Rexx object's superclass to start looking for the method by the name of messageNameargs- array of Objects serving as arguments- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage
public Object sendMessage(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object[] args) throws org.apache.bsf.BSFException Sends the given message with the given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
raj- RexxAndJava object which RexxEngine will be used for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokeargs- array of Objects serving as arguments- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage0
public Object sendMessage0(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName) throws org.apache.bsf.BSFException Sends the given message using a callback to ooRexx using the RexxEngine instance.- Parameters:
raj- RexxAndJava object which RexxEngine will be used for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invoke- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage1
public Object sendMessage1(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1) throws org.apache.bsf.BSFException Sends the given message with the given argument using a callback to ooRexx using the RexxEngine instance.- Parameters:
raj- RexxAndJava object which RexxEngine will be used for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- single argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage2
public Object sendMessage2(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1, Object arg2) throws org.apache.bsf.BSFException Sends the given message with the two given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
raj- RexxAndJava object which RexxEngine will be used for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- argumentarg2- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage3
public Object sendMessage3(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1, Object arg2, Object arg3) throws org.apache.bsf.BSFException Sends the given message with the three given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
raj- RexxAndJava object which RexxEngine will be used for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- argumentarg2- argumentarg3- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage4
public Object sendMessage4(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1, Object arg2, Object arg3, Object arg4) throws org.apache.bsf.BSFException Sends the given message with the four given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
raj- RexxAndJava object which RexxEngine will be used for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- argumentarg2- argumentarg3- argumentarg4- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
sendMessage5
public Object sendMessage5(org.rexxla.bsf.engines.rexx.RexxAndJava raj, String messageName, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) throws org.apache.bsf.BSFException Sends the given message with the five given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
raj- RexxAndJava object which RexxEngine will be used for the call, if null, using RexxEngine object that created this RexxProxy objectmessageName- name of the method to invokearg1- argumentarg2- argumentarg3- argumentarg4- argumentarg5- argument- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
invoke
Invokes the given method with the given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
methodObject- for which we invoke a Rexx messageargs- array of Objects serving as arguments- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException
-
invoke
public Object invoke(Object javaObject, String methodName, String methodDescriptor, Object[] args) throws org.apache.bsf.BSFException Invokes the given method with the given arguments using a callback to ooRexx using the RexxEngine instance.- Parameters:
javaObject- object that invoked this callback, such that the Rexx side can get access to it and send additional messages to itmethodName- this name is used as the message to be sent to the Rexx objectmethodDescriptor- the Java internal representation of the method's arguments and return type, if anyargs- array of Objects serving as arguments- Returns:
- value that the ooRexx method returns, if any
- Throws:
org.apache.bsf.BSFException- Since:
- 2009-07-11
-
invoke
Implements theInvocationHandler's method.- Specified by:
invokein interfaceInvocationHandler- Throws:
org.apache.bsf.BSFException
-
newJavaProxyInstance
Creates an instance of java.lang.reflect.Proxy using the supplied list of interfaces; will use the RexxProxy as the target object.- Parameters:
interfaces- array of interfaces the java.lang.reflect.Proxy object should implement. Each element may be either a class object, a String which denotes a fully qualified class name which should be loaded instead, or any other object, whose implemented interfaces should be honored.- Returns:
- java.lang.reflect.Proxy object which dispatches all messages to this RexxProxy instance, which itself will dispatch (forward) it to ooRexx via a callback
- Throws:
IllegalArgumentException
-
newExtendedProxyInstance
public Object newExtendedProxyInstance(Object[] arguments) throws IllegalArgumentException, ClassNotFoundException, NoSuchFieldException, NoSuchMethodException, org.apache.bsf.BSFException, IllegalAccessException, InvocationTargetException Creates a new class from a supplied abstract class on the fly with all abstract methods being implemented such that they forward their invocations to a RexxProxy. This method then instantiates the extended class supplying itself as the RexxProxy object to be the target of the dispatch. If more than one element gets supplied in the argument array, then they are taken as values for the constructor to invoke.- Parameters:
arguments- array of arguments, element at index0must be given and denotes an abstract class whose abstract methods should be implemented; remaining arguments are taken as arguments for the constructor of the extended class- Returns:
- object which dispatches all method invocations to this RexxProxy instance, which itself will dispatch (forward) it to ooRexx via a callback
- Throws:
IllegalArgumentExceptionClassNotFoundExceptionNoSuchFieldExceptionNoSuchMethodExceptionorg.apache.bsf.BSFExceptionIllegalAccessExceptionInvocationTargetException
-