2005/5/10

     
 

acdk::io::FileSystem

artefaktur

ACDK implementation of acdk::io::File is a fassade to a virtual file system.


Content of this chapter:

   Overview
     Implementation Interfaces
     File Naming
   Available FileSystem
     Internal ressources
     ZIP files
     TAR files
     HTTP files
     FTP files
     Simple Remote Filesystem (experimental)
   Configuration of Filesystems



 Overview

ACDK File related classes Java java.io.File In Java the file java.io.File provides access to a File, whereas the file located on the normal operations system file system.
ACDK acdk::io::File In ACDK files addressed with acdk::io::File can also be located in the local ressources of the executable, a file in an archive, like TAR or ZIP files, or can be located on a remote machine accessible via FTP or HTTP.

 Implementation Interfaces

The framework classes Behind of the fassade of the class File following interfaces build the functionality of files:

 File Naming


Virtual file system naming follows two conventions:
  • URLs identify root file systems (like http:// or ftp://)
  • container identifies files, which contains own internal file system like zip or tar archives. Container file systems are identified by a path/file.fileextension@ wheras the significant part is .fileextension@.

File names are addresses The internet introduces the concept of URL's - unified ressource locator. The URL concept describes method of access (ftp, http, email, etc.) and the location.
  • /home/roger/tmp/file.txt is a normal local file
  • /home/roger/tmp/archive.zip is a normal local file too
  • /home/roger/tmp/archive.zip@ is the root directory of the internal file system contained in the archive.zip.
  • .ressource@/com/artefaktur/test/file.dat is a file in the internal ressource file system
  • ftp://ftp.artefaktur.ch/acdk is a directory on the ftp file system located at ftp.artefaktur.ch.
  • .ressouce@/com/artefaktur/archive.zip@dir/file.txt is file in an archive file system, which itself resides in the internal ressource file system.

 Available FileSystem

 Internal ressources

".ressource@com/artefaktur/my/file"
  • ".ressource@" is the file system prefix.
  • "com/artefaktur/my" is the directory
  • "file" is the file name.

 ZIP files

/home/roger/myarchive.zip@mydir/sub/myfile.dat where
  • /home/roger/myarchive.zip is an existent file
  • mydir/sub the directory in the archive
  • the file in the archive. myfile.dat

Please refer to

 TAR files


TAR files are addressed following way: /home/roger/myarchive.tar@mydir/sub/myfile.dat where
  • /home/roger/myarchive.tar is an existent file
  • mydir/sub the directory in the archive
  • the file in the archive. myfile.dat


 HTTP files


HTTP files are identified by a url http://domain.net/path/file.
This file system only supports reading a file. Directory or modification operations are not supported.

 FTP files

The FTP file system is identified by a url ftp://domain.net/path/file_or_dir Not all operations on FTP files are supported.

 Simple Remote Filesystem (experimental)

 The Simple Remote Filesystem is a traditional TCP/IP based remote file system used inhouse to synchronize complete directories.

 Configuration of Filesystems

The implementation of the different file systems are located in dll/shared libraries.

In the configuration (%ACDKHOME/cfg/acdk.cfg by default) these file systems are registered:
Sample:
acdk.io.filesystem.protocol.container.0=.zip@=acdk/vfile/zip/ZipFileSystemFactory
acdk.io.filesystem.protocol.container.1=.ZIP@=acdk/vfile/zip/ZipFileSystemFactory
acdk.io.filesystem.protocol.container.2=.tar@=acdk/vfile/tar/TarFileSystemFactory
acdk.io.filesystem.protocol.container.3=.TAR@=acdk/vfile/zip/TarFileSystemFactory

# filename has to start with the url
acdk.io.filesystem.protocol.url.0=ftp://=acdk/net/ftp/FTPFileSystemFactory
acdk.io.filesystem.protocol.url.1=http://=acdk/net/UrlFileSystemFactory

If a acdk::io::File instance will be created with a matching naming pattern (url or container) the acdk class loader will load the corresponding factory classes.