TrueZIP Kernel 7.0-rc1

de.schlichtherle.truezip.fs
Class FsManager

java.lang.Object
  extended by de.schlichtherle.truezip.fs.FsManager
All Implemented Interfaces:
Iterable<FsController<?>>
Direct Known Subclasses:
FsDecoratingManager, FsDefaultManager

@ThreadSafe
@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public abstract class FsManager
extends Object
implements Iterable<FsController<?>>

An abstract container which manages the life cycle of controllers for federated file systems. A file system is federated if and only if it's a member of a parent (virtual) file system.

Sub-classes must be thread-safe, too.

Author:
Christian Schlichtherle

Nested Class Summary
private static interface FsManager.Visitor
          A visitor for file system controllers.
 
Field Summary
static BitField<FsSyncOption> UMOUNT
          Equivalent to BitField.of(FsSyncOption.FORCE_CLOSE_INPUT, FsSyncOption.FORCE_CLOSE_OUTPUT, FsSyncOption.CLEAR_CACHE).
 
Constructor Summary
FsManager()
           
 
Method Summary
 boolean equals(Object that)
          Two file system managers are considered equal if and only if they are identical.
abstract  FsController<?> getController(FsMountPoint mountPoint, FsCompositeDriver driver)
          Returns a thread-safe file system controller for the given mount point.
abstract  int getSize()
          Returns the number of federated file systems managed by this instance.
 int hashCode()
          Returns a hash code which is consistent with equals(java.lang.Object).
abstract  Iterator<FsController<?>> iterator()
          Returns an iterator for the controller of all federated file systems managed by this instance.
 void sync(BitField<FsSyncOption> options)
          Commits all unsynchronized changes to the contents of the federated file systems managed by this instance to their respective parent file system.
<X extends IOException>
void
sync(BitField<FsSyncOption> options, ExceptionHandler<? super IOException,X> handler)
          Commits all unsynchronized changes to the contents of all federated file systems managed by this instance to their respective parent file system.
 String toString()
          Returns a string representation of this object for debugging and logging purposes.
private
<X extends IOException>
void
visit(FsManager.Visitor visitor, ExceptionHandler<? super IOException,X> handler)
          Visits the controller of all federated file systems managed by this instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UMOUNT

public static final BitField<FsSyncOption> UMOUNT
Equivalent to BitField.of(FsSyncOption.FORCE_CLOSE_INPUT, FsSyncOption.FORCE_CLOSE_OUTPUT, FsSyncOption.CLEAR_CACHE).

Constructor Detail

FsManager

public FsManager()
Method Detail

getController

public abstract FsController<?> getController(FsMountPoint mountPoint,
                                              FsCompositeDriver driver)
Returns a thread-safe file system controller for the given mount point. If and only if the given mount point addresses a federated file system, the returned file system controller is remembered for life cycle management, i.e. future lookup and synchronization operations.

Parameters:
mountPoint - the mount point of the file system.
driver - the file system composite driver which will be used to create a new file system controller if required.
Returns:
A file system controller.

getSize

public abstract int getSize()
Returns the number of federated file systems managed by this instance.

Returns:
The number of federated file systems managed by this instance.

iterator

public abstract Iterator<FsController<?>> iterator()
Returns an iterator for the controller of all federated file systems managed by this instance.

Important: The iterated file system controllers must be ordered so that all file systems appear before any of their parent file systems.

Specified by:
iterator in interface Iterable<FsController<?>>
Returns:
An iterator for the controller of all federated file systems managed by this instance.

sync

public final void sync(BitField<FsSyncOption> options)
                throws FsSyncException
Commits all unsynchronized changes to the contents of the federated file systems managed by this instance to their respective parent file system. This will reset the state of the respective file system controllers.

This method calls sync(options, builder), where builder is an instance of FsSyncExceptionBuilder. If the call succeeds, the builder's AbstractExceptionBuilder.check() method is called to check out any FsSyncWarningException, too.

Parameters:
options - the synchronization options.
Throws:
FsSyncException - if committing the changes fails for any reason.
IllegalArgumentException - if the combination of synchronization options is illegal, e.g. if FORCE_CLOSE_INPUT is cleared and FORCE_CLOSE_OUTPUT is set or if the synchronization option ABORT_CHANGES is set.

sync

public <X extends IOException> void sync(BitField<FsSyncOption> options,
                                         ExceptionHandler<? super IOException,X> handler)
          throws X extends IOException
Commits all unsynchronized changes to the contents of all federated file systems managed by this instance to their respective parent file system. This will reset the state of the respective file system controllers.

Type Parameters:
X - the type of the IOException to throw at the discretion of the exception handler.
Parameters:
options - the synchronization options.
handler - the exception handling strategy for dealing with one or more input SyncExceptions which may trigger an X.
Throws:
IOException - at the discretion of the exception handler.
IllegalArgumentException - if the combination of synchronization options is illegal, e.g. if FORCE_CLOSE_INPUT is cleared and FORCE_CLOSE_OUTPUT is set or if the synchronization option ABORT_CHANGES is set.

visit

private <X extends IOException> void visit(FsManager.Visitor visitor,
                                           ExceptionHandler<? super IOException,X> handler)
            throws X extends IOException
Visits the controller of all federated file systems managed by this instance.

Type Parameters:
X - the type of the IOException to throw at the discretion of the exception handler.
Parameters:
visitor - the visitor.
handler - the exception handling strategy for dealing with one or more input SyncExceptions which may trigger an X.
Throws:
IOException - at the discretion of the exception handler.

equals

public final boolean equals(Object that)
Two file system managers are considered equal if and only if they are identical. This can't get overriden.

Overrides:
equals in class Object

hashCode

public final int hashCode()
Returns a hash code which is consistent with equals(java.lang.Object). This can't get overriden.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a string representation of this object for debugging and logging purposes.

Overrides:
toString in class Object

TrueZIP Kernel 7.0-rc1

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