TrueZIP Kernel 7.0-rc2

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

java.lang.Object
  extended by de.schlichtherle.truezip.fs.FsDriver
      extended by de.schlichtherle.truezip.fs.archive.FsArchiveDriver<E>
Type Parameters:
E - The type of the archive entries.
All Implemented Interfaces:
EntryFactory<E>
Direct Known Subclasses:
FsCharsetArchiveDriver

@Immutable
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public abstract class FsArchiveDriver<E extends FsArchiveEntry>
extends FsDriver
implements EntryFactory<E>

An abstract archive driver which provides access to a federated file system which is persistet in an archive file format like ZIP, JAR, TZP, TAR, TAR.GZ, TAR.BZ2 etc.

Author:
Christian Schlichtherle

Constructor Summary
FsArchiveDriver()
           
 
Method Summary
 Icon getClosedIcon(FsConcurrentModel model)
          Returns the icon that should be displayed for the given archive file if it's closed/collapsed in the view.
 Icon getOpenIcon(FsConcurrentModel model)
          Returns the icon that should be displayed for the given archive file if it's open/expanded in the view.
abstract  IOPool<?> getPool()
          Returns the I/O pool to use for allocating temporary I/O entries.
 boolean isFederated()
          Returns true iff this file system driver implements a federated file system type, i.e. if the type of file system must be a member of a parent file system.
 FsController<?> newController(FsModel model, FsController<?> parent)
          Returns a new thread-safe file system controller for the given mount point and parent file system controller.
abstract  InputShop<E> newInputShop(FsConcurrentModel model, InputSocket<?> input)
          Creates a new input shop for reading the archive entries of the the described archive from the given input socket's target.
abstract  OutputShop<E> newOutputShop(FsConcurrentModel model, OutputSocket<?> output, InputShop<E> source)
          Creates a new output shop for writing archive entries to the the described archive to the given output socket's target.
 
Methods inherited from class de.schlichtherle.truezip.fs.FsDriver
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.schlichtherle.truezip.entry.EntryFactory
newEntry
 

Constructor Detail

FsArchiveDriver

public FsArchiveDriver()
Method Detail

isFederated

public final boolean isFederated()
Returns true iff this file system driver implements a federated file system type, i.e. if the type of file system must be a member of a parent file system.

The implementation in the class FsDriver returns false.

The implementation in the class FsArchiveDriver always returns true. This can't get overridden.

Overrides:
isFederated in class FsDriver
Returns:
true iff the type of the file system implemented by this file system driver is federated, i.e. must be a member of a parent file system.

getPool

public abstract IOPool<?> getPool()
Returns the I/O pool to use for allocating temporary I/O entries.

Returns:
The I/O pool to use for allocating temporary I/O entries.

newController

public FsController<?> newController(FsModel model,
                                     FsController<?> parent)
Returns a new thread-safe file system controller for the given mount point and parent file system controller.

When called, the following expression is a precondition: mountPoint.getParent().equals(parent.getModel().getMountPoint())

Note that an archive file system is always federated and therefore its parent file system controller is never null.

Furthermore, an archive driver implementation is not expected to consider the scheme of the given mount point to determine the class of the returned file system controller. Consequently, it is an error to call this method with a mount point which has a scheme which is not supported by this archive driver.

Note again that the returned file system controller must be thread-safe!

Specified by:
newController in class FsDriver
Parameters:
model - the file system model.
parent - the nullable parent file system controller.
Returns:
A new thread-safe file system controller for the given mount point and parent file system controller.

newInputShop

public abstract InputShop<E> newInputShop(FsConcurrentModel model,
                                          InputSocket<?> input)
                                                          throws IOException
Creates a new input shop for reading the archive entries of the the described archive from the given input socket's target.

Parameters:
model - the concurrent file system model.
input - the input socket for reading the contents of the archive from its target.
Returns:
A new input shop.
Throws:
TabuFileException - if the target archive file is temporarily not accessible, e.g. if a key for decryption is currently not available. The client application will recognize the target archive file as a tabu file until a subsequent repetition of this method call succeeds. A tabu file will not be accessible through the API although it exists.
FileNotFoundException - if the target archive file does not exist or is (temporarily) not accessible. An exception of this type marks a transient cause, i.e. this method may get subsequently called until it succeeds.
IOException - if the target archive file is a false positive archive file. An exception of this type marks a persistent cause, i.e. this method will not get called again until the archive file system is synchronized with its parent file system.

newOutputShop

public abstract OutputShop<E> newOutputShop(FsConcurrentModel model,
                                            OutputSocket<?> output,
                                            @CheckForNull
                                            InputShop<E> source)
                                                            throws IOException
Creates a new output shop for writing archive entries to the the described archive to the given output socket's target.

Parameters:
model - the concurrent file system model.
output - the output socket for writing the contents of the archive to its target.
source - the InputShop if archive is going to get updated. If not null, this is guaranteed to be a product of this driver's newInputShop(de.schlichtherle.truezip.fs.FsConcurrentModel, de.schlichtherle.truezip.socket.InputSocket) factory method, which may be used to copy some meta data which is specific to the type of archive this driver supports. For example, this could be used to copy the comment of a ZIP file.
Returns:
A new output shop.
Throws:
FileNotFoundException - if the target archive file does not exist or is (temporarily) not accessible. An exception of this type marks a transient cause, i.e. this method may get subsequently called until it succeeds.
IOException - if the target archive file is a false positive archive file. An exception of this type marks a persistent cause, i.e. this method will not get called again until the archive file system is synchronized with its parent file system.

getOpenIcon

@CheckForNull
public Icon getOpenIcon(FsConcurrentModel model)
Returns the icon that should be displayed for the given archive file if it's open/expanded in the view.

The implementation in the abstract class FsArchiveDriver simply returns null.

Parameters:
model - the concurrent file system model.
Returns:
The icon that should be displayed for the given archive file if it's open/expanded in the view. If null is returned, a default icon should be displayed.

getClosedIcon

@CheckForNull
public Icon getClosedIcon(FsConcurrentModel model)
Returns the icon that should be displayed for the given archive file if it's closed/collapsed in the view.

The implementation in the abstract class FsArchiveDriver simply returns null.

Parameters:
model - the concurrent file system model.
Returns:
The icon that should be displayed for the given archive file if it's closed/collapsed in the view. If null is returned, a default icon should be displayed.

TrueZIP Kernel 7.0-rc2

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