org.metasyntactic.io.filesystem
Class AbstractDirectory

java.lang.Object
  |
  +--org.metasyntactic.io.filesystem.AbstractEntry
        |
        +--org.metasyntactic.io.filesystem.AbstractDirectory
All Implemented Interfaces:
Directory, Entry, TreeConstants

public abstract class AbstractDirectory
extends AbstractEntry
implements Directory, TreeConstants


Field Summary
protected  java.util.Map nameToMount
           
protected  Directory parent
           
 
Fields inherited from interface org.metasyntactic.io.filesystem.Directory
PARENT_DIRECTORY, THIS_DIRECTORY
 
Fields inherited from interface org.metasyntactic.io.filesystem.TreeConstants
TERMINAL, TERMINAL_BLANK, TERMINAL_HORIZONTAL, TERMINAL_UP_AND_RIGHT, TERMINAL_VERTICAL, TERMINAL_VERTICAL_AND_RIGHT, UNICODE, UNICODE_BLANK, UNICODE_HORIZONTAL, UNICODE_UP_AND_RIGHT, UNICODE_VERTICAL, UNICODE_VERTICAL_AND_RIGHT
 
Constructor Summary
AbstractDirectory()
           
 
Method Summary
 boolean addEntry(Entry entry)
          Adds the specified entry to this directory
 boolean containsEntry(Entry entry)
          Returns true if the specified entry is contained within this directory
 Entry getEntry(java.lang.String name)
          Returns the entry in this directory with this name, or null of that entry didn't exist.
 Directory getParent()
          Returns this parent of this Directory.
 java.util.List listEntries(EntryFilter filter)
          Returns an array of all the entries in this Directory satisfying the specified filter
 void mount(FileSystem other, java.lang.String name)
          Mounts the specified FileSystem into this Directory with a name of "name"
 boolean removeEntry(Entry entry)
          Removes the specified entry from this directory
 java.lang.String toString()
           
 FileSystem unMount(java.lang.String name)
          Unmounts the specified FileSystem making it unavailable from this directory
 
Methods inherited from class org.metasyntactic.io.filesystem.AbstractEntry
getPath, isLegal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.metasyntactic.io.filesystem.Directory
getLastModified, listEntries
 
Methods inherited from interface org.metasyntactic.io.filesystem.Entry
delete, equals, getFileSystem, getName, getPath, hashCode
 

Field Detail

parent

protected Directory parent

nameToMount

protected java.util.Map nameToMount
Constructor Detail

AbstractDirectory

public AbstractDirectory()
Method Detail

mount

public void mount(FileSystem other,
                  java.lang.String name)
           throws NoPermissionException
Description copied from interface: Directory
Mounts the specified FileSystem into this Directory with a name of "name"

Specified by:
mount in interface Directory
Throws:
NoPermissionException - when the User is not allowed to mount a FileSystem in this directory

unMount

public FileSystem unMount(java.lang.String name)
                   throws NoPermissionException
Description copied from interface: Directory
Unmounts the specified FileSystem making it unavailable from this directory

Specified by:
unMount in interface Directory
NoPermissionException

getParent

public Directory getParent()
                    throws NoPermissionException
Returns this parent of this Directory. This implementation will traverse to the FileSystem this FileSystem is mounted in if one exists

Specified by:
getParent in interface Entry
NoPermissionException

addEntry

public boolean addEntry(Entry entry)
                 throws NoPermissionException
Description copied from interface: Directory
Adds the specified entry to this directory

Specified by:
addEntry in interface Directory
Returns:
true If and only if the addition was successful
NoPermissionException

removeEntry

public boolean removeEntry(Entry entry)
                    throws NoPermissionException
Description copied from interface: Directory
Removes the specified entry from this directory

Specified by:
removeEntry in interface Directory
NoPermissionException

containsEntry

public boolean containsEntry(Entry entry)
                      throws NoPermissionException
Description copied from interface: Directory
Returns true if the specified entry is contained within this directory

Specified by:
containsEntry in interface Directory
NoPermissionException

getEntry

public Entry getEntry(java.lang.String name)
               throws NoPermissionException
Description copied from interface: Directory
Returns the entry in this directory with this name, or null of that entry didn't exist.

Specified by:
getEntry in interface Directory
Returns:
The entry that this name maps to
NoPermissionException

listEntries

public java.util.List listEntries(EntryFilter filter)
                           throws NoPermissionException
Description copied from interface: Directory
Returns an array of all the entries in this Directory satisfying the specified filter

Specified by:
listEntries in interface Directory
Returns:
An array of Entries representing all the Entries in this directory
Throws:
NoPermissionException - if the user does not have permission to list in this directory

toString

public java.lang.String toString()
Specified by:
toString in interface Entry
Overrides:
toString in class AbstractEntry