TrueZIP Kernel 7.0-rc2

de.schlichtherle.truezip.fs.archive
Class FsFileSystemArchiveController<E extends FsArchiveEntry>

java.lang.Object
  extended by de.schlichtherle.truezip.fs.FsController<FsConcurrentModel>
      extended by de.schlichtherle.truezip.fs.archive.FsArchiveController<E>
          extended by de.schlichtherle.truezip.fs.archive.FsFileSystemArchiveController<E>
Type Parameters:
E - The type of the archive entries.
Direct Known Subclasses:
FsDefaultArchiveController

@NotThreadSafe
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
abstract class FsFileSystemArchiveController<E extends FsArchiveEntry>
extends FsArchiveController<E>

This abstract archive controller controls the mount state transition. It is up to the sub class to implement the actual mounting/unmounting strategy.

Author:
Christian Schlichtherle

Nested Class Summary
private  class FsFileSystemArchiveController.FalsePositiveFileSystem
           
private  class FsFileSystemArchiveController.MountedFileSystem
           
private static class FsFileSystemArchiveController.MountState<E extends FsArchiveEntry>
          Represents the mount state of the archive file system.
private  class FsFileSystemArchiveController.ResetFileSystem
           
 
Field Summary
private  FsFileSystemArchiveController.MountState<E> mountState
          The mount state of the archive file system.
 
Constructor Summary
FsFileSystemArchiveController(FsConcurrentModel model)
          Creates a new instance of FsFileSystemArchiveController
 
Method Summary
(package private)  FsArchiveFileSystem<E> autoMount(boolean autoCreate, BitField<FsOutputOption> options)
          Returns the (virtual) archive file system mounted from the target archive file.
(package private)  FsArchiveFileSystem<E> getFileSystem()
           
(package private) abstract  void mount(boolean autoCreate, BitField<FsOutputOption> options)
          Mounts the (virtual) archive file system from the target file.
(package private)  void setFileSystem(FsArchiveFileSystem<E> fileSystem)
           
 
Methods inherited from class de.schlichtherle.truezip.fs.archive.FsArchiveController
autoMount, autoSync, getEntry, getInputSocket, getInputSocket, getModel, getOutputSocket, getOutputSocket, isReadable, isReadOnly, isWritable, mknod, setReadOnly, setTime, unlink
 
Methods inherited from class de.schlichtherle.truezip.fs.FsController
equals, getClosedIcon, getOpenIcon, getParent, hashCode, sync, sync, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mountState

private FsFileSystemArchiveController.MountState<E extends FsArchiveEntry> mountState
The mount state of the archive file system.

Constructor Detail

FsFileSystemArchiveController

FsFileSystemArchiveController(FsConcurrentModel model)
Creates a new instance of FsFileSystemArchiveController

Method Detail

autoMount

final FsArchiveFileSystem<E> autoMount(boolean autoCreate,
                                       BitField<FsOutputOption> options)
                                                       throws IOException
Description copied from class: FsArchiveController
Returns the (virtual) archive file system mounted from the target archive 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 FsArchiveController<E extends FsArchiveEntry>
Parameters:
autoCreate - 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:
FsFalsePositiveException
IOException

getFileSystem

@Nullable
final FsArchiveFileSystem<E> getFileSystem()

setFileSystem

final void setFileSystem(@CheckForNull
                         FsArchiveFileSystem<E> fileSystem)

mount

abstract void mount(boolean autoCreate,
                    BitField<FsOutputOption> options)
             throws IOException
Mounts the (virtual) archive 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 FsFileSystemArchiveController.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:
autoCreate - 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:
IOException

TrueZIP Kernel 7.0-rc2

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