org.metasyntactic.io.filesystem
Interface FileSystem

All Known Implementing Classes:
AbstractFileSystem

public interface FileSystem

A File System is a hierarchical setup of Entries. Entries can either hold children (interface Directories), or represent abstract FileSystem entities (such as Files, or Links). All FileSystems are required to contain at least one Directory which represents the Root of the FileSystem.

FileSystems can be mounted within Directories of other FileSystems.

All FileSystem entries are reachable by name of tpye String. This String follows a very simple set of Rules. The root Directory's Name is "/".

Priviliged charaters and their rules:


Field Summary
static java.lang.String ESCAPE
           
static char ESCAPE_CHAR
           
static java.lang.String SEPARATOR
           
static char SEPARATOR_CHAR
           
 
Method Summary
 Entry getEntry(java.lang.String name)
          Returns the entry denoted by this abstract path string.
 Directory getParent()
          Returns the Directory of the FileSystem that this FileSystem is mounted in, or null if this FileSystem is not mounted in another
 Directory getRoot()
          In any given file system there must always be one root from which every FileSystem entry is reachable from.
 void mount(FileSystem other, Directory mountInto, java.lang.String name)
          Mounts the other file system into the specified directroy of this file system and gives it the name "name"
 Directory setParent(Directory dir)
          Sets the directory that this FileSystem is mounted in.
 FileSystem unMount(Directory mountedInto, java.lang.String name)
          Unmounts the FileSystem with hte given name from teh specified directory and returns it
 

Field Detail

SEPARATOR_CHAR

public static final char SEPARATOR_CHAR
See Also:
Constant Field Values

SEPARATOR

public static final java.lang.String SEPARATOR
See Also:
Constant Field Values

ESCAPE_CHAR

public static final char ESCAPE_CHAR
See Also:
Constant Field Values

ESCAPE

public static final java.lang.String ESCAPE
See Also:
Constant Field Values
Method Detail

mount

public void mount(FileSystem other,
                  Directory mountInto,
                  java.lang.String name)
           throws NoPermissionException
Mounts the other file system into the specified directroy of this file system and gives it the name "name"

NoPermissionException

unMount

public FileSystem unMount(Directory mountedInto,
                          java.lang.String name)
                   throws NoPermissionException
Unmounts the FileSystem with hte given name from teh specified directory and returns it

Returns:
The now Unmounted FileSystem
NoPermissionException

getRoot

public Directory getRoot()
In any given file system there must always be one root from which every FileSystem entry is reachable from. In file systems such as Unix this is simply / . However, when mapping something like Windows, a virtual root must be provided. Presumably one that all the Windows drives (a: b: c: etc.) are themselves mounted in.

Returns:
The root directory of this FileSystem

getEntry

public Entry getEntry(java.lang.String name)
               throws NoPermissionException,
                      EntryNotFoundException
Returns the entry denoted by this abstract path string.

NoPermissionException
EntryNotFoundException

getParent

public Directory getParent()
                    throws NoPermissionException
Returns the Directory of the FileSystem that this FileSystem is mounted in, or null if this FileSystem is not mounted in another

NoPermissionException

setParent

public Directory setParent(Directory dir)
                    throws NoPermissionException
Sets the directory that this FileSystem is mounted in. Should only be called by the mounting FileSystem. Returns the old value that getParent() would have returned

NoPermissionException