Bug 147839 - [FTP] eclipse FTP WebDAV plugin does not provide FTP server details (OS type)
Summary: [FTP] eclipse FTP WebDAV plugin does not provide FTP server details (OS type)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.3 M1   Edit
Assignee: Platform Team Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-06-20 05:07 EDT by Ashish Billore CLA
Modified: 2006-09-11 13:17 EDT (History)
0 users

See Also:


Attachments
"SYST_patch.txt" containing the modifications suggested for this Bug. (2.38 KB, patch)
2006-06-20 12:30 EDT, Ashish Billore CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ashish Billore CLA 2006-06-20 05:07:30 EDT
Hello All,
	I am working with Eclipse eclipse-FTP-WebDAV-3.1 plug-in. I wish to know the target FTP server OS (Windows / Unix / Linux) based on this information my utility should auto-format subsequent commands and arguments. 
	FTP protocol specifies command “SYST” for this purpose, which typically responds (for e.g. if FTP server is on Unix) as:
> UNIX Type: L8

I could not find similar functionality in Eclipse FTP plug-in to use. 
While debugging with FTP plug-in source for this problem, observed that plug-in has no support (method) to query this information from the FTP server.

Now, to deal with this short-coming of FTP plug-in, a method could be added to org.eclipse.ftp.IClient.java class, like:

public abstract String getSystemDetails(IProgressMonitor monitor) throws FtpException;

And in the FTP client implementation, this method should return the response for command “SYST”. A sample implementation for this method in org.eclipse.ftp.internal.FTPClient.java class could be:


//------------------------- Get system details --------------//
	/**
	 * Lists the FTP server's platform details.
	 * @param monitor the progress monitor, or null
	 * @return String with return code 215 and system details like Windows / Unix or null if error.
	 */
	
	public String getSystemDetails(IProgressMonitor monitor) throws FtpException {
		monitor = FtpPlugin.monitorFor(monitor);
		monitor.beginTask(null, 100);
		monitor.subTask("system details..."); //$NON-NLS-1$
		String retResponse = null;
		try {
			sendCommand("SYST", null); //$NON-NLS-1$
			monitor.worked(50);
			switch (readResponseSkip100()) {
				case 215: // SYST response ok
					retResponse = responseText;
					break;
				default:
					defaultResponseHandler();
			}
			monitor.worked(50);
		} finally {
			monitor.done();
		}
		return retResponse;
	}

//------------------------- Get system details --------------//


And slight modification to existing method org.eclipse.ftp.internal.FTPClient.handleDataTransferCompletion() should be (case 215 => response code for “SYST” command):

private boolean handleDataTransferCompletion() throws FtpException {
		boolean success = false;
		if (expectDataTransferCompletion) {
			// set the flag to false so the call to readResponseSkip100() will not recurse infinitely
			expectDataTransferCompletion = false;
			switch (readResponseSkip100()) {
				case 226: // closing data connection (file transfer or abort)
				case 250: // requested file action okay, completed
				case 215: // Response of SYST, okey
					success = true;
					break;
				default:
					defaultResponseHandler();
			}
		}
		return success;
	}

Hope to see this enhancement in future release / versions of FTP
and WebDAV plugin.

Best Regards,
Ashish Billore
Comment 1 Michael Valenta CLA 2006-06-20 08:37:09 EDT
We would be happy to add this functionality to the client but would appreciate it if you gave us the change in patch format. To create a patch, you will need to load the ftp plugin from the repository. The instructions to do so are found here:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-vcm-home/plugins/target/target-project-sets/readme.html

After youload the plugin, you can modify it and then choose Team>Create Patch from the context menu. Same the patch to a file and attach it to this bug report. Please reopen the bug as well.
Comment 2 Ashish Billore CLA 2006-06-20 12:30:40 EDT
Created attachment 44925 [details]
"SYST_patch.txt" containing the modifications suggested for this Bug. 

Attaching "SYST_patch.txt" containing the modifications suggested for this Bug.
Comment 3 Ashish Billore CLA 2006-06-20 12:31:49 EDT
Attached "SYST_patch.txt" containing the modifications suggested for this Bug.
Comment 4 Michael Valenta CLA 2006-06-20 13:32:05 EDT
Patch released. Thanks.
Comment 5 Michael Valenta CLA 2006-09-11 13:17:52 EDT
I've added the following copyright to the modified files. Let me know if it should be something different:

Ashish Billore (ashish.billore@gxs.com) - Bug 147839 [FTP] eclipse FTP WebDAV plugin does not provide FTP server details (OS type)