Bug 212382 - [api][ftp] additional "initCommands" slot for ftpListingParsers extension point
Summary: [api][ftp] additional "initCommands" slot for ftpListingParsers extension point
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Javier Montalvo Orús CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: api, bugday, helpwanted
Depends on:
Blocks: 225821
  Show dependency tree
 
Reported: 2007-12-10 05:35 EST by Martin Oberhuber CLA
Modified: 2009-06-17 14:45 EDT (History)
3 users (show)

See Also:


Attachments
Patch to list initCommands by XML markup (6.83 KB, patch)
2008-03-28 13:30 EDT, Martin Oberhuber CLA
no flags Details | Diff
Patch adding the "site namefmt 1" command for OS/400 (773 bytes, patch)
2008-04-01 08:21 EDT, Martin Oberhuber CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2007-12-10 05:35:07 EST
Some remote FTP system types might require additional commands to be sent for initialization, before RSE can properly communicate with them. For instance, an an AS/400 (System i), the following command is necessary after logon:
  quote site namefmt 1
It supposes to change the file system to IFS, see also 
  http://dev.eclipse.org/mhonarc/lists/dsdp-tm-dev/msg01537.html

In the ftpListingParsers extension point framework, we already have a means to match remote system types against custom extensions for listing parsers. It seems logical to add a new optional slot to this extension point:

  initCommands

which allows users to specify commands like the one above, which need to be issued right after logon to the FTP server (and after the remote system type has been determined).
It should be possible to specify multiple commands to be sent right in the extension.
Comment 1 Martin Oberhuber CLA 2007-12-10 05:36:28 EST
This seems a simple change which would make us a whole lot more flexible. Should plan for it in time for API freeze (M4).
Comment 2 Martin Oberhuber CLA 2008-01-07 10:04:15 EST
Did not make the fix for M4, targeting 3.0M5
Comment 3 Martin Oberhuber CLA 2008-02-12 14:18:23 EST
Retargeting M6.
Anyone in the Community want to step up? Javier is pretty busy currently.
Comment 4 Javier Montalvo Orús CLA 2008-03-27 12:51:09 EDT
Since it would be good to have multiple commands, we could use '|' as a control character to split the "initCommands" string passed through the extension point.
This character is not allowed as a filename in Windows and I expect the same in other OS's as it's used for piping, so it minimises having conflicts when splitting multiple commands.

For example, in case wanting to send the following initial commands:

> PWD
> quote site namefmt 1

The initCommands attribute should contain "PWD|quote site namefmt 1"

Any better suggestion ?
Comment 5 Martin Oberhuber CLA 2008-03-27 12:59:47 EDT
Hm... I first thought I think I'd prefer a ';' character as separator since it is often used as command separator in shellscripts already. But on the other hand, VMS uses it as version selector e.g.
   TYPE [FOO.DIR]MYFILE.TXT;13
so the | might be better after all.

Or, what about doing the command list as XML markup? That would save us from worrying about invalid characters and quoting altogether.

Yet another option would be embedded newlines as command separator.
Comment 6 Javier Montalvo Orús CLA 2008-03-27 13:56:55 EDT
We could use XML syntax, for example:
<command>PWD</command><command>quote site namefmt 1</command>
Comment 7 Martin Oberhuber CLA 2008-03-27 14:56:09 EDT
Seems like the best solution to me. Does PDE provide proper UI tooling for ordered lists in XML, in the plugin.xml editor?
Comment 8 Javier Montalvo Orús CLA 2008-03-28 07:46:56 EDT
(In reply to comment #7)
> Seems like the best solution to me. Does PDE provide proper UI tooling for
> ordered lists in XML, in the plugin.xml editor?
> 

No, it looks like there's no support for string lists in plugin attributes (please correct me if I'm wrong)
Since having XML processed within FTPService seems a bit overkilling, I'd prefer going for the character separated commands.
Comment 9 Javier Montalvo Orús CLA 2008-03-28 10:49:12 EDT
I have committed the modified extension point using '|' as a command separator.
In case a better solution is found, the way of processing the initCommands list  can be changed after M6, since it won't require an API modification.
Comment 10 Martin Oberhuber CLA 2008-03-28 13:30:02 EDT
Created attachment 94018 [details]
Patch to list initCommands by XML markup

I managed to do a list of init commands by XML markup - it was actually really easy with the Extension Point Schema Editor. Right-click > new > Sequence; New Element; Associate Sequence with Element; Right-click > new > Attribute.

I really think that this is better than any artificial character as separator, since the UI tooling can be used and we don't need to worry about quoting.

Can you please add the necessary code to parse the XML markup and pass it into the service.
Comment 11 Martin Oberhuber CLA 2008-03-28 13:31:07 EDT
Reopen to improve initCommand markup handling
Comment 12 Javier Montalvo Orús CLA 2008-03-31 12:31:31 EDT
Yes, much better providing a the initial commands as a sequence.
I'll make the changes so the commands are parsed and passed to the FTP service as an array of String rather than a String with a character separator.
Comment 13 Javier Montalvo Orús CLA 2008-03-31 13:00:41 EDT
Now the initial commands are passed as a sequence in the extension point and the FTP service receives a String[] containing them.
Comment 14 Martin Oberhuber CLA 2008-04-01 08:21:30 EDT
Created attachment 94349 [details]
Patch adding the "site namefmt 1" command for OS/400

Attached patch adds the "quote site namefmt 1" command to our standard OS/400 FTP Parser, as specified in comment 0. I'm committing this fix right away, could anyone test and verify it on an OS/400 machine?
Comment 15 Martin Oberhuber CLA 2008-04-02 10:55:03 EDT
From E-Mail:
I used this driver to connect to one of the iSeries box, and the following is what I got in the console.  It seems the "quote site namefmt 1" command is sent, but not recognized by the system. 

If I tried to use "ftp xxxx.xxx.ibm.com" command in the dos prompt to connect to this system, the command "quote site namefmt 1" executed correctly.  I got message : 250  Now using naming format "1". 

It looks like the "quote" should not be sent when directly talking to the host. I've changed the plugin.xml accordingly, to avoid the "quote". I've committed this change and started a fresh I-build. I20080402-1100 should become available later today, in an hour or so, Xuan could you please verify with that one:

http://download.eclipse.org/dsdp/tm/downloads/drops/I20080402-1100/
Comment 16 Xuan Chen CLA 2008-04-02 12:50:58 EDT
Martin,

I sync up with the cvs, and give it a try again.  This time, it is better.  I could  see the files/folders right under the "/" directory in.

But I could not expand any folders under it.  I got this error:

Folder /home is not readable.  Cannot expand.

But I do have enough authority on the system to access to home and all its sub folders.
Comment 17 Martin Oberhuber CLA 2008-04-02 16:35:19 EDT
Thanks Xuan. What does the FTP Console show?
Comment 18 Xuan Chen CLA 2008-04-04 15:00:23 EDT
If I remembered correctly, I did not see anything extra in the console. I will double check it.
Comment 19 Xuan Chen CLA 2008-04-04 15:07:38 EDT
Just checked, no additional output in the console if I expand the home directory.
Comment 20 Martin Oberhuber CLA 2008-04-04 15:22:44 EDT
Hm, odd. This would mean that the query is not made at all. Guess we'll need to debug that at some point. I filed bug 225821 to track this.