radwin.org -> Michael J. Radwin -> Projects -> The Java Network File System -> README | Search |
The NCRP specification proposes that Sun's Network File System (NFS) be optionally used as a file system for NC devices: ``NCs which do not implement a distributed file system need not implement this protocol''. It does, however, mandate support of the TCP/IP-based Hypertext Transfer Protocol (HTTP) to enable Web browsing and the File Transfer Protocol (FTP) for file exchange.
Both the JNFS client and server were developed
with Sun's Java Development Kit 1.1. The client will run on both
any NC-compliant device as well as
PCs with the Java support. The server is also written Java
for ease of portability. An overview of the architecture is
presented in the above figure.
The JNFS server runs as a user-level daemon as the
privileged user (for example, root on UNIX,
or any user with the Administrative Privilege on Windows
NT). It serves out files from the underlying file
system(s) used by the host operating system. Thus, if the server's
operating system provides support for distributed file systems such
as NFS, JNFS will serve those files
out as well.
java.io
package. The table below presents an
overview of the file classes in the java.io
package
and their JNFS equivalents. Each of these
JNFS client classes inherits from either its
java.io
counterpart or from an ancestor of its
java.io
counterpart. package
java.io |
package
jnfs |
purpose |
File | RemoteFile | pathname abstraction, file attributes |
FileInputStream | RemoteFileInputStream | read-only input stream |
FileOutputStream | RemoteFileOutputStream | write-only output stream |
RandomAccessFile | RemoteRandomAccessFile | read/write, block-oriented random access |
FileReader | RemoteFileReader | character file input |
FileWriter | RemoteFileWriter | character file output |
FileServer | gives back filehandles, provides user info |
Performance in our simulations was reasonable for a Java application, but not nearly as good as NFS. On average, JNFS file transfers take about 8 times as long as analogous NFS transfers on a Sun SparcStation 10 running Solaris 2.5. We present a comparison of JNFS and NFS read speeds on various different file sizes in the above figure. There are several factors that lead to worse performance in our simulation:
Filename | Description |
---|---|
public_html/jquest-README.html |
This document, in HTML format. |
public_html/demo.html |
The demo applet which must be run with appletviewer (see "Running the demo") |
public_html/jnfs.jar |
A signed jarfile of the server and client code, as well as the demo applet. |
public_html/jnfs.x509 |
The X509 certificate for the jnfs entity. |
public_html/signer.guest |
Serialized private key file for the guest user. |
public_html/usertab.obj |
The user table of public keys. Contains entries for foo, mjr, tag, guest, bar, and admin. |
src |
The root of the directory tree containing the JNFS source code and class files. |
src/users/signer.* |
Serialized private key files for individual users. |
src/users/identity.* |
Serialized public key files for individual users. |
CLASSPATH
appropriately to include the src
directory (or to the full path of jnfs.jar
), start the
server by issuing the following command:
java jnfs.FileServerStarter fully.qualified.host.name \ dirListingPathname groupPathname passwdPathnamePlease forgive the lengthy explanation of the command-line parameters. Much care was taken to make sure that the server is platform-independent, so it is crucial to understand the structure of the configuration files so they can be generated if the server is not a UNIX machine. As a matter of convenience, these configuration files mimic the structure of standard files found on a UNIX machine.
fully.qualified.host.name
hostname
command should supply the name of the machine.
dirListingPathname
ls -laR
command. This file
tells the server what permissions to associate with each
file. An example is given below, where the first column lists
the permission bits, the third lists the owner, the fourth lists
the group, and the ninth the filename. All other fields are
required but ignored.
The filename separator used to indicate which directory the files belong to must conform to the system-dependent file separator string (for example, "/" on unix and "\" on WinNT). A fragment from a directory listing is given below:
/: total 129 drwxr-xr-x 32 root root 1024 Feb 25 13:05 . drwxr-xr-x 32 root root 1024 Feb 25 13:05 .. dr-xr-xr-x 2 root root 3 May 21 15:40 bin lrwxrwxrwx 1 root root 9 Jan 6 19:47 lib -> ./usr/lib drwx------ 2 root root 8192 Jan 6 19:47 lost+found drwxrwxr-x 25 root sys 1024 Jan 7 09:16 usr /bin: total 18944 drwxrwxr-x 2 root bin 7168 Mar 18 05:13 . drwxrwxr-x 25 root sys 1024 Jan 7 09:16 .. -r-sr-xr-x 1 root bin 32868 Jan 29 05:13 login -r-xr-xr-x 1 bin bin 17500 Oct 25 1995 ls -r-x--s--x 1 bin mail 66208 Jan 6 20:16 mail
If you're running JNFS on Win32, you'll need a program that can do the equivalent of the UNIX command "/bin/ls -laR". I'd recommend installing the GNU-Win32 toolkit. After running their "ls -laR", you'll need to open up the file in an editor and search/replace all /'s with \'s.
groupPathname
/etc/group
file. This file tells the server the
membership of each group. If the server is being run on a
UNIX system, passing /etc/group
as this
parameter will work fine.
If one needs to generate a group file (if the server runs Windows NT or MacOS), the following format may be used. The file must consist of a one-line entry for each group recognized by the system, of the form:
groupname:password:gid:user-list
where
groupname
is the name of the group.gid
is the group's unique numerical ID within the
system.password
is ignored. May be left blank.user-list
is a comma-separated list of users
allowed in the group.passwdPathname
/etc/passwd
file. This file tells the server the
principal group id associated with each user. If the server
is being run on a UNIX system, passing
/etc/passwd
as this parameter will work fine.
If one needs to generate a password file (if the server runs Windows NT or MacOS), the following format may be used. The file must consist of a one-line entry for each user of the form:
username:password:uid:gid:gcos-field:home-dir:login-shell
where
username
is the user's login name.gid
is the user's numerical group ID.
password
field may be left blank, but all other fields may
not be blank.jquest.acm.org
jquest.acm.org
:
cd /home/mjr/src unset noclobber setenv CLASSPATH /home/mjr/src ls -laR / > /tmp/ls-laR java jnfs.FileServerStarter jquest.acm.org /tmp/ls-laR /etc/group /etc/passwd
The demo is an applet, but requires special access privileges that Java does not normally grant applets (it calls System.runFinalizersOnExit(true), which for some silly reason is considered dangerous). Thus, it must be a "trusted" applet to run in the HotJava 1.0 browser or the JDK1.1 appletviewer.
You'll need to obtain the jnfs x509 certificate and then use the javakey tool to trust the jnfs entity. Once you've got the certificate, run:
javakey -c jnfs true javakey -ic jnfs jnfs.x509 javakey -ld
jquest.acm.org
jnfs
demo that work on
jquest.acm.org
:
javakey -c jnfs true javakey -ic jnfs /home/mjr/public_html/jnfs.x509 javakey -ldOnce you've trusted the jnfs entity (you'll notice a file called
identitydb.obj
in your home directory), you can launch
the demo via:
appletviewer demo.html
usertab.obj
)usertab.obj
.
The usage and description of options follows:
java jnfs.UserTool [-r host] {add | new | del | list} [user(s) | identity_file(s)]
host
instead of locally on usertab.obj
.new
and del
options both take a a
list of usernames. The del
option removes each user
specified; the new
option creates
FileSystemUser
s and FileSystemSigner
s for each
username specified.new
option, the UserTool creates a
public key file called identity.username
and a private
key file called signer.username
. After
generating identity.username
, the add
option may be used to update the user database.add
argument takes a list of files. Each file
should consist of a serialized a FileSystemUser
.list
option takes no other arguments.