|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.caucho.vfs.Path
com.caucho.vfs.FilesystemPath
com.caucho.vfs.MergePath
public class MergePath
A merging of several Paths used like a CLASSPATH. When the MergePath is opened for read, the first path in the list which contains the file will be the opened file. When the MergePath is opened for write, the first path in the list is used for the write.
In the following example, "first" has priority over "second".
If test.xml exists in both "first" and "second", the open will
return "first/test.xml".
MergePage merge = new MergePath();
merge.addMergePath(Vfs.lookup("first");
merge.addMergePath(Vfs.lookup("second");
Path path = merge.lookup("test.xml");
ReadStream is = path.openRead();
MergePath corresponds to the "merge:" Vfs schema
Path path = Vfs.lookup("merge:(../custom-foo;foo)");
Field Summary |
---|
Fields inherited from class com.caucho.vfs.FilesystemPath |
---|
_bindRoot, _pathname, _root, _userPath |
Fields inherited from class com.caucho.vfs.Path |
---|
_pathSeparatorChar, _schemeMap, _separatorChar, L |
Constructor Summary | |
---|---|
|
MergePath()
Creates a new merge path. |
protected |
MergePath(MergePath root,
java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String path)
|
|
MergePath(Path... paths)
|
|
MergePath(java.lang.String userPath,
java.lang.String path,
Path... paths)
|
Method Summary | |
---|---|
void |
addClassPath()
Adds the classpath as paths in the MergePath. |
void |
addClassPath(java.lang.ClassLoader loader)
Adds the classpath for the loader as paths in the MergePath. |
void |
addClassPath(java.lang.String classpath)
Adds the classpath for the loader as paths in the MergePath. |
void |
addLocalClassPath()
Adds the classpath as paths in the MergePath. |
void |
addLocalClassPath(java.lang.ClassLoader loader)
Adds the classpath for the loader as paths in the MergePath. |
void |
addMergePath(Path path)
Adds a new path to the end of the merge path. |
void |
addResourceClassPath(java.lang.ClassLoader loader)
Adds the classpath for the loader as paths in the MergePath. |
boolean |
canRead()
Returns true if the best path can be read. |
boolean |
canWrite()
Returns true if the best path can be written to. |
Path |
copy()
|
PersistentDependency |
createDepend()
Creates a dependency. |
protected MergePath |
createMergePath()
|
boolean |
exists()
True if any file matching this path exists. |
Path |
fsWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String path)
Walking down the path just extends the path. |
Path |
getBestPath()
Returns the first matching path. |
long |
getLastModified()
Returns the last modified time of the best path. |
long |
getLength()
Returns the length of the best path. |
java.util.ArrayList<Path> |
getMergePaths()
Return the list of paths searched in the merge path. |
int |
getMode()
Returns equivalent of struct stat.st_mode if appropriate. |
protected java.util.ArrayList<Path> |
getPathList()
|
java.lang.String |
getRelativePath()
Returns the relative path into the merge path. |
java.util.ArrayList<Path> |
getResources()
Returns all the resources matching the path. |
java.util.ArrayList<Path> |
getResources(java.lang.String pathName)
Returns all the resources matching the path. |
java.lang.String |
getScheme()
Returns the scheme of the best path. |
Path |
getWritePath()
Returns the first matching path. |
boolean |
isDirectory()
True if the best path is a directory. |
boolean |
isExecutable()
Tests if the path is marked as executable |
boolean |
isFile()
True if the best path is a file. |
java.lang.String[] |
list()
List the merged directories. |
boolean |
mkdir()
XXX: Probably should mkdir in the first path |
boolean |
mkdirs()
XXX: Probably should mkdir in the first path |
StreamImpl |
openAppendImpl()
Opens the best path for appending. |
RandomAccessStream |
openFileRandomAccess()
Opens the best path for random access. |
StreamImpl |
openReadImpl()
Opens the best path for reading. |
StreamImpl |
openReadWriteImpl()
Opens the best path for reading and writing. |
StreamImpl |
openWriteImpl()
Opens the best path for writing. |
boolean |
remove()
Remove the matching path. |
boolean |
renameTo(Path path)
Renames the path. |
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 |
java.lang.String |
toString()
Returns a name for the path |
Methods inherited from class com.caucho.vfs.FilesystemPath |
---|
bind, createRoot, equals, getFullPath, getParent, getPath, getRoot, getTail, getUserPath, hashCode, init, normalizePath, normalizePath, setUserPath |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MergePath()
public MergePath(java.lang.String userPath, java.lang.String path, Path... paths)
public MergePath(Path... paths)
protected MergePath(MergePath root, java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String path)
path
- canonical pathMethod Detail |
---|
public Path schemeWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String filePath, int offset)
schemeWalk
in class FilesystemPath
userPath
- the user's lookup() pathattributes
- the user's attributesfilePath
- the actual lookup() pathoffset
- offset into filePath
protected MergePath createMergePath()
public void addMergePath(Path path)
path
- the new path to searchpublic void addClassPath()
public void addClassPath(java.lang.ClassLoader loader)
loader
- class loader whose classpath should be used to search.public void addResourceClassPath(java.lang.ClassLoader loader)
loader
- class loader whose classpath should be used to search.public void addLocalClassPath()
public void addLocalClassPath(java.lang.ClassLoader loader)
loader
- class loader whose classpath should be used to search.public void addClassPath(java.lang.String classpath)
classpath
- class loader whose classpath should be used to search.public java.util.ArrayList<Path> getMergePaths()
public Path fsWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String path)
fsWalk
in class FilesystemPath
userPath
- the exact string passed by the user's lookup()attributes
- the user's new attributespath
- the normalized real path
public java.lang.String getScheme()
getScheme
in class Path
public java.lang.String getRelativePath()
getRelativePath
in class Path
public boolean exists()
exists
in class Path
public int getMode()
getMode
in class Path
public boolean isExecutable()
isExecutable
in class Path
public boolean isDirectory()
isDirectory
in class Path
public boolean isFile()
isFile
in class Path
public long getLength()
getLength
in class Path
public long getLastModified()
getLastModified
in class Path
public boolean canRead()
canRead
in class Path
public boolean canWrite()
canWrite
in class Path
public java.util.ArrayList<Path> getResources(java.lang.String pathName)
getResources
in class Path
public java.util.ArrayList<Path> getResources()
getResources
in class Path
public java.lang.String[] list() throws java.io.IOException
list
in class Path
java.io.IOException
public boolean mkdir() throws java.io.IOException
mkdir
in class Path
java.io.IOException
public boolean mkdirs() throws java.io.IOException
mkdirs
in class Path
java.io.IOException
public boolean remove() throws java.io.IOException
remove
in class Path
java.io.IOException
public boolean renameTo(Path path) throws java.io.IOException
renameTo
in class Path
java.io.IOException
public StreamImpl openReadImpl() throws java.io.IOException
openReadImpl
in class Path
java.io.IOException
public StreamImpl openWriteImpl() throws java.io.IOException
openWriteImpl
in class Path
java.io.IOException
public StreamImpl openReadWriteImpl() throws java.io.IOException
openReadWriteImpl
in class Path
java.io.IOException
public StreamImpl openAppendImpl() throws java.io.IOException
openAppendImpl
in class Path
java.io.IOException
public RandomAccessStream openFileRandomAccess() throws java.io.IOException
openFileRandomAccess
in class Path
java.io.IOException
public Path getWritePath()
public PersistentDependency createDepend()
createDepend
in class Path
public Path getBestPath()
protected java.util.ArrayList<Path> getPathList()
public Path copy()
copy
in class Path
public java.lang.String toString()
toString
in class Path
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |