You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Paul Smith <Pa...@lawlex.com.au> on 2004/05/23 09:37:51 UTC
[vfs]: FileSystemManage.createFileSystem(FileObject)
Hi Ho,
I just have a simple question. It appears that there is a method:
FileObject FileSystemManage.createFileSystem(FileObject)
Do I interpret this code that if I had a FileObject that was a remote Zip
file, that the returned FileObject would represent a 'directory' of the Zip
contents?
If this is the case I am hoping to add to Chainsaw v2's VFS plugin an
ability to 'mount' a new repository using a particular zip/jar etc. In
Chainsaw terms this would display the zip/jar as a new repository icon in
the tree, and allow you to "browse" the contents of the zip like you would a
directory.
Is that the case? <cross-fingers>true</cross-fingers>
If this is the case, is there some way through the
FileObject/FileSystemManager interfaces whether a particular FileObject is
able to be translated into a virtual FileObject? Given any arbitary
FileObject, how can my code know whether this object could be mounted as a
virtualy file system root.
cheers,
Paul Smith
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [vfs]: FileSystemManage.createFileSystem(FileObject)
Posted by Mario Ivankovits <im...@apache.org>.
Paul Smith wrote:
> <>FileObject FileSystemManage.createFileSystem(FileObject)
> Do I interpret this code that if I had a FileObject that was a remote Zip
> file, that the returned FileObject would represent a 'directory' of
> the Zip
> contents?
yes
> <>Is that the case? <cross-fingers>true</cross-fingers>
yesyes.
> <>If this is the case, is there some way through the
> FileObject/FileSystemManager interfaces whether a particular FileObject is
> able to be translated into a virtual FileObject? Given any arbitary
> FileObject, how can my code know whether this object could be mounted as a
> virtualy file system root.
if (manager.canCreateFileSystem(file))
{
// Use contents of the file
file = manager.createFileSystem(file);
}
If the manager returns true on canCreateFileSystem depends on the
"mime-type-map" entries in providers.xml.
first the java internal methods to determine the mimetype (by filename)
is used and a lookup on mime-type-map is done:
<mime-type-map mimetype="application/zip" scheme="zip"/>
if this fails, vfs tries to find an entry using the extension in the
extension-map
<extension-map extension="jar" scheme="jar"/>
if a scheme is found this file "canCreate-A-FileSystem".
There is a todo from the old authors to implement this more
transparently - i will pick this up as one of the next vfs things i will do.
Maybe a new hasChildren() and then a simple getChildren() might do the job.
However, for now the above if/create should make it too.
-- Mario
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org