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 7036ce01a35..d27c5612c60 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
@@ -71,6 +71,7 @@
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
* Martin Oberhuber (Wind River) - [216351] Improve cancellation of SystemFetchOperation for files
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
+ * Javier Montalvo Orus (Symbian) - [212382] additional "initCommands" slot for ftpListingParsers extension point
********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp;
@@ -90,6 +91,7 @@ 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;
@@ -153,6 +155,7 @@ 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 {
@@ -426,6 +429,20 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
_ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
_isBinaryFileType = true;
+ //Initial commands
+ 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);
+ }
+ }
+
_userHome = _ftpClient.printWorkingDirectory();
//For VMS, normalize the home location
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 aca83921b97..bef0b5b8bae 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
@@ -1,11 +1,12 @@
/********************************************************************************
- * Copyright (c) 2007 Symbian Software Ltd. All rights reserved.
+ * Copyright (c) 2007, 2008 Symbian Software Ltd. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Javier Montalvo Orus (Symbian) - initial API and implementation
+ * Javier Montalvo Orus (Symbian) - [212382] additional "initCommands" slot for ftpListingParsers extension point
********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp.parser;
@@ -27,6 +28,7 @@ public interface IFTPClientConfigProxy {
public String getServerLanguageCode();
public String getShortMonthNames();
public String getServerTimeZoneId();
+ 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 cc81de685e9..06a876a80b2 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
@@ -14,6 +14,7 @@ allowing the user to select them overriding the default parser.
The string attributes <code>defaultDateFormatStr</code> <code>recentDateFormatStr</code>
<code>serverLanguageCode</code> <code>serverTimeZoneId</code> <code>shortMonthNames</code> have to
follow the format described by <code>org.apache.commons.net.ftp.FTPClientConfig</code>
+ Each parser can also specify one or more FTP commands to be sent after establishing the connection in the <code>initCommands</code> attribute.
@@ -162,6 +163,13 @@ If no priority is specified, the default value will be <code>Integer.MAX_V
+
+
+
+ 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 '|'
+
+
+
@@ -238,7 +246,7 @@ If no priority is specified, the default value will be <code>Integer.MAX_V
- Copyright (c) 2007 Symbian Software Ltd. and others. All rights reserved.
+ Copyright (c) 2007, 2008 Symbian Software Ltd. and others. All rights reserved.
This program and the accompanying materials are made available under the terms
of the Eclipse Public License v1.0 which accompanies this distribution, and is
available at http://www.eclipse.org/legal/epl-v10.html
@@ -246,6 +254,7 @@ available at http://www.eclipse.org/legal/epl-v10.html
Contributors:
Javier Montalvo Orus (Symbian) - initial API and implementation
Javier Montalvo Orus (Symbian) - added ftpSystemTypes and priority
+ Javier Montalvo Orus (Symbian) - [212382] additional "initCommands" slot for ftpListingParsers extension point
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 018e5eafe57..eb9b62e7c55 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
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2007 Symbian Software Ltd. All rights reserved.
+ * Copyright (c) 2007, 2008 Symbian Software Ltd. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -7,6 +7,7 @@
* Contributors:
* Javier Montalvo Orus (Symbian) - initial API and implementation
* Javier Montalvo Orus (Symbian) - improved autodetection of FTPListingParser
+ * Javier Montalvo Orus (Symbian) - [212382] additional "initCommands" slot for ftpListingParsers extension point
********************************************************************************/
package org.eclipse.rse.internal.subsystems.files.ftp.parser;
@@ -68,9 +69,10 @@ 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$
FTPClientConfigProxy ftpClientConfigProxy = new FTPClientConfigProxy(id,label,priority,systemTypeRegex,className,declaringBundle,listCommandModifiers,
- defaultDateFormatStr,recentDateFormatStr,serverLanguageCode,shortMonthNames,serverTimeZoneId);
+ defaultDateFormatStr,recentDateFormatStr,serverLanguageCode,shortMonthNames,serverTimeZoneId, initialCommands);
ftpConfigProxyById.put(id, ftpClientConfigProxy);
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 b7128ca9a48..0a69bc0d5d2 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
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2007 Symbian Software Ltd. All rights reserved.
+ * Copyright (c) 2007, 2008 Symbian Software Ltd. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -7,6 +7,7 @@
* Contributors:
* Javier Montalvo Orus (Symbian) - initial API and implementation
* Javier Montalvo Orus (Symbian) - improved autodetection of FTPListingParser
+ * Javier Montalvo Orus (Symbian) - [212382] additional "initCommands" slot for ftpListingParsers extension point
********************************************************************************/
package org.eclipse.rse.internal.subsystems.files.ftp.parser;
@@ -30,11 +31,12 @@ public class FTPClientConfigProxy implements IFTPClientConfigProxy{
private String serverLanguageCode;
private String shortMonthNames;
private String serverTimeZoneId;
+ 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 defaultDateFormatStr, String recentDateFormatStr, String serverLanguageCode, String shortMonthNames, String serverTimeZoneId, String initialCommands)
{
this.id = id;
this.label = label;
@@ -55,6 +57,8 @@ public class FTPClientConfigProxy implements IFTPClientConfigProxy{
this.shortMonthNames = shortMonthNames;
this.serverTimeZoneId = serverTimeZoneId;
+ this.initialCommands = initialCommands;
+
}
public String getId() {
@@ -109,6 +113,10 @@ public class FTPClientConfigProxy implements IFTPClientConfigProxy{
return ftpClientConfig;
}
+ public String getInitialCommands() {
+ return initialCommands;
+ }
+
public void setFTPClientConfig(FTPClientConfig ftpClientConfig) {
this.ftpClientConfig=ftpClientConfig;
}