1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

[212382] additional "initCommands" slot for ftpListingParsers extension point

This commit is contained in:
Javier Montalvo Orus 2008-03-28 14:45:46 +00:00
parent 14af215d50
commit 1097961ed2
5 changed files with 44 additions and 6 deletions

View file

@ -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

View file

@ -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();

View file

@ -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.
</documentation>
</annotation>
@ -162,6 +163,13 @@ If no priority is specified, the default value will be &lt;code&gt;Integer.MAX_V
</documentation>
</annotation>
</attribute>
<attribute name="initCommands" type="string">
<annotation>
<documentation>
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 &apos;|&apos;
</documentation>
</annotation>
</attribute>
</complexType>
</element>
@ -238,7 +246,7 @@ If no priority is specified, the default value will be &lt;code&gt;Integer.MAX_V
<meta.section type="copyright"/>
</appInfo>
<documentation>
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 &quot;initCommands&quot; slot for ftpListingParsers extension point
</documentation>
</annotation>

View file

@ -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);

View file

@ -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;
}