diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java index d27c5612c60..0424ecf9e6a 100644 --- a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java +++ b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java @@ -91,7 +91,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.StringTokenizer; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; @@ -155,8 +154,6 @@ public class FTPService extends AbstractFileService implements IFileService, IFT private Map _fCachePreviousFiles = new HashMap(); private static long FTP_STATCACHE_TIMEOUT = 200; //msec - private static final String FTP_COMMAND_SEPARATOR = "|"; //$NON-NLS-1$ - private static class FTPBufferedInputStream extends BufferedInputStream { private FTPClient client; @@ -430,18 +427,11 @@ public class FTPService extends AbstractFileService implements IFileService, IFT _isBinaryFileType = true; //Initial commands - String initialCommands = _clientConfigProxy.getInitialCommands(); + String[] initialCommands = _clientConfigProxy.getInitialCommands(); - if(initialCommands!=null) - { - StringTokenizer stk = new StringTokenizer(initialCommands,FTP_COMMAND_SEPARATOR); - - while(stk.hasMoreElements()) - { - String command = stk.nextToken(); - _ftpClient.sendCommand(command); - } - } + for (int i = 0; i < initialCommands.length; i++) { + _ftpClient.sendCommand(initialCommands[i]); + } _userHome = _ftpClient.printWorkingDirectory(); diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/parser/IFTPClientConfigProxy.java b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/parser/IFTPClientConfigProxy.java index bef0b5b8bae..4cab9e78da5 100644 --- a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/parser/IFTPClientConfigProxy.java +++ b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/parser/IFTPClientConfigProxy.java @@ -28,7 +28,7 @@ public interface IFTPClientConfigProxy { public String getServerLanguageCode(); public String getShortMonthNames(); public String getServerTimeZoneId(); - public String getInitialCommands(); + public String[] getInitialCommands(); public FTPClientConfig getFTPClientConfig(); diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/schema/ftpListingParsers.exsd b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/schema/ftpListingParsers.exsd index 06a876a80b2..02363c9588b 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/schema/ftpListingParsers.exsd +++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/schema/ftpListingParsers.exsd @@ -1,10 +1,10 @@ - + - + - + Extension point that allows providing extra parsers for the FTP LIST command output. Apache commons net provides some APIs and factories to costumize the parser and this extension @@ -42,9 +42,9 @@ The string attributes <code>defaultDateFormatStr</code> <code> - + - + @@ -52,6 +52,9 @@ The string attributes <code>defaultDateFormatStr</code> <code> + + + @@ -64,9 +67,9 @@ The string attributes <code>defaultDateFormatStr</code> <code> Name that will be displayed in the FTP Settings dialog - + - + @@ -74,9 +77,9 @@ The string attributes <code>defaultDateFormatStr</code> <code> Extension of <code>org.apache.commons.net.ftp.Configurable,org.apache.commons.net.ftp.FTPFileEntryParser</code> implementing the parser for the specific server - + - + @@ -163,10 +166,20 @@ If no priority is specified, the default value will be <code>Integer.MAX_V - + + + + + + + FTP initialization command to perform after connecting to the remote server, when the server's system type is detected to match the current listing parser. + + + + - List of FTP commands to be sent after connecting to the remote server. If more than one command is specified, it has to be separated using the character '|' + Command string to execute @@ -174,18 +187,18 @@ If no priority is specified, the default value will be <code>Integer.MAX_V - + - + RSE 2.0 - + - + <!-- Default UNIX parser provided by Apache commons net package --> <parser @@ -224,27 +237,28 @@ If no priority is specified, the default value will be <code>Integer.MAX_V - + - + The provider of a new FTPEntryParser must implement <samp>org.apache.commons.net.ftp.Configurable</samp> and <samp>org.apache.commons.net.ftp.FTPFileEntryParser</samp> + - + - + Customized VMS and WinNT implementations are supplied in the <code>org.eclipse.rse.subsystems.files.ftp</code> plug-in. - + - + Copyright (c) 2007, 2008 Symbian Software Ltd. and others. All rights reserved. This program and the accompanying materials are made available under the terms diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigFactory.java b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigFactory.java index eb9b62e7c55..8d85a0bbf2a 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigFactory.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigFactory.java @@ -69,7 +69,13 @@ public class FTPClientConfigFactory implements IFTPClientConfigFactory { String serverLanguageCode = ce[i].getAttribute("serverLanguageCode"); //$NON-NLS-1$ String shortMonthNames = ce[i].getAttribute("shortMonthNames"); //$NON-NLS-1$ String serverTimeZoneId = ce[i].getAttribute("serverTimeZoneId"); //$NON-NLS-1$ - String initialCommands = ce[i].getAttribute("initCommands"); //$NON-NLS-1$ + + IConfigurationElement[] initialCommandsSequence = ce[i].getChildren("initCommand"); //$NON-NLS-1$ + String[] initialCommands = new String[initialCommandsSequence.length]; + + for (int j = 0; j < initialCommands.length; j++) { + initialCommands[j] = initialCommandsSequence[j].getAttribute("cmd"); //$NON-NLS-1$ + } FTPClientConfigProxy ftpClientConfigProxy = new FTPClientConfigProxy(id,label,priority,systemTypeRegex,className,declaringBundle,listCommandModifiers, defaultDateFormatStr,recentDateFormatStr,serverLanguageCode,shortMonthNames,serverTimeZoneId, initialCommands); diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigProxy.java b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigProxy.java index 0a69bc0d5d2..1c29948a06b 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigProxy.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigProxy.java @@ -31,12 +31,12 @@ public class FTPClientConfigProxy implements IFTPClientConfigProxy{ private String serverLanguageCode; private String shortMonthNames; private String serverTimeZoneId; - private String initialCommands; + private String[] initialCommands; private FTPClientConfig ftpClientConfig; public FTPClientConfigProxy(String id, String label, String priority, String systemTypeRegex, String className, Bundle declaringBundle, String listCommandModifiers, - String defaultDateFormatStr, String recentDateFormatStr, String serverLanguageCode, String shortMonthNames, String serverTimeZoneId, String initialCommands) + String defaultDateFormatStr, String recentDateFormatStr, String serverLanguageCode, String shortMonthNames, String serverTimeZoneId, String[] initialCommands) { this.id = id; this.label = label; @@ -113,7 +113,7 @@ public class FTPClientConfigProxy implements IFTPClientConfigProxy{ return ftpClientConfig; } - public String getInitialCommands() { + public String[] getInitialCommands() { return initialCommands; }