mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 13:05:22 +02:00
[212382] additional "initCommands" slot for ftpListingParsers extension point
This commit is contained in:
parent
14af215d50
commit
1097961ed2
5 changed files with 44 additions and 6 deletions
|
@ -71,6 +71,7 @@
|
||||||
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
|
* 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
|
* 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
|
* 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;
|
package org.eclipse.rse.internal.services.files.ftp;
|
||||||
|
@ -90,6 +91,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.apache.commons.net.ftp.FTP;
|
import org.apache.commons.net.ftp.FTP;
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
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 Map _fCachePreviousFiles = new HashMap();
|
||||||
private static long FTP_STATCACHE_TIMEOUT = 200; //msec
|
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 static class FTPBufferedInputStream extends BufferedInputStream {
|
||||||
|
|
||||||
|
@ -426,6 +429,20 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
|
||||||
_ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
_ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
|
||||||
_isBinaryFileType = true;
|
_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();
|
_userHome = _ftpClient.printWorkingDirectory();
|
||||||
|
|
||||||
//For VMS, normalize the home location
|
//For VMS, normalize the home location
|
||||||
|
|
|
@ -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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Javier Montalvo Orus (Symbian) - initial API and implementation
|
* 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;
|
package org.eclipse.rse.internal.services.files.ftp.parser;
|
||||||
|
@ -27,6 +28,7 @@ public interface IFTPClientConfigProxy {
|
||||||
public String getServerLanguageCode();
|
public String getServerLanguageCode();
|
||||||
public String getShortMonthNames();
|
public String getShortMonthNames();
|
||||||
public String getServerTimeZoneId();
|
public String getServerTimeZoneId();
|
||||||
|
public String getInitialCommands();
|
||||||
|
|
||||||
public FTPClientConfig getFTPClientConfig();
|
public FTPClientConfig getFTPClientConfig();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ allowing the user to select them overriding the default parser.
|
||||||
The string attributes <code>defaultDateFormatStr</code> <code>recentDateFormatStr</code>
|
The string attributes <code>defaultDateFormatStr</code> <code>recentDateFormatStr</code>
|
||||||
<code>serverLanguageCode</code> <code>serverTimeZoneId</code> <code>shortMonthNames</code> have to
|
<code>serverLanguageCode</code> <code>serverTimeZoneId</code> <code>shortMonthNames</code> have to
|
||||||
follow the format described by <code>org.apache.commons.net.ftp.FTPClientConfig</code>
|
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>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
|
|
||||||
|
@ -162,6 +163,13 @@ If no priority is specified, the default value will be <code>Integer.MAX_V
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</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 '|'
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
|
@ -238,7 +246,7 @@ If no priority is specified, the default value will be <code>Integer.MAX_V
|
||||||
<meta.section type="copyright"/>
|
<meta.section type="copyright"/>
|
||||||
</appInfo>
|
</appInfo>
|
||||||
<documentation>
|
<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
|
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
|
of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
available at http://www.eclipse.org/legal/epl-v10.html
|
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:
|
Contributors:
|
||||||
Javier Montalvo Orus (Symbian) - initial API and implementation
|
Javier Montalvo Orus (Symbian) - initial API and implementation
|
||||||
Javier Montalvo Orus (Symbian) - added ftpSystemTypes and priority
|
Javier Montalvo Orus (Symbian) - added ftpSystemTypes and priority
|
||||||
|
Javier Montalvo Orus (Symbian) - [212382] additional "initCommands" slot for ftpListingParsers extension point
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
|
|
||||||
|
|
|
@ -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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Javier Montalvo Orus (Symbian) - initial API and implementation
|
* Javier Montalvo Orus (Symbian) - initial API and implementation
|
||||||
* Javier Montalvo Orus (Symbian) - improved autodetection of FTPListingParser
|
* 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;
|
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 serverLanguageCode = ce[i].getAttribute("serverLanguageCode"); //$NON-NLS-1$
|
||||||
String shortMonthNames = ce[i].getAttribute("shortMonthNames"); //$NON-NLS-1$
|
String shortMonthNames = ce[i].getAttribute("shortMonthNames"); //$NON-NLS-1$
|
||||||
String serverTimeZoneId = ce[i].getAttribute("serverTimeZoneId"); //$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,
|
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);
|
ftpConfigProxyById.put(id, ftpClientConfigProxy);
|
||||||
|
|
||||||
|
|
|
@ -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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Javier Montalvo Orus (Symbian) - initial API and implementation
|
* Javier Montalvo Orus (Symbian) - initial API and implementation
|
||||||
* Javier Montalvo Orus (Symbian) - improved autodetection of FTPListingParser
|
* 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;
|
package org.eclipse.rse.internal.subsystems.files.ftp.parser;
|
||||||
|
@ -30,11 +31,12 @@ public class FTPClientConfigProxy implements IFTPClientConfigProxy{
|
||||||
private String serverLanguageCode;
|
private String serverLanguageCode;
|
||||||
private String shortMonthNames;
|
private String shortMonthNames;
|
||||||
private String serverTimeZoneId;
|
private String serverTimeZoneId;
|
||||||
|
private String initialCommands;
|
||||||
|
|
||||||
private FTPClientConfig ftpClientConfig;
|
private FTPClientConfig ftpClientConfig;
|
||||||
|
|
||||||
public FTPClientConfigProxy(String id, String label, String priority, String systemTypeRegex, String className, Bundle declaringBundle, String listCommandModifiers,
|
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.id = id;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
|
@ -55,6 +57,8 @@ public class FTPClientConfigProxy implements IFTPClientConfigProxy{
|
||||||
this.shortMonthNames = shortMonthNames;
|
this.shortMonthNames = shortMonthNames;
|
||||||
this.serverTimeZoneId = serverTimeZoneId;
|
this.serverTimeZoneId = serverTimeZoneId;
|
||||||
|
|
||||||
|
this.initialCommands = initialCommands;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -109,6 +113,10 @@ public class FTPClientConfigProxy implements IFTPClientConfigProxy{
|
||||||
return ftpClientConfig;
|
return ftpClientConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getInitialCommands() {
|
||||||
|
return initialCommands;
|
||||||
|
}
|
||||||
|
|
||||||
public void setFTPClientConfig(FTPClientConfig ftpClientConfig) {
|
public void setFTPClientConfig(FTPClientConfig ftpClientConfig) {
|
||||||
this.ftpClientConfig=ftpClientConfig;
|
this.ftpClientConfig=ftpClientConfig;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue