THE SETUP :
Terminologies in our project -
SERVER : - The machine in an intranet having access to the internet. Server application of the project is installed & executed on this machine.
CLIENT : - All the machines in an intranet having unique IP address. Client application of the project is installed & executed on these machines.
The SERVER and the CLIENT directory contains SRC and DOC subdirectories. They hold the .java files and relative documentation.
ENVIRONMENT VARIABLES :
SET the following environmental variables :
SET PATH=yourjavadirectory\bin;%path%
SET CLASSPATH=.;yourjavadir\LIB\CLASSES.ZIP;yourswingdir\ROSE.JAR;yourswingdir\SWING.JAR;%CLASSPATH%
e. g.
SET PATH=C:\jdk1.1.3\bin;%path%
SET CLASSPATH=.;C:\jdk1.1.3\LIB\CLASSES.ZIP;C:\swing-0.2\ROSE.JAR;C:\swing-0.2\SWING.JAR;%CLASSPATH%
Important !!
* Watch out for the case structure of java filenames while compiling.
* You may have to delete all the .class files and rebuild the application. The compiler may not recognise and build all of the modified source files.
RUNNING THE THE APPLICATION :
THE SERVER :
c:\yourdir\server\src>javac sint.java
c:\yourdir\server\src>java sint
(Coding have been done taking this site into consideration. This application equally supports other sites with html pages but not javascript and other scripting languages for the web. To support javascripts, etc. add code in file getLinks.java in the server\src directory).
Accept it by pressing the enter key in your keyboard or enter other address. Only after that the second textfield becomes editable. It shows the reference string "spor". Again press the enter key to accept reference string for default address or enter new reference string
(All sports related files on Times of India site are named as *spor*.htm. Hence default reference string in our case is "spor". If any other address is selected in first textfield, corresponding reference string has to be selected in second textfield. For editing, use the backspace key if necessary, delete key will not work.)
Now click the OK button to start pulling files from the internet.
* The first file pulled will be saved as homepage.html. Soon the other files will follow. Recursively all html files with the filename containing the reference string will be pulled. Also the .gif, .jpg or other image files referenced by the html files will get pulled.
* Clipping is performed on the html files so that the URL contains only the filename and not the host and the directory name. Also unwanted links of which the files were not pulled are clipped off.
* The links to the .jpg files in the advt directory are inserted in the html files.
Multiple Clients can be connected to the Server at any given time. While the pulling, clipping and the inserting operation is going on, any Client trying to connect to the Server will display a 'SERVER BUSY' message in the Client's text area. Also "pull on wait" message appearing on the screen states that its time for the next pull and no further Clients are to be serviced by the Server. The pullthread is only waiting for the present Clients to be finished.
Since the pull operation is repeated after a period of time, in the first iteration, for each file, a table of 'last modified' status is made by the server. In the following iterations a 'last modified' check is made for each file. Only the modified files are pulled.
( For demonstration the third file's lastmodified status is changed and this file is pulled in the successive iterations).
THE CLIENT :
c:\yourdir\client\src>javac cint.java
c:\yourdir\client\src>java cint
(If the server is located on same machine, type in the IP address as "127.0.0.1" or "localhost". Use the backspace key if necessary, delete key will not work.)
It may happen that the server may not respond favourably or may not respond at all. Then make the use of the stop button and try again pressing Connect button.
The client detaches itself from the server after a successful server push.
Confession
User Interface is implemented using Java Foundation Classes. The look and feel could have been more attractive. Our intention was to learn the language & explore ourselves as programmers in implementing push-pull rather than making attractive user interface.
Vijay Mukhi's Computer Institute
VMCI, B-13, Everest Building, Tardeo, Bombay 400 034, India
E-mail:vmukhi@giasbm01.vsnl.net.in Tel : 91-22-496 4335 /6/7/8/9 Fax :
91-22-307 28 59
http://www.vijaymukhi.com