Lisp Annotator - Applet Demo

A simple demonstration of Lisp/Java communication.
{

Pre-Conditions to run this demo in a browser:

  • You need the Java 1.2 PlugIn available at the Sun MicroSystems Java site
  • You need to enable access to the Franz server from a Java applet running in the Java plugin.
    • This means that you must allow an applet to connect to a pair of sockets at Franz.
    • There is a file "java.policy" that needs to be updated with an appropriate permission entry. If there is only one file, that is the one to update. If there are more than one, the one in a JRE subtree may be the likely target, but some trial and error may be required.
    • The file may be edited with Notepad or Emacs to add the following 3 lines grant { permission java.net.SocketPermission "spider.franz.com:9385-9386", "connect, resolve"; };
    • It is also possible to use the JDK (Java Develper ToolKit) policytool program to modify the policy file. Use the tool to add a SocketPermission entry with components:
      target: spider.franz.com:9385-9386
      actions: "connect,resolve"
    • It may be necessary to reboot to make the permissions effective.
    • On my Windows machine, Java 1.2 JRE is installed at c:\mmProgs\JRE\1.2\ and the corresponding policy file was c:\mmProgs\JRE\1.2\lib\security\java.policy.
  • Once the above two conditions are met, return to this page and select the "remote server" link below.
  • Alternatively, you can run the Lisp server in your own machine, and avoid the socket permission issues.
    • Download and expand the file demo.zip
    • Compile and load the file t-java.cl
    • Evaluate (enable-applets)
    • Point your browser at the local copy of this file
    • Select the "local server" link below
}

Run the Applet Demo

Remote server at Franz Inc.

Local Lisp server


The applet above is connected to Lisp where all the work is done. Lisp calls Java to make the applet GUI components, but the database is maintained in Lisp. The Lisp code is running in the remote server. The Java applet code is running in the browser plugin.

Login Screen

Enter a user name under which to save annotations made in this session.

Main Screen

The main screen shows a scrollable and searchable database of trivia about the original Star Trek episodes. The input fields allow you to add comments to the database. The comments may be saved (at the server) from one session to the next.

As the mouse moves around the window, the status area at the bottom edge is updated by local Java code. Button presses are sent back to Lisp for handling there, hence the greater delay.

A Note on Performance

This program was initially created to demonstrate jLinker in a closely-coupled situation where Lisp and Java are running on the same machine. The Lisp code naively used the awt library as if it were a local Lisp library. In the one-host situation, screen creation and scrolling response are nominally instantaneous.

In this internet demonstration, the round-trip delay for even a single Lisp-Java interaction is the overwhelming component. I modified the original application to reduce the number of calls form Lisp to Java by adding some Java code that performs commonly used sequences of calls. The main screen creation still uses about 200 calls from Lisp to Java, while a scrolling operation takes only 15 calls. Any practical internet applet should be mostly self-contained; communication with the Lisp host should be limited to a few round-trips per user interaction.

The Source Code

Yet Another Way to Run the Demo

This demo will also run without a browser. In this case, Lisp simply starts a Java process to manage the graphic components.
mm@Franz.com