The Java source file should be named FileServer.java. It compiles to FileServer.class which should be placed in the CGI directory. The class file should be given world read and execute permission. There should also be a script (any name you like) in that directory which starts the Java code. The following is an example of such a script:
#!/bin/sh /local/packages/information-systems/java/bin/java FileServer $1
The C code can be called anything and compiled to any name you like. The compiled code should be in the CGI directory. The permissions must be set for the world to read and execute the code.
The files maintained by the file server are text files with variable length record delimited by the character | (pipe or vertical bar).
The functions available from the server are Create, Read, Write. The create function takes a filename as argument and creates a file of that name in the CGI directory. Any previous file of the same name is obliterated by this function. The read function takes a filename and record number i as input and returns the string of characters between the ith and i+1st delimiters. The write function takes a filename and record as input and places the given record at the end of the named file. If the file does not exist, it is created then given the record.
To facilitate easy access to the file server, another class, called the FileServerClient class has been constructed. This class may be used by applications to interface with the file server in an easy manner. A simple outline of the use of this class follows. The class itself is presented completely here.
... FileServerClient fs; ... fs = new FileServerClient(); ... fs.create("file.ext"); ... String out = fs.read("file.ext",3); ... fs.write("file.ext", out); ...