com.caucho.vfs
Class FilesystemPath

java.lang.Object
  extended by com.caucho.vfs.Path
      extended by com.caucho.vfs.FilesystemPath
All Implemented Interfaces:
java.lang.Comparable<Path>
Direct Known Subclasses:
ClasspathPath, FilePath, HmuxPath, HttpPath, JarPath, JarScheme, JndiPath, MemoryPath, MergePath, RemotePath, SpyScheme

public abstract class FilesystemPath
extends Path

Abstract FilesystemPath, the parent of hierarchical Paths like FilePath or HttpPath.


Field Summary
protected  com.caucho.vfs.BindPath _bindRoot
           
protected  java.lang.String _pathname
           
protected  FilesystemPath _root
           
protected  java.lang.String _userPath
           
 
Fields inherited from class com.caucho.vfs.Path
_pathSeparatorChar, _schemeMap, _separatorChar, L
 
Constructor Summary
protected FilesystemPath(FilesystemPath root, java.lang.String userPath, java.lang.String pathname)
          Create a new filesystemPath
 
Method Summary
 void bind(Path context)
          Binds the context to the current path.
 Path createRoot(SchemeMap schemeMap)
          Essentially chroot
 boolean equals(java.lang.Object b)
           
abstract  Path fsWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> newAttributes, java.lang.String newPath)
          Lookup a path relative to the current filesystem's root.
 java.lang.String getFullPath()
          For chrooted filesystems return the real system path.
 Path getParent()
          Return the parent Path
 java.lang.String getPath()
          Returns the path portion of the URL.
 FilesystemPath getRoot()
          Returns the root.
 java.lang.String getTail()
          Returns the last segment of the path.
 java.lang.String getUserPath()
          Return's the application's name for the path, e.g.
 int hashCode()
           
protected static void normalizePath(CharBuffer cb, java.lang.String oldPath, java.lang.String newPath, int offset, char separatorChar)
          Normalizes a filesystemPath path.
protected static java.lang.String normalizePath(java.lang.String oldPath, java.lang.String newPath, int offset, char separatorChar)
          wrapper for the real normalize path routine to use CharBuffer.
 Path schemeWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String filePath, int offset)
          schemeWalk is called by Path for a scheme lookup like file:/tmp/foo
 void setUserPath(java.lang.String path)
          Sets the user path.
 
Methods inherited from class com.caucho.vfs.Path
cacheCopy, canExecute, canRead, canWrite, changeGroup, changeGroup, changeOwner, changeOwner, chmod, clearStatusCache, compareTo, copy, createDepend, createLink, createNewFile, createRoot, createTempFile, escapeURL, exists, getAttribute, getAttributeNames, getBlockCount, getBlockSize, getCache, getCertificates, getContentType, getCrc64, getCreateTime, getDevice, getDeviceId, getDiskSpaceFree, getDiskSpaceTotal, getFileSeparatorChar, getGroup, getHost, getInode, getLastAccessTime, getLastModified, getLastStatusChangeTime, getLength, getMode, getNativePath, getNewlineString, getNumberOfLinks, getObject, getOwner, getPathSeparatorChar, getPort, getQuery, getRelativePath, getResources, getResources, getScheme, getSchemeMap, getSeparatorChar, getURL, getUser, getUserDir, getValue, isBlockDevice, isCharacterDevice, isDirectory, isExecutable, isFIFO, isFile, isHardLink, isLink, isObject, isPathCacheable, isSocket, isSymbolicLink, isWindows, isWindowsInsecure, iterator, list, lookup, lookup, lookup, lookupImpl, lookupNative, lookupNative, lookupRelativeNativePath, mkdir, mkdirs, openAppend, openAppendImpl, openFileRandomAccess, openMemoryMappedFile, openRandomAccess, openRead, openReadImpl, openReadWrite, openReadWrite, openReadWrite, openReadWriteImpl, openWrite, openWriteImpl, putCache, readLink, realPath, remove, removeAll, renameTo, renameTo, scanScheme, setDefaultSchemeMap, setExecutable, setLastModified, setObject, setTestWindows, setValue, toString, truncate, truncate, unbind, writeToStream, writeToStream
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_root

protected FilesystemPath _root

_bindRoot

protected com.caucho.vfs.BindPath _bindRoot

_pathname

protected java.lang.String _pathname

_userPath

protected java.lang.String _userPath
Constructor Detail

FilesystemPath

protected FilesystemPath(FilesystemPath root,
                         java.lang.String userPath,
                         java.lang.String pathname)
Create a new filesystemPath

Parameters:
root - Root of url space
userPath - the user's path
pathname - Canonical path
Method Detail

getParent

public Path getParent()
Return the parent Path

Overrides:
getParent in class Path

schemeWalk

public Path schemeWalk(java.lang.String userPath,
                       java.util.Map<java.lang.String,java.lang.Object> attributes,
                       java.lang.String filePath,
                       int offset)
schemeWalk is called by Path for a scheme lookup like file:/tmp/foo

Specified by:
schemeWalk in class Path
Parameters:
userPath - the user's lookup() path
attributes - the user's attributes
filePath - the actual lookup() path
offset - offset into filePath
Returns:
the found path

fsWalk

public abstract Path fsWalk(java.lang.String userPath,
                            java.util.Map<java.lang.String,java.lang.Object> newAttributes,
                            java.lang.String newPath)
Lookup a path relative to the current filesystem's root. Filesystems will specialize fsWalk.

Parameters:
userPath - the exact string passed by the user's lookup()
newAttributes - the user's new attributes
newPath - the normalized real path
Returns:
the matching path

normalizePath

protected static java.lang.String normalizePath(java.lang.String oldPath,
                                                java.lang.String newPath,
                                                int offset,
                                                char separatorChar)
wrapper for the real normalize path routine to use CharBuffer.

Parameters:
oldPath - The parent Path's path
newPath - The user's new path
offset - Offset into the user path
Returns:
the normalized path

normalizePath

protected static void normalizePath(CharBuffer cb,
                                    java.lang.String oldPath,
                                    java.lang.String newPath,
                                    int offset,
                                    char separatorChar)
Normalizes a filesystemPath path.

Parameters:
cb - charBuffer holding the normalized result
oldPath - the parent path
newPath - the relative path
offset - where in the child path to start

getRoot

public FilesystemPath getRoot()
Returns the root.


getPath

public java.lang.String getPath()
Returns the path portion of the URL.

Specified by:
getPath in class Path

getUserPath

public java.lang.String getUserPath()
Return's the application's name for the path, e.g. for a relative path.

Overrides:
getUserPath in class Path

setUserPath

public void setUserPath(java.lang.String path)
Description copied from class: Path
Sets the user path. Useful for temporary files caching another URL.

Overrides:
setUserPath in class Path

getFullPath

public java.lang.String getFullPath()
For chrooted filesystems return the real system path.

Overrides:
getFullPath in class Path

getTail

public java.lang.String getTail()
Description copied from class: Path
Returns the last segment of the path.

e.g. for http://www.caucho.com/products/index.html, getTail() returns 'index.html'

Overrides:
getTail in class Path

createRoot

public Path createRoot(SchemeMap schemeMap)
Essentially chroot

Overrides:
createRoot in class Path

bind

public void bind(Path context)
Description copied from class: Path
Binds the context to the current path. Later lookups will return the new context instead of the current path. Essentially, this is a software symbolic link.

Overrides:
bind in class Path

hashCode

public int hashCode()
Overrides:
hashCode in class Path

equals

public boolean equals(java.lang.Object b)
Overrides:
equals in class Path