TrueZIP 6.8.3

de.schlichtherle.io
Class ArchiveFileSystemController

java.lang.Object
  extended by de.schlichtherle.io.ArchiveController
      extended by de.schlichtherle.io.ArchiveFileSystemController
All Implemented Interfaces:
Archive, Entry
Direct Known Subclasses:
UpdatingArchiveController

abstract class ArchiveFileSystemController
extends ArchiveController

This archive controller implements the automounting functionality. It is up to the sub class to implement the actual mounting/unmounting strategy.

Since:
TrueZIP 6.5
Author:
Christian Schlichtherle

Nested Class Summary
private static class ArchiveFileSystemController.AutoMounter
          Represents the mount state of the archive file system.
private  class ArchiveFileSystemController.FalsePositiveFileSystem
           
private  class ArchiveFileSystemController.MountedFileSystem
           
private  class ArchiveFileSystemController.ResetFileSystem
           
 
Nested classes/interfaces inherited from class de.schlichtherle.io.ArchiveController
ArchiveController.ArchiveEntryFalsePositiveException, ArchiveController.ArchiveEntryNotFoundException, ArchiveController.ArchiveFileNotFoundException, ArchiveController.DirectoryArchiveEntryFalsePositiveException, ArchiveController.FalsePositiveException, ArchiveController.FileArchiveEntryFalsePositiveException, ArchiveController.RfsEntryFalsePositiveException
 
Field Summary
private  ArchiveFileSystemController.AutoMounter autoMounter
          The mount state of the archive file system.
 
Fields inherited from interface de.schlichtherle.io.Entry
ROOT_NAME, SEPARATOR, SEPARATOR_CHAR
 
Constructor Summary
ArchiveFileSystemController(File target, ArchiveController enclController, String enclEntryName, ArchiveDriver driver)
          Creates a new instance of ArchiveFileSystemController
 
Method Summary
(package private)  ArchiveFileSystem autoMount(boolean create)
          Returns the virtual archive file system mounted from the target file.
(package private)  ArchiveEntry createArchiveEntry(String entryName, ArchiveEntry blueprint)
           
(package private)  ArchiveFileSystem getFileSystem()
           
(package private)  boolean isTouched()
          Returns true if and only if the file system has been touched.
(package private) abstract  void mount(boolean create)
          Mounts the virtual file system from the target file.
(package private)  void reset()
          Resets the archive controller to its initial state - all changes to the archive file which have not yet been updated get lost!
(package private)  void setFileSystem(ArchiveFileSystem fileSystem)
           
(package private)  void touch()
          Called by this controller's ArchiveFileSystem to notify it that the file system has been touched.
 
Methods inherited from class de.schlichtherle.io.ArchiveController
autoUmount, canRead, canWrite, createInputStream, createInputStream, createInputStream0, createNewFile, createOutputStream, createOutputStream, createOutputStream0, delete, enclEntryName, exists, getClosedIcon, getDriver, getEnclArchive, getEnclController, getEnclEntryName, getOpenIcon, getPath, getTarget, hasNewData, isDirectory, isFile, isRfsEntryTarget, isRoot, lastModified, length, list, list, listFiles, listFiles, mkdir, readLock, runWriteLocked, setDriver, setLastModified, setReadOnly, setScheduled, toString, umount, waitAllInputStreamsByOtherThreads, waitAllOutputStreamsByOtherThreads, writeLock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

autoMounter

private ArchiveFileSystemController.AutoMounter autoMounter
The mount state of the archive file system.

Constructor Detail

ArchiveFileSystemController

ArchiveFileSystemController(File target,
                            ArchiveController enclController,
                            String enclEntryName,
                            ArchiveDriver driver)
Creates a new instance of ArchiveFileSystemController

Method Detail

isTouched

final boolean isTouched()
Description copied from class: ArchiveController
Returns true if and only if the file system has been touched.

Specified by:
isTouched in class ArchiveController

touch

void touch()
     throws IOException
Called by this controller's ArchiveFileSystem to notify it that the file system has been touched. A file system is touched if an operation has been performed on it which modifies it.

Warning: The write lock of this controller must be acquired while this method is called!

Throws:
IOException

autoMount

final ArchiveFileSystem autoMount(boolean create)
                           throws IOException
Description copied from class: ArchiveController
Returns the virtual archive file system mounted from the target file. This method is reentrant with respect to any exceptions it may throw.

Warning: Either the read or the write lock of this controller must be acquired while this method is called! If only a read lock is acquired, but a write lock is required, this method will temporarily release all locks, so any preconditions must be checked again upon return to protect against concurrent modifications!

Specified by:
autoMount in class ArchiveController
Parameters:
create - If the archive file does not exist and this is true, a new file system with only a virtual root directory is created with its last modification time set to the system's current time.
Returns:
A valid archive file system - null is never returned.
Throws:
ArchiveController.FalsePositiveException
IOException - On any other I/O related issue with the target file or the target file of any enclosing archive file's controller.

getFileSystem

final ArchiveFileSystem getFileSystem()

setFileSystem

final void setFileSystem(ArchiveFileSystem fileSystem)

mount

abstract void mount(boolean create)
             throws IOException
Mounts the virtual file system from the target file. This method is called while the write lock to mount the file system for this controller is acquired.

Upon normal termination, this method is expected to have called ArchiveFileSystemController.ResetFileSystem to assign the fully initialized file system to this controller. Other than this, the method must not have any side effects on the state of this class or its super class. It may, however, have side effects on the state of the sub class.

Parameters:
create - If the archive file does not exist and this is true, a new file system with only a virtual root directory is created with its last modification time set to the system's current time.
Throws:
FalsePositiveException
IOException - On any other I/O related issue with the target file or the target file of any enclosing archive file's controller.

reset

void reset()
     throws IOException
Description copied from class: ArchiveController
Resets the archive controller to its initial state - all changes to the archive file which have not yet been updated get lost! Thereafter, the archive controller will behave as if it has just been created and any subsequent operations on its entries will remount the virtual file system from the archive file again.

This method should be overridden by subclasses, but must still be called when doing so.

Specified by:
reset in class ArchiveController
Throws:
IOException

createArchiveEntry

final ArchiveEntry createArchiveEntry(String entryName,
                                      ArchiveEntry blueprint)
                               throws CharConversionException
Throws:
CharConversionException

TrueZIP 6.8.3

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.