You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rg...@apache.org on 2009/04/13 06:06:06 UTC

svn commit: r764356 [3/11] - in /commons/proper/vfs/trunk: ./ core/src/main/java/org/apache/commons/vfs/ core/src/main/java/org/apache/commons/vfs/auth/ core/src/main/java/org/apache/commons/vfs/cache/ core/src/main/java/org/apache/commons/vfs/events/ ...

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java Mon Apr 13 04:06:01 2009
@@ -62,45 +62,45 @@
  */
 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 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;
 
     /**
      * Class which decorates all returned fileObjects
@@ -109,189 +109,199 @@
     private Constructor fileObjectDecoratorConst;
 
     /**
-	 * 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 == null)
-		{
-			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;
-	}
+     * 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;
+
+    private final Map operationProviders = new HashMap();
+
+    /**
+     * Returns the logger used by this manager.
+     * @return the Logger.
+     */
+    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.
+     * @throws FileSystemException if an error occurs adding 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.
+     * @throws FileSystemException if an error occurs adding 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 == null)
+        {
+            localFileProvider = (LocalFileProvider) provider;
+        }
+    }
+
+    /**
+     * Returns true if this manager has a provider for a particular scheme.
+     * @param scheme The scheme to check.
+     * @return true if a provider is configured for this scheme, false otherwise.
+     */
+    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.
+     * @param provider The FileProvider.
+     * @throws FileSystemException if an error occurs setting the provider.
+     */
+    public void setDefaultProvider(final FileProvider provider)
+            throws FileSystemException
+    {
+        setupComponent(provider);
+        defaultProvider = provider;
+    }
+
+    /**
+     * Returns the filesCache implementation used to cache files.
+     * @return The FilesCache.
+     */
+    public FilesCache getFilesCache()
+    {
+        return filesCache;
+    }
+
+    /**
+     * Sets the filesCache implementation used to cache files
+     * @param filesCache The FilesCache.
+     * @throws FileSystemException if an error occurs setting the cache..
+     */
+    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>
+     *
+     * @param fileCacheStrategy The CacheStrategy to use.
+     * @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
+     * @return The CacheStrategy.
+     */
+    public CacheStrategy getCacheStrategy()
+    {
+        return fileCacheStrategy;
+    }
 
     /**
      * Get the file object decorator used
+     * @return The decorator.
      */
     public Class getFileObjectDecorator()
     {
@@ -301,6 +311,7 @@
     /**
      * The constructor associated to the fileObjectDecorator.
      * We cache it here for performance reasons.
+     * @return The decorator's Constructor.
      */
     public Constructor getFileObjectDecoratorConst()
     {
@@ -312,6 +323,7 @@
      *
      * @param fileObjectDecorator must be inherted from {@link DecoratedFileObject} a has to provide a
      * constructor with a single {@link FileObject} as argument
+     * @throws FileSystemException if an error occurs setting the decorator.
      */
     public void setFileObjectDecorator(Class fileObjectDecorator) throws FileSystemException
     {
@@ -337,759 +349,812 @@
     }
 
     /**
-	 * 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 || buffer.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();
-	}
-
-	/**
-	 * Closes the given filesystem.<br />
-	 * If you use VFS as singleton it is VERY dangerous to call this method
-	 */
-	public void closeFileSystem(FileSystem filesystem)
-	{
-		// inform the cache ...
-		getFilesCache().clear(filesystem);
-
-		// just in case the cache didnt call _closeFileSystem
-		_closeFileSystem(filesystem);
-	}
-
-	/**
-	 * Closes the given filesystem.<br />
-	 * If you use VFS as singleton it is VERY dangerous to call this method
-	 */
-	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[] {});
-	}
+     * get the fileContentInfoFactory used to determine the infos of a file
+     * content.
+     * @return The FileContentInfoFactory.
+     */
+    public FileContentInfoFactory getFileContentInfoFactory()
+    {
+        return fileContentInfoFactory;
+    }
+
+    /**
+     * set the fileContentInfoFactory used to determine the infos of a file
+     * content.
+     * @param fileContentInfoFactory The FileContentInfoFactory.
+     * @throws FileSystemException if an error occurs setting the FileContentInfoFactory.
+     */
+    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.
+     * @param replicator The FileReplicator.
+     * @throws FileSystemException if an error occurs setting the replicator.
+     */
+    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.
+     * @param tempFileStore The temporary FileStore.
+     * @throws FileSystemException if an error occurs adding the file store.
+     */
+    public void setTemporaryFileStore(final TemporaryFileStore tempFileStore)
+            throws FileSystemException
+    {
+        setupComponent(tempFileStore);
+        this.tempFileStore = tempFileStore;
+    }
+
+    /**
+     * Sets the logger to use.
+     * @param log The Logger to use.
+     */
+    public void setLogger(final Log log)
+    {
+        this.log = log;
+    }
+
+    /**
+     * Initialises a component, if it has not already been initialised.
+     * @param component The component to setup.
+     * @throws FileSystemException if an error occurs.
+     */
+    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.
+     * @param component The component to close.
+     */
+    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.
+     * @throws FileSystemException if there is no FileReplicator.
+     */
+    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.
+     * @throws FileSystemException if there is no TemporaryFileStore.
+     */
+    public TemporaryFileStore getTemporaryFileStore()
+            throws FileSystemException
+    {
+        if (tempFileStore == null)
+        {
+            throw new FileSystemException("vfs.impl/no-temp-file-store.error");
+        }
+        return tempFileStore;
+    }
+
+    /**
+     * Initialises this manager.
+     * @throws FileSystemException if an error occurs during initialization.
+     */
+    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.
+     * @param baseFile The new base FileObject.
+     * @throws FileSystemException if an error occurs.
+     */
+    public void setBaseFile(final FileObject baseFile)
+            throws FileSystemException
+    {
+        this.baseFile = baseFile;
+    }
+
+    /**
+     * Sets the base file to use when resolving relative URI.
+     * @param baseFile The new base FileObject.
+     * @throws FileSystemException if an error occurs.
+     */
+    public void setBaseFile(final File baseFile) throws FileSystemException
+    {
+        this.baseFile = getLocalFileProvider().findLocalFile(baseFile);
+    }
+
+    /**
+     * Returns the base file used to resolve relative URI.
+     * @return The FileObject that represents the base file.
+     * @throws FileSystemException if an error occurs.
+     */
+    public FileObject getBaseFile() throws FileSystemException
+    {
+        return baseFile;
+    }
+
+    /**
+     * Locates a file by URI.
+     * @param uri The URI of the file to locate.
+     * @return The FileObject for the located file.
+     * @throws FileSystemException if the file cannot be located or an error occurs.
+     */
+    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.
+     * @param uri The URI of the file to locate.
+     * @param fileSystemOptions The options for the FileSystem.
+     * @return The FileObject for the located file.
+     * @throws FileSystemException if the file cannot be located or an error occurs.
+     */
+
+    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.
+     * @param baseFile The base File to use to locate the file.
+     * @param uri The URI of the file to locate.
+     * @return The FileObject for the located file.
+     * @throws FileSystemException if the file cannot be located or an error occurs.
+     */
+    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.
+     * @param baseFile The base FileOjbect to use to locate the file.
+     * @param uri The URI of the file to locate.
+     * @return The FileObject for the located file.
+     * @throws FileSystemException if the file cannot be located or an error occurs.
+     */
+    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
+     * @param baseFile The base file.
+     * @param uri The file name. May be a fully qualified or relative path or a url.
+     * @param fileSystemOptions Options to pass to the file system.
+     * @return A FileObject representing the target file.
+     * @throws FileSystemException if an error occurs accessing the file.
+     */
+    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.
+     * @param root The base FileName.
+     * @param path The path to the file relative to the base FileName or an absolute path.
+     * @return The constructed FileName.
+     * @throws FileSystemException if an error occurs constructing the FileName.
+     */
+    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}
+     * @return The FileName of the file.
+     * @throws FileSystemException if an error occurs.
+     */
+    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 || buffer.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
+     * @param uri The URI to resolve.
+     * @return The FileName of the file.
+     * @throws FileSystemException if an error occurs.
+     */
+    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}.
+     * @param file The input File.
+     * @return the create FileObject
+     * @throws FileSystemException if an error occurs creating the file naem.
+     */
+    public FileObject toFileObject(final File file) throws FileSystemException
+    {
+        return getLocalFileProvider().findLocalFile(file);
+    }
+
+    /**
+     * Creates a layered file system.
+     * @param scheme The scheme to use.
+     * @param file The FileObject.
+     * @return The layered FileObject.
+     * @throws FileSystemException if an error occurs.
+     */
+    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.
+     * @param file The FileObject to use.
+     * @return The layered FileObject.
+     * @throws FileSystemException if an error occurs.
+     */
+    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.
+     * @return true if the FileSystem can be created.
+     * @throws FileSystemException if an error occurs.
+     */
+    public boolean canCreateFileSystem(final FileObject file)
+            throws FileSystemException
+    {
+        return map.getScheme(file) != null;
+    }
+
+    /**
+     * Creates a virtual file system.
+     * @param rootFile The FileObject to use.
+     * @return The FileObject in the VirtualFileSystem.
+     * @throws FileSystemException if an error occurs creating the file.
+     */
+    public FileObject createVirtualFileSystem(final FileObject rootFile)
+            throws FileSystemException
+    {
+        return vfsProvider.createFileSystem(rootFile);
+    }
+
+    /**
+     * Creates an empty virtual file system.
+     * @param rootUri The URI to use as the root of the FileSystem.
+     * @return A FileObject in the virtual FileSystem.
+     * @throws FileSystemException if an error occurs.
+     */
+    public FileObject createVirtualFileSystem(final String rootUri)
+            throws FileSystemException
+    {
+        return vfsProvider.createFileSystem(rootUri);
+    }
+
+    /**
+     * Locates the local file provider.
+     * @return The LocalFileProvider.
+     * @throws FileSystemException if an error occurs.
+     */
+    private LocalFileProvider getLocalFileProvider() throws FileSystemException
+    {
+        if (localFileProvider == null)
+        {
+            throw new FileSystemException(
+                    "vfs.impl/no-local-file-provider.error");
+        }
+        return localFileProvider;
+    }
+
+    /**
+     * Get the URLStreamHandlerFactory.
+     * @return The URLStreamHandlerFactory.
+     */
+    public URLStreamHandlerFactory getURLStreamHandlerFactory()
+    {
+        return new VfsStreamHandlerFactory();
+    }
+
+    /**
+     * Closes the given filesystem.<br />
+     * If you use VFS as singleton it is VERY dangerous to call this method
+     * @param filesystem The FileSystem to close.
+     */
+    public void closeFileSystem(FileSystem filesystem)
+    {
+        // inform the cache ...
+        getFilesCache().clear(filesystem);
+
+        // just in case the cache didnt call _closeFileSystem
+        _closeFileSystem(filesystem);
+    }
+
+    /**
+     * Closes the given filesystem.<br />
+     * If you use VFS as singleton it is VERY dangerous to call this method
+     * @param filesystem The FileSystem to close.
+     */
+    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.
+     * @return The array of scheme names.
+     */
+    public String[] getSchemes()
+    {
+        String[] schemes = new String[providers.size()];
+        providers.keySet().toArray(schemes);
+        return schemes;
+    }
+
+    /**
+     * Get the capabilities for a given scheme.
+     *
+     * @param scheme The scheme to located.
+     * @return A Collection of capabilities.
+     * @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
+     * @param scheme The scheme to locate.
+     * @return The FileSystemConfigBuilder for the 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 --
+
+    /**
+     * 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 The scheme the provider should be registered for.
+     * @param operationProvider The FileOperationProvider.
+     * @throws FileSystemException if an error occurs adding the provider.
+     */
+    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 The array of schemes the provider should apply to.
+     * @param operationProvider The FileOperationProvider.
+     * @throws FileSystemException if an error occurs.
+     */
+    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 if an error occurs.
+     */
+    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: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultVfsComponentContext.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultVfsComponentContext.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultVfsComponentContext.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/DefaultVfsComponentContext.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,8 @@
     /**
      * Locate a file by name.
      */
-    public FileObject resolveFile(final FileObject baseFile, final String name, final FileSystemOptions fileSystemOptions)
+    public FileObject resolveFile(final FileObject baseFile, final String name,
+                                  final FileSystemOptions fileSystemOptions)
         throws FileSystemException
     {
         return manager.resolveFile(baseFile, name, fileSystemOptions);

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/FileContentInfoFilenameFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/FileContentInfoFilenameFactory.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/FileContentInfoFilenameFactory.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/FileContentInfoFilenameFactory.java Mon Apr 13 04:06:01 2009
@@ -27,7 +27,7 @@
  * The FileContentInfoFilenameFactory.<br>
  * Uses the filename extension to determine the content-type.<br>
  * The content-encoding is not resolved.
- * 
+ *
  * @author <a href="mailto:imario@apache.org">Mario Ivankovits</a>
  * @version $Revision$ $Date$
  */

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/FileTypeMap.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/FileTypeMap.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/FileTypeMap.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/FileTypeMap.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/PrivilegedFileReplicator.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/PrivilegedFileReplicator.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/PrivilegedFileReplicator.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/PrivilegedFileReplicator.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -58,6 +58,7 @@
 
     /**
      * Sets the Logger to use for the component.
+     * @param logger The logger.
      */
     public void setLogger(final Log logger)
     {
@@ -69,6 +70,7 @@
 
     /**
      * Sets the context for the replicator.
+     * @param context The component context.
      */
     public void setContext(final VfsComponentContext context)
     {
@@ -80,6 +82,7 @@
 
     /**
      * Initialises the component.
+     * @throws FileSystemException if an error occurs.
      */
     public void init() throws FileSystemException
     {
@@ -109,6 +112,10 @@
 
     /**
      * Creates a local copy of the file, and all its descendents.
+     * @param srcFile The source FileObject.
+     * @param selector The file selector.
+     * @return The replicated file.
+     * @throws FileSystemException if an error occurs.
      */
     public File replicateFile(FileObject srcFile, FileSelector selector)
         throws FileSystemException
@@ -156,6 +163,7 @@
 
         /**
          * Performs the action.
+         * @throws Exception if an error occurs.
          */
         public Object run() throws Exception
         {

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/ProviderConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/ProviderConfiguration.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/ProviderConfiguration.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/ProviderConfiguration.java Mon Apr 13 04:06:01 2009
@@ -22,15 +22,15 @@
 /**
  * This class describes the configuration for a provider.<br>
  * Used by digester in StandardFileSystemManager
- * 
+ *
  * @author <a href="mailto:imario@apache.org">Mario Ivankovits</a>
  * @version $Revision$ $Date$
  */
 public class ProviderConfiguration
 {
     private String className;
-    private List schemes = new ArrayList(10);
-    private List dependenies = new ArrayList(10);
+    private final List schemes = new ArrayList(10);
+    private final List dependenies = new ArrayList(10);
 
     public ProviderConfiguration()
     {

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/Resource.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/Resource.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/Resource.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/Resource.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java Mon Apr 13 04:06:01 2009
@@ -50,16 +50,17 @@
 public class StandardFileSystemManager
     extends DefaultFileSystemManager
 {
-    private Log log = LogFactory.getLog(StandardFileSystemManager.class);
-
     private static final String CONFIG_RESOURCE = "providers.xml";
     private static final String PLUGIN_CONFIG_RESOURCE = "META-INF/vfs-providers.xml";
 
+    private Log log = LogFactory.getLog(StandardFileSystemManager.class);
+
     private URL configUri;
     private ClassLoader classLoader;
 
     /**
      * Sets the configuration file for this manager.
+     * @param configUri The URI forthis manager.
      */
     public void setConfiguration(final String configUri)
     {
@@ -75,6 +76,7 @@
 
     /**
      * Sets the configuration file for this manager.
+     * @param configUri The URI forthis manager.
      */
     public void setConfiguration(final URL configUri)
     {
@@ -84,6 +86,7 @@
     /**
      * Sets the ClassLoader to use to load the providers.  Default is to
      * use the ClassLoader that loaded this class.
+     * @param classLoader The ClassLoader.
      */
     public void setClassLoader(final ClassLoader classLoader)
     {
@@ -92,6 +95,7 @@
 
     /**
      * Initializes this manager.  Adds the providers and replicator.
+     * @throws FileSystemException if an error occurs.
      */
     public void init() throws FileSystemException
     {
@@ -100,15 +104,15 @@
         setReplicator(new PrivilegedFileReplicator(replicator));
         setTemporaryFileStore(replicator);
 
-		/* replaced by findClassLoader
-		if (classLoader == null)
+        /* replaced by findClassLoader
+        if (classLoader == null)
         {
             // Use default classloader
             classLoader = getClass().getClassLoader();
         }
         */
 
-		if (configUri == null)
+        if (configUri == null)
         {
             // Use default config
             final URL url = getClass().getResource(CONFIG_RESOURCE);
@@ -132,51 +136,54 @@
     /**
      * Scans the classpath to find any droped plugin.<br />
      * The plugin-description has to be in /META-INF/vfs-providers.xml
+     * @throws FileSystemException if an error occurs.
      */
     protected void configurePlugins() throws FileSystemException
     {
-		ClassLoader cl = findClassLoader();
+        ClassLoader cl = findClassLoader();
 
-		Enumeration enumResources = null;
-		try
-		{
-			enumResources = cl.getResources(PLUGIN_CONFIG_RESOURCE);
-		}
-		catch (IOException e)
-		{
-			throw new FileSystemException(e);
-		}
-
-		while (enumResources.hasMoreElements())
-		{
-			URL url = (URL) enumResources.nextElement();
-			configure(url);
-		}
-	}
-
-	private ClassLoader findClassLoader()
-	{
-		if (classLoader != null)
-		{
-			return classLoader;
-		}
-
-		ClassLoader cl = Thread.currentThread().getContextClassLoader();
-		if (cl == null)
-		{
-			cl = getClass().getClassLoader();
-		}
+        Enumeration enumResources;
+        try
+        {
+            enumResources = cl.getResources(PLUGIN_CONFIG_RESOURCE);
+        }
+        catch (IOException e)
+        {
+            throw new FileSystemException(e);
+        }
 
-		return cl;
-	}
+        while (enumResources.hasMoreElements())
+        {
+            URL url = (URL) enumResources.nextElement();
+            configure(url);
+        }
+    }
+
+    private ClassLoader findClassLoader()
+    {
+        if (classLoader != null)
+        {
+            return classLoader;
+        }
+
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null)
+        {
+            cl = getClass().getClassLoader();
+        }
+
+        return cl;
+    }
 
-	protected DefaultFileReplicator createDefaultFileReplicator()
+    protected DefaultFileReplicator createDefaultFileReplicator()
     {
         return new DefaultFileReplicator();
     }
 
     /**
      * Configures this manager from an XML configuration file.
+     * @param configUri The URI of the configuration.
+     * @throws FileSystemException if an error occus.
      */
     private void configure(final URL configUri) throws FileSystemException
     {
@@ -213,8 +220,12 @@
 
     /**
      * Configures this manager from an XML configuration file.
+     * @param configUri The URI of the configuration.
+     * @param configStream An InputStream containing the configuration.
+     * @throws FileSystemException if an error occurs.
      */
-    private void configure(final String configUri, final InputStream configStream) throws FileSystemException
+    private void configure(final String configUri, final InputStream configStream)
+            throws FileSystemException
     {
         try
         {
@@ -234,6 +245,8 @@
 
     /**
      * Configure and create a DocumentBuilder
+     * @return A DocumentBuilder for the configuration.
+     * @throws ParserConfigurationException if an error occurs.
      */
     private DocumentBuilder createDocumentBuilder() throws ParserConfigurationException
     {
@@ -241,12 +254,13 @@
         factory.setIgnoringElementContentWhitespace(true);
         factory.setIgnoringComments(true);
         factory.setExpandEntityReferences(true);
-        final DocumentBuilder builder = factory.newDocumentBuilder();
-        return builder;
+        return  factory.newDocumentBuilder();
     }
 
     /**
      * Configures this manager from an parsed XML configuration file
+     * @param config The configuration Element.
+     * @throws FileSystemException if an error occurs.
      */
     private void configure(final Element config) throws FileSystemException
     {
@@ -294,6 +308,7 @@
 
     /**
      * Adds an extension map.
+     * @param map containing the Elements.
      */
     private void addExtensionMap(final Element map)
     {
@@ -307,6 +322,7 @@
 
     /**
      * Adds a mime-type map.
+     * @param map containing the Elements.
      */
     private void addMimeTypeMap(final Element map)
     {
@@ -317,6 +333,9 @@
 
     /**
      * Adds a provider from a provider definition.
+     * @param providerDef the provider definition
+     * @param isDefault true if the default should be used.
+     * @throws FileSystemException if an error occurs.
      */
     private void addProvider(final Element providerDef, final boolean isDefault)
         throws FileSystemException
@@ -381,7 +400,7 @@
             if (hasProvider(schema))
             {
                 final FileOperationProvider operationProvider = (FileOperationProvider) createInstance(classname);
-            	addOperationProvider(schema, operationProvider);
+                addOperationProvider(schema, operationProvider);
             }
         }
     }
@@ -474,4 +493,4 @@
             throw new FileSystemException("vfs.impl/create-provider.error", className, e);
         }
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/SynchronizedFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/SynchronizedFileObject.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/SynchronizedFileObject.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/SynchronizedFileObject.java Mon Apr 13 04:06:01 2009
@@ -33,160 +33,160 @@
  */
 public class SynchronizedFileObject extends DecoratedFileObject
 {
-	public SynchronizedFileObject(FileObject fileObject)
-	{
-		super(fileObject);
-	}
+        public SynchronizedFileObject(FileObject fileObject)
+        {
+                super(fileObject);
+        }
 
-	public void close() throws FileSystemException
+        public void close() throws FileSystemException
     {
-        synchronized(this)
+        synchronized (this)
         {
-		    super.close();
+                    super.close();
         }
     }
 
-	public void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException
-	{
-        synchronized(this)
+        public void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException
+        {
+        synchronized (this)
         {
-    		super.copyFrom(srcFile, selector);
+                super.copyFrom(srcFile, selector);
         }
     }
 
-	public void createFile() throws FileSystemException
-	{
-        synchronized(this)
+        public void createFile() throws FileSystemException
         {
-    		super.createFile();
+        synchronized (this)
+        {
+                super.createFile();
         }
     }
 
-	public void createFolder() throws FileSystemException
-	{
-        synchronized(this)
+        public void createFolder() throws FileSystemException
+        {
+        synchronized (this)
         {
-    		super.createFolder();
+                super.createFolder();
         }
     }
 
-	public boolean delete() throws FileSystemException
-	{
-        synchronized(this)
+        public boolean delete() throws FileSystemException
         {
-    		return super.delete();
+        synchronized (this)
+        {
+                return super.delete();
         }
     }
 
-	public int delete(FileSelector selector) throws FileSystemException
-	{
-        synchronized(this)
+        public int delete(FileSelector selector) throws FileSystemException
+        {
+        synchronized (this)
         {
-    		return super.delete(selector);
+                return super.delete(selector);
         }
     }
 
-	public boolean exists() throws FileSystemException
-	{
-        synchronized(this)
+        public boolean exists() throws FileSystemException
+        {
+        synchronized (this)
         {
-    		return super.exists();
+                return super.exists();
         }
     }
 
-	public void findFiles(FileSelector selector, boolean depthwise, List selected) throws FileSystemException
-	{
-        synchronized(this)
+        public void findFiles(FileSelector selector, boolean depthwise, List selected) throws FileSystemException
         {
-    		super.findFiles(selector, depthwise, selected);
+        synchronized (this)
+        {
+                super.findFiles(selector, depthwise, selected);
         }
     }
 
-	public FileObject[] findFiles(FileSelector selector) throws FileSystemException
-	{
-        synchronized(this)
+        public FileObject[] findFiles(FileSelector selector) throws FileSystemException
+        {
+        synchronized (this)
         {
-    		return super.findFiles(selector);
+                return super.findFiles(selector);
         }
     }
 
-	public FileObject getChild(String name) throws FileSystemException
-	{
-        synchronized(this)
+        public FileObject getChild(String name) throws FileSystemException
         {
-    		return super.getChild(name);
+        synchronized (this)
+        {
+                return super.getChild(name);
         }
     }
 
-	public FileObject[] getChildren() throws FileSystemException
-	{
-        synchronized(this)
+        public FileObject[] getChildren() throws FileSystemException
+        {
+        synchronized (this)
         {
-    		return super.getChildren();
+                return super.getChildren();
         }
     }
 
-	public FileContent getContent() throws FileSystemException
-	{
-        synchronized(this)
+        public FileContent getContent() throws FileSystemException
+        {
+        synchronized (this)
         {
-    		return super.getContent();
+                return super.getContent();
         }
     }
 
-	public FileType getType() throws FileSystemException
-	{
-        synchronized(this)
+        public FileType getType() throws FileSystemException
         {
-    		return super.getType();
+        synchronized (this)
+        {
+                return super.getType();
         }
     }
 
-	public boolean isHidden() throws FileSystemException
-	{
-        synchronized(this)
+        public boolean isHidden() throws FileSystemException
+        {
+        synchronized (this)
         {
-    		return super.isHidden();
+                return super.isHidden();
         }
     }
 
-	public boolean isReadable() throws FileSystemException
-	{
-        synchronized(this)
+        public boolean isReadable() throws FileSystemException
         {
-    		return super.isReadable();
+        synchronized (this)
+        {
+                return super.isReadable();
         }
     }
 
-	public boolean isWriteable() throws FileSystemException
-	{
-        synchronized(this)
+        public boolean isWriteable() throws FileSystemException
+        {
+        synchronized (this)
         {
-    		return super.isWriteable();
+                return super.isWriteable();
         }
     }
 
-	public void moveTo(FileObject destFile) throws FileSystemException
-	{
-        synchronized(this)
+        public void moveTo(FileObject destFile) throws FileSystemException
+        {
+        synchronized (this)
         {
-    		super.moveTo(destFile);
+                super.moveTo(destFile);
         }
     }
 
-	public FileObject resolveFile(String name, NameScope scope) throws FileSystemException
-	{
-        synchronized(this)
+        public FileObject resolveFile(String name, NameScope scope) throws FileSystemException
         {
-    		return super.resolveFile(name, scope);
+        synchronized (this)
+        {
+                return super.resolveFile(name, scope);
         }
     }
 
-	public FileObject resolveFile(String path) throws FileSystemException
-	{
-        synchronized(this)
+        public FileObject resolveFile(String path) throws FileSystemException
+        {
+        synchronized (this)
         {
-    		return super.resolveFile(path);
+                return super.resolveFile(path);
         }
     }
 }

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/URLStreamHandlerProxy.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/URLStreamHandlerProxy.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/URLStreamHandlerProxy.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/URLStreamHandlerProxy.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/VFSClassLoader.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/VFSClassLoader.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/VFSClassLoader.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/impl/VFSClassLoader.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,7 +19,6 @@
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileSystemManager;
-import org.apache.commons.vfs.FileType;
 import org.apache.commons.vfs.NameScope;
 
 import java.io.IOException;
@@ -40,7 +39,7 @@
 /**
  * A class loader that can load classes and resources from a search path
  * VFS FileObjects refering both to folders and JAR files. Any FileObject
- * of type {@link FileType#FILE} is asumed to be a JAR and is opened
+ * of type FileType.FILE is asumed to be a JAR and is opened
  * by creating a layered file system with the "jar" scheme.
  * </p><p>
  * TODO - Test this with signed Jars and a SecurityManager.
@@ -49,8 +48,7 @@
  * @version $Revision$ $Date$
  * @see FileSystemManager#createFileSystem
  */
-public class VFSClassLoader
-    extends SecureClassLoader
+public class VFSClassLoader extends SecureClassLoader
 {
     private final ArrayList resources = new ArrayList();
 
@@ -60,6 +58,7 @@
      * @param file    the file to load the classes and resources from.
      * @param manager the FileManager to use when trying create a layered Jar file
      *                system.
+     * @throws FileSystemException if an error occurs.
      */
     public VFSClassLoader(final FileObject file,
                           final FileSystemManager manager)
@@ -75,6 +74,7 @@
      * @param manager the FileManager to use when trying create a layered Jar file
      *                system.
      * @param parent  the parent class loader for delegation.
+     * @throws FileSystemException if an error occurs.
      */
     public VFSClassLoader(final FileObject file,
                           final FileSystemManager manager,
@@ -91,6 +91,7 @@
      * @param files   the files to load the classes and resources from.
      * @param manager the FileManager to use when trying create a layered Jar file
      *                system.
+     * @throws FileSystemException if an error occurs.
      */
     public VFSClassLoader(final FileObject[] files,
                           final FileSystemManager manager)
@@ -107,6 +108,7 @@
      * @param manager the FileManager to use when trying create a layered Jar file
      *                system.
      * @param parent  the parent class loader for delegation.
+     * @throws FileSystemException if an error occurs.
      */
     public VFSClassLoader(final FileObject[] files,
                           final FileSystemManager manager,
@@ -116,19 +118,22 @@
         addFileObjects(manager, files);
     }
 
-	/**
-	 * provide access to the file objects this class loader represents 
-	 */
-	public FileObject[] getFileObjects()
-	{
-		return (FileObject[]) resources.toArray(new FileObject[resources.size()]);
-	}
+    /**
+     * provide access to the file objects this class loader represents
+     * @return An array of FileObjects.
+     */
+    public FileObject[] getFileObjects()
+    {
+        return (FileObject[]) resources.toArray(new FileObject[resources.size()]);
+    }
 
-	/**
+    /**
      * Appends the specified FileObjects to the list of FileObjects to search
      * for classes and resources.
      *
+     * @param manager The FileSystemManager.
      * @param files the FileObjects to append to the search path.
+     * @throws FileSystemException if an error occurs.
      */
     private void addFileObjects(final FileSystemManager manager,
                                 final FileObject[] files) throws FileSystemException
@@ -260,6 +265,8 @@
     /**
      * Calls super.getPermissions both for the code source and also
      * adds the permissions granted to the parent layers.
+     * @param cs the CodeSource.
+     * @return The PermissionCollections.
      */
     protected PermissionCollection getPermissions(final CodeSource cs)
     {
@@ -303,6 +310,8 @@
 
     /**
      * Copies the permissions from src to dest.
+     * @param src The source PermissionCollection.
+     * @param dest The destination PermissionCollection.
      */
     protected void copyPermissions(final PermissionCollection src,
                                    final PermissionCollection dest)
@@ -335,6 +344,8 @@
     /**
      * Finds the resource with the specified name from the search path.
      * This returns null if the resource is not found.
+     * @param name The resource name.
+     * @return The URL that matches the resource.
      */
     protected URL findResource(final String name)
     {
@@ -359,6 +370,8 @@
      * Returns an Enumeration of all the resources in the search path
      * with the specified name.
      * TODO - Implement this.
+     * @param name The resources to find.
+     * @return An Enumeration of the resources associated with the name.
      */
     protected Enumeration findResources(final String name)
     {
@@ -379,6 +392,9 @@
     /**
      * Searches through the search path of for the first class or resource
      * with specified name.
+     * @param name The resource to load.
+     * @return The Resource.
+     * @throws FileSystemException if an error occurs.
      */
     private Resource loadResource(final String name) throws FileSystemException
     {