NAME: Rixin Liao 018-80-4625 Xi Ren 002-88-9922 PROJECT: A Web Script Language for Web Computing DIRECTORY: /proj/demsys/com3360/f97/rixin/project CREDITS: The Web Script Language was created by Luca Cardelli at Digital Palo Alto and Rowan Davies,Ph.D student at Carnegie-Mellon University. We also thanks Professor Liberherr ans his group who provide the powerful Demeter/Java tools. DESCRIPTION: This project implements a simple script language which allows easy expression of common strategies for handling failure and slow communication when fetching content on the Web. The script language is based on service combinators. [note:] Please see Digital research report SRC 148 by Luca Cardelli and Rowan Davies The following is the definition of service: S::= url(String) | (S1 ? S2) | (S1 '|' S2) | timeout(Real,S) | limit(Real1,Real2,S) | repeat(S) | stall | post(String,{Id=String}*) | get(String,{Id=String}*) please see my .cd file "WebScript.cd" for detail. MOTIVATION: Better grasp of the power of Demeter/Java and Java language. INCEPTION: After a studying of the proposed projects, we decided to choose this project as a chance to do a real project using the idea and tools of Demeter/Java. PLANNING: We had several phases in doing this project: phase 1: class diagram, .cd file ,traversal and visitor. phase 2: GUI. (1) class Gui which has a menu bar and two TextArea. The top TextArea is used to display the data received from the web server. The script file is display in the bottom TextArea. (2) class FileCommand which implements how to create, open and save a script file. (2) class ExecutionCommand which can run a script commant and stop the running of current script. phase 3: classes for getting data from Web server. These classes are the real phsical connection to the web server. All of them inheritence form class java.lang.Thread. (1) class UrlRun which can get a html file from a web server by using the url. (2) class PostRun which can receive data from a CGI program at a web server using HTTP Post method. (3) class GetRun which can get data from a CGI program at a web server using HTTP Get method. phase 4-n: implement each service combinator at each phase. (1) class Url for service "url" (2) class TimeOut for service "timeout" (3) class Stall for service "stall" (4) class Fail for service "fail" (5) class Limit for service "limit" (6) class Repeat for service "repeat" (7) class Post for service "post" (8) class Get for service "get" (9) class SequenceOp for service "(S1 ? S2)" (10) class ConcurrentOp for service "(S1 | S2)" EHANCEMENT: (1) More friendly GUI. Although now the GUI works OK, it need some improvement. For example, A status bar can be added to display current url and the network rate. (2) HTML browser Now the program can only html source files. If we have a HTML browser, we can the html file just like NetScape Navigator. That would be very nice. (3) Function (See Luca and Rowan's paper on Digital SRC 148) For example: let av = fun(x) get("http://www.altavista.digital.com/cgi-bin/query", pg="q" what="web" q=x) av("java") av("c++") TEST: We have saved a test file "test.script" under the project directory. There are 10 test cases in the test file (most of the examples are extracted from Luca and Rowan's paper). Test 1: url("http://www.neu.edu/") This command simply attempts to fetch the html file from www.neu.edu Test 2: url("http://www.ccs.neu.edu") This command simply attempts to fetch the html file from www.ccs.neu.edu Test 3: get("http://www.altavista.digital.com/cgi-bin/query", pg="q" what="web" q="java") This command looks up the word "java" on the AltaVista search engine using HTTP GET method. Test 4: post("http://www.dbc.com/cgi-bin/htx.exe/squote", source="dbcc" TICKER="ticker" format="decimals" tables="table") This command looks up stock quotes on www.dbc.com using HTTP POST method. Test 5: timeout(10,stall) This command just wait 10 seconds Test 6: limit(1,1,url("http://www.cmu.edu")) This command gives the url connection 1 second start-time and force the connection to fail if the rate ever drops below 1 KB/Second. Test 7: limit(1,10,url("http://www.cmu.edu")) This command is just like the above example except it require a higher rate 10 KB/Second. Test 8: repeat((url("http://www.cs.cmu.edu/~rowan")?timeout(10,stall))) This command repeatedly tries to fetch the URL, but waits 10 seconds between attempts. Test 9: (url("http://www.cs.umd.edu/~pugh/popl97/") | url("http://www.diku.dk/popl97/")) This command atempts to fetch the POPL'97 conference page from one of two alternate sites. Both sites are attempted concurrently, and the result is that from whichever site successfully completes first. Test 10: (repeat(limit(1,1,url("http://www7.conf.au/"))) | (timeout(20,stall) ? url("http://www.cs.cmu.edu/~rowan/failed.txt"))) This command attempts to fetch the WWW7 conference page from Australia. If the fetch fails or the rate ever drops below 1 KB/second, than it starts again. If the page is not successfully fetched withis 20 seconds, then a site know to be easily reachable is used to retrieve a failure message. HOW TO USE THE PROGRAM please see file "USER-MANUAL.txt"