You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ra...@apache.org on 2010/09/27 08:52:21 UTC

svn commit: r1001601 - in /synapse/branches/commons-vfs-2-synapse-2.0: ./ core/ core/src/main/java/org/apache/commons/vfs/provider/ core/src/main/java/org/apache/commons/vfs/provider/ftp/ examples/ sandbox/

Author: rajikak
Date: Mon Sep 27 06:52:21 2010
New Revision: 1001601

URL: http://svn.apache.org/viewvc?rev=1001601&view=rev
Log:
Fixed SYNAPSE-626. Fixed the commons-vfs version.

Modified:
    synapse/branches/commons-vfs-2-synapse-2.0/core/pom.xml
    synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java
    synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java
    synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileProvider.java
    synapse/branches/commons-vfs-2-synapse-2.0/examples/pom.xml
    synapse/branches/commons-vfs-2-synapse-2.0/pom.xml
    synapse/branches/commons-vfs-2-synapse-2.0/sandbox/pom.xml

Modified: synapse/branches/commons-vfs-2-synapse-2.0/core/pom.xml
URL: http://svn.apache.org/viewvc/synapse/branches/commons-vfs-2-synapse-2.0/core/pom.xml?rev=1001601&r1=1001600&r2=1001601&view=diff
==============================================================================
--- synapse/branches/commons-vfs-2-synapse-2.0/core/pom.xml (original)
+++ synapse/branches/commons-vfs-2-synapse-2.0/core/pom.xml Mon Sep 27 06:52:21 2010
@@ -26,13 +26,13 @@
   <name>Commons VFS Core</name>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-vfs</artifactId>
-  <version>2.0-SNAPSHOT</version>
+  <version>2.0-21092010</version>
   <description>VFS is a Virtual File System library.</description>
 
   <parent>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-vfs-project</artifactId>
-    <version>2.0-SNAPSHOT</version>
+    <version>2.0-21092010</version>
     <relativePath>../</relativePath>
   </parent>
 

Modified: synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java
URL: http://svn.apache.org/viewvc/synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java?rev=1001601&r1=1001600&r2=1001601&view=diff
==============================================================================
--- synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java (original)
+++ synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java Mon Sep 27 06:52:21 2010
@@ -29,8 +29,7 @@ import org.apache.commons.vfs.VFS;
  * @version $Revision$ $Date$
  */
 public abstract class AbstractFileName
-    implements FileName
-{
+        implements FileName {
 
     private final String scheme;
     private final String absPath;
@@ -47,36 +46,33 @@ public abstract class AbstractFileName
     private int calculatedHashCode;
 
     public AbstractFileName(final String scheme,
-                            final String absPath, FileType type)
-    {
+                            final String absPath, FileType type) {
         this.rootUri = null;
         this.scheme = scheme;
         this.type = type;
-        if (absPath != null && absPath.length() > 0)
-        {
-            if (absPath.length() > 1 && absPath.endsWith("/"))
-            {
-                this.absPath = absPath.substring(0, absPath.length() - 1);
+        String actualPath = absPath;
+        int pos = absPath.indexOf("?");
+        if (pos != -1) {
+            actualPath = absPath.substring(0, pos);
+        }
+        if (actualPath != null && actualPath.length() > 0) {
+            if (actualPath.length() > 1 && actualPath.endsWith("/")) {
+                this.absPath = actualPath.substring(0, actualPath.length() - 1);
+            } else {
+                this.absPath = actualPath;
             }
-            else
-            {
-                this.absPath = absPath;
-            }
-        }
-        else
-        {
+        } else {
             this.absPath = ROOT_PATH;
         }
     }
 
     /**
      * Returns the hashcode for this name.
+     *
      * @return The hashCode.
      */
-    public int hashCode()
-    {
-        if (calculateHashCode)
-        {
+    public int hashCode() {
+        if (calculateHashCode) {
             calculatedHashCode = getRootURI().hashCode() ^ getPath().hashCode();
             calculateHashCode = false;
         }
@@ -85,13 +81,12 @@ public abstract class AbstractFileName
 
     /**
      * Determines if this object is equal to another.
+     *
      * @param obj The object to compare.
      * @return true if equal, false if not.
      */
-    public boolean equals(final Object obj)
-    {
-        if (!(obj instanceof AbstractFileName))
-        {
+    public boolean equals(final Object obj) {
+        if (!(obj instanceof AbstractFileName)) {
             return false;
         }
         final AbstractFileName name = (AbstractFileName) obj;
@@ -104,39 +99,36 @@ public abstract class AbstractFileName
      * @param obj another abstractfilename
      * @return negative number if less than, 0 if equal, postive if greater than.
      */
-    public int compareTo(Object obj)
-    {
+    public int compareTo(Object obj) {
         final AbstractFileName name = (AbstractFileName) obj;
         int ret = getRootURI().compareTo(name.getRootURI());
-        if (ret != 0)
-        {
+        if (ret != 0) {
             return ret;
         }
 
         // return absPath.compareTo(name.absPath);
-        try
-        {
+        try {
             return getPathDecoded().compareTo(name.getPathDecoded());
         }
-        catch (FileSystemException e)
-        {
+        catch (FileSystemException e) {
             throw new RuntimeException(e.getMessage());
         }
     }
 
     /**
      * Returns the URI of the file.
+     *
      * @return the FileName as a URI.
      */
-    public String toString()
-    {
+    public String toString() {
         return getURI();
     }
 
     /**
      * Factory method for creating name instances.
+     *
      * @param absPath The absolute path.
-     * @param type The FileType.
+     * @param type    The FileType.
      * @return The FileName.
      */
     public abstract FileName createName(String absPath, FileType type);
@@ -144,26 +136,23 @@ public abstract class AbstractFileName
     /**
      * Builds the root URI for this file name.  Note that the root URI must not
      * end with a separator character.
-     * @param buffer A StringBuffer to use to construct the URI.
+     *
+     * @param buffer      A StringBuffer to use to construct the URI.
      * @param addPassword true if the password should be added, false otherwise.
      */
     protected abstract void appendRootUri(StringBuffer buffer, boolean addPassword);
 
     /**
      * Returns the base name of the file.
+     *
      * @return The base name of the file.
      */
-    public String getBaseName()
-    {
-        if (baseName == null)
-        {
+    public String getBaseName() {
+        if (baseName == null) {
             final int idx = getPath().lastIndexOf(SEPARATOR_CHAR);
-            if (idx == -1)
-            {
+            if (idx == -1) {
                 baseName = getPath();
-            }
-            else
-            {
+            } else {
                 baseName = getPath().substring(idx + 1);
             }
         }
@@ -174,31 +163,28 @@ public abstract class AbstractFileName
     /**
      * Returns the absolute path of the file, relative to the root of the
      * file system that the file belongs to.
+     *
      * @return The path String.
      */
-    public String getPath()
-    {
-        if (VFS.isUriStyle())
-        {
+    public String getPath() {
+        if (VFS.isUriStyle()) {
             return absPath + getUriTrailer();
         }
         return absPath;
     }
 
-    protected String getUriTrailer()
-    {
+    protected String getUriTrailer() {
         return getType().hasChildren() ? "/" : "";
     }
 
     /**
      * Returns the decoded path.
+     *
      * @return The decoded path String.
      * @throws FileSystemException If an error occurs.
      */
-    public String getPathDecoded() throws FileSystemException
-    {
-        if (decodedAbsPath == null)
-        {
+    public String getPathDecoded() throws FileSystemException {
+        if (decodedAbsPath == null) {
             decodedAbsPath = UriParser.decode(getPath());
         }
 
@@ -207,24 +193,19 @@ public abstract class AbstractFileName
 
     /**
      * Returns the name of the parent of the file.
+     *
      * @return the FileName of the parent.
      */
-    public FileName getParent()
-    {
+    public FileName getParent() {
         final String parentPath;
         final int idx = getPath().lastIndexOf(SEPARATOR_CHAR);
-        if (idx == -1 || idx == getPath().length() - 1)
-        {
+        if (idx == -1 || idx == getPath().length() - 1) {
             // No parent
             return null;
-        }
-        else if (idx == 0)
-        {
+        } else if (idx == 0) {
             // Root is the parent
             parentPath = SEPARATOR;
-        }
-        else
-        {
+        } else {
             parentPath = getPath().substring(0, idx);
         }
         return createName(parentPath, FileType.FOLDER);
@@ -232,13 +213,12 @@ public abstract class AbstractFileName
 
     /**
      * find the root of the filesystem.
+     *
      * @return The root FileName.
      */
-    public FileName getRoot()
-    {
+    public FileName getRoot() {
         FileName root = this;
-        while (root.getParent() != null)
-        {
+        while (root.getParent() != null) {
             root = root.getParent();
         }
 
@@ -247,28 +227,26 @@ public abstract class AbstractFileName
 
     /**
      * Returns the URI scheme of this file.
+     *
      * @return The protocol used to access the file.
      */
-    public String getScheme()
-    {
+    public String getScheme() {
         return scheme;
     }
 
     /**
      * Returns the absolute URI of the file.
+     *
      * @return The absolute URI of the file.
      */
-    public String getURI()
-    {
-        if (uri == null)
-        {
+    public String getURI() {
+        if (uri == null) {
             uri = createURI();
         }
         return uri;
     }
 
-    protected String createURI()
-    {
+    protected String createURI() {
         final StringBuffer buffer = new StringBuffer();
         appendRootUri(buffer, true);
         buffer.append(getPath());
@@ -277,12 +255,12 @@ public abstract class AbstractFileName
 
     /**
      * Converts a file name to a relative name, relative to this file name.
+     *
      * @param name The FileName.
      * @return The relative path to the file.
      * @throws FileSystemException if an error occurs.
      */
-    public String getRelativeName(final FileName name) throws FileSystemException
-    {
+    public String getRelativeName(final FileName name) throws FileSystemException {
         final String path = name.getPath();
 
         // Calculate the common prefix
@@ -290,36 +268,28 @@ public abstract class AbstractFileName
         final int pathLen = path.length();
 
         // Deal with root
-        if (basePathLen == 1 && pathLen == 1)
-        {
+        if (basePathLen == 1 && pathLen == 1) {
             return ".";
-        }
-        else if (basePathLen == 1)
-        {
+        } else if (basePathLen == 1) {
             return path.substring(1);
         }
 
         final int maxlen = Math.min(basePathLen, pathLen);
         int pos = 0;
-        for (; pos < maxlen && getPath().charAt(pos) == path.charAt(pos); pos++)
-        {
+        for (; pos < maxlen && getPath().charAt(pos) == path.charAt(pos); pos++) {
         }
 
-        if (pos == basePathLen && pos == pathLen)
-        {
+        if (pos == basePathLen && pos == pathLen) {
             // Same names
             return ".";
-        }
-        else if (pos == basePathLen && pos < pathLen && path.charAt(pos) == SEPARATOR_CHAR)
-        {
+        } else if (pos == basePathLen && pos < pathLen && path.charAt(pos) == SEPARATOR_CHAR) {
             // A descendent of the base path
             return path.substring(pos + 1);
         }
 
         // Strip the common prefix off the path
         final StringBuffer buffer = new StringBuffer();
-        if (pathLen > 1 && (pos < pathLen || getPath().charAt(pos) != SEPARATOR_CHAR))
-        {
+        if (pathLen > 1 && (pos < pathLen || getPath().charAt(pos) != SEPARATOR_CHAR)) {
             // Not a direct ancestor, need to back up
             pos = getPath().lastIndexOf(SEPARATOR_CHAR, pos);
             buffer.append(path.substring(pos));
@@ -329,8 +299,7 @@ public abstract class AbstractFileName
         // prefix
         buffer.insert(0, "..");
         pos = getPath().indexOf(SEPARATOR_CHAR, pos + 1);
-        while (pos != -1)
-        {
+        while (pos != -1) {
             buffer.insert(0, "../");
             pos = getPath().indexOf(SEPARATOR_CHAR, pos + 1);
         }
@@ -340,12 +309,11 @@ public abstract class AbstractFileName
 
     /**
      * Returns the root URI of the file system this file belongs to.
+     *
      * @return The URI of the root.
      */
-    public String getRootURI()
-    {
-        if (rootUri == null)
-        {
+    public String getRootURI() {
+        if (rootUri == null) {
             final StringBuffer buffer = new StringBuffer();
             appendRootUri(buffer, true);
             buffer.append(SEPARATOR_CHAR);
@@ -356,18 +324,16 @@ public abstract class AbstractFileName
 
     /**
      * Returns the depth of this file name, within its file system.
+     *
      * @return The depth of the file name.
      */
-    public int getDepth()
-    {
+    public int getDepth() {
         final int len = getPath().length();
-        if (len == 0 || (len == 1 && getPath().charAt(0) == SEPARATOR_CHAR))
-        {
+        if (len == 0 || (len == 1 && getPath().charAt(0) == SEPARATOR_CHAR)) {
             return 0;
         }
         int depth = 1;
-        for (int pos = 0; pos > -1 && pos < len; depth++)
-        {
+        for (int pos = 0; pos > -1 && pos < len; depth++) {
             pos = getPath().indexOf(SEPARATOR_CHAR, pos + 1);
         }
         return depth;
@@ -375,12 +341,11 @@ public abstract class AbstractFileName
 
     /**
      * Returns the extension of this file name.
+     *
      * @return The file extension.
      */
-    public String getExtension()
-    {
-        if (extension == null)
-        {
+    public String getExtension() {
+        if (extension == null) {
             getBaseName();
             final int pos = baseName.lastIndexOf('.');
             // if ((pos == -1) || (pos == baseName.length() - 1))
@@ -388,13 +353,10 @@ public abstract class AbstractFileName
             // do not treat filenames like
             // .bashrc c:\windows\.java c:\windows\.javaws c:\windows\.jedit c:\windows\.appletviewer
             // as extension
-            if ((pos < 1) || (pos == baseName.length() - 1))
-            {
+            if ((pos < 1) || (pos == baseName.length() - 1)) {
                 // No extension
                 extension = "";
-            }
-            else
-            {
+            } else {
                 extension = baseName.substring(pos + 1).intern();
             }
         }
@@ -403,13 +365,12 @@ public abstract class AbstractFileName
 
     /**
      * Determines if another file name is an ancestor of this file name.
+     *
      * @param ancestor The FileName to check.
      * @return true if the FileName is an ancestor, false otherwise.
      */
-    public boolean isAncestor(final FileName ancestor)
-    {
-        if (!ancestor.getRootURI().equals(getRootURI()))
-        {
+    public boolean isAncestor(final FileName ancestor) {
+        if (!ancestor.getRootURI().equals(getRootURI())) {
             return false;
         }
         return checkName(ancestor.getPath(), getPath(), NameScope.DESCENDENT);
@@ -417,25 +378,24 @@ public abstract class AbstractFileName
 
     /**
      * Determines if another file name is a descendent of this file name.
+     *
      * @param descendent The FileName to check.
      * @return true if the FileName is a descendent, false otherwise.
      */
-    public boolean isDescendent(final FileName descendent)
-    {
+    public boolean isDescendent(final FileName descendent) {
         return isDescendent(descendent, NameScope.DESCENDENT);
     }
 
     /**
      * Determines if another file name is a descendent of this file name.
+     *
      * @param descendent The FileName to check.
-     * @param scope The NameScope.
+     * @param scope      The NameScope.
      * @return true if the FileName is a descendent, false otherwise.
      */
     public boolean isDescendent(final FileName descendent,
-                                final NameScope scope)
-    {
-        if (!descendent.getRootURI().equals(getRootURI()))
-        {
+                                final NameScope scope) {
+        if (!descendent.getRootURI().equals(getRootURI())) {
             return false;
         }
         return checkName(getPath(), descendent.getPath(), scope);
@@ -454,8 +414,7 @@ public abstract class AbstractFileName
      *
      * @return {@link FileType#FOLDER} or {@link FileType#FILE}
      */
-    public FileType getType()
-    {
+    public FileType getType() {
         return type;
     }
 
@@ -465,10 +424,8 @@ public abstract class AbstractFileName
      * @param type {@link FileType#FOLDER} or {@link FileType#FILE}
      * @throws FileSystemException if an error occurs.
      */
-    void setType(FileType type) throws FileSystemException
-    {
-        if (type != FileType.FOLDER && type != FileType.FILE && type != FileType.FILE_OR_FOLDER)
-        {
+    void setType(FileType type) throws FileSystemException {
+        if (type != FileType.FOLDER && type != FileType.FILE && type != FileType.FILE_OR_FOLDER) {
             throw new FileSystemException("vfs.provider/filename-type.error");
         }
 
@@ -479,60 +436,46 @@ public abstract class AbstractFileName
      * Checks whether a path fits in a particular scope of another path.
      *
      * @param basePath An absolute, normalised path.
-     * @param path   An absolute, normalised path.
-     * @param scope The NameScope.
+     * @param path     An absolute, normalised path.
+     * @param scope    The NameScope.
      * @return true if the path fits in the scope, false otherwise.
      */
     public static boolean checkName(final String basePath,
                                     final String path,
-                                    final NameScope scope)
-    {
-        if (scope == NameScope.FILE_SYSTEM)
-        {
+                                    final NameScope scope) {
+        if (scope == NameScope.FILE_SYSTEM) {
             // All good
             return true;
         }
 
-        if (!path.startsWith(basePath))
-        {
+        if (!path.startsWith(basePath)) {
             return false;
         }
 
         int baseLen = basePath.length();
-        if (VFS.isUriStyle())
-        {
+        if (VFS.isUriStyle()) {
             // strip the trailing "/"
             baseLen--;
         }
 
-        if (scope == NameScope.CHILD)
-        {
+        if (scope == NameScope.CHILD) {
             if (path.length() == baseLen
-                || (baseLen > 1 && path.charAt(baseLen) != SEPARATOR_CHAR)
-                || path.indexOf(SEPARATOR_CHAR, baseLen + 1) != -1)
-            {
+                    || (baseLen > 1 && path.charAt(baseLen) != SEPARATOR_CHAR)
+                    || path.indexOf(SEPARATOR_CHAR, baseLen + 1) != -1) {
                 return false;
             }
-        }
-        else if (scope == NameScope.DESCENDENT)
-        {
+        } else if (scope == NameScope.DESCENDENT) {
             if (path.length() == baseLen
-                || (baseLen > 1 && path.charAt(baseLen) != SEPARATOR_CHAR))
-            {
+                    || (baseLen > 1 && path.charAt(baseLen) != SEPARATOR_CHAR)) {
                 return false;
             }
-        }
-        else if (scope == NameScope.DESCENDENT_OR_SELF)
-        {
+        } else if (scope == NameScope.DESCENDENT_OR_SELF) {
             if (baseLen > 1
-                && path.length() > baseLen
-                && path.charAt(baseLen) != SEPARATOR_CHAR)
-            {
+                    && path.length() > baseLen
+                    && path.charAt(baseLen) != SEPARATOR_CHAR) {
                 return false;
             }
-        }
-        else if (scope != NameScope.FILE_SYSTEM)
-        {
+        } else if (scope != NameScope.FILE_SYSTEM) {
             throw new IllegalArgumentException();
         }
 
@@ -541,10 +484,10 @@ public abstract class AbstractFileName
 
     /**
      * returns a "friendly path", this is a path without a password.
+     *
      * @return The "friendly" URI.
      */
-    public String getFriendlyURI()
-    {
+    public String getFriendlyURI() {
         final StringBuffer buffer = new StringBuffer();
         appendRootUri(buffer, false);
         buffer.append(getPath());

Modified: synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java
URL: http://svn.apache.org/viewvc/synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java?rev=1001601&r1=1001600&r2=1001601&view=diff
==============================================================================
--- synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java (original)
+++ synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java Mon Sep 27 06:52:21 2010
@@ -16,26 +16,60 @@
  */
 package org.apache.commons.vfs.provider.ftp;
 
-import org.apache.commons.vfs.provider.FileNameParser;
-import org.apache.commons.vfs.provider.HostFileNameParser;
+import org.apache.commons.vfs.provider.*;
+import org.apache.commons.vfs.FileName;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileType;
+
 
 /**
  * Implementation for ftp. set default port to 21
+ *
  * @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
  */
-public class FtpFileNameParser extends HostFileNameParser
-{
+public class FtpFileNameParser extends HostFileNameParser {
     private static final FtpFileNameParser INSTANCE = new FtpFileNameParser();
 
     private static final int PORT = 21;
 
-    public FtpFileNameParser()
-    {
+    public FtpFileNameParser() {
         super(PORT);
     }
 
-    public static FileNameParser getInstance()
-    {
+    public static FileNameParser getInstance() {
         return INSTANCE;
     }
+
+    public FileName parseUri(final VfsComponentContext context, FileName base, final String fileName)
+            throws FileSystemException {
+        // FTP URIs are generic URIs as per RFC 2396
+        final StringBuffer name = new StringBuffer();
+
+        // Extract the scheme and authority parts
+        final Authority auth = extractToPath(fileName, name);
+
+        // Extract the queuString
+        String queuString = UriParser.extractQueryString(name);
+        if(queuString == null && base instanceof URLFileName){
+            queuString = ((URLFileName) base).getQueryString();
+        }
+
+        // Decode and normalise the file name
+        UriParser.canonicalizePath(name, 0, name.length(), this);
+        UriParser.fixSeparators(name);
+        FileType fileType = UriParser.normalisePath(name);
+        final String path = name.toString();
+
+        return new URLFileName(
+                auth.getScheme(),
+                auth.getHostName(),
+                auth.getPort(),
+                getDefaultPort(),
+                auth.getUserName(),
+                auth.getPassword(),
+                path,
+                fileType,
+                queuString);
+
+    }
 }

Modified: synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileProvider.java
URL: http://svn.apache.org/viewvc/synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileProvider.java?rev=1001601&r1=1001600&r2=1001601&view=diff
==============================================================================
--- synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileProvider.java (original)
+++ synapse/branches/commons-vfs-2-synapse-2.0/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileProvider.java Mon Sep 27 06:52:21 2010
@@ -25,10 +25,12 @@ import org.apache.commons.vfs.FileSystem
 import org.apache.commons.vfs.UserAuthenticationData;
 import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider;
 import org.apache.commons.vfs.provider.GenericFileName;
+import org.apache.commons.vfs.provider.URLFileName;
 
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.StringTokenizer;
 
 /**
  * A provider for FTP file systems.
@@ -37,38 +39,41 @@ import java.util.Collections;
  * @version $Revision$ $Date$
  */
 public class FtpFileProvider
-    extends AbstractOriginatingFileProvider
-{
+        extends AbstractOriginatingFileProvider {
     /**
      * File Entry Parser.
      */
     public static final String ATTR_FILE_ENTRY_PARSER = "FEP";
 
     /**
+     * Passive mode
+     */
+    public static final String PASSIVE_MODE = "vfs.passive";
+
+    /**
      * Authenticator types.
      */
     public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[]
-        {
-            UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD
-        };
+            {
+                    UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD
+            };
 
     static final Collection capabilities = Collections.unmodifiableCollection(Arrays.asList(new Capability[]
-    {
-        Capability.CREATE,
-        Capability.DELETE,
-        Capability.RENAME,
-        Capability.GET_TYPE,
-        Capability.LIST_CHILDREN,
-        Capability.READ_CONTENT,
-        Capability.GET_LAST_MODIFIED,
-        Capability.URI,
-        Capability.WRITE_CONTENT,
-        Capability.APPEND_CONTENT,
-        Capability.RANDOM_ACCESS_READ,
-    }));
+            {
+                    Capability.CREATE,
+                    Capability.DELETE,
+                    Capability.RENAME,
+                    Capability.GET_TYPE,
+                    Capability.LIST_CHILDREN,
+                    Capability.READ_CONTENT,
+                    Capability.GET_LAST_MODIFIED,
+                    Capability.URI,
+                    Capability.WRITE_CONTENT,
+                    Capability.APPEND_CONTENT,
+                    Capability.RANDOM_ACCESS_READ,
+            }));
 
-    public FtpFileProvider()
-    {
+    public FtpFileProvider() {
         super();
         setFileNameParser(FtpFileNameParser.getInstance());
     }
@@ -77,12 +82,29 @@ public class FtpFileProvider
      * Creates the filesystem.
      */
     protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions)
-        throws FileSystemException
-    {
+            throws FileSystemException {
         // Create the file system
-        final GenericFileName rootName = (GenericFileName) name;
+        //final GenericFileName rootName = (GenericFileName) name;
+        final URLFileName rootName = (URLFileName) name;
 
-        FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, fileSystemOptions);
+
+        //FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, fileSystemOptions);
+
+        String queryString = rootName.getQueryString();
+        FileSystemOptions opts = fileSystemOptions;
+        if (opts == null) {
+            opts = new FileSystemOptions();
+        }
+        if (queryString != null) {
+            FtpFileSystemConfigBuilder cfgBuilder = FtpFileSystemConfigBuilder.getInstance();
+            StringTokenizer st = new StringTokenizer(queryString, "?&!=");
+            while (st.hasMoreTokens()) {
+                if (PASSIVE_MODE.equalsIgnoreCase(st.nextToken()) &&
+                        st.hasMoreTokens() && "true".equalsIgnoreCase(st.nextToken())) {
+                    cfgBuilder.setPassiveMode(opts, true);
+                }
+            }
+        }
         /*
         FTPClient ftpClient = FtpClientFactory.createConnection(rootName.getHostName(),
             rootName.getPort(),
@@ -91,17 +113,15 @@ public class FtpFileProvider
             rootName.getPath(),
             fileSystemOptions);
         */
-
+        FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, opts);
         return new FtpFileSystem(rootName, ftpClient, fileSystemOptions);
     }
 
-    public FileSystemConfigBuilder getConfigBuilder()
-    {
+    public FileSystemConfigBuilder getConfigBuilder() {
         return FtpFileSystemConfigBuilder.getInstance();
     }
 
-    public Collection getCapabilities()
-    {
+    public Collection getCapabilities() {
         return capabilities;
     }
 }

Modified: synapse/branches/commons-vfs-2-synapse-2.0/examples/pom.xml
URL: http://svn.apache.org/viewvc/synapse/branches/commons-vfs-2-synapse-2.0/examples/pom.xml?rev=1001601&r1=1001600&r2=1001601&view=diff
==============================================================================
--- synapse/branches/commons-vfs-2-synapse-2.0/examples/pom.xml (original)
+++ synapse/branches/commons-vfs-2-synapse-2.0/examples/pom.xml Mon Sep 27 06:52:21 2010
@@ -25,13 +25,13 @@
   <name>Commons VFS Examples</name>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-vfs-examples</artifactId>
-  <version>2.0-SNAPSHOT</version>
+  <version>2.0-21092010</version>
   <description>VFS is a Virtual File System library - Examples.</description>
 
   <parent>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-vfs-project</artifactId>
-    <version>2.0-SNAPSHOT</version>
+    <version>2.0-21092010</version>
     <relativePath>../</relativePath>
   </parent>
 

Modified: synapse/branches/commons-vfs-2-synapse-2.0/pom.xml
URL: http://svn.apache.org/viewvc/synapse/branches/commons-vfs-2-synapse-2.0/pom.xml?rev=1001601&r1=1001600&r2=1001601&view=diff
==============================================================================
--- synapse/branches/commons-vfs-2-synapse-2.0/pom.xml (original)
+++ synapse/branches/commons-vfs-2-synapse-2.0/pom.xml Mon Sep 27 06:52:21 2010
@@ -32,7 +32,7 @@
   <name>Commons VFS</name>
   <description>VFS is a Virtual File System library.</description>
   <packaging>pom</packaging>
-  <version>2.0-SNAPSHOT</version>
+  <version>2.0-21092010</version>
 
   <url>http://commons.apache.org/vfs/</url>
   <inceptionYear>2002</inceptionYear>

Modified: synapse/branches/commons-vfs-2-synapse-2.0/sandbox/pom.xml
URL: http://svn.apache.org/viewvc/synapse/branches/commons-vfs-2-synapse-2.0/sandbox/pom.xml?rev=1001601&r1=1001600&r2=1001601&view=diff
==============================================================================
--- synapse/branches/commons-vfs-2-synapse-2.0/sandbox/pom.xml (original)
+++ synapse/branches/commons-vfs-2-synapse-2.0/sandbox/pom.xml Mon Sep 27 06:52:21 2010
@@ -26,13 +26,13 @@
   <name>Commons VFS Sandbox</name>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-vfs-sandbox</artifactId>
-  <version>2.0-SNAPSHOT</version>
+  <version>2.0-21092010</version>
   <description>VFS is a Virtual File System library - Sandbox.</description>
 
   <parent>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-vfs-project</artifactId>
-    <version>2.0-SNAPSHOT</version>
+    <version>2.0-21092010</version>
     <relativePath>../</relativePath>
   </parent>