You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2006/05/16 21:07:47 UTC

svn commit: r407025 [1/2] - in /jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs: ./ impl/ operations/ operations/vcs/ provider/

Author: imario
Date: Tue May 16 12:07:44 2006
New Revision: 407025

URL: http://svn.apache.org/viewcvs?rev=407025&view=rev
Log:
VFS-43: added operations framework (renamed services to operations)

Configureable through e.g. providers.xml you are now able to add special stuff like svn, cvs, thumbnails etc
svn provider already there, just have to check the license stuff

Added:
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperation.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperationProvider.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/DefaultFileOperations.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperation.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperationProvider.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperations.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsAdd.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsCheckout.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsCommit.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsCommitListener.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsDelete.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsLog.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsLogEntry.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsLogEntryHandler.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsModifyListener.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsRevert.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsStatus.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsUpdate.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsUpdateListener.java   (with props)
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/readme.html   (with props)
Modified:
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileSystemManager.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/VFS.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DecoratedFileObject.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/VirtualFileProvider.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/providers.xml
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileObject.java Tue May 16 12:07:44 2006
@@ -18,6 +18,8 @@
 import java.net.URL;
 import java.util.List;
 
+import org.apache.commons.vfs.operations.FileOperations;
+
 /**
  * Represents a file, and is used to access the content and
  * structure of the file.
@@ -323,4 +325,12 @@
 	 * check if someone reads/write to this file
 	 */
 	public boolean isContentOpen();
+
+	
+	// --- OPERATIONS --
+	/**
+	 * @return FileOperations interface that provides access to the operations API.
+	 * @throws FileSystemException
+	 */
+	FileOperations getFileOperations() throws FileSystemException;
 }

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileSystemManager.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileSystemManager.java?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileSystemManager.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/FileSystemManager.java Tue May 16 12:07:44 2006
@@ -21,6 +21,8 @@
 import java.net.URLStreamHandlerFactory;
 import java.util.Collection;
 
+import org.apache.commons.vfs.operations.FileOperationProvider;
+
 /**
  * A FileSystemManager manages a set of file systems.  This interface is
  * used to locate a {@link FileObject} by name from one of those file systems.
@@ -262,4 +264,37 @@
      * @throws FileSystemException if this is not possible
      */
     public FileName resolveURI(String uri) throws FileSystemException;
+
+    // -- OPERATIONS --
+    /**
+     * Adds the specified FileOperationProvider for the specified scheme.
+     * Several FileOperationProvider's might be registered for the same scheme.
+     * For example, for "file" scheme we can register SvnWsOperationProvider and
+     * CvsOperationProvider.
+     *
+     * @param scheme
+     * @param operationProvider
+     * @throws FileSystemException
+     */
+    public void addOperationProvider(final String scheme, final FileOperationProvider operationProvider) throws FileSystemException;
+
+    /**
+     * @see FileSystemManager#addOperationProvider(String, org.apache.commons.vfs.operations.FileOperationProvider)
+     *
+     * @param schemes
+     * @param operationProvider
+     * @throws FileSystemException
+     */
+    public void addOperationProvider(final String[] schemes, final FileOperationProvider operationProvider) throws FileSystemException;
+
+
+    /**
+     * @param scheme the scheme for wich we want to get the list af registered providers.
+     *
+     * @return the registered FileOperationProviders for the specified scheme.
+     * If there were no providers registered for the scheme, it returns null.
+     *
+     * @throws FileSystemException
+     */
+    public FileOperationProvider[] getOperationProviders(final String scheme) throws FileSystemException; 
 }

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties Tue May 16 12:07:44 2006
@@ -96,6 +96,13 @@
 # AbstractFileName
 vfs.provider/filename-type.error=A filename can only be of type FileType.FOLDER or FileType.FILE
 
+# Operations
+vfs.operation/wrong-type.error=Can't lookup operation, wrong type: "{0}"
+vfs.operation/not-found.error=Operation not found, type: "{0}"
+vfs.operation/cant-register.error=Can't register operation, wrong type: "{0}"
+vfs.operation/operation-not-supported.error=Operation "{0}" not supported.
+vfs.operation/operation-provider-already-added.error=Operation provider already added to scheme "{0}"
+
 # RandomAccess
 vfs.provider/random-access-invalid-position.error=Invalid position: "{0}"
 vfs.provider/random-access-open-failed.error=Could not access file "{0}" because it does not exist.

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/VFS.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/VFS.java?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/VFS.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/VFS.java Tue May 16 12:07:44 2006
@@ -36,7 +36,7 @@
     }
 
     /**
-     * Returns the default {@link FileSystemManager} instance.
+     * Returns the default {@link FileSystemManager} instance
      */
     public static synchronized FileSystemManager getManager()
         throws FileSystemException

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DecoratedFileObject.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DecoratedFileObject.java?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DecoratedFileObject.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DecoratedFileObject.java Tue May 16 12:07:44 2006
@@ -26,6 +26,7 @@
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileType;
 import org.apache.commons.vfs.NameScope;
+import org.apache.commons.vfs.operations.FileOperations;
 
 /**
  * Base class to build a fileObject decoration
@@ -186,5 +187,10 @@
 	public String toString()
 	{
 		return decoratedFileObject.toString();
+	}
+
+	public FileOperations getFileOperations() throws FileSystemException
+	{
+		return decoratedFileObject.getFileOperations();
 	}
 }

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java Tue May 16 12:07:44 2006
@@ -15,6 +15,16 @@
  */
 package org.apache.commons.vfs.impl;
 
+import java.io.File;
+import java.net.URLStreamHandler;
+import java.net.URLStreamHandlerFactory;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.vfs.CacheStrategy;
 import org.apache.commons.vfs.FileContentInfoFactory;
@@ -30,6 +40,7 @@
 import org.apache.commons.vfs.NameScope;
 import org.apache.commons.vfs.VFS;
 import org.apache.commons.vfs.cache.SoftRefFilesCache;
+import org.apache.commons.vfs.operations.FileOperationProvider;
 import org.apache.commons.vfs.provider.AbstractFileName;
 import org.apache.commons.vfs.provider.AbstractFileProvider;
 import org.apache.commons.vfs.provider.DefaultURLStreamHandler;
@@ -40,857 +51,975 @@
 import org.apache.commons.vfs.provider.UriParser;
 import org.apache.commons.vfs.provider.VfsComponent;
 
-import java.io.File;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
 /**
  * A default file system manager implementation.
- *
+ * 
  * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2006-03-30 21:16:24 +0200 (Do, 30 Mrz
+ *          2006) $
  */
-public class DefaultFileSystemManager
-    implements FileSystemManager
+public class DefaultFileSystemManager implements FileSystemManager
 {
-    /**
-     * The provider for local files.
-     */
-    private LocalFileProvider localFileProvider;
-
-    /**
-     * The default provider.
-     */
-    private FileProvider defaultProvider;
-
-    /**
-     * The file replicator to use.
-     */
-    private FileReplicator fileReplicator;
-
-    /**
-     * Mapping from URI scheme to FileProvider.
-     */
-    private final Map providers = new HashMap();
-
-    /**
-     * All components used by this manager.
-     */
-    private final ArrayList components = new ArrayList();
-
-    /**
-     * The base file to use for relative URI.
-     */
-    private FileObject baseFile;
-
-    /**
-     * The files cache
-     */
-    private FilesCache filesCache;
-
-    /**
-     * The cache strategy
-     */
-    private CacheStrategy fileCacheStrategy;    
-
-    /**
-     * The class to use to determine the content-type (mime-type)
-     */
-    private FileContentInfoFactory fileContentInfoFactory;
-
-    /**
-     * The logger to use.
-     */
-    private Log log;
-
-    /**
-     * The context to pass to providers.
-     */
-    private final DefaultVfsComponentContext context =
-        new DefaultVfsComponentContext(this);
-
-    private TemporaryFileStore tempFileStore;
-    private final FileTypeMap map = new FileTypeMap();
-    private final VirtualFileProvider vfsProvider = new VirtualFileProvider();
-    private boolean init;
-
-    /**
-     * Returns the logger used by this manager.
-     */
-    protected Log getLogger()
-    {
-        return log;
-    }
-
-    /**
-     * Registers a file system provider.  The manager takes care of all
-     * lifecycle management.  A provider may be registered multiple times.
-     *
-     * @param urlScheme The scheme the provider will handle.
-     * @param provider  The provider.
-     */
-    public void addProvider(final String urlScheme,
-                            final FileProvider provider)
-        throws FileSystemException
-    {
-        addProvider(new String[]{urlScheme}, provider);
-    }
-
-    /**
-     * Registers a file system provider.  The manager takes care of all
-     * lifecycle management.  A provider may be registered multiple times.
-     *
-     * @param urlSchemes The schemes the provider will handle.
-     * @param provider   The provider.
-     */
-    public void addProvider(final String[] urlSchemes,
-                            final FileProvider provider)
-        throws FileSystemException
-    {
-        // Warn about duplicate providers
-        for (int i = 0; i < urlSchemes.length; i++)
-        {
-            final String scheme = urlSchemes[i];
-            if (providers.containsKey(scheme))
-            {
-                throw new FileSystemException("vfs.impl/multiple-providers-for-scheme.error", scheme);
-            }
-        }
-
-        // Contextualise the component (if not already)
-        setupComponent(provider);
-
-        // Add to map
-        for (int i = 0; i < urlSchemes.length; i++)
-        {
-            final String scheme = urlSchemes[i];
-            providers.put(scheme, provider);
-        }
-
-        if (provider instanceof LocalFileProvider)
-        {
-            localFileProvider = (LocalFileProvider) provider;
-        }
-    }
-
-    /**
-     * Returns true if this manager has a provider for a particular scheme.
-     */
-    public boolean hasProvider(final String scheme)
-    {
-        return providers.containsKey(scheme);
-    }
-
-    /**
-     * Adds an filename extension mapping.
-     *
-     * @param extension The file name extension.
-     * @param scheme    The scheme to use for files with this extension.
-     */
-    public void addExtensionMap(final String extension, final String scheme)
-    {
-        map.addExtension(extension, scheme);
-    }
-
-    /**
-     * Adds a mime type mapping.
-     *
-     * @param mimeType The mime type.
-     * @param scheme   The scheme to use for files with this mime type.
-     */
-    public void addMimeTypeMap(final String mimeType, final String scheme)
-    {
-        map.addMimeType(mimeType, scheme);
-    }
-
-    /**
-     * Sets the default provider.  This is the provider that will handle URI
-     * with unknown schemes.  The manager takes care of all lifecycle
-     * management.
-     */
-    public void setDefaultProvider(final FileProvider provider)
-        throws FileSystemException
-    {
-        setupComponent(provider);
-        defaultProvider = provider;
-    }
-
-    /**
-     * Returns the filesCache implementation used to cache files
-     */
-    public FilesCache getFilesCache()
-    {
-        return filesCache;
-    }
-
-    /**
-     * Sets the filesCache implementation used to cache files
-     */
-    public void setFilesCache(final FilesCache filesCache) throws FileSystemException
-    {
-        if (init)
-        {
-            throw new FileSystemException("vfs.impl/already-inited.error");
-        }
-
-        this.filesCache = filesCache;
-    }
-
-    /**
-     * <p>
-     * Set the cache strategy to use when dealing with file object data.
-     * You can set it only once before the FileSystemManager is initialized.
-     * <p />
-     * <p>
-     * The default is {@link CacheStrategy#ON_RESOLVE}
-     * </p>
-     *   
-     * @throws FileSystemException if this is not possible. e.g. it is already set.
-     */
-    public void setCacheStrategy(final CacheStrategy fileCacheStrategy) throws FileSystemException
-    {
-        if (init)
-        {
-            throw new FileSystemException("vfs.impl/already-inited.error");
-        }
-        
-    	this.fileCacheStrategy = fileCacheStrategy;
-    }
-    
-    /**
-     * Get the cache strategy used
-     */
-    public CacheStrategy getCacheStrategy()
+	/**
+	 * The provider for local files.
+	 */
+	private LocalFileProvider localFileProvider;
+
+	/**
+	 * The default provider.
+	 */
+	private FileProvider defaultProvider;
+
+	/**
+	 * The file replicator to use.
+	 */
+	private FileReplicator fileReplicator;
+
+	/**
+	 * Mapping from URI scheme to FileProvider.
+	 */
+	private final Map providers = new HashMap();
+
+	/**
+	 * All components used by this manager.
+	 */
+	private final ArrayList components = new ArrayList();
+
+	/**
+	 * The base file to use for relative URI.
+	 */
+	private FileObject baseFile;
+
+	/**
+	 * The files cache
+	 */
+	private FilesCache filesCache;
+
+	/**
+	 * The cache strategy
+	 */
+	private CacheStrategy fileCacheStrategy;
+
+	/**
+	 * The class to use to determine the content-type (mime-type)
+	 */
+	private FileContentInfoFactory fileContentInfoFactory;
+
+	/**
+	 * The logger to use.
+	 */
+	private Log log;
+
+	/**
+	 * The context to pass to providers.
+	 */
+	private final DefaultVfsComponentContext context = new DefaultVfsComponentContext(
+			this);
+
+	private TemporaryFileStore tempFileStore;
+	private final FileTypeMap map = new FileTypeMap();
+	private final VirtualFileProvider vfsProvider = new VirtualFileProvider();
+	private boolean init;
+
+	/**
+	 * Returns the logger used by this manager.
+	 */
+	protected Log getLogger()
+	{
+		return log;
+	}
+
+	/**
+	 * Registers a file system provider. The manager takes care of all lifecycle
+	 * management. A provider may be registered multiple times.
+	 * 
+	 * @param urlScheme
+	 *            The scheme the provider will handle.
+	 * @param provider
+	 *            The provider.
+	 */
+	public void addProvider(final String urlScheme, final FileProvider provider)
+			throws FileSystemException
+	{
+		addProvider(new String[]
+		{ urlScheme }, provider);
+	}
+
+	/**
+	 * Registers a file system provider. The manager takes care of all lifecycle
+	 * management. A provider may be registered multiple times.
+	 * 
+	 * @param urlSchemes
+	 *            The schemes the provider will handle.
+	 * @param provider
+	 *            The provider.
+	 */
+	public void addProvider(final String[] urlSchemes,
+			final FileProvider provider) throws FileSystemException
+	{
+		// Warn about duplicate providers
+		for (int i = 0; i < urlSchemes.length; i++)
+		{
+			final String scheme = urlSchemes[i];
+			if (providers.containsKey(scheme))
+			{
+				throw new FileSystemException(
+						"vfs.impl/multiple-providers-for-scheme.error", scheme);
+			}
+		}
+
+		// Contextualise the component (if not already)
+		setupComponent(provider);
+
+		// Add to map
+		for (int i = 0; i < urlSchemes.length; i++)
+		{
+			final String scheme = urlSchemes[i];
+			providers.put(scheme, provider);
+		}
+
+		if (provider instanceof LocalFileProvider)
+		{
+			localFileProvider = (LocalFileProvider) provider;
+		}
+	}
+
+	/**
+	 * Returns true if this manager has a provider for a particular scheme.
+	 */
+	public boolean hasProvider(final String scheme)
+	{
+		return providers.containsKey(scheme);
+	}
+
+	/**
+	 * Adds an filename extension mapping.
+	 * 
+	 * @param extension
+	 *            The file name extension.
+	 * @param scheme
+	 *            The scheme to use for files with this extension.
+	 */
+	public void addExtensionMap(final String extension, final String scheme)
+	{
+		map.addExtension(extension, scheme);
+	}
+
+	/**
+	 * Adds a mime type mapping.
+	 * 
+	 * @param mimeType
+	 *            The mime type.
+	 * @param scheme
+	 *            The scheme to use for files with this mime type.
+	 */
+	public void addMimeTypeMap(final String mimeType, final String scheme)
+	{
+		map.addMimeType(mimeType, scheme);
+	}
+
+	/**
+	 * Sets the default provider. This is the provider that will handle URI with
+	 * unknown schemes. The manager takes care of all lifecycle management.
+	 */
+	public void setDefaultProvider(final FileProvider provider)
+			throws FileSystemException
+	{
+		setupComponent(provider);
+		defaultProvider = provider;
+	}
+
+	/**
+	 * Returns the filesCache implementation used to cache files
+	 */
+	public FilesCache getFilesCache()
+	{
+		return filesCache;
+	}
+
+	/**
+	 * Sets the filesCache implementation used to cache files
+	 */
+	public void setFilesCache(final FilesCache filesCache)
+			throws FileSystemException
+	{
+		if (init)
+		{
+			throw new FileSystemException("vfs.impl/already-inited.error");
+		}
+
+		this.filesCache = filesCache;
+	}
+
+	/**
+	 * <p>
+	 * Set the cache strategy to use when dealing with file object data. You can
+	 * set it only once before the FileSystemManager is initialized.
+	 * <p />
+	 * <p>
+	 * The default is {@link CacheStrategy#ON_RESOLVE}
+	 * </p>
+	 * 
+	 * @throws FileSystemException
+	 *             if this is not possible. e.g. it is already set.
+	 */
+	public void setCacheStrategy(final CacheStrategy fileCacheStrategy)
+			throws FileSystemException
+	{
+		if (init)
+		{
+			throw new FileSystemException("vfs.impl/already-inited.error");
+		}
+
+		this.fileCacheStrategy = fileCacheStrategy;
+	}
+
+	/**
+	 * Get the cache strategy used
+	 */
+	public CacheStrategy getCacheStrategy()
 	{
 		return fileCacheStrategy;
 	}
 
 	/**
-     * get the fileContentInfoFactory used to determine the infos of a file content.
-     */
-    public FileContentInfoFactory getFileContentInfoFactory()
-    {
-        return fileContentInfoFactory;
-    }
-
-    /**
-     * set the fileContentInfoFactory used to determine the infos of a file content.
-     */
-    public void setFileContentInfoFactory(FileContentInfoFactory fileContentInfoFactory) throws FileSystemException
-    {
-        if (init)
-        {
-            throw new FileSystemException("vfs.impl/already-inited.error");
-        }
-
-        this.fileContentInfoFactory = fileContentInfoFactory;
-    }
-
-    /**
-     * Sets the file replicator to use.  The manager takes care of all
-     * lifecycle management.
-     */
-    public void setReplicator(final FileReplicator replicator)
-        throws FileSystemException
-    {
-        setupComponent(replicator);
-        fileReplicator = replicator;
-    }
-
-    /**
-     * Sets the temporary file store to use.  The manager takes care of all
-     * lifecycle management.
-     */
-    public void setTemporaryFileStore(final TemporaryFileStore tempFileStore)
-        throws FileSystemException
-    {
-        setupComponent(tempFileStore);
-        this.tempFileStore = tempFileStore;
-    }
-
-    /**
-     * Sets the logger to use.
-     */
-    public void setLogger(final Log log)
-    {
-        this.log = log;
-    }
-
-    /**
-     * Initialises a component, if it has not already been initialised.
-     */
-    private void setupComponent(final Object component)
-        throws FileSystemException
-    {
-        if (!components.contains(component))
-        {
-            if (component instanceof VfsComponent)
-            {
-                final VfsComponent vfsComponent = (VfsComponent) component;
-                vfsComponent.setLogger(getLogger());
-                vfsComponent.setContext(context);
-                vfsComponent.init();
-            }
-            components.add(component);
-        }
-    }
-
-    /**
-     * Closes a component, if it has not already been closed.
-     */
-    private void closeComponent(final Object component)
-    {
-        if (component != null && components.contains(component))
-        {
-            if (component instanceof VfsComponent)
-            {
-                final VfsComponent vfsComponent = (VfsComponent) component;
-                vfsComponent.close();
-            }
-            components.remove(component);
-        }
-    }
-
-    /**
-     * Returns the file replicator.
-     *
-     * @return The file replicator.  Never returns null.
-     */
-    public FileReplicator getReplicator()
-        throws FileSystemException
-    {
-        if (fileReplicator == null)
-        {
-            throw new FileSystemException("vfs.impl/no-replicator.error");
-        }
-        return fileReplicator;
-    }
-
-    /**
-     * Returns the temporary file store.
-     *
-     * @return The file store.  Never returns null.
-     */
-    public TemporaryFileStore getTemporaryFileStore()
-        throws FileSystemException
-    {
-        if (tempFileStore == null)
-        {
-            throw new FileSystemException("vfs.impl/no-temp-file-store.error");
-        }
-        return tempFileStore;
-    }
-
-    /**
-     * Initialises this manager.
-     */
-    public void init() throws FileSystemException
-    {
-        if (filesCache == null)
-        {
-            // filesCache = new DefaultFilesCache();
-            filesCache = new SoftRefFilesCache();
-        }
-        if (fileContentInfoFactory == null)
-        {
-            fileContentInfoFactory = new FileContentInfoFilenameFactory();
-        }
-        
-        if (fileCacheStrategy == null)
-        {
-        	fileCacheStrategy = CacheStrategy.ON_RESOLVE;
-        }
-
-        setupComponent(filesCache);
-        setupComponent(vfsProvider);
-
-        init = true;
-    }
-
-    /**
-     * Closes all files created by this manager, and cleans up any temporary
-     * files.  Also closes all providers and the replicator.
-     */
-    public void close()
-    {
-        if (!init)
-        {
-            return;
-        }
-
-        // Close the providers.
-        for (Iterator iterator = providers.values().iterator(); iterator.hasNext();)
-        {
-            final Object provider = iterator.next();
-            closeComponent(provider);
-        }
-
-        // Close the other components
-        closeComponent(defaultProvider);
-        closeComponent(fileReplicator);
-        closeComponent(tempFileStore);
-
-        components.clear();
-        providers.clear();
-        filesCache.close();
-        localFileProvider = null;
-        defaultProvider = null;
-        fileReplicator = null;
-        tempFileStore = null;
-        init = false;
-    }
-
-    /**
-     * Free all resources used by unused filesystems created by this manager.
-     */
-    public void freeUnusedResources()
-    {
-        if (!init)
-        {
-            return;
-        }
-
-        // Close the providers.
-        for (Iterator iterator = providers.values().iterator(); iterator.hasNext();)
-        {
-            final AbstractFileProvider provider = (AbstractFileProvider) iterator.next();
-            provider.freeUnusedResources();
-        }
-    }
-
-    /**
-     * Sets the base file to use when resolving relative URI.
-     */
-    // public void setBaseFile(final FileObject baseFile)
-    public void setBaseFile(final FileObject baseFile)
-        throws FileSystemException
-    {
-        this.baseFile = baseFile;
-    }
-
-    /**
-     * Sets the base file to use when resolving relative URI.
-     */
-    public void setBaseFile(final File baseFile) throws FileSystemException
-    {
-        this.baseFile = getLocalFileProvider().findLocalFile(baseFile);
-    }
-
-    /**
-     * Returns the base file used to resolve relative URI.
-     */
-    public FileObject getBaseFile() throws FileSystemException
-    {
-        return baseFile;
-    }
-
-    /**
-     * Locates a file by URI.
-     */
-    public FileObject resolveFile(final String uri) throws FileSystemException
-    {
-        // return resolveFile(baseFile, uri);
-        return resolveFile(getBaseFile(), uri);
-    }
-
-    /**
-     * Locate a file by URI, use the FileSystemOptions for file-system creation
-     */
-
-    public FileObject resolveFile(final String uri, final FileSystemOptions fileSystemOptions) throws FileSystemException
-    {
-        // return resolveFile(baseFile, uri, fileSystemOptions);
-        return resolveFile(getBaseFile(), uri, fileSystemOptions);
-    }
-
-    /**
-     * Locates a file by URI.
-     */
-    public FileObject resolveFile(final File baseFile, final String uri)
-        throws FileSystemException
-    {
-        final FileObject baseFileObj =
-            getLocalFileProvider().findLocalFile(baseFile);
-        return resolveFile(baseFileObj, uri);
-    }
-
-    /**
-     * Resolves a URI, relative to a base file.
-     */
-    public FileObject resolveFile(final FileObject baseFile, final String uri)
-        throws FileSystemException
-    {
-        return resolveFile(baseFile, uri, baseFile == null ? null : baseFile.getFileSystem().getFileSystemOptions());
-    }
-
-    /**
-     * Resolves a URI, realtive to a base file with specified FileSystem configuration
-     */
-    public FileObject resolveFile(final FileObject baseFile, final String uri, final FileSystemOptions fileSystemOptions)
-        throws FileSystemException
-    {
-        final FileObject realBaseFile;
-        if (baseFile != null && VFS.isUriStyle() && baseFile.getName().getType() == FileType.FILE)
-        {
-            realBaseFile = baseFile.getParent();
-        }
-        else
-        {
-            realBaseFile = baseFile;
-        }
-        // TODO: use resolveName and use this name to resolve the fileObject
-
-
-        UriParser.checkUriEncoding(uri);
-
-        if (uri == null)
-        {
-            throw new IllegalArgumentException();
-        }
-
-// Extract the scheme
-        final String scheme = UriParser.extractScheme(uri);
-        if (scheme != null)
-        {
-// An absolute URI - locate the provider
-            final FileProvider provider = (FileProvider) providers.get(scheme);
-            if (provider != null)
-            {
-                return provider.findFile(realBaseFile, uri, fileSystemOptions);
-            }
-// Otherwise, assume a local file
-        }
-
-// Handle absolute file names
-        if (localFileProvider != null
-            && localFileProvider.isAbsoluteLocalName(uri))
-        {
-            return localFileProvider.findLocalFile(uri);
-        }
-
-        if (scheme != null)
-        {
-// An unknown scheme - hand it to the default provider
-            if (defaultProvider == null)
-            {
-                throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object[]{scheme, uri});
-            }
-            return defaultProvider.findFile(realBaseFile, uri, fileSystemOptions);
-        }
-
-// Assume a relative name - use the supplied base file
-        if (realBaseFile == null)
-        {
-            throw new FileSystemException("vfs.impl/find-rel-file.error", uri);
-        }
-
-        return realBaseFile.resolveFile(uri);
-    }
-
-    /**
-     * Resolves a name, relative to the file.  If the supplied name is an
-     * absolute path, then it is resolved relative to the root of the
-     * file system that the file belongs to.  If a relative name is supplied,
-     * then it is resolved relative to this file name.
-     */
-    public FileName resolveName(final FileName root, final String path) throws FileSystemException
-    {
-        return resolveName(root, path, NameScope.FILE_SYSTEM);
-    }
-
-    /**
-     * Resolves a name, relative to the root.
-     *
-     * @param base  the base filename
-     * @param name  the name
-     * @param scope the {@link NameScope}
-     * @throws FileSystemException
-     */
-    public FileName resolveName(final FileName base,
-                                final String name,
-                                final NameScope scope)
-        throws FileSystemException
-    {
-        final FileName realBase;
-        if (base != null && VFS.isUriStyle() && base.getType() == FileType.FILE)
-        {
-            realBase = base.getParent();
-        }
-        else
-        {
-            realBase = base;
-        }
-
-        final StringBuffer buffer = new StringBuffer(name);
-
-        // Adjust separators
-        UriParser.fixSeparators(buffer);
-
-        // Determine whether to prepend the base path
-        if (name.length() == 0 || name.charAt(0) != FileName.SEPARATOR_CHAR)
-        {
-            // Supplied path is not absolute
-            if (!VFS.isUriStyle())
-            {
-                // when using uris the parent already do have the trailing "/"
-                buffer.insert(0, FileName.SEPARATOR_CHAR);
-            }
-            buffer.insert(0, realBase.getPath());
-        }
-
-        //// UriParser.canonicalizePath(buffer, 0, name.length());
-
-        // Normalise the path
-        FileType fileType = UriParser.normalisePath(buffer);
-
-        // Check the name is ok
-        final String resolvedPath = buffer.toString();
-        if (!AbstractFileName.checkName(realBase.getPath(), resolvedPath, scope))
-        {
-            throw new FileSystemException("vfs.provider/invalid-descendent-name.error", name);
-        }
-
-        String scheme = realBase.getScheme();
-        String fullPath = realBase.getRootURI() + resolvedPath;
-        final FileProvider provider = (FileProvider) providers.get(scheme);
-        if (provider != null)
-        {
-            // todo: extend the filename parser to be able to parse
-            // only a pathname and take the missing informations from
-            // the base. Then we can get rid of the string operation.
-            //// String fullPath = base.getRootURI() + resolvedPath.substring(1);
-
-            return provider.parseUri(realBase, fullPath);
-        }
-
-        if (scheme != null)
-        {
-// An unknown scheme - hand it to the default provider - if possible
-            if (defaultProvider != null)
-            {
-                return defaultProvider.parseUri(realBase, fullPath);
-            }
-        }
-
-        // todo: avoid fallback to this point
-        // this happens if we have a virtual filesystem (no provider for scheme)
-        return ((AbstractFileName) realBase).createName(resolvedPath, fileType);
-    }
-
-    /**
-     * resolve the uri to a filename
-     *
-     * @throws FileSystemException
-     */
-    public FileName resolveURI(String uri) throws FileSystemException
-    {
-        UriParser.checkUriEncoding(uri);
-
-        if (uri == null)
-        {
-            throw new IllegalArgumentException();
-        }
-
-// Extract the scheme
-        final String scheme = UriParser.extractScheme(uri);
-        if (scheme != null)
-        {
-// An absolute URI - locate the provider
-            final FileProvider provider = (FileProvider) providers.get(scheme);
-            if (provider != null)
-            {
-                return provider.parseUri(null, uri);
-            }
-
-// Otherwise, assume a local file
-        }
-
-// Handle absolute file names
-        if (localFileProvider != null
-            && localFileProvider.isAbsoluteLocalName(uri))
-        {
-            return localFileProvider.parseUri(null, uri);
-        }
-
-        if (scheme != null)
-        {
-// An unknown scheme - hand it to the default provider
-            if (defaultProvider == null)
-            {
-                throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object[]{scheme, uri});
-            }
-            return defaultProvider.parseUri(null, uri);
-        }
-
-// Assume a relative name - use the supplied base file
-        if (baseFile == null)
-        {
-            throw new FileSystemException("vfs.impl/find-rel-file.error", uri);
-        }
-
-        return resolveName(baseFile.getName(), uri, NameScope.FILE_SYSTEM);
-    }
-
-    /**
-     * Converts a local file into a {@link FileObject}.
-     */
-    public FileObject toFileObject(final File file)
-        throws FileSystemException
-    {
-        return getLocalFileProvider().findLocalFile(file);
-    }
-
-    /**
-     * Creates a layered file system.
-     */
-    public FileObject createFileSystem(final String scheme,
-                                       final FileObject file)
-        throws FileSystemException
-    {
-        final FileProvider provider = (FileProvider) providers.get(scheme);
-        if (provider == null)
-        {
-            throw new FileSystemException("vfs.impl/unknown-provider.error", new Object[]{scheme, file});
-        }
-        return provider.createFileSystem(scheme, file, file.getFileSystem().getFileSystemOptions());
-    }
-
-    /**
-     * Creates a layered file system.
-     */
-    public FileObject createFileSystem(final FileObject file)
-        throws FileSystemException
-    {
-        final String scheme = map.getScheme(file);
-        if (scheme == null)
-        {
-            throw new FileSystemException("vfs.impl/no-provider-for-file.error", file);
-        }
-
-        return createFileSystem(scheme, file);
-    }
-
-    /**
-     * Determines if a layered file system can be created for a given file.
-     *
-     * @param file The file to check for.
-     */
-    public boolean canCreateFileSystem(final FileObject file) throws FileSystemException
-    {
-        return (map.getScheme(file) != null);
-    }
-
-    /**
-     * Creates a virtual file system.
-     */
-    public FileObject createVirtualFileSystem(final FileObject rootFile)
-        throws FileSystemException
-    {
-        return vfsProvider.createFileSystem(rootFile);
-    }
-
-    /**
-     * Creates an empty virtual file system.
-     */
-    public FileObject createVirtualFileSystem(final String rootUri)
-        throws FileSystemException
-    {
-        return vfsProvider.createFileSystem(rootUri);
-    }
-
-    /**
-     * Locates the local file provider.
-     */
-    private LocalFileProvider getLocalFileProvider()
-        throws FileSystemException
-    {
-        if (localFileProvider == null)
-        {
-            throw new FileSystemException("vfs.impl/no-local-file-provider.error");
-        }
-        return localFileProvider;
-    }
-
-    /**
-     * Get the URLStreamHandlerFactory.
-     */
-    public URLStreamHandlerFactory getURLStreamHandlerFactory()
-    {
-        return new VfsStreamHandlerFactory();
-    }
-
-    public void closeFileSystem(FileSystem filesystem)
-    {
-        FileProvider provider = (FileProvider) providers.get(filesystem.getRootName().getScheme());
-        if (provider != null)
-        {
-            ((AbstractFileProvider) provider).closeFileSystem(filesystem);
-        }
-    }
-
-    /**
-     * This is an internal class because it needs access to the private
-     * member providers.
-     */
-    final class VfsStreamHandlerFactory implements URLStreamHandlerFactory
-    {
-        public URLStreamHandler createURLStreamHandler(final String protocol)
-        {
-            FileProvider provider = (FileProvider) providers.get(protocol);
-            if (provider != null)
-            {
-                return new DefaultURLStreamHandler(context);
-            }
-
-            //Route all other calls to the default URLStreamHandlerFactory
-            return new URLStreamHandlerProxy();
-        }
-    }
-
-    /**
-     * Get the schemes currently available.
-     */
-    public String[] getSchemes()
-    {
-        String schemes[] = new String[providers.size()];
-        providers.keySet().toArray(schemes);
-        return schemes;
-    }
-
-    /**
-     * Get the capabilities for a given scheme.
-     *
-     * @throws FileSystemException if the given scheme is not konwn
-     */
-    public Collection getProviderCapabilities(final String scheme) throws FileSystemException
-    {
-        FileProvider provider = (FileProvider) providers.get(scheme);
-        if (provider == null)
-        {
-            throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object[]{scheme});
-        }
-
-        return provider.getCapabilities();
-    }
-
-    /**
-     * Get the configuration builder for the given scheme
-     *
-     * @throws FileSystemException if the given scheme is not konwn
-     */
-    public FileSystemConfigBuilder getFileSystemConfigBuilder(final String scheme) throws FileSystemException
-    {
-        FileProvider provider = (FileProvider) providers.get(scheme);
-        if (provider == null)
-        {
-            throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object[]{scheme});
-        }
+	 * get the fileContentInfoFactory used to determine the infos of a file
+	 * content.
+	 */
+	public FileContentInfoFactory getFileContentInfoFactory()
+	{
+		return fileContentInfoFactory;
+	}
+
+	/**
+	 * set the fileContentInfoFactory used to determine the infos of a file
+	 * content.
+	 */
+	public void setFileContentInfoFactory(
+			FileContentInfoFactory fileContentInfoFactory)
+			throws FileSystemException
+	{
+		if (init)
+		{
+			throw new FileSystemException("vfs.impl/already-inited.error");
+		}
+
+		this.fileContentInfoFactory = fileContentInfoFactory;
+	}
+
+	/**
+	 * Sets the file replicator to use. The manager takes care of all lifecycle
+	 * management.
+	 */
+	public void setReplicator(final FileReplicator replicator)
+			throws FileSystemException
+	{
+		setupComponent(replicator);
+		fileReplicator = replicator;
+	}
+
+	/**
+	 * Sets the temporary file store to use. The manager takes care of all
+	 * lifecycle management.
+	 */
+	public void setTemporaryFileStore(final TemporaryFileStore tempFileStore)
+			throws FileSystemException
+	{
+		setupComponent(tempFileStore);
+		this.tempFileStore = tempFileStore;
+	}
+
+	/**
+	 * Sets the logger to use.
+	 */
+	public void setLogger(final Log log)
+	{
+		this.log = log;
+	}
+
+	/**
+	 * Initialises a component, if it has not already been initialised.
+	 */
+	private void setupComponent(final Object component)
+			throws FileSystemException
+	{
+		if (!components.contains(component))
+		{
+			if (component instanceof VfsComponent)
+			{
+				final VfsComponent vfsComponent = (VfsComponent) component;
+				vfsComponent.setLogger(getLogger());
+				vfsComponent.setContext(context);
+				vfsComponent.init();
+			}
+			components.add(component);
+		}
+	}
+
+	/**
+	 * Closes a component, if it has not already been closed.
+	 */
+	private void closeComponent(final Object component)
+	{
+		if (component != null && components.contains(component))
+		{
+			if (component instanceof VfsComponent)
+			{
+				final VfsComponent vfsComponent = (VfsComponent) component;
+				vfsComponent.close();
+			}
+			components.remove(component);
+		}
+	}
+
+	/**
+	 * Returns the file replicator.
+	 * 
+	 * @return The file replicator. Never returns null.
+	 */
+	public FileReplicator getReplicator() throws FileSystemException
+	{
+		if (fileReplicator == null)
+		{
+			throw new FileSystemException("vfs.impl/no-replicator.error");
+		}
+		return fileReplicator;
+	}
+
+	/**
+	 * Returns the temporary file store.
+	 * 
+	 * @return The file store. Never returns null.
+	 */
+	public TemporaryFileStore getTemporaryFileStore()
+			throws FileSystemException
+	{
+		if (tempFileStore == null)
+		{
+			throw new FileSystemException("vfs.impl/no-temp-file-store.error");
+		}
+		return tempFileStore;
+	}
+
+	/**
+	 * Initialises this manager.
+	 */
+	public void init() throws FileSystemException
+	{
+		if (filesCache == null)
+		{
+			// filesCache = new DefaultFilesCache();
+			filesCache = new SoftRefFilesCache();
+		}
+		if (fileContentInfoFactory == null)
+		{
+			fileContentInfoFactory = new FileContentInfoFilenameFactory();
+		}
+
+		if (fileCacheStrategy == null)
+		{
+			fileCacheStrategy = CacheStrategy.ON_RESOLVE;
+		}
+
+		setupComponent(filesCache);
+		setupComponent(vfsProvider);
+
+		init = true;
+	}
+
+	/**
+	 * Closes all files created by this manager, and cleans up any temporary
+	 * files. Also closes all providers and the replicator.
+	 */
+	public void close()
+	{
+		if (!init)
+		{
+			return;
+		}
+
+		// Close the providers.
+		for (Iterator iterator = providers.values().iterator(); iterator
+				.hasNext();)
+		{
+			final Object provider = iterator.next();
+			closeComponent(provider);
+		}
+
+		// Close the other components
+		closeComponent(defaultProvider);
+		closeComponent(fileReplicator);
+		closeComponent(tempFileStore);
+
+		components.clear();
+		providers.clear();
+		filesCache.close();
+		localFileProvider = null;
+		defaultProvider = null;
+		fileReplicator = null;
+		tempFileStore = null;
+		init = false;
+	}
+
+	/**
+	 * Free all resources used by unused filesystems created by this manager.
+	 */
+	public void freeUnusedResources()
+	{
+		if (!init)
+		{
+			return;
+		}
+
+		// Close the providers.
+		for (Iterator iterator = providers.values().iterator(); iterator
+				.hasNext();)
+		{
+			final AbstractFileProvider provider = (AbstractFileProvider) iterator
+					.next();
+			provider.freeUnusedResources();
+		}
+	}
+
+	/**
+	 * Sets the base file to use when resolving relative URI.
+	 */
+	// public void setBaseFile(final FileObject baseFile)
+	public void setBaseFile(final FileObject baseFile)
+			throws FileSystemException
+	{
+		this.baseFile = baseFile;
+	}
+
+	/**
+	 * Sets the base file to use when resolving relative URI.
+	 */
+	public void setBaseFile(final File baseFile) throws FileSystemException
+	{
+		this.baseFile = getLocalFileProvider().findLocalFile(baseFile);
+	}
+
+	/**
+	 * Returns the base file used to resolve relative URI.
+	 */
+	public FileObject getBaseFile() throws FileSystemException
+	{
+		return baseFile;
+	}
+
+	/**
+	 * Locates a file by URI.
+	 */
+	public FileObject resolveFile(final String uri) throws FileSystemException
+	{
+		// return resolveFile(baseFile, uri);
+		return resolveFile(getBaseFile(), uri);
+	}
+
+	/**
+	 * Locate a file by URI, use the FileSystemOptions for file-system creation
+	 */
+
+	public FileObject resolveFile(final String uri,
+			final FileSystemOptions fileSystemOptions)
+			throws FileSystemException
+	{
+		// return resolveFile(baseFile, uri, fileSystemOptions);
+		return resolveFile(getBaseFile(), uri, fileSystemOptions);
+	}
+
+	/**
+	 * Locates a file by URI.
+	 */
+	public FileObject resolveFile(final File baseFile, final String uri)
+			throws FileSystemException
+	{
+		final FileObject baseFileObj = getLocalFileProvider().findLocalFile(
+				baseFile);
+		return resolveFile(baseFileObj, uri);
+	}
+
+	/**
+	 * Resolves a URI, relative to a base file.
+	 */
+	public FileObject resolveFile(final FileObject baseFile, final String uri)
+			throws FileSystemException
+	{
+		return resolveFile(baseFile, uri, baseFile == null ? null : baseFile
+				.getFileSystem().getFileSystemOptions());
+	}
+
+	/**
+	 * Resolves a URI, realtive to a base file with specified FileSystem
+	 * configuration
+	 */
+	public FileObject resolveFile(final FileObject baseFile, final String uri,
+			final FileSystemOptions fileSystemOptions)
+			throws FileSystemException
+	{
+		final FileObject realBaseFile;
+		if (baseFile != null && VFS.isUriStyle()
+				&& baseFile.getName().getType() == FileType.FILE)
+		{
+			realBaseFile = baseFile.getParent();
+		}
+		else
+		{
+			realBaseFile = baseFile;
+		}
+		// TODO: use resolveName and use this name to resolve the fileObject
+
+		UriParser.checkUriEncoding(uri);
+
+		if (uri == null)
+		{
+			throw new IllegalArgumentException();
+		}
+
+		// Extract the scheme
+		final String scheme = UriParser.extractScheme(uri);
+		if (scheme != null)
+		{
+			// An absolute URI - locate the provider
+			final FileProvider provider = (FileProvider) providers.get(scheme);
+			if (provider != null)
+			{
+				return provider.findFile(realBaseFile, uri, fileSystemOptions);
+			}
+			// Otherwise, assume a local file
+		}
+
+		// Handle absolute file names
+		if (localFileProvider != null
+				&& localFileProvider.isAbsoluteLocalName(uri))
+		{
+			return localFileProvider.findLocalFile(uri);
+		}
+
+		if (scheme != null)
+		{
+			// An unknown scheme - hand it to the default provider
+			if (defaultProvider == null)
+			{
+				throw new FileSystemException("vfs.impl/unknown-scheme.error",
+						new Object[]
+						{ scheme, uri });
+			}
+			return defaultProvider.findFile(realBaseFile, uri,
+					fileSystemOptions);
+		}
+
+		// Assume a relative name - use the supplied base file
+		if (realBaseFile == null)
+		{
+			throw new FileSystemException("vfs.impl/find-rel-file.error", uri);
+		}
+
+		return realBaseFile.resolveFile(uri);
+	}
+
+	/**
+	 * Resolves a name, relative to the file. If the supplied name is an
+	 * absolute path, then it is resolved relative to the root of the file
+	 * system that the file belongs to. If a relative name is supplied, then it
+	 * is resolved relative to this file name.
+	 */
+	public FileName resolveName(final FileName root, final String path)
+			throws FileSystemException
+	{
+		return resolveName(root, path, NameScope.FILE_SYSTEM);
+	}
+
+	/**
+	 * Resolves a name, relative to the root.
+	 * 
+	 * @param base
+	 *            the base filename
+	 * @param name
+	 *            the name
+	 * @param scope
+	 *            the {@link NameScope}
+	 * @throws FileSystemException
+	 */
+	public FileName resolveName(final FileName base, final String name,
+			final NameScope scope) throws FileSystemException
+	{
+		final FileName realBase;
+		if (base != null && VFS.isUriStyle() && base.getType() == FileType.FILE)
+		{
+			realBase = base.getParent();
+		}
+		else
+		{
+			realBase = base;
+		}
+
+		final StringBuffer buffer = new StringBuffer(name);
+
+		// Adjust separators
+		UriParser.fixSeparators(buffer);
+
+		// Determine whether to prepend the base path
+		if (name.length() == 0 || name.charAt(0) != FileName.SEPARATOR_CHAR)
+		{
+			// Supplied path is not absolute
+			if (!VFS.isUriStyle())
+			{
+				// when using uris the parent already do have the trailing "/"
+				buffer.insert(0, FileName.SEPARATOR_CHAR);
+			}
+			buffer.insert(0, realBase.getPath());
+		}
+
+		// // UriParser.canonicalizePath(buffer, 0, name.length());
+
+		// Normalise the path
+		FileType fileType = UriParser.normalisePath(buffer);
+
+		// Check the name is ok
+		final String resolvedPath = buffer.toString();
+		if (!AbstractFileName
+				.checkName(realBase.getPath(), resolvedPath, scope))
+		{
+			throw new FileSystemException(
+					"vfs.provider/invalid-descendent-name.error", name);
+		}
+
+		String scheme = realBase.getScheme();
+		String fullPath = realBase.getRootURI() + resolvedPath;
+		final FileProvider provider = (FileProvider) providers.get(scheme);
+		if (provider != null)
+		{
+			// todo: extend the filename parser to be able to parse
+			// only a pathname and take the missing informations from
+			// the base. Then we can get rid of the string operation.
+			// // String fullPath = base.getRootURI() +
+			// resolvedPath.substring(1);
+
+			return provider.parseUri(realBase, fullPath);
+		}
+
+		if (scheme != null)
+		{
+			// An unknown scheme - hand it to the default provider - if possible
+			if (defaultProvider != null)
+			{
+				return defaultProvider.parseUri(realBase, fullPath);
+			}
+		}
+
+		// todo: avoid fallback to this point
+		// this happens if we have a virtual filesystem (no provider for scheme)
+		return ((AbstractFileName) realBase).createName(resolvedPath, fileType);
+	}
+
+	/**
+	 * resolve the uri to a filename
+	 * 
+	 * @throws FileSystemException
+	 */
+	public FileName resolveURI(String uri) throws FileSystemException
+	{
+		UriParser.checkUriEncoding(uri);
+
+		if (uri == null)
+		{
+			throw new IllegalArgumentException();
+		}
+
+		// Extract the scheme
+		final String scheme = UriParser.extractScheme(uri);
+		if (scheme != null)
+		{
+			// An absolute URI - locate the provider
+			final FileProvider provider = (FileProvider) providers.get(scheme);
+			if (provider != null)
+			{
+				return provider.parseUri(null, uri);
+			}
+
+			// Otherwise, assume a local file
+		}
+
+		// Handle absolute file names
+		if (localFileProvider != null
+				&& localFileProvider.isAbsoluteLocalName(uri))
+		{
+			return localFileProvider.parseUri(null, uri);
+		}
+
+		if (scheme != null)
+		{
+			// An unknown scheme - hand it to the default provider
+			if (defaultProvider == null)
+			{
+				throw new FileSystemException("vfs.impl/unknown-scheme.error",
+						new Object[]
+						{ scheme, uri });
+			}
+			return defaultProvider.parseUri(null, uri);
+		}
+
+		// Assume a relative name - use the supplied base file
+		if (baseFile == null)
+		{
+			throw new FileSystemException("vfs.impl/find-rel-file.error", uri);
+		}
+
+		return resolveName(baseFile.getName(), uri, NameScope.FILE_SYSTEM);
+	}
+
+	/**
+	 * Converts a local file into a {@link FileObject}.
+	 */
+	public FileObject toFileObject(final File file) throws FileSystemException
+	{
+		return getLocalFileProvider().findLocalFile(file);
+	}
+
+	/**
+	 * Creates a layered file system.
+	 */
+	public FileObject createFileSystem(final String scheme,
+			final FileObject file) throws FileSystemException
+	{
+		final FileProvider provider = (FileProvider) providers.get(scheme);
+		if (provider == null)
+		{
+			throw new FileSystemException("vfs.impl/unknown-provider.error",
+					new Object[]
+					{ scheme, file });
+		}
+		return provider.createFileSystem(scheme, file, file.getFileSystem()
+				.getFileSystemOptions());
+	}
 
-        return provider.getConfigBuilder();
-    }
+	/**
+	 * Creates a layered file system.
+	 */
+	public FileObject createFileSystem(final FileObject file)
+			throws FileSystemException
+	{
+		final String scheme = map.getScheme(file);
+		if (scheme == null)
+		{
+			throw new FileSystemException(
+					"vfs.impl/no-provider-for-file.error", file);
+		}
+
+		return createFileSystem(scheme, file);
+	}
+
+	/**
+	 * Determines if a layered file system can be created for a given file.
+	 * 
+	 * @param file
+	 *            The file to check for.
+	 */
+	public boolean canCreateFileSystem(final FileObject file)
+			throws FileSystemException
+	{
+		return (map.getScheme(file) != null);
+	}
+
+	/**
+	 * Creates a virtual file system.
+	 */
+	public FileObject createVirtualFileSystem(final FileObject rootFile)
+			throws FileSystemException
+	{
+		return vfsProvider.createFileSystem(rootFile);
+	}
+
+	/**
+	 * Creates an empty virtual file system.
+	 */
+	public FileObject createVirtualFileSystem(final String rootUri)
+			throws FileSystemException
+	{
+		return vfsProvider.createFileSystem(rootUri);
+	}
+
+	/**
+	 * Locates the local file provider.
+	 */
+	private LocalFileProvider getLocalFileProvider() throws FileSystemException
+	{
+		if (localFileProvider == null)
+		{
+			throw new FileSystemException(
+					"vfs.impl/no-local-file-provider.error");
+		}
+		return localFileProvider;
+	}
+
+	/**
+	 * Get the URLStreamHandlerFactory.
+	 */
+	public URLStreamHandlerFactory getURLStreamHandlerFactory()
+	{
+		return new VfsStreamHandlerFactory();
+	}
+
+	public void closeFileSystem(FileSystem filesystem)
+	{
+		FileProvider provider = (FileProvider) providers.get(filesystem
+				.getRootName().getScheme());
+		if (provider != null)
+		{
+			((AbstractFileProvider) provider).closeFileSystem(filesystem);
+		}
+	}
+
+	/**
+	 * This is an internal class because it needs access to the private member
+	 * providers.
+	 */
+	final class VfsStreamHandlerFactory implements URLStreamHandlerFactory
+	{
+		public URLStreamHandler createURLStreamHandler(final String protocol)
+		{
+			FileProvider provider = (FileProvider) providers.get(protocol);
+			if (provider != null)
+			{
+				return new DefaultURLStreamHandler(context);
+			}
+
+			// Route all other calls to the default URLStreamHandlerFactory
+			return new URLStreamHandlerProxy();
+		}
+	}
+
+	/**
+	 * Get the schemes currently available.
+	 */
+	public String[] getSchemes()
+	{
+		String schemes[] = new String[providers.size()];
+		providers.keySet().toArray(schemes);
+		return schemes;
+	}
+
+	/**
+	 * Get the capabilities for a given scheme.
+	 * 
+	 * @throws FileSystemException
+	 *             if the given scheme is not konwn
+	 */
+	public Collection getProviderCapabilities(final String scheme)
+			throws FileSystemException
+	{
+		FileProvider provider = (FileProvider) providers.get(scheme);
+		if (provider == null)
+		{
+			throw new FileSystemException("vfs.impl/unknown-scheme.error",
+					new Object[]
+					{ scheme });
+		}
+
+		return provider.getCapabilities();
+	}
+
+	/**
+	 * Get the configuration builder for the given scheme
+	 * 
+	 * @throws FileSystemException
+	 *             if the given scheme is not konwn
+	 */
+	public FileSystemConfigBuilder getFileSystemConfigBuilder(
+			final String scheme) throws FileSystemException
+	{
+		FileProvider provider = (FileProvider) providers.get(scheme);
+		if (provider == null)
+		{
+			throw new FileSystemException("vfs.impl/unknown-scheme.error",
+					new Object[]
+					{ scheme });
+		}
+
+		return provider.getConfigBuilder();
+	}
+
+	// -- OPERATIONS --
+
+	private final Map operationProviders = new HashMap();
+
+	/**
+	 * Adds the specified FileOperationProvider for the specified scheme.
+	 * Several FileOperationProvider's might be registered for the same scheme.
+	 * For example, for "file" scheme we can register SvnWsOperationProvider and
+	 * CvsOperationProvider.
+	 * 
+	 * @param scheme
+	 * @param operationProvider
+	 * @throws FileSystemException
+	 */
+	public void addOperationProvider(final String scheme,
+			final FileOperationProvider operationProvider)
+			throws FileSystemException
+	{
+		addOperationProvider(new String[]
+		{ scheme }, operationProvider);
+	}
+
+	/**
+	 * @see FileSystemManager#addOperationProvider(String,
+	 *      org.apache.commons.vfs.operations.FileOperationProvider)
+	 * 
+	 * @param schemes
+	 * @param operationProvider
+	 * @throws FileSystemException
+	 */
+	public void addOperationProvider(final String[] schemes,
+			final FileOperationProvider operationProvider)
+			throws FileSystemException
+	{
+		for (int i = 0; i < schemes.length; i++)
+		{
+			final String scheme = schemes[i];
+
+			if (!operationProviders.containsKey(scheme))
+			{
+				final List providers = new ArrayList();
+				operationProviders.put(scheme, providers);
+			}
+
+			final List providers = (List) operationProviders.get(scheme);
+
+			if (providers.contains(operationProvider))
+			{
+				throw new FileSystemException(
+						"vfs.operation/operation-provider-already-added.error",
+						scheme);
+			}
+
+			setupComponent(operationProvider);
+
+			providers.add(operationProvider);
+		}
+	}
+
+	/**
+	 * @param scheme
+	 *            the scheme for wich we want to get the list af registered
+	 *            providers.
+	 * 
+	 * @return the registered FileOperationProviders for the specified scheme.
+	 *         If there were no providers registered for the scheme, it returns
+	 *         null.
+	 * 
+	 * @throws FileSystemException
+	 */
+	public FileOperationProvider[] getOperationProviders(final String scheme)
+			throws FileSystemException
+	{
+
+		List providers = (List) operationProviders.get(scheme);
+		if (providers == null || providers.size() == 0)
+		{
+			return null;
+		}
+		return (FileOperationProvider[]) providers
+				.toArray(new FileOperationProvider[] {});
+	}
 }

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java Tue May 16 12:07:44 2006
@@ -19,6 +19,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.VfsLog;
+import org.apache.commons.vfs.operations.FileOperationProvider;
 import org.apache.commons.vfs.provider.FileProvider;
 import org.apache.commons.vfs.util.Messages;
 import org.w3c.dom.Element;
@@ -286,6 +287,14 @@
             addProvider(provider, false);
         }
 
+        // Add the operation providers
+        final NodeList operationProviders = config.getElementsByTagName("operationProvider");
+        for (int i = 0; i < operationProviders.getLength(); i++)
+        {
+            final Element operationProvider = (Element) operationProviders.item(i);
+            addOperationProvider(operationProvider);
+        }
+        
         // Add the default provider
         final NodeList defProviders = config.getElementsByTagName("default-provider");
         if (defProviders.getLength() > 0)
@@ -371,7 +380,7 @@
         }
 
         // Create and register the provider
-        final FileProvider provider = createProvider(classname);
+        final FileProvider provider = (FileProvider) createInstance(classname);
         final String[] schemas = getSchemas(providerDef);
         if (schemas.length > 0)
         {
@@ -386,6 +395,26 @@
     }
 
     /**
+     * Adds a operationProvider from a operationProvider definition.
+     */
+    private void addOperationProvider(final Element providerDef) throws FileSystemException
+    {
+        final String classname = providerDef.getAttribute("class-name");
+
+        // Attach only to available schemas
+        final String[] schemas = getSchemas(providerDef);
+        for (int i = 0; i < schemas.length; i++)
+        {
+            final String schema = schemas[i];
+            if (hasProvider(schema))
+            {
+                final FileOperationProvider operationProvider = (FileOperationProvider) createInstance(classname);
+            	addOperationProvider(schema, operationProvider);
+            }
+        }
+    }
+    
+    /**
      * Tests if a class is available.
      */
     private boolean findClass(final String className)
@@ -460,17 +489,17 @@
     /**
      * Creates a provider.
      */
-    private FileProvider createProvider(final String providerClassName)
+    private Object createInstance(final String className)
         throws FileSystemException
     {
         try
         {
-            final Class providerClass = classLoader.loadClass(providerClassName);
-            return (FileProvider) providerClass.newInstance();
+            final Class clazz = classLoader.loadClass(className);
+            return clazz.newInstance();
         }
         catch (final Exception e)
         {
-            throw new FileSystemException("vfs.impl/create-provider.error", providerClassName, e);
+            throw new FileSystemException("vfs.impl/create-provider.error", className, e);
         }
     }
 }

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/VirtualFileProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/VirtualFileProvider.java?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/VirtualFileProvider.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/VirtualFileProvider.java Tue May 16 12:07:44 2006
@@ -41,7 +41,7 @@
             getContext().getFileSystemManager().resolveName(rootFile.getName(), FileName.ROOT_PATH);
         // final FileName rootName =
         //    new BasicFileName(rootFile.getName(), FileName.ROOT_PATH);
-        final VirtualFileSystem fs = new VirtualFileSystem(rootName, null);
+        final VirtualFileSystem fs = new VirtualFileSystem(rootName, rootFile.getFileSystem().getFileSystemOptions());
         addComponent(fs);
         fs.addJunction(FileName.ROOT_PATH, rootFile);
         return fs.getRoot();

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/providers.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/providers.xml?rev=407025&r1=407024&r2=407025&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/providers.xml (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/impl/providers.xml Tue May 16 12:07:44 2006
@@ -52,6 +52,11 @@
         <scheme name="res"/>
     </provider>
     <!--
+    <provider class-name="org.apache.commons.vfs.provider.svn.SvnFileProvider">
+        <scheme name="svnhttps"/>
+    </provider>
+    -->
+    <!--
         <provider class-name="org.apache.commons.vfs.provider.tar.TgzFileProvider">
             <scheme name="tgz"/>
             <if-available scheme="gz"/>

Added: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperation.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperation.java?rev=407025&view=auto
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperation.java (added)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperation.java Tue May 16 12:07:44 2006
@@ -0,0 +1,35 @@
+package org.apache.commons.vfs.operations;
+
+import org.apache.commons.vfs.FileObject;
+
+/**
+ * todo: add class description here
+ * 
+ * @author Siarhei Baidun
+ * @since 0.1
+ */
+public abstract class AbstractFileOperation implements FileOperation
+{
+	/**
+	 * FileObject which the FileOperation is operate on.
+	 */
+	private FileObject fileObject;
+
+	/**
+	 * 
+	 * @param file
+	 */
+	public AbstractFileOperation(final FileObject file)
+	{
+		fileObject = file;
+	}
+
+	/**
+	 * 
+	 * @return an instance of FileObject which this FileOperation is operate on.
+	 */
+	protected FileObject getFileObject()
+	{
+		return fileObject;
+	}
+}

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperationProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperationProvider.java?rev=407025&view=auto
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperationProvider.java (added)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperationProvider.java Tue May 16 12:07:44 2006
@@ -0,0 +1,135 @@
+package org.apache.commons.vfs.operations;
+
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileObject;
+
+import java.util.*;
+
+/**
+ * todo: add class description here
+ * 
+ * @author Siarhei Baidun
+ * @since 0.1
+ */
+public abstract class AbstractFileOperationProvider implements
+		FileOperationProvider
+{
+
+	/**
+	 * Available operations. Operations could be registered for different schemes.
+	 * Some operations can work only for "file" scheme, other - for "svnhttp(s)",
+	 * "svn", "svnssh", but not for "file", etc. The Map has scheme as a key and
+	 * Colleaction of operations that are available for that scheme.
+	 */
+	private Collection operations = new ArrayList();
+
+	/**
+	 * Gather available operations for the specified FileObject and put them into
+	 * specified operationsList.
+	 * 
+	 * @param operationsList
+	 *            the list of available operations for the specivied FileObject.
+	 *            The operationList contains classes of available operations, e.g.
+	 *            Class objects.
+	 * @param file
+	 *            the FileObject for which we want to get the list of available
+	 *            operations.
+	 * @throws org.apache.commons.vfs.FileSystemException
+	 *             if list of operations cannto be retrieved.
+	 */
+	public final void collectOperations(final Collection operationsList,
+			final FileObject file) throws FileSystemException
+	{
+
+		doCollectOperations(operations, operationsList, file);
+	}
+
+	/**
+	 * 
+	 * @throws FileSystemException
+	 */
+	protected abstract void doCollectOperations(
+			final Collection availableOperations, final Collection resultList,
+			final FileObject file) throws FileSystemException;
+
+	/**
+	 * @param file
+	 *            the FileObject for which we need a operation.
+	 * @param operationClass
+	 *            the Class which instance we are needed.
+	 * @return the requried operation instance.
+	 * @throws org.apache.commons.vfs.FileSystemException
+	 *             if operation cannot be retrieved.
+	 */
+	public final FileOperation getOperation(FileObject file, Class operationClass)
+			throws FileSystemException
+	{
+		Class implementation = lookupOperation(operationClass);
+
+		FileOperation operationInstance = instantiateOperation(file, implementation);
+
+		return operationInstance;
+	}
+
+	/**
+	 * 
+	 * @param operationClass
+	 * @return
+	 * @throws FileSystemException
+	 */
+	protected abstract FileOperation instantiateOperation(final FileObject file,
+			final Class operationClass) throws FileSystemException;
+
+	/**
+	 * 
+	 * @param operationClass
+	 * @return never returns null
+	 */
+	protected final Class lookupOperation(final Class operationClass)
+			throws FileSystemException
+	{
+		// check validity of passed class
+		if (!FileOperation.class.isAssignableFrom(operationClass))
+		{
+			throw new FileSystemException("vfs.operation/wrong-type.error", operationClass);
+		}
+
+		// find appropriate class
+		Class foundClass = null;
+		Iterator iterator = operations.iterator();
+		while (iterator.hasNext())
+		{
+			Class operation = (Class) iterator.next();
+			if (operationClass.isAssignableFrom(operation))
+			{
+				foundClass = operation;
+				break;
+			}
+		}
+
+		if (foundClass == null)
+		{
+			throw new FileSystemException("vfs.operation/not-found.error", operationClass);
+		}
+
+		return foundClass;
+	}
+
+	/**
+	 * 
+	 * @param operationClass
+	 * @throws FileSystemException
+	 */
+	protected final void addOperation(final Class operationClass)
+			throws FileSystemException
+	{
+		// check validity of passed class
+		if (!FileOperation.class.isAssignableFrom(operationClass))
+		{
+			throw new FileSystemException("vfs.operation/cant-register.error", operationClass);
+		}
+
+		// ok, lets add it to the list
+		operations.add(operationClass);
+	}
+}

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperationProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperationProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/AbstractFileOperationProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/DefaultFileOperations.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/DefaultFileOperations.java?rev=407025&view=auto
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/DefaultFileOperations.java (added)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/DefaultFileOperations.java Tue May 16 12:07:44 2006
@@ -0,0 +1,139 @@
+package org.apache.commons.vfs.operations;
+
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.FileObject;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * todo: add class description here
+ * 
+ * @author Siarhei Baidun
+ * @since 0.1
+ */
+public class DefaultFileOperations implements FileOperations
+{
+	/**
+	 * 
+	 */
+	private FileSystemManager fsmanager;
+
+	/**
+	 * 
+	 */
+	private FileObject fileObject;
+
+	/**
+	 * 
+	 * @param file
+	 */
+	public DefaultFileOperations(final FileObject file)
+	{
+		fileObject = file;
+
+		fsmanager = file.getFileSystem().getFileSystemManager();
+	}
+
+	/**
+	 * @return
+	 * @throws org.apache.commons.vfs.FileSystemException
+	 * 
+	 */
+	public Class[] getOperations() throws FileSystemException
+	{
+
+		final String scheme = fileObject.getURL().getProtocol();
+		final FileOperationProvider[] providers = fsmanager
+				.getOperationProviders(scheme);
+
+		if (providers == null)
+		{
+			return null;
+		}
+
+		final List operations = new ArrayList();
+
+		for (int i = 0; i < providers.length; i++)
+		{
+			FileOperationProvider provider = providers[i];
+
+			provider.collectOperations(operations, fileObject);
+		}
+
+		return (Class[]) operations.toArray(new Class[] {});
+	}
+
+	/**
+	 * @param operationClass
+	 * @return
+	 * @throws org.apache.commons.vfs.FileSystemException
+	 * 
+	 */
+	public FileOperation getOperation(Class operationClass)
+			throws FileSystemException
+	{
+
+		final String scheme = fileObject.getURL().getProtocol();
+		final FileOperationProvider[] providers = fsmanager
+				.getOperationProviders(scheme);
+
+		if (providers == null)
+		{
+			throw new FileSystemException(
+					"vfs.provider/operation-not-supported.error", operationClass);
+		}
+
+		FileOperation resultOperation = null;
+
+		for (int i = 0; i < providers.length; i++)
+		{
+			FileOperationProvider provider = providers[i];
+
+			resultOperation = provider.getOperation(fileObject, operationClass);
+
+			if (resultOperation != null)
+			{
+				break;
+			}
+		}
+
+		if (resultOperation == null)
+		{
+			throw new FileSystemException(
+					"vfs.provider/operation-not-supported.error", operationClass);
+		}
+
+		return resultOperation;
+	}
+
+	/**
+	 * @param operationClass
+	 *            the operation's class.
+	 * 
+	 * @return true if the operation of specified class is supported for current
+	 *         FileObject and false otherwise.
+	 * 
+	 * @throws org.apache.commons.vfs.FileSystemException
+	 * 
+	 */
+	public boolean hasOperation(Class operationClass) throws FileSystemException
+	{
+		Class[] operations = getOperations();
+		if (operations == null)
+		{
+			return false;
+		}
+
+		for (int i = 0; i < operations.length; i++)
+		{
+			Class operation = operations[i];
+			if (operationClass.isAssignableFrom(operation))
+			{
+				return true;
+			}
+		}
+		return false;
+	}
+}

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/DefaultFileOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/DefaultFileOperations.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/DefaultFileOperations.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperation.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperation.java?rev=407025&view=auto
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperation.java (added)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperation.java Tue May 16 12:07:44 2006
@@ -0,0 +1,40 @@
+package org.apache.commons.vfs.operations;
+
+import org.apache.commons.vfs.FileSystemException;
+
+/**
+ * <p>
+ * A FileOperation is an object that brings an extra functions to a FileObject.
+ * The VFS provides the basic functionality to deal with FileObject's. Tha is
+ * create, delete, rename, copy, etc functions. However, if you are working with
+ * FileSystem and its files are, for example, under Version Control System (VCS)
+ * you might want to get an access to the versioning framework and to be able to
+ * manage your files regarding VCS (e.g. commit them, undate, get logs, etc.).
+ * Such type of extended functionality is provided by FileOperation.
+ * </p>
+ * <p>
+ * The FileOperation interface is a genetic interface that should not be
+ * implemented directly. It rather should be extended by other interfaces that
+ * provide some concrete functions.
+ * </p>
+ * <p>
+ * FileOperation is provided by
+ * 
+ * @see FileOperationProvider Especially the FileOperationProvider is responsible
+ *      for looking up and instantiating any concrete FileOperation.
+ *      </p>
+ * 
+ * @author Siarhei Baidun
+ * @since 0.1
+ */
+public interface FileOperation
+{
+
+	/**
+	 * Performs necessary actions that are related to the concrete
+	 * implementation of a FileOperation.
+	 * 
+	 * @throws FileSystemException
+	 */
+	void process() throws FileSystemException;
+}

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperation.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperationProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperationProvider.java?rev=407025&view=auto
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperationProvider.java (added)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperationProvider.java Tue May 16 12:07:44 2006
@@ -0,0 +1,48 @@
+package org.apache.commons.vfs.operations;
+
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+
+import java.util.List;
+import java.util.Collection;
+
+/**
+ * FileOperationProvider is responsible for dealing with FileOperation's.
+ * 
+ * @author Siarhei Baidun
+ * @since 0.1
+ */
+public interface FileOperationProvider
+{
+
+	/**
+	 * Gather available operations for the specified FileObject and put them into
+	 * specified operationsList.
+	 * 
+	 * @param operationsList
+	 *            the list of available operations for the specivied FileObject.
+	 *            The operationList contains classes of available operations, e.g.
+	 *            Class objects.
+	 * @param file
+	 *            the FileObject for which we want to get the list of available
+	 *            operations.
+	 * 
+	 * @throws FileSystemException
+	 *             if list of operations cannto be retrieved.
+	 */
+	void collectOperations(final Collection operationsList, final FileObject file)
+			throws FileSystemException;
+
+	/**
+	 * 
+	 * @param file
+	 *            the FileObject for which we need a operation.
+	 * @param operationClass
+	 *            the Class which instance we are needed.
+	 * @return the requried operation instance. s
+	 * @throws FileSystemException
+	 *             if operation cannot be retrieved.
+	 */
+	FileOperation getOperation(final FileObject file, final Class operationClass)
+			throws FileSystemException;
+}

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperationProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperationProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperationProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperations.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperations.java?rev=407025&view=auto
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperations.java (added)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperations.java Tue May 16 12:07:44 2006
@@ -0,0 +1,32 @@
+package org.apache.commons.vfs.operations;
+
+import org.apache.commons.vfs.FileSystemException;
+
+/**
+ * FileOperations interface provides API to work with operations.
+ * 
+ * @see FileOperation on what a operation in the context of VFS is.
+ * 
+ * @author Siarhei Baidun
+ * @since 0.1
+ */
+public interface FileOperations
+{
+	/**
+	 * @return all operations associated with the fileObject
+	 * @throws FileSystemException
+	 */
+	Class[] getOperations() throws FileSystemException;
+
+	/**
+	 * @return a operation implementing the given <code>operationClass</code>
+	 * @throws FileSystemException
+	 */
+	FileOperation getOperation(Class operationClass) throws FileSystemException;
+
+	/**
+	 * @return if a operation <code>operationClass</code> is available
+	 * @throws FileSystemException
+	 */
+	boolean hasOperation(Class operationClass) throws FileSystemException;
+}

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperations.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/FileOperations.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsAdd.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsAdd.java?rev=407025&view=auto
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsAdd.java (added)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsAdd.java Tue May 16 12:07:44 2006
@@ -0,0 +1,24 @@
+package org.apache.commons.vfs.operations.vcs;
+
+import org.apache.commons.vfs.operations.FileOperation;
+
+/**
+ * todo: add class description here
+ * 
+ * @author Siarhei Baidun
+ * @since 0.1
+ */
+public interface VcsAdd extends FileOperation
+{
+	/**
+	 * 
+	 * @param makedir
+	 */
+	void setMakedir(final boolean makedir);
+
+	/**
+	 * 
+	 * @param recirsive
+	 */
+	void setRecursive(final boolean recirsive);
+}

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsAdd.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsAdd.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsAdd.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsCheckout.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsCheckout.java?rev=407025&view=auto
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsCheckout.java (added)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/operations/vcs/VcsCheckout.java Tue May 16 12:07:44 2006
@@ -0,0 +1,40 @@
+package org.apache.commons.vfs.operations.vcs;
+
+import org.apache.commons.vfs.operations.FileOperation;
+import org.apache.commons.vfs.FileObject;
+
+/**
+ * todo: add class description here
+ * 
+ * @author Siarhei Baidun
+ * @since 0.1
+ */
+public interface VcsCheckout extends FileOperation
+{
+	/**
+	 * 
+	 * @param revision
+	 */
+	void setRevision(final long revision);
+
+	/**
+	 * 
+	 * @param recursive
+	 */
+	void setRecursive(final boolean recursive);
+
+	/**
+	 * 
+	 * @param targetDir
+	 *            directory under which retrieved files should be placed.
+	 */
+	void setTargetDirectory(final FileObject targetDir);
+
+	/**
+	 * @param export
+	 *            if true, administrative .svn directoies will not be created on
+	 *            the retrieved tree. The checkout operation in this case is
+	 *            equivalent to export function.
+	 */
+	void setExport(final boolean export);
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org