TrueZIP Kernel 7.0-rc1

de.schlichtherle.truezip.fs
Class FsDecoratingController<M extends FsModel,C extends FsController<? extends M>>

java.lang.Object
  extended by de.schlichtherle.truezip.fs.FsController<M>
      extended by de.schlichtherle.truezip.fs.FsDecoratingController<M,C>
Type Parameters:
M - The type of the file system model.
C - The type of the decorated file system controller.
Direct Known Subclasses:
FsCachingController, FsConcurrentController, FsFederatingController, FsStatisticsController

@ThreadSafe
public abstract class FsDecoratingController<M extends FsModel,C extends FsController<? extends M>>
extends FsController<M>

An abstract decorator for a file system controller.

Author:
Christian Schlichtherle

Field Summary
protected  C delegate
          The decorated file system controller.
private  M model
           
 
Constructor Summary
protected FsDecoratingController(C controller)
          Constructs a new decorating file system controller.
 
Method Summary
 Icon getClosedIcon()
           
 FsEntry getEntry(FsEntryName name)
           
 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.
 M getModel()
          Returns the file system model.
 Icon getOpenIcon()
           
 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.
 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.
 boolean isReadable(FsEntryName name)
           
 boolean isReadOnly()
           
 boolean isWritable(FsEntryName name)
           
 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.
 void setReadOnly(FsEntryName name)
           
 boolean setTime(FsEntryName name, BitField<Entry.Access> types, long value)
           
<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.
 void unlink(FsEntryName name)
           
 
Methods inherited from class de.schlichtherle.truezip.fs.FsController
equals, hashCode, sync
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

delegate

protected final C extends FsController<? extends M> delegate
The decorated file system controller.


model

private volatile M extends FsModel model
Constructor Detail

FsDecoratingController

protected FsDecoratingController(@NonNull
                                 C controller)
Constructs a new decorating file system controller.

Parameters:
controller - the decorated file system controller.
Method Detail

getModel

public final M getModel()
Description copied from class: FsController
Returns the file system model.

Specified by:
getModel in class FsController<M extends FsModel>

getParent

public FsController<?> getParent()
Description copied from class: FsController
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.

Specified by:
getParent in class FsController<M extends FsModel>

getOpenIcon

public Icon getOpenIcon()
                 throws IOException
Specified by:
getOpenIcon in class FsController<M extends FsModel>
Throws:
IOException

getClosedIcon

public Icon getClosedIcon()
                   throws IOException
Specified by:
getClosedIcon in class FsController<M extends FsModel>
Throws:
IOException

isReadOnly

public boolean isReadOnly()
                   throws IOException
Specified by:
isReadOnly in class FsController<M extends FsModel>
Throws:
IOException

getEntry

public FsEntry getEntry(FsEntryName name)
                 throws IOException
Specified by:
getEntry in class FsController<M extends FsModel>
Throws:
IOException

isReadable

public boolean isReadable(FsEntryName name)
                   throws IOException
Specified by:
isReadable in class FsController<M extends FsModel>
Throws:
IOException

isWritable

public boolean isWritable(FsEntryName name)
                   throws IOException
Specified by:
isWritable in class FsController<M extends FsModel>
Throws:
IOException

setReadOnly

public void setReadOnly(FsEntryName name)
                 throws IOException
Specified by:
setReadOnly in class FsController<M extends FsModel>
Throws:
IOException

setTime

public boolean setTime(FsEntryName name,
                       BitField<Entry.Access> types,
                       long value)
                throws IOException
Specified by:
setTime in class FsController<M extends FsModel>
Throws:
IOException

getInputSocket

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

Specified by:
getInputSocket in class FsController<M extends FsModel>
Parameters:
name - a file system entry name.
Returns:
An InputSocket.

getOutputSocket

public OutputSocket<?> getOutputSocket(FsEntryName name,
                                       BitField<FsOutputOption> options,
                                       Entry template)
Description copied from class: FsController
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.

Specified by:
getOutputSocket in class FsController<M extends FsModel>
Parameters:
name - a file system entry name.
template - a nullable template for the properties of the output entry.
Returns:
An OutputSocket.

mknod

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

Specified by:
mknod in class FsController<M extends FsModel>
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 void unlink(FsEntryName name)
            throws IOException
Specified by:
unlink in class FsController<M extends FsModel>
Throws:
IOException

sync

public <X extends IOException> void sync(@NonNull
                                         BitField<FsSyncOption> options,
                                         @NonNull
                                         ExceptionHandler<? super FsSyncException,X> handler)
          throws X extends IOException
Description copied from class: FsController
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.

Specified by:
sync in class FsController<M extends FsModel>
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:
X extends IOException

toString

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

Overrides:
toString in class FsController<M extends FsModel>

TrueZIP Kernel 7.0-rc1

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