org.millscript.commons.vfs
Class AbstractVFolder<V extends VVolume>

java.lang.Object
  extended by org.millscript.commons.vfs.AbstractVEntry<V>
      extended by org.millscript.commons.vfs.AbstractVFolder<V>
All Implemented Interfaces:
org.millscript.commons.alert.AlertDecorator, VEntry, VFolder
Direct Known Subclasses:
FtpFolder, HttpFolder, LocalFolder, ReadOnlyZipFolder

public abstract class AbstractVFolder<V extends VVolume>
extends AbstractVEntry<V>
implements org.millscript.commons.alert.AlertDecorator, VFolder

This class provides the skeletal implementation of a virtual filesystem folder,


Constructor Summary
AbstractVFolder(V vol, VFolder parent, java.lang.String name)
          Constructs a new virtual filesystem folder with the specified name, parent folder and volume.
 
Method Summary
 java.lang.StringBuffer appendRelativePath(java.lang.StringBuffer buff)
          Appends the relative path to this entry to the specified string buffer.
 java.lang.StringBuffer appendRelativePathOnVolume(java.lang.StringBuffer buff)
          Appends the relative path to this entry, from the root folder of this entries volume, to the specified string buffer.
 java.lang.StringBuffer appendURI(java.lang.StringBuffer buffer)
          Appends the URI of this entry to the specified string buffer.
 VVolume chroot()
          Returns a new chroot'd volume with this virtual folder as its root.
 org.millscript.commons.alert.Alert decorate(org.millscript.commons.alert.Alert alert)
           
 VFolder make(java.lang.String segment)
          Makes the specified folder in the volume, as a child of the current folder.
 VFile resolveAsFile(java.lang.String path)
          Resolves the specified path to a virtual file in this folder.
 VFolder resolveAsFolder(java.lang.String path)
          Resolves the specified path to a virtual folder in this folder.
 VVolume resolveAsVolume(java.lang.String path)
          Resolves the specified path to a new virtual volume, with its root at the specified resolved path.
 LocalFolder toLocal()
          Returns this virtual entry as a local entry, which may simply be this object.
 java.lang.String toString()
           
 VVolume toVolume()
          Returns a new volume with this folder as it's root.
 
Methods inherited from class org.millscript.commons.vfs.AbstractVEntry
appendAbsolutePath, appendAbsolutePathOnVolume, getAbsolutePath, getAbsolutePathOnVolume, getMIMEType, getMIMETypeHandler, getName, getParent, getRelativePath, getRelativePathOnVolume, getURI, getVolume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.millscript.commons.vfs.VFolder
checkVEntry, checkVFile, checkVFolder, getVFile, getVFolder, listEntries, listFiles, listFolders, make
 
Methods inherited from interface org.millscript.commons.vfs.VEntry
appendAbsolutePath, appendAbsolutePathOnVolume, exists, getAbsolutePath, getAbsolutePathOnVolume, getMIMEType, getMIMETypeHandler, getName, getParent, getRelativePath, getRelativePathOnVolume, getURI, getVolume
 

Constructor Detail

AbstractVFolder

public AbstractVFolder(V vol,
                       VFolder parent,
                       java.lang.String name)
Constructs a new virtual filesystem folder with the specified name, parent folder and volume.

Parameters:
vol - the volume this entry is held on
parent - the parent folder for this folder
name - the name of the folder
Method Detail

appendRelativePath

public final java.lang.StringBuffer appendRelativePath(java.lang.StringBuffer buff)
Description copied from interface: VEntry
Appends the relative path to this entry to the specified string buffer. The path will be relative from the root volume.

Specified by:
appendRelativePath in interface VEntry
Parameters:
buff - the string buffer to append the path to
Returns:
the specified StringBuffer with this entries path appended to it
See Also:
VEntry.appendRelativePath(java.lang.StringBuffer)

appendRelativePathOnVolume

public final java.lang.StringBuffer appendRelativePathOnVolume(java.lang.StringBuffer buff)
Description copied from interface: VEntry
Appends the relative path to this entry, from the root folder of this entries volume, to the specified string buffer. The path will be relative from the volume this entry belongs to.

Specified by:
appendRelativePathOnVolume in interface VEntry
Parameters:
buff - the string buffer to append the path to
Returns:
the specified StringBuffer with this entries path appended to it
See Also:
VEntry.appendRelativePathOnVolume(java.lang.StringBuffer)

appendURI

public final java.lang.StringBuffer appendURI(java.lang.StringBuffer buffer)
Description copied from interface: VEntry
Appends the URI of this entry to the specified string buffer.

Specified by:
appendURI in interface VEntry
Parameters:
buffer - the string buffer to append the URI to
Returns:
the specified StringBuffer with this entries URI appended to it
See Also:
VEntry.appendURI(java.lang.StringBuffer)

chroot

public final VVolume chroot()
Description copied from interface: VFolder
Returns a new chroot'd volume with this virtual folder as its root.

Specified by:
chroot in interface VFolder
Returns:
a new ChrootVolume with this folder as its root
See Also:
VFolder.chroot()

decorate

public org.millscript.commons.alert.Alert decorate(org.millscript.commons.alert.Alert alert)
Specified by:
decorate in interface org.millscript.commons.alert.AlertDecorator
See Also:
AlertDecorator.decorate(org.millscript.commons.alert.Alert)

make

public final VFolder make(java.lang.String segment)
Description copied from interface: VFolder
Makes the specified folder in the volume, as a child of the current folder. This method will also make this folder and any required parent folders. If this method succeeds you are guaranteed that the folder has been made.

Specified by:
make in interface VFolder
Parameters:
segment - the name for the new folder
Returns:
the VFolder for the specified folder, if it was successfully made
See Also:
VFolder.make(java.lang.String)

resolveAsFile

public final VFile resolveAsFile(java.lang.String path)
Description copied from interface: VFolder
Resolves the specified path to a virtual file in this folder. The new file may have different parent folders.

Specified by:
resolveAsFile in interface VFolder
Parameters:
path - the path to get a virtual file for
Returns:
a VFile for the specified relative URI
See Also:
VFolder.resolveAsFile(java.lang.String)

resolveAsFolder

public final VFolder resolveAsFolder(java.lang.String path)
Description copied from interface: VFolder
Resolves the specified path to a virtual folder in this folder. The new folder may have different parent folders.

Specified by:
resolveAsFolder in interface VFolder
Parameters:
path - the path to get a virtual folder for
Returns:
a VFile for the specified relative URI
See Also:
VFolder.resolveAsFolder(java.lang.String)

resolveAsVolume

public final VVolume resolveAsVolume(java.lang.String path)
Description copied from interface: VFolder
Resolves the specified path to a new virtual volume, with its root at the specified resolved path. For this to work it must be possible to resolve the specified path as a folder.

Specified by:
resolveAsVolume in interface VFolder
Parameters:
path - the path to get a virtual volume for
Returns:
a VVolume for the specified relative URI
See Also:
VFolder.resolveAsVolume(java.lang.String)

toLocal

public LocalFolder toLocal()
Description copied from interface: VEntry
Returns this virtual entry as a local entry, which may simply be this object. For example if this instance where a remote file accessed over HTTP, this method should cache the file and return a virtual file for that local copy.

Specified by:
toLocal in interface VEntry
Specified by:
toLocal in interface VFolder
Returns:
a VEntry for a local copy of this entry
See Also:
VFolder.toLocal()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

toVolume

public final VVolume toVolume()
Description copied from interface: VFolder
Returns a new volume with this folder as it's root.

Specified by:
toVolume in interface VFolder
Returns:
a new VVolume with this folder as it's root
See Also:
VFolder.toVolume()


Copyright © 2005-2007 Open World Ltd. All Rights Reserved.