diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/plugin.xml b/rse/plugins/org.eclipse.rse.services.files.ftp/plugin.xml
deleted file mode 100644
index a34a1a69b91..00000000000
--- a/rse/plugins/org.eclipse.rse.services.files.ftp/plugin.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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 b128435468c..e31a09e2807 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
@@ -62,7 +62,7 @@ import org.apache.commons.net.ftp.FTPReply;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.rse.core.model.IPropertySet;
-import org.eclipse.rse.internal.services.files.ftp.parser.FTPClientConfigFactory;
+import org.eclipse.rse.internal.services.files.ftp.parser.IFTPClientConfigFactory;
import org.eclipse.rse.services.Mutex;
import org.eclipse.rse.services.clientserver.FileTypeMatcher;
import org.eclipse.rse.services.clientserver.IMatcher;
@@ -95,6 +95,8 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
private boolean _isBinaryFileType = true;
private boolean _isPassiveDataConnectionMode = false;
+ private IFTPClientConfigFactory _entryParserFactory;
+
private class FTPBufferedInputStream extends BufferedInputStream {
@@ -224,6 +226,11 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
{
_ftpLoggingOutputStream = ftpLoggingOutputStream;
}
+
+ public void setFTPClientConfigFactory(IFTPClientConfigFactory entryParserFactory)
+ {
+ _entryParserFactory = entryParserFactory;
+ }
public void connect() throws Exception
{
@@ -283,8 +290,10 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
if(!_parser.equalsIgnoreCase("AUTO")) //$NON-NLS-1$
{
- _ftpClient.setParserFactory(FTPClientConfigFactory.getParserFactory());
- _ftpClient.configure(FTPClientConfigFactory.getParserFactory().getFTPClientConfig(_parser));
+
+ _ftpClient.setParserFactory(_entryParserFactory);
+ _ftpClient.configure(_entryParserFactory.getFTPClientConfig(_parser));
+
}
else
{
@@ -299,8 +308,8 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
//FTPClientConfig.SYST_NT = "WINDOWS"
if(systemName.startsWith(FTPClientConfig.SYST_NT))
{
- _ftpClient.setParserFactory(FTPClientConfigFactory.getParserFactory());
- _ftpClient.configure(FTPClientConfigFactory.getParserFactory().getFTPClientConfig("WinNT")); //$NON-NLS-1$
+ _ftpClient.setParserFactory(_entryParserFactory);
+ _ftpClient.configure(_entryParserFactory.getFTPClientConfig("WinNT")); //$NON-NLS-1$
}else
//FTPClientConfig.SYST_MVS = "MVS"
if(systemName.startsWith(FTPClientConfig.SYST_MVS))
@@ -320,8 +329,8 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
//FTPClientConfig.SYST_VMS = "VMS"
if(systemName.startsWith(FTPClientConfig.SYST_VMS))
{
- _ftpClient.setParserFactory(FTPClientConfigFactory.getParserFactory());
- _ftpClient.configure(FTPClientConfigFactory.getParserFactory().getFTPClientConfig("VMS_improved")); //$NON-NLS-1$
+ _ftpClient.setParserFactory(_entryParserFactory);
+ _ftpClient.configure(_entryParserFactory.getFTPClientConfig("VMS")); //$NON-NLS-1$
}else
//Default UNIX-like parsing
//FTPClientConfig.SYST_UNIX = "UNIX"
diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/parser/IFTPClientConfigFactory.java b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/parser/IFTPClientConfigFactory.java
new file mode 100644
index 00000000000..d58720a7bf5
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/parser/IFTPClientConfigFactory.java
@@ -0,0 +1,24 @@
+package org.eclipse.rse.internal.services.files.ftp.parser;
+
+import java.util.Set;
+
+import org.apache.commons.net.ftp.FTPClientConfig;
+import org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory;
+
+
+public interface IFTPClientConfigFactory extends FTPFileEntryParserFactory {
+
+ /**
+ *
+ * @param key name attribute of the extension point to be returned
+ * @return FTPClientConfig instance created from the attributes passed in the extension point
+ */
+ public FTPClientConfig getFTPClientConfig(String key);
+
+ /**
+ * Returns a Set of key names
+ * @return a Set containing the name attribute of the extension points
+ */
+ public Set getKeySet();
+
+}
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/META-INF/MANIFEST.MF
index 57b521d33f4..2c16f1d1d9e 100644
--- a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/META-INF/MANIFEST.MF
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/META-INF/MANIFEST.MF
@@ -9,14 +9,15 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.rse.services,
- org.eclipse.rse.services.files.ftp,
org.eclipse.rse.subsystems.files.core,
org.eclipse.rse.core,
org.eclipse.rse.ui,
- org.eclipse.ui.console
+ org.eclipse.ui.console,
+ org.eclipse.rse.services.files.ftp
Eclipse-LazyStart: true
Export-Package: org.eclipse.rse.internal.subsystems.files.ftp;x-internal:=true,
org.eclipse.rse.internal.subsystems.files.ftp.connectorservice;x-internal:=true,
org.eclipse.rse.internal.subsystems.files.ftp.model;x-internal:=true,
+ org.eclipse.rse.internal.subsystems.files.ftp.parser;x-friends:="org.eclipse.rse.services.files.ftp",
org.eclipse.rse.subsystems.files.ftp
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/plugin.xml b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/plugin.xml
index a0da901b16d..e609fedd313 100644
--- a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/plugin.xml
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/plugin.xml
@@ -15,6 +15,7 @@ Contributors:
Javier Montalvo Orus (Symbian) - add Windows to list of valid FTP systems
Martin Oberhuber (Wind River) - add FTP Only system type
Javier Montalvo Orus (Symbian) - [plan] Improve Discovery and Autodetect in RSE
+Javier Montalvo Orus (Symbian) - Fixing 176216 - [api] FTP sould provide API to allow clients register their own FTPListingParser
-->
@@ -42,5 +43,34 @@ Javier Montalvo Orus (Symbian) - [plan] Improve Discovery and Autodetect in RSE
serviceType="_ftp._tcp">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/schema/ftpFileEntryParser.exsd b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/schema/ftpFileEntryParser.exsd
similarity index 96%
rename from rse/plugins/org.eclipse.rse.services.files.ftp/schema/ftpFileEntryParser.exsd
rename to rse/plugins/org.eclipse.rse.subsystems.files.ftp/schema/ftpFileEntryParser.exsd
index 6cca44b1f52..fbabf00838d 100644
--- a/rse/plugins/org.eclipse.rse.services.files.ftp/schema/ftpFileEntryParser.exsd
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/schema/ftpFileEntryParser.exsd
@@ -1,9 +1,9 @@
-
+
-
+
Extension point that allows providing extra parsers for the FTP LIST command output.
@@ -167,7 +167,7 @@ The string attributes <code>defaultDateFormatStr</code> <code>
- Customized VMS and WinNT implementations are supplied in the <code>org.eclipse.rse.services.files.ftp</code> plug-in.
+ Customized VMS and WinNT implementations are supplied in the <code>org.eclipse.rse.subsystems.files.ftp</code> plug-in.
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/connectorservice/FTPConnectorService.java b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/connectorservice/FTPConnectorService.java
index d76ad052a4d..60883c05baf 100644
--- a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/connectorservice/FTPConnectorService.java
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/connectorservice/FTPConnectorService.java
@@ -31,7 +31,7 @@ import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.PropertyType;
import org.eclipse.rse.core.model.SystemSignonInformation;
import org.eclipse.rse.internal.services.files.ftp.FTPService;
-import org.eclipse.rse.internal.services.files.ftp.parser.FTPClientConfigFactory;
+import org.eclipse.rse.internal.subsystems.files.ftp.parser.FTPClientConfigFactory;
import org.eclipse.rse.internal.subsystems.files.ftp.FTPSubsystemResources;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.ui.subsystems.StandardConnectorService;
@@ -88,6 +88,9 @@ public class FTPConnectorService extends StandardConnectorService
_ftpService.setPortNumber(getPort());
_ftpService.setLoggingStream(getLoggingStream(info.getHostname(),getPort()));
_ftpService.setPropertySet(_propertySet);
+ _ftpService.setFTPClientConfigFactory(FTPClientConfigFactory.getParserFactory());
+
+
_ftpService.connect();
}
diff --git a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/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
similarity index 86%
rename from rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/parser/FTPClientConfigFactory.java
rename to rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/FTPClientConfigFactory.java
index 7ee4f7076e1..1b21a225e16 100644
--- a/rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/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
@@ -8,21 +8,21 @@
* Javier Montalvo Orus (Symbian) - initial API and implementation
********************************************************************************/
-package org.eclipse.rse.internal.services.files.ftp.parser;
+package org.eclipse.rse.internal.subsystems.files.ftp.parser;
import java.util.Hashtable;
import java.util.Set;
import org.apache.commons.net.ftp.FTPClientConfig;
import org.apache.commons.net.ftp.FTPFileEntryParser;
-import org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory;
import org.apache.commons.net.ftp.parser.ParserInitializationException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.rse.internal.services.files.ftp.parser.IFTPClientConfigFactory;
-public class FTPClientConfigFactory implements FTPFileEntryParserFactory {
+public class FTPClientConfigFactory implements IFTPClientConfigFactory {
private static FTPClientConfigFactory factory = null;
@@ -47,7 +47,7 @@ private static FTPClientConfigFactory factory = null;
FTPClientConfig config = null;
- IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.rse.services.files.ftp","ftpFileEntryParser"); //$NON-NLS-1$ //$NON-NLS-2$
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.rse.subsystems.files.ftp","ftpFileEntryParser"); //$NON-NLS-1$ //$NON-NLS-2$
IConfigurationElement[] ce = ep.getConfigurationElements();
for (int i = 0; i < ce.length; i++) {
@@ -86,19 +86,18 @@ private static FTPClientConfigFactory factory = null;
}
}
- /**
- *
- * @param key name attribute of the extension point to be returned
- * @return FTPClientConfig instance created from the attributes passed in the extension point
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.rse.internal.services.files.ftp.parser.IFTPClientConfigFactory#getFTPClientConfig(java.lang.String)
*/
public FTPClientConfig getFTPClientConfig(String key)
{
return (FTPClientConfig)ftpConfig.get(key);
}
- /**
- * Returns a Set of key names
- * @return a Set containing the name attribute of the extension points
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.rse.internal.services.files.ftp.parser.IFTPClientConfigFactory#getKeySet()
*/
public Set getKeySet()
{
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/RSENTFTPEntryParser.java b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/RSENTFTPEntryParser.java
new file mode 100644
index 00000000000..2fbaff89efc
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/RSENTFTPEntryParser.java
@@ -0,0 +1,37 @@
+/********************************************************************************
+ * Copyright (c) 2007 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) - [198272] Classification for executable in WinNT parser
+ * Javier Montalvo Orus (Symbian) - [198635] On Windows servers, only lowercase *.exe files are treated as executable
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.subsystems.files.ftp.parser;
+
+import org.apache.commons.net.ftp.FTPFile;
+import org.apache.commons.net.ftp.parser.NTFTPEntryParser;
+
+public class RSENTFTPEntryParser extends NTFTPEntryParser {
+
+ public FTPFile parseFTPEntry(String entry)
+ {
+ FTPFile f = super.parseFTPEntry(entry);
+
+ if(f != null)
+ {
+ // only USER permission is shown in RSE
+ f.setPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION, true);
+ f.setPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION, true);
+
+ if(f.getName().toLowerCase().endsWith(".exe")) //$NON-NLS-1$
+ {
+ f.setPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION, true);
+ }
+ }
+ return (f);
+ }
+}
diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/RSEVMSFTPEntryParser.java b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/RSEVMSFTPEntryParser.java
new file mode 100644
index 00000000000..98043080a04
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/parser/RSEVMSFTPEntryParser.java
@@ -0,0 +1,65 @@
+/********************************************************************************
+ * Copyright (c) 2007 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
+ ********************************************************************************/
+
+package org.eclipse.rse.internal.subsystems.files.ftp.parser;
+
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.net.ftp.FTPFile;
+import org.apache.commons.net.ftp.parser.VMSFTPEntryParser;
+
+public class RSEVMSFTPEntryParser extends VMSFTPEntryParser {
+
+ private static final Pattern PERMISSIONS_PATTERN= Pattern.compile(".*(\\([a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*\\))"); //$NON-NLS-1$
+
+ public FTPFile parseFTPEntry(String entry)
+ {
+ FTPFile f = super.parseFTPEntry(entry);
+
+ if(f != null)
+ {
+ if (!isVersioning())
+ {
+ if(f.getName().lastIndexOf(".DIR")!=-1) //$NON-NLS-1$
+ {
+ f.setName(f.getName().substring(0, f.getName().lastIndexOf(".DIR"))); //$NON-NLS-1$
+ }
+ }
+
+ Matcher m = PERMISSIONS_PATTERN.matcher(entry.trim());
+
+ if(m.matches())
+ {
+ //Set file permission.
+ //VMS has (SYSTEM,OWNER,GROUP,WORLD) users that can contain
+ //R (read) W (write) E (execute) D (delete)
+
+ StringTokenizer t = new StringTokenizer(m.group(1), ","); //$NON-NLS-1$
+
+ //discard SYSTEM permission
+ t.nextElement();
+
+ //iterate for OWNER GROUP WORLD permissions
+ for (int access = 0; access < 3; access++)
+ {
+ String token = t.nextToken();
+
+ f.setPermission(access, FTPFile.READ_PERMISSION, token.indexOf('R') >= 0);
+ f.setPermission(access, FTPFile.WRITE_PERMISSION, token.indexOf('W') >= 0);
+ f.setPermission(access, FTPFile.EXECUTE_PERMISSION, token.indexOf('E') >= 0);
+ }
+ }
+ }
+
+ return f;
+ }
+}