Mittwoch, 25. Mai 2011

RemoteRunner for JTalk Server

As announced in an earlier blog-post, i implemented a RemoteRunner for the jtalk-server (based on the jtalk-project). It's very simple: if you implement a Method runRemote in your class, e.g. RemoteTest, then by executing:
RemoteRunner new runClass: RemoteTest
will execute the Smalltalk-Code implemented in the runRemote-Method on the server. The example prints out the date and time of the server.
To see how the results can be transferred back to the client-caller, just look at the example-class.
The jtalk.js on the server-side is exactly the same as the one on the client-side. So if you make changes, don't forget to press the button "Export & Save JTalk to DB".
If you like to play around with this new feature and you played around with jtalk-server before (and pressed the save-button), you need to reset the jtalk.js by pressing the button. This is because, the jtalk.js will be saved to the database for every user (identified by his/ her google-id). So changes made to the jtalk.js, which is located in the server-filesystem won't get executed, because on startup (page-load) a jtalk.js in the DB, associated with the current google-user, has priority.
The JVM of the JDK/ JRE 6 is packaged with a ScriptEngine for executing Javascript. This feature is currently not supported on the Google App Engine, so i needed to use the "external" Rhino-jar, and a slightly different mechanism. Here is some work needed on optimizing the server-execution. So, the jtalk.js on the server should get reduced to the classes that are needed on the server (no canvas etc.) and most imported, the precompiled jtalk.js should get persisted somehow. Currently the complete javascript-source of the Smalltalk-System is executed/ interpreted for every call on the server.
But the next step will be to use the GAE persistence-layer via java-calls from Smalltalk/ Javascript to the google-api. Calling java is already possible and i think this is where the fun begins ...

1 Kommentar:

Andy Burnett hat gesagt…

Wow, Stefan this is looking really exciting. I can't wait until we can call google apis etc., straight from server based smalltalk.