commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test AbstractFileSystemTestCase.java
Date Fri, 01 Nov 2002 03:29:31 GMT
adammurdoch    2002/10/31 19:29:31

  Modified:    vfs/src/java/org/apache/commons/vfs/impl
                        DefaultFileSystemManager.java
                        StandardFileSystemManager.java
               vfs/src/java/org/apache/commons/vfs FileSystemManager.java
                        Resources.properties
               vfs/src/test/org/apache/commons/vfs/test
                        AbstractFileSystemTestCase.java
  Log:
  - Added FileSystemManager.createFileSystem(), which allows virtual file systems to be created.
  - Added DefaultFileSystemManager.init().
  
  Revision  Changes    Path
  1.15      +37 -0     jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java
  
  Index: DefaultFileSystemManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/DefaultFileSystemManager.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DefaultFileSystemManager.java	28 Oct 2002 02:05:06 -0000	1.14
  +++ DefaultFileSystemManager.java	1 Nov 2002 03:29:31 -0000	1.15
  @@ -86,6 +86,7 @@
    * <li>Set the file replicator using {@link #setReplicator} (optional).
    * <li>Set the temporary file store using {@link #setTemporaryFileStore} (optional).
    * <li>Set the base file using {@link #setBaseFile} (optional).
  + * <li>Initialise the manager using {@link #init}.
    * </ul>
    *
    * <p>When finished with the manager, call its {@link #close} method to clean
  @@ -126,6 +127,9 @@
   
       private TemporaryFileStore tempFileStore;
   
  +    private final VirtualFileProvider vfsProvider = new VirtualFileProvider();
  +    private boolean init;
  +
       /**
        * Returns the logger used by this manager.
        */
  @@ -294,11 +298,25 @@
       }
   
       /**
  +     * Initialises this manager.
  +     */
  +    public void init() throws FileSystemException
  +    {
  +        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(); )
           {
  @@ -317,6 +335,7 @@
           defaultProvider = null;
           fileReplicator = null;
           tempFileStore = null;
  +        init = false;
       }
   
       /**
  @@ -433,6 +452,24 @@
               throw new FileSystemException( "vfs.impl/unknown-provider.error", scheme );
           }
           return provider.createFileSystem( scheme, file );
  +    }
  +
  +    /**
  +     * Creates a virtual file system.
  +     */
  +    public FileObject createFileSystem( final FileObject rootFile )
  +        throws FileSystemException
  +    {
  +        return vfsProvider.createFileSystem( rootFile );
  +    }
  +
  +    /**
  +     * Creates an empty virtual file system.
  +     */
  +    public FileObject createFileSystem( final String rootUri )
  +        throws FileSystemException
  +    {
  +        return vfsProvider.createFileSystem( rootUri );
       }
   
       /**
  
  
  
  1.4       +4 -3      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java
  
  Index: StandardFileSystemManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/impl/StandardFileSystemManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardFileSystemManager.java	28 Oct 2002 02:05:06 -0000	1.3
  +++ StandardFileSystemManager.java	1 Nov 2002 03:29:31 -0000	1.4
  @@ -57,7 +57,6 @@
   
   import org.apache.commons.vfs.FileSystemException;
   import org.apache.commons.vfs.util.Messages;
  -import org.apache.commons.vfs.provider.FileReplicator;
   import org.apache.commons.vfs.provider.FileProvider;
   
   /**
  @@ -84,7 +83,7 @@
       public void init() throws FileSystemException
       {
           // Set the replicator and temporary file store (use the same component)
  -        DefaultFileReplicator replicator = new DefaultFileReplicator();
  +        final DefaultFileReplicator replicator = new DefaultFileReplicator();
           setReplicator( new PrivilegedFileReplicator( replicator ) );
           setTemporaryFileStore( replicator );
   
  @@ -102,6 +101,8 @@
           {
               setDefaultProvider( provider );
           }
  +
  +        super.init();
       }
   
       /**
  
  
  
  1.8       +25 -0     jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/FileSystemManager.java
  
  Index: FileSystemManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/FileSystemManager.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FileSystemManager.java	25 Oct 2002 03:57:29 -0000	1.7
  +++ FileSystemManager.java	1 Nov 2002 03:29:31 -0000	1.8
  @@ -203,6 +203,31 @@
           throws FileSystemException;
   
       /**
  +     * Creates an empty virtual file system.  Can be populated by adding
  +     * junctions to it.
  +     *
  +     * @param rootUri
  +     *          The root URI to use for the new file system.  Can be null.
  +     *
  +     * @return
  +     *          The root file of the new file system.
  +     */
  +    FileObject createFileSystem( String rootUri )
  +        throws FileSystemException;
  +
  +    /**
  +     * Creates a virtual file system.  The file system will contain a junction
  +     * at the fs root to the supplied root file.
  +     *
  +     * @param rootFile The root file to backs the file system.
  +     *
  +     * @return
  +     *          The root of the new file system.
  +     */
  +    FileObject createFileSystem( FileObject rootFile )
  +        throws FileSystemException;
  +
  +    /**
        * Returns a streamhandler factory to enable URL lookup using this
        * FileSystemManager.
        */
  
  
  
  1.11      +1 -0      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/Resources.properties,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Resources.properties	31 Oct 2002 10:35:18 -0000	1.10
  +++ Resources.properties	1 Nov 2002 03:29:31 -0000	1.11
  @@ -55,6 +55,7 @@
   vfs.provider/not-layered-fs.error=File system for URL scheme "{0}" is not a layered file
system.
   
   # AbstractFileSystem
  +vfs.provider/mismatched-fs-for-name.error=Incorrect file system URI for in name "{0}",
was expecting "{1}".
   vfs.provider/junctions-not-supported.error=Junctions not supported for file system "{0}".
   vfs.provider/notify-listener.warn=Could not notify listener of change to "{0}".
   
  
  
  
  1.17      +2 -0      jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/AbstractFileSystemTestCase.java
  
  Index: AbstractFileSystemTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/AbstractFileSystemTestCase.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AbstractFileSystemTestCase.java	25 Oct 2002 11:11:51 -0000	1.16
  +++ AbstractFileSystemTestCase.java	1 Nov 2002 03:29:31 -0000	1.17
  @@ -186,6 +186,8 @@
           manager.setReplicator( new PrivilegedFileReplicator( replicator ) );
           manager.setTemporaryFileStore( replicator );
   
  +        manager.init();
  +
           // Locate the base folder
           baseFolder = getBaseFolder();
   
  
  
  

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


Mime
View raw message