java.io
classes and the com.dalsemi.fs.DSFile
class.
The driver interface has been written such that a variety of systems can be implemented. The developer has the freedom to handle files in whatever way is appropriate for their design. Possibilities include a Network File System (NFS) implementation, a FTP file system where files are written to and read from an FTP server, or an IDE hard drive connected to TINI.
Here are the basics:
/<mountname>/<filename>
.
File objects and streams can be created with this String. For
example,
new File("mnt/test.txt").length()
will return the length of the file "test.txt" that is located on the
mounted file system called "mnt". The string can also be used with
the FileInputStream
, FileOutputStream
, and
RandomAccessFile
classes.
init(String[] args)
method will be called on the driver class
the first time a mount point is accessed from each process.
First, you must implement the com.dalsemi.fs.FileSystemDriver
interface.
This class may use a native library, rely on a server running elsewhere
(like the included example), or any number of other options.
Second, you must make the class (or classes) available to your process. This can be done by placing a copy of the classes in TINI's classpath or by including them in the TINIConvertor step.
Finally, the file system needs to be mounted. You can either call the
com.dalsemi.fs.DSFile.mount(*)
method from inside your application, or
you can use the mount
command in slush. There is also an unmount
method
in the same package and an unmount
slush command.
NOTE: The mount and unmount command are not included in the slush binary, but the source is available in the OptionalSlushCommandsSrc.jar file. See Section 3.2 of this readme for an easy way to add them without rebuilding slush.
To run the example, complete the following steps:
mount
and unmount
commands in slush. To do this, first
extract and compile the source files from the
OptionalSlushCommandsSrc.jar file. Then ftp the class files into the
/tiniext/com/dalsemi/slush/command
directory. Run the following
commands at the slush prompt:
addc com.dalsemi.slush.command.MountCommand mount
addc com.dalsemi.slush.command.UnmountCommand unmount
NetworkFileSystemDriver.java
and NetworkFileSystemHost.java
) using the following commands:
where <TINI1.1b2> is your TINI1.1 installation directory.
javac -bootclasspath <TINI1.1b2>\bin\tiniclasses.jar NetworkFileSystemDriver.java
javac NetworkFileSystemHost.java
NetworkFileSystemDriver.class
file into your tiniext
directory.
where <startDir> is the directory you want visible to your TINI.
java NetworkFileSystemHost <startDir>
where <host ip> is the ip address of the machine where the server is
running.
mount mnt NetworkFileSystemDriver <host ip> 3453
NOTE: The first time you access the mounted directory, there will be a delay while the driver class is dynamically loaded. Subsequent operations should then be faster.