Class DefaultFileReplicator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList<java.lang.Object> copies  
      private long filecount  
      private static org.apache.commons.logging.Log log  
      private static int MASK  
      private static java.util.Random random  
      private java.io.File tempDir  
      private boolean tempDirMessageLogged  
      private static char[] TMP_RESERVED_CHARS  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addFile​(java.lang.Object file)  
      java.io.File allocateFile​(java.lang.String baseName)
      Allocates a new temporary file.
      void close()
      Closes the replicator, deleting all temporary files.
      protected java.io.File createAndAddFile​(java.io.File parent, java.lang.String basename)  
      protected java.io.File createFile​(java.io.File parent, java.lang.String name)
      Create the temporary file.
      protected java.lang.String createFilename​(java.lang.String baseName)
      Create the temporary file name.
      protected void deleteFile​(java.io.File file)
      Physically deletes the file from the file system.
      protected long getFilecount()  
      void init()
      Initializes this component.
      protected java.lang.Object removeFile()
      Removes a file from the copies list.
      protected void removeFile​(java.lang.Object file)
      Removes a instance from the list of copies.
      java.io.File replicateFile​(FileObject srcFile, FileSelector selector)
      Creates a local copy of the file, and all its descendants.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        private static final org.apache.commons.logging.Log log
      • random

        private static final java.util.Random random
      • TMP_RESERVED_CHARS

        private static final char[] TMP_RESERVED_CHARS
      • copies

        private final java.util.ArrayList<java.lang.Object> copies
      • filecount

        private long filecount
      • tempDir

        private java.io.File tempDir
      • tempDirMessageLogged

        private boolean tempDirMessageLogged
    • Constructor Detail

      • DefaultFileReplicator

        public DefaultFileReplicator()
      • DefaultFileReplicator

        public DefaultFileReplicator​(java.io.File tempDir)
        Constructor to set the location of the temporary directory.
        Parameters:
        tempDir - The temporary directory.
    • Method Detail

      • addFile

        protected void addFile​(java.lang.Object file)
      • close

        public void close()
        Closes the replicator, deleting all temporary files.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface VfsComponent
        Overrides:
        close in class AbstractVfsComponent
      • createFile

        protected java.io.File createFile​(java.io.File parent,
                                          java.lang.String name)
                                   throws FileSystemException
        Create the temporary file.
        Parameters:
        parent - The file to use as the parent of the file being created.
        name - The name of the file to create.
        Returns:
        The File that was created.
        Throws:
        FileSystemException - if an error occurs creating the file.
      • createFilename

        protected java.lang.String createFilename​(java.lang.String baseName)
        Create the temporary file name.
        Parameters:
        baseName - The base to prepend to the file name being created.
        Returns:
        the name of the File.
      • deleteFile

        protected void deleteFile​(java.io.File file)
        Physically deletes the file from the file system.
        Parameters:
        file - The File to delete.
      • getFilecount

        protected long getFilecount()
      • removeFile

        protected java.lang.Object removeFile()
        Removes a file from the copies list. Will be used for cleanup.

        Notice: The system awaits that the returning object can be cast to a File.

        Returns:
        the File that was removed.
      • removeFile

        protected void removeFile​(java.lang.Object file)
        Removes a instance from the list of copies.
        Parameters:
        file - The File to remove.