my little php-ext/java-RMI extension
| From: | norbert frese | Date: | Wed, 14 Aug 2002 15:40:56 +0000 |
| Subject: | my little php-ext/java-RMI extension | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-86834@lists.php.net to get a copy of this message | ||
hi!
i have written a little extension to the php-java module to allow convenient access to objects living in other virtual machines via rmi. this should be handy because the php-java JVM terminates at the end of every php-script.
the idea was to make remote objects look like local objects:
---------------
$dow = new Java("rmi/RemoteControllable1.0","//192.168.2.20:5002/remoteControlDemo_dowJonesInfo");
$dow->changeValue(1000);
$value = $dow->getValue();
print "getValue() of remote dowJonesInfo-Object: " . $value . "\n";
------------
because i use a generic wrapper for remote-objects (RemoteControllableImpl), they don't have to be available in the classpath of php-java.
i have hacked the reflect.java-class to handle both local objects and remote objects. methods on remote-objects are handled via reflection on the remote-side (which need to be plugged into my RemoteControllableImpl class).
!!! i have used the reflect.java from PHP 4.0.6 which might not be up to date.
to test my extension you have to replace the php_java.jar and start runRemoteControlTestSrv.bat.
i hope you like it!
cheers
norbert