Re: Newb question about calling Scheme from Java
"Mike J. Bell" <[email protected]> Wed, 3 Sep 2008 07:27:37 -0400
| Newsgroups | gmane.comp.java.sisc.user |
|---|---|
| Message-ID | <[email protected]> |
--===============0881800763== Content-Type: multipart/alternative; boundary="----=_Part_23506_4789188.1220441257615" ------=_Part_23506_4789188.1220441257615 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Sep 3, 2008 at 7:00 AM, Norman Gray <[email protected]> wrote: > Mike, hello. Hey! =) > The way I use that is as follows, where initialiseProcedure is some String > parameter obtained from the webapp configuration, naming (surprise) an > initialisation procedure: > > Object val = SchemeWrapper > .getInstance() > .eval(initialiserProcedure, new Object[] {this}); > > and the initialisation procedure looks like: > > ;; INITIALISE-QUAESTOR : <QuaestorServlet> -> void > ;; Initialise Quaestor, with a servlet object. We require this object > ;; to implement interface QuaestorServlet > (define (initialise-quaestor scheme-servlet) > (define-generic-java-methods > register-handler > get-init-parameter) > (define (get-param s) ;get parameter, or #f if java-null > (let ((val (get-init-parameter scheme-servlet (->jstring s)))) > (and (not (java-null? val)) > val))) > > ...)) > > (register-handler and get-init-parameter are methods on the 'this' passed > to the procedure) > > Good luck! Thanks, I think this is moving me forward more quickly than trying to use the Java-side API to set up the "back link." Quick question though: where'd you define your initialize-quaestor procedure? Did you eval it before you called the SchemeWrapper initialize procedure, or did you make a custom heap? Is there some other slick way to make sure your necessary "bootstrap" code is present? Thanks again for sharing...this is really helping me get on my way... -- Mike J. Bell on gmail ------=_Part_23506_4789188.1220441257615 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline <div dir="ltr">On Wed, Sep 3, 2008 at 7:00 AM, Norman Gray <span dir="ltr"><<a href="mailto:[email protected]">[email protected]</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Mike, hello.</blockquote><div><br>Hey! =)<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The way I use that is as follows, where initialiseProcedure is some String parameter obtained from the webapp configuration, naming (surprise) an initialisation procedure:<br> <br> Object val = SchemeWrapper<br> .getInstance()<br> .eval(initialiserProcedure, new Object[] {this});<br> <br> and the initialisation procedure looks like:<br> <br> ;; INITIALISE-QUAESTOR : <QuaestorServlet> -> void<br> ;; Initialise Quaestor, with a servlet object. We require this object<br> ;; to implement interface QuaestorServlet<br> (define (initialise-quaestor scheme-servlet)<br> (define-generic-java-methods<br> register-handler<br> get-init-parameter)<br> (define (get-param s) ;get parameter, or #f if java-null<br> (let ((val (get-init-parameter scheme-servlet (->jstring s))))<br> (and (not (java-null? val))<br> val)))<br> <br> ...))<br> <br> (register-handler and get-init-parameter are methods on the 'this' passed to the procedure)<br> <br> Good luck!</blockquote><div><br>Thanks, I think this is moving me forward more quickly than trying to use the Java-side API to set up the "back link."<br><br>Quick question though: where'd you define your initialize-quaestor procedure? Did you eval it before you called the SchemeWrapper initialize procedure, or did you make a custom heap? Is there some other slick way to make sure your necessary "bootstrap" code is present?<br> <br>Thanks again for sharing...this is really helping me get on my way...<br> </div></div><br>-- <br>Mike J. Bell on gmail<br> </div> ------=_Part_23506_4789188.1220441257615-- --===============0881800763== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ --===============0881800763== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Sisc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sisc-users --===============0881800763==--