EFS questions [message #306580] |
Wed, 02 August 2006 08:14  |
Eclipse User |
|
|
|
Hi,
I just started experimenting with the new EFS stuff and I have a few
questions. I implemented & registered a filesystem extension, as well as a
FileSystemContributor for my new filesystem, however:
- the import wizard doesn't seem to be aware of the new filesystem (I am
trying to import a project that resides on my custom filesystem)? Is there
another extension I need to implement? I do see the new filesystem in the
new project wizard.
- my custom filesystem is actually a filesystem type (a la FTP) which could
point to several filesystem hierarchies depending on connection settings
used. Is it better to have an IFileSystem singleton that caches defined
connections and dispatches requests based on the ID in the URI, or should I
instantiate a new IFileSystem for each connection? I'd prefer the latter,
but that would require me to dynamically register the new connection as a
filesystem extension; and I don't see any provision in the GUI for letting
the user create a new connection for a given filesystem type?
The alternative is to put the GUI to create new connections, choose a
connection, and browse an FS instance in my
FileSystemContributor.browseFileSystem implementation - is that the expected
approach?
- What is FileSystemContributor.getURI(String) supposed to do? If it is
supposed to map a relative path into an absolute URI how can I figure out
which connection the file came from (e.g. for FTP which host:port to use)?
- same question for FileSystem.getStore(IPath)?
Thanks for your advice!
Franck
|
|
|
Re: EFS questions [message #306598 is a reply to message #306580] |
Wed, 02 August 2006 11:45   |
Eclipse User |
|
|
|
Originally posted by: john.eclipsefaq.org
Franck wrote:
> - the import wizard doesn't seem to be aware of the new filesystem (I am
> trying to import a project that resides on my custom filesystem)? Is there
> another extension I need to implement? I do see the new filesystem in the
> new project wizard.
It is true that the import wizard has no support for EFS. You currently
have to write your own import wizard for your file system type. There
is a bug report for this - please CC yourself on the bug, and
comment/vote on it if it is important to you.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=124530
> - my custom filesystem is actually a filesystem type (a la FTP) which could
> point to several filesystem hierarchies depending on connection settings
> used. Is it better to have an IFileSystem singleton that caches defined
> connections and dispatches requests based on the ID in the URI, or should I
> instantiate a new IFileSystem for each connection? I'd prefer the latter,
> but that would require me to dynamically register the new connection as a
> filesystem extension; and I don't see any provision in the GUI for letting
> the user create a new connection for a given filesystem type?
> The alternative is to put the GUI to create new connections, choose a
> connection, and browse an FS instance in my
> FileSystemContributor.browseFileSystem implementation - is that the expected
> approach?
Your IFileSystem implementation should be a singleton. Storing and
caching connection within that singleton or another related class makes
sense. See the partially completed EFS FTP example for how it is done
there.
> - What is FileSystemContributor.getURI(String) supposed to do? If it is
> supposed to map a relative path into an absolute URI how can I figure out
> which connection the file came from (e.g. for FTP which host:port to use)?
The idea is that the user types some string into the text box in the
wizard. The getURI method is called to convert the user's input into a
URI that is appropriate for your file system. THe idea is to shield the
end user from implementation details such as the URI encoding used by
your file system. For example, a local file system contributor might
convert "d:\foo\bar.txt" to "file:///d:\foo\bar".
>
> - same question for FileSystem.getStore(IPath)?
>
This method is really only intended for file systems that can be
completed expressed as scheme/IPath pair (the local file system, for
example). Many file systems have more elaborate information such as
domain, etc, and files within such file systems cannot be expressed
using IPath (which is just an array of uninterpreted string segments).
If this is the case for you, you can return
EFS.getNullFileSystem().getStore(path);. Clients should only be calling
this method if they know that your file system works that way.
> Thanks for your advice!
> Franck
No problem. Finally, I wanted to point you at this wiki page:
http://wiki.eclipse.org/index.php/EFS
There is not a lot of information there right now, but I am trying to
encourage people working on EFS implementations to use it as a resource
for sharing information - so people can learn from each other's
experiences, etc. Please feel free to add to what's there - you just
need an Eclipse bugzilla account to edit the wiki.
--
|
|
|
|
Re: EFS questions [message #306693 is a reply to message #306668] |
Thu, 03 August 2006 11:34   |
Eclipse User |
|
|
|
Originally posted by: john.eclipsefaq.org
It is hard to predict what kind of information might be needed for a
given file system. Some may have a notion of mount point, while others
may not. To elaborate a bit on my previous response, the "Browse"
button was intended to be the place where a file system contributor
could present arbitrary controls for more complicated file system
connections (CVS for example would want a dialog like the one you see
under File > New > Other > CVS > CVS Repository Location).
FileSystemContributor#browseFileSystem is called when the user clicks
browse, and you can display whatever input dialog you want at that point.
We realized in 3.2 that we didn't have a very good UI integration story
for EFS, but lacked really good examples and use cases to get it into a
polished state. This is an area where we really need to improve in 3.3.
I suggest CCing yourself, and adding comments, suggestions, use cases
such as the one you describe, to this bug report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=134270
John
--
Franck wrote:
> John,
>
> Thanks for your reply.
>
>
>>>- What is FileSystemContributor.getURI(String) supposed to do? If it is
>>>supposed to map a relative path into an absolute URI how can I figure out
>>>which connection the file came from (e.g. for FTP which host:port to
>>>use)?
>>
>>The idea is that the user types some string into the text box in the
>>wizard. The getURI method is called to convert the user's input into a
>>URI that is appropriate for your file system. THe idea is to shield the
>>end user from implementation details such as the URI encoding used by your
>>file system. For example, a local file system contributor might convert
>>"d:\foo\bar.txt" to "file:///d:\foo\bar".
>
>
> Hmmm... but if the file system requires mount point information (e.g.
> host:port for ftp) then the user must provide it in the textbox or the
> method can't figure out the URI.
>
> Wouldn't it make sense to add the concept of "mount point" or "file system
> instance"? File system providers would provide GUI to define a new mount
> point, then the file chooser dialogs would let the user choose not only a
> file system type but also one of mount points defined for that FS, and could
> then browse/enter just a path relative to the mount point. It seems most
> non-local file systems could use something like this?
> This could also provide a unified URI syntax for locations, e.g.
> <scheme>://<mount point ID>/<path> where mount point ID would be a key in a
> registry maintained by the FileSystem implementation in a mount point
> registry.
> I read somewhere there is a plan to provide a DirectoryDialog that would
> work on custom file systems, but I don't see how it is going to work unless
> it is rooted at a particular mount point...
>
>
>>No problem. Finally, I wanted to point you at this wiki page:
>>
>>http://wiki.eclipse.org/index.php/EFS
>>
>
> Good info there, thanks!
>
> Franck
>
>
|
|
|
|
Re: EFS questions [message #306948 is a reply to message #306934] |
Wed, 09 August 2006 14:05  |
Eclipse User |
|
|
|
Originally posted by: john.eclipsefaq.org
Thanks, I have added this. Feel free to add things directly to the
wiki... I'm not always able to keep up with the newsgroup.
--
Franck wrote:
> John,
>
> Thanks for the FAQ at the end of your wiki page, very useful.
> Here is a contribution that you may find useful... took me a couple hours to
> figure out :)
>
> Q: Can I programmatically create a project located on a non-local
> filesystem?
>
> A: Yes, use this sequence:
>
> IProject project =
> ResourcesPlugin.getWorkspace().getRoot().getProject(projectN ame);
> IProjectDescription description =
> workspace.newProjectDescription(projectName);
> description.setLocationURI(projectURI);
> _project.create(description, ...);
>
> wkspcRoot.getProject(projectName) will work as expected for an existing
> non-local project.
>
> Franck
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05240 seconds