Class AbstractFileSystem

    • Method Detail

      • closeCommunicationLink

        public void closeCommunicationLink()
        Close the underlying link used to access the files.
      • doCloseCommunicationLink

        protected void doCloseCommunicationLink()
        Close the underlying link used to access the files
      • createFile

        protected abstract FileObject createFile​(AbstractFileName name)
                                          throws java.lang.Exception
        Creates a file object.

        This method is called only if the requested file is not cached.

        Parameters:
        name - name referencing the new file.
        Returns:
        new created FileObject.
        Throws:
        java.lang.Exception - might throw an Exception, which is then wrapped in FileSystemException.
      • addCapabilities

        protected abstract void addCapabilities​(java.util.Collection<Capability> caps)
        Adds the capabilities of this file system.
        Parameters:
        caps - collections of Capabilities, can be immutable.
      • getRootName

        public FileName getRootName()
        Returns the name of the root of this file system.
        Specified by:
        getRootName in interface FileSystem
        Returns:
        the root FileName.
      • getRootURI

        public java.lang.String getRootURI()
        Returns the root URI specified for this file System.
        Specified by:
        getRootURI in interface FileSystem
        Returns:
        The root URI used in this file system.
        Since:
        2.0
      • putFileToCache

        protected void putFileToCache​(FileObject file)
        Adds a file object to the cache.
        Parameters:
        file - the file to add.
      • getFileFromCache

        protected FileObject getFileFromCache​(FileName name)
        Returns a cached file.
        Parameters:
        name - name to search for.
        Returns:
        file object or null if not found.
      • removeFileFromCache

        protected void removeFileFromCache​(FileName name)
        Remove a cached file.
        Parameters:
        name - The file name to remove.
      • hasCapability

        public boolean hasCapability​(Capability capability)
        Determines if this file system has a particular capability.
        Specified by:
        hasCapability in interface FileSystem
        Parameters:
        capability - the Capability to check for.
        Returns:
        true if the FileSystem has the Capability, false otherwise.
      • resolveFile

        public FileObject resolveFile​(java.lang.String nameStr)
                               throws FileSystemException
        Finds a file in this file system.
        Specified by:
        resolveFile in interface FileSystem
        Parameters:
        nameStr - The name of the file to resolve.
        Returns:
        The located FileObject or null if none could be located.
        Throws:
        FileSystemException - if an error occurs.
      • getLastModTimeAccuracy

        public double getLastModTimeAccuracy()
        Returns the accuracy of the last modification time.
        Specified by:
        getLastModTimeAccuracy in interface FileSystem
        Returns:
        ms 0 perfectly accurate, >0 might be off by this value e.g. sftp 1000ms
      • doReplicateFile

        protected java.io.File doReplicateFile​(FileObject file,
                                               FileSelector selector)
                                        throws java.lang.Exception
        Creates a temporary local copy of a file and its descendants.
        Parameters:
        file - the start of the tree.
        selector - selection what to do with childs.
        Returns:
        replicated root file.
        Throws:
        java.lang.Exception - any Exception is wrapped as FileSystemException.
      • addJunction

        public void addJunction​(java.lang.String junctionPoint,
                                FileObject targetFile)
                         throws FileSystemException
        Adds a junction to this file system.
        Specified by:
        addJunction in interface FileSystem
        Parameters:
        junctionPoint - The junction point.
        targetFile - The target to add.
        Throws:
        FileSystemException - if an error occurs.
      • addListener

        public void addListener​(FileObject file,
                                FileListener listener)
        Adds a listener on a file in this file system.
        Specified by:
        addListener in interface FileSystem
        Parameters:
        file - The FileObject to be monitored.
        listener - The FileListener
      • removeListener

        public void removeListener​(FileObject file,
                                   FileListener listener)
        Removes a listener from a file in this file system.
        Specified by:
        removeListener in interface FileSystem
        Parameters:
        file - The FileObject to be monitored.
        listener - The FileListener
      • fireFileCreated

        public void fireFileCreated​(FileObject file)
        Fires a file create event.
        Parameters:
        file - The FileObject that was created.
      • fireFileDeleted

        public void fireFileDeleted​(FileObject file)
        Fires a file delete event.
        Parameters:
        file - The FileObject that was deleted.
      • fireFileChanged

        public void fireFileChanged​(FileObject file)
        Fires a file changed event.

        This will only happen if you monitor the file using FileMonitor.

        Parameters:
        file - The FileObject that changed.
      • isReleaseable

        public boolean isReleaseable()
        Returns true if no file is using this filesystem.
        Returns:
        true if no file is using this FileSystem.
      • notifyAllStreamsClosed

        protected void notifyAllStreamsClosed()
        will be called after all file-objects closed their streams.
      • isOpen

        public boolean isOpen()
        check if this filesystem has open streams.
        Returns:
        true if the FileSystem has open streams.