TrueZIP Kernel 7.0-rc1

de.schlichtherle.truezip.fs
Class FsController<M extends FsModel>

java.lang.Object
  extended by de.schlichtherle.truezip.fs.FsController<M>
Type Parameters:
M - The type of the file system model.
Direct Known Subclasses:
FsArchiveController, FsDecoratingController

@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class)
public abstract class FsController<M extends FsModel>
extends Object

An abstract class which provides read/write access to a file system. This class may be organized in a chain of responsibility for file system federation. The mount point of the file system model addresses the file system at the head of this chain of federated file systems.

Where the methods of this abstract class accept a file system entry name as a parameter, this will get resolved against the mount point URI of this controller's file system model.

Sub-classes must be reentrant on exceptions - so users may repeatedly call their methods.

Author:
Christian Schlichtherle

Constructor Summary
FsController()
           
 
Method Summary
 boolean equals(Object that)
          Two file system controllers are considered equal if and only if they are identical.
abstract  Icon getClosedIcon()
           
abstract  FsEntry getEntry(FsEntryName name)
           
abstract  InputSocket<?> getInputSocket(FsEntryName name, BitField<FsInputOption> options)
          Returns an input socket for reading the contents of the entry addressed by the given name from the file system.
abstract  M getModel()
          Returns the file system model.
abstract  Icon getOpenIcon()
           
abstract  OutputSocket<?> getOutputSocket(FsEntryName name, BitField<FsOutputOption> options, Entry template)
          Returns an output socket for writing the contents of the entry addressed by the given name to the file system.
abstract  FsController<?> getParent()
          Returns the controller for the parent file system or null if and only if this file system is not federated, i.e. not a member of another file system.
 int hashCode()
          Returns a hash code which is consistent with equals(java.lang.Object).
abstract  boolean isReadable(FsEntryName name)
           
abstract  boolean isReadOnly()
           
abstract  boolean isWritable(FsEntryName name)
           
abstract  void mknod(FsEntryName name, Entry.Type type, BitField<FsOutputOption> options, Entry template)
          Creates or replaces and finally links a chain of one or more entries for the given entry name into the file system.
abstract  void setReadOnly(FsEntryName name)
           
abstract  boolean setTime(FsEntryName name, BitField<Entry.Access> types, long value)
           
 void sync(BitField<FsSyncOption> options)
          Commits all unsynchronized changes to the contents of this file to its parent file system.
abstract
<X extends IOException>
void
sync(BitField<FsSyncOption> options, ExceptionHandler<? super FsSyncException,X> handler)
          Commits all unsynchronized changes to the contents of this file system to its parent file system.
 String toString()
          Returns a string representation of this object for debugging and logging purposes.
abstract  void unlink(FsEntryName name)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FsController

public FsController()
Method Detail

getModel

public abstract M getModel()
Returns the file system model.


getParent

@Nullable
public abstract FsController<?> getParent()
Returns the controller for the parent file system or null if and only if this file system is not federated, i.e. not a member of another file system.


getOpenIcon

@Nullable
public abstract Icon getOpenIcon()
                          throws IOException
Throws:
IOException

getClosedIcon

@Nullable
public abstract Icon getClosedIcon()
                            throws IOException
Throws:
IOException

isReadOnly

public abstract boolean isReadOnly()
                            throws IOException
Throws:
IOException

getEntry

@CheckForNull
public abstract FsEntry getEntry(FsEntryName name)
                          throws IOException
Throws:
IOException

isReadable

public abstract boolean isReadable(FsEntryName name)
                            throws IOException
Throws:
IOException

isWritable

public abstract boolean isWritable(FsEntryName name)
                            throws IOException
Throws:
IOException

setReadOnly

public abstract void setReadOnly(FsEntryName name)
                          throws IOException
Throws:
IOException

setTime

public abstract boolean setTime(FsEntryName name,
                                BitField<Entry.Access> types,
                                long value)
                         throws IOException
Throws:
IOException

getInputSocket

public abstract InputSocket<?> getInputSocket(FsEntryName name,
                                              BitField<FsInputOption> options)
Returns an input socket for reading the contents of the entry addressed by the given name from the file system.

Parameters:
name - a file system entry name.
Returns:
An InputSocket.

getOutputSocket

public abstract OutputSocket<?> getOutputSocket(FsEntryName name,
                                                BitField<FsOutputOption> options,
                                                @CheckForNull
                                                Entry template)
Returns an output socket for writing the contents of the entry addressed by the given name to the file system. If template is not null, then the output entry shall have as many of its properties copied as reasonable, e.g. the last modification time.

Parameters:
name - a file system entry name.
template - a nullable template for the properties of the output entry.
Returns:
An OutputSocket.

mknod

public abstract void mknod(FsEntryName name,
                           Entry.Type type,
                           BitField<FsOutputOption> options,
                           @CheckForNull
                           Entry template)
                    throws IOException
Creates or replaces and finally links a chain of one or more entries for the given entry name into the file system.

Parameters:
name - the file system entry name.
type - the file system entry type.
options - the file system output options. If CREATE_PARENTS is set, any missing parent directories will be created and linked into this file system with its last modification time set to the system's current time.
template - if not null, then the file system entry at the end of the chain shall inherit as much properties from this entry as possible - with the exception of its name and type.
Throws:
IOException - for some other I/O related reason, including but not exclusively upon one or more of the following conditions:
  • The file system is read only.
  • name contains characters which are not supported by the file system.
  • The entry already exists and either the option FsOutputOption.EXCLUSIVE is set or the entry is a directory.
  • The entry exists as a different type.
  • A parent entry exists but is not a directory.
  • A parent entry is missing and createParents is false.

unlink

public abstract void unlink(FsEntryName name)
                     throws IOException
Throws:
IOException

sync

public final void sync(BitField<FsSyncOption> options)
                throws FsSyncException
Commits all unsynchronized changes to the contents of this file to its parent file system. If this is not a federated file system, i.e. if its not a member of a parent file system, then nothing happens. Otherwise, the state of this file system controller is reset.

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.

sync

public abstract <X extends IOException> void sync(BitField<FsSyncOption> options,
                                                  ExceptionHandler<? super FsSyncException,X> handler)
                   throws X extends IOException
Commits all unsynchronized changes to the contents of this file system to its parent file system. If this is not a federated file system, i.e. if its not a member of a parent file system, then nothing happens. Otherwise, the state of this file system controller is reset.

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 FsSyncExceptions which may trigger an X.
Throws:
IllegalArgumentException - if the combination of synchronization options is illegal, e.g. if FORCE_CLOSE_INPUT is cleared and FORCE_CLOSE_OUTPUT is set.
X extends IOException

equals

public final boolean equals(@CheckForNull
                            Object that)
Two file system controllers 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.