org.millscript.commons.vfs.util
Class ChrootFolder

java.lang.Object
  extended by org.millscript.commons.vfs.util.AbstractChrootEntry
      extended by org.millscript.commons.vfs.util.ChrootFolder
All Implemented Interfaces:
VEntry, VFolder

public class ChrootFolder
extends AbstractChrootEntry
implements VFolder

This class implements a virtual folder for a Unix style chroot volume.


Method Summary
 java.lang.StringBuffer appendRelativePath(java.lang.StringBuffer buffer)
          Appends the relative path to this entry to the specified string buffer.
 java.lang.StringBuffer appendURI(java.lang.StringBuffer buffer)
          Appends the URI of this entry to the specified string buffer.
 VEntry checkVEntry(java.lang.String segment)
          Returns the entry for the child with the specified name, but only if it exists and throws an exception otherwise.
 ChrootFile checkVFile(java.lang.String segment)
          Returns the entry for the child file with the specified name, but only if it exists and throws an exception otherwise.
 ChrootFolder checkVFolder(java.lang.String segment)
          Returns the entry for the child folder with the specified name, but only if it exists and throws an exception otherwise.
 ChrootVolume chroot()
          Returns a new chroot'd volume with this virtual folder as its root.
 boolean exists()
          Tests to see if the entry exits.
 java.lang.String getMIMEType(java.lang.String fileName)
          Returns the MIME type for the specified file name.
 MIMETypeHandler getMIMETypeHandler(java.lang.String type)
          Returns a MIME type handler for the specified type.
 java.lang.String getName()
          Returns the name of this entry in the filesystem.
 VFolder getParent()
          Returns the parent folder for this entry.
 ChrootFile getVFile(java.lang.String segment)
          Returns the entry for the child file with the specified name.
 ChrootFolder getVFolder(java.lang.String segment)
          Returns the entry for the child folder with the specified name.
 ChrootVolume getVolume()
          Returns the volume this entry is located on.
 java.util.List<VEntry> listEntries()
          Returns a list of all the child entries in this folder.
 java.util.List<VFile> listFiles()
          Returns a list of all the child files in this folder.
 java.util.List<VFolder> listFolders()
          Returns a list of all the child folders in this folder.
 VFolder make()
          Makes this folder in the volume.
 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.
 VFolder 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.util.AbstractChrootEntry
appendAbsolutePath, appendAbsolutePathOnVolume, appendRelativePathOnVolume, getAbsolutePath, getAbsolutePathOnVolume, getRelativePath, getRelativePathOnVolume, getURI
 
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.VEntry
appendAbsolutePath, appendAbsolutePathOnVolume, appendRelativePathOnVolume, getAbsolutePath, getAbsolutePathOnVolume, getRelativePath, getRelativePathOnVolume, getURI
 

Method Detail

appendRelativePath

public java.lang.StringBuffer appendRelativePath(java.lang.StringBuffer buffer)
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:
buffer - 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)

appendURI

public 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)

checkVEntry

public VEntry checkVEntry(java.lang.String segment)
Description copied from interface: VFolder
Returns the entry for the child with the specified name, but only if it exists and throws an exception otherwise.

Specified by:
checkVEntry in interface VFolder
Parameters:
segment - the name of the required child
Returns:
the VEntry for the specified child
See Also:
VFolder.checkVEntry(java.lang.String)

checkVFile

public ChrootFile checkVFile(java.lang.String segment)
Description copied from interface: VFolder
Returns the entry for the child file with the specified name, but only if it exists and throws an exception otherwise.

Specified by:
checkVFile in interface VFolder
Parameters:
segment - the name of the required child file
Returns:
the VFile for the specified child file
See Also:
VFolder.checkVFile(java.lang.String)

checkVFolder

public ChrootFolder checkVFolder(java.lang.String segment)
Description copied from interface: VFolder
Returns the entry for the child folder with the specified name, but only if it exists and throws an exception otherwise.

Specified by:
checkVFolder in interface VFolder
Parameters:
segment - the name of the required child folder
Returns:
the VFolder for the specified child
See Also:
VFolder.checkVFolder(java.lang.String)

chroot

public ChrootVolume 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()

exists

public boolean exists()
Description copied from interface: VEntry
Tests to see if the entry exits. This method is specific to the type of entry represented. For instance, if the entry is a file this method will only be true if the entry exists and is a file.

Specified by:
exists in interface VEntry
Returns:
true if this entry exits and false otherwise
See Also:
VEntry.exists()

getMIMEType

public java.lang.String getMIMEType(java.lang.String fileName)
Description copied from interface: VEntry
Returns the MIME type for the specified file name.

Specified by:
getMIMEType in interface VEntry
Parameters:
fileName - the file name to get a MIME type for
Returns:
a String holding the MIME type for the specified file name
See Also:
VEntry.getMIMEType(java.lang.String)

getMIMETypeHandler

public MIMETypeHandler getMIMETypeHandler(java.lang.String type)
Description copied from interface: VEntry
Returns a MIME type handler for the specified type.

Specified by:
getMIMETypeHandler in interface VEntry
Parameters:
type - the MIME type to get a handler for
Returns:
a MIMETypeHandler for the specified type
See Also:
VEntry.getMIMETypeHandler(java.lang.String)

getName

public java.lang.String getName()
Description copied from interface: VEntry
Returns the name of this entry in the filesystem.

Specified by:
getName in interface VEntry
Returns:
this entries name
See Also:
VEntry.getName()

getParent

public VFolder getParent()
Description copied from interface: VEntry
Returns the parent folder for this entry.

Specified by:
getParent in interface VEntry
Returns:
the parent folder for this entry
See Also:
VEntry.getParent()

getVFile

public ChrootFile getVFile(java.lang.String segment)
Description copied from interface: VFolder
Returns the entry for the child file with the specified name.

Specified by:
getVFile in interface VFolder
Parameters:
segment - the name of the required child file
Returns:
the VFile for the specified child file
See Also:
VFolder.getVFile(java.lang.String)

getVFolder

public ChrootFolder getVFolder(java.lang.String segment)
Description copied from interface: VFolder
Returns the entry for the child folder with the specified name.

Specified by:
getVFolder in interface VFolder
Parameters:
segment - the name of the required child folder
Returns:
the VFolder for the specified child
See Also:
VFolder.getVFolder(java.lang.String)

getVolume

public ChrootVolume getVolume()
Description copied from interface: VEntry
Returns the volume this entry is located on.

Specified by:
getVolume in interface VEntry
Returns:
the VVolume for this entry
See Also:
VEntry.getVolume()

listEntries

public java.util.List<VEntry> listEntries()
Description copied from interface: VFolder
Returns a list of all the child entries in this folder.

Specified by:
listEntries in interface VFolder
Returns:
a List of all the child entries in this folder
See Also:
VFolder.listEntries()

listFiles

public java.util.List<VFile> listFiles()
Description copied from interface: VFolder
Returns a list of all the child files in this folder.

Specified by:
listFiles in interface VFolder
Returns:
a List of all the child files in this folder.
See Also:
VFolder.listFiles()

listFolders

public java.util.List<VFolder> listFolders()
Description copied from interface: VFolder
Returns a list of all the child folders in this folder.

Specified by:
listFolders in interface VFolder
Returns:
a List of all the child folders in this folder.
See Also:
VFolder.listFolders()

make

public VFolder make()
Description copied from interface: VFolder
Makes this folder in the volume. This will also make any required parent folders. If this method succeeds you are guaranteed that the folder has been made.

Specified by:
make in interface VFolder
Returns:
this folder if it was successfully made
See Also:
VFolder.make()

make

public 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 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 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 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 VFolder 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:
VEntry.toLocal()

toString

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

toVolume

public 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.