Bug 162950 - [api][files] IFileService should use IHostFile arguments instead of (String)parentDir, fileName
Summary: [api][files] IFileService should use IHostFile arguments instead of (String)p...
Status: NEW
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: Future   Edit
Assignee: dsdp.tm.rse-inbox CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 221556 195830 218947
  Show dependency tree
 
Reported: 2006-10-31 12:31 EST by Lothar Werzinger CLA
Modified: 2008-03-06 05:31 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lothar Werzinger CLA 2006-10-31 12:31:26 EST
I thgink RSE should not use String parameters for paths and filenames. 
Example: 
http://127.0.0.1:59548/help/topic/org.eclipse.rse.doc.isv/reference/api/org/eclipse/rse/services/files/IFileService.html#copy

Why not use something like IPath. That would condense two arguments into one 
and the user would not have to worry about directory separators in the 
strings etc.
Comment 1 Martin Oberhuber CLA 2006-11-01 04:55:35 EST
Need to look at this after 1.0
Comment 2 Martin Oberhuber CLA 2007-05-10 05:12:10 EDT
The RSE Services Layer is meant to be used also in contexts other than Eclipse, so IPath / Path is probably not the best choice.

Still, I'm not totally against getting rid the "String" arguments since all the path handling is pretty clumsy right now.

Deferring to Future for now.
Comment 3 Martin Oberhuber CLA 2007-08-02 07:15:36 EDT
One problem with passing (String) parentDir, fileName into the IFileService is that some methods require more information about the actual file to be handled:

* Download may want a file size to use in a progress monitor
* setReadOnly might want current file attributes
* mkDir, chDir might want to know if working on a file or directory

The upper RSE layers tyipcally do have that information, because they use getFile() in order to retrieve IHostFile objects and maintain them. These IHostFile objects should be passed back into the service in order to allow for more efficient service implementations.

In FTP, for instance, a small stat cache had to be implemented by bug #198638 in order to avoid unnecessary LIST commands in FTP just for getting file size and similar. That stat cache would be unnecessary if the API were properly set up.

Note that when IHostFile objects are being passed into the service, the service would need to verify it's a proper IHostFile object (e.g. not too old) before using its data without further host query. The actual IHostFile implementation would potentially need to carry a timestamp to know when it was created.