@ThreadSafe @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public final class FsFederatingController extends FsDecoratingController<FsModel,FsController<?>>
FsFalsePositiveExceptions thrown by the prospective file system
provided to its constructor.
Whenever the controller for the prospective file system throws a
FsFalsePositiveException, the method call is delegated to the
controller for its parent file system in order to resolve the requested
operation.
If this method call fails with another exception, then the
IOException which is associated as the cause of the first exception
gets rethrown unless the second exception is an FsException again.
In this case the FsException gets rethrown as is in order to enable
the caller to resolve it, which is typically - but not necessarily - the
TrueZIP Kernel again.
This algorithm effectively achieves the following objectives:
FsException and are excempt from this
masquerade in order to support resolving them by a more competent caller.
As an example consider the case of accessing a RAES encrypted ZIP file.
When an archive file of this type gets mounted, the user is typically
prompted for a password.
If the user cancels the password prompting dialog, then an appropriate
exception gets thrown.
Some other class in the TrueZIP Kernel would then catch this exception and
flag the archive file as a false positive by wrapping the exception in a
FsFalsePositiveException.
This class would then catch this false positive exception and try to resolve
the issue by using the parent file system controller.
Failing that, the initial exception would get rethrown in order to signal
to the caller that the user had cancelled password prompting.
FsFalsePositiveException| Modifier and Type | Class and Description |
|---|---|
private class |
FsFederatingController.Input |
private class |
FsFederatingController.Output |
| Modifier and Type | Field and Description |
|---|---|
private FsPath |
path |
delegate| Constructor and Description |
|---|
FsFederatingController(FsController<?> controller)
Constructs a new file system federating controller.
|
| Modifier and Type | Method and Description |
|---|---|
Icon |
getClosedIcon() |
FsEntry |
getEntry(FsEntryName name)
Returns a file system entry or
null if no file system entry
exists for the given name. |
InputSocket<?> |
getInputSocket(FsEntryName name,
BitField<FsInputOption> options)
Returns an input socket for reading the contents of the file system
entry addressed by the given name from the file system.
|
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.
|
private FsPath |
getPath() |
boolean |
isReadable(FsEntryName name)
Returns
false if the named file system entry is not readable. |
boolean |
isReadOnly()
Returns
true if and only if the file system is read-only. |
boolean |
isWritable(FsEntryName name)
Returns
false if the named file system entry is not writable. |
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. |
private FsEntryName |
resolveParent(FsEntryName name) |
void |
setReadOnly(FsEntryName name) |
boolean |
setTime(FsEntryName name,
BitField<Entry.Access> types,
long value,
BitField<FsOutputOption> options)
Makes an attempt to set the last access time of all types in the given
bit field for the file system entry with the given name.
|
boolean |
setTime(FsEntryName name,
Map<Entry.Access,Long> times,
BitField<FsOutputOption> options)
Makes an attempt to set the last access time of all types in the given
map for the file system entry with the given name.
|
void |
unlink(FsEntryName name,
BitField<FsOutputOption> options)
Removes the named file system entry from the file system.
|
getParent, isExecutable, sync, toStringgetModel, getMountPoint, isTouched, setTouchedequals, hashCode, sync@CheckForNull private volatile FsPath path
FsFederatingController(FsController<?> controller)
controller - the decorated file system controller.public Icon getClosedIcon() throws IOException
getClosedIcon in class FsDecoratingController<FsModel,FsController<?>>IOExceptionpublic FsEntry getEntry(FsEntryName name) throws IOException
FsControllernull if no file system entry
exists for the given name.
Modifying the returned object is either not supported (i.e. throws an
UnsupportedOperationException) or does not show any effect on
the file system.getEntry in class FsDecoratingController<FsModel,FsController<?>>name - the name of the file system entry.null if no file system entry
exists for the given name.IOException - on any I/O error.public InputSocket<?> getInputSocket(FsEntryName name, BitField<FsInputOption> options)
FsControllergetInputSocket in class FsDecoratingController<FsModel,FsController<?>>name - the file system entry name.options - the input options.InputSocket.public Icon getOpenIcon() throws IOException
getOpenIcon in class FsDecoratingController<FsModel,FsController<?>>IOExceptionpublic OutputSocket<?> getOutputSocket(FsEntryName name, BitField<FsOutputOption> options, @CheckForNull Entry template)
FsControllertemplate is not null, then the output entry shall
have as many of its properties copied as reasonable, e.g. the last
modification time.getOutputSocket in class FsDecoratingController<FsModel,FsController<?>>name - a file system entry name.options - a bit field of output options.template - a nullable template for the properties of the output
entry.OutputSocket.private FsPath getPath()
public boolean isReadable(FsEntryName name) throws IOException
FsControllerfalse if the named file system entry is not readable.isReadable in class FsDecoratingController<FsModel,FsController<?>>name - the name of the file system entry.false if the named file system entry is not readable.IOException - On any I/O error.public boolean isReadOnly()
throws IOException
FsControllertrue if and only if the file system is read-only.isReadOnly in class FsDecoratingController<FsModel,FsController<?>>true if and only if the file system is read-only.IOException - on any I/O error.public boolean isWritable(FsEntryName name) throws IOException
FsControllerfalse if the named file system entry is not writable.isWritable in class FsDecoratingController<FsModel,FsController<?>>name - the name of the file system entry.false if the named file system entry is not writable.IOException - On any I/O error.public void mknod(FsEntryName name, Entry.Type type, BitField<FsOutputOption> options, @CheckForNull Entry template) throws IOException
FsControllername into the file system.mknod in class FsDecoratingController<FsModel,FsController<?>>name - the file system entry name.type - the file system entry type.options - the file system output options.
If FsOutputOption.CREATE_PARENTS is set, any missing
parent directories will be created and linked into the 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.IOException - on any I/O error, including but not limited to these
reasons:
name contains characters which are not
supported by the file system.
FsOutputOption.EXCLUSIVE is set or the entry is a
directory.
createParents is
false.
private FsEntryName resolveParent(FsEntryName name)
public void setReadOnly(FsEntryName name) throws IOException
setReadOnly in class FsDecoratingController<FsModel,FsController<?>>IOExceptionpublic boolean setTime(FsEntryName name, BitField<Entry.Access> types, long value, BitField<FsOutputOption> options) throws IOException
FsControllerfalse is returned or an IOException is thrown, then
still some of the last access times may have been set.
Whether or not this is an atomic operation is specific to the
implementation.setTime in class FsDecoratingController<FsModel,FsController<?>>name - the file system entry name.types - the access types.value - the last access time.true if and only if setting the access time for all
types in types succeeded.IOException - on any I/O error.public boolean setTime(FsEntryName name, Map<Entry.Access,Long> times, BitField<FsOutputOption> options) throws IOException
FsControllerfalse is returned or an IOException is thrown, then
still some of the last access times may have been set.
Whether or not this is an atomic operation is specific to the
implementation.setTime in class FsDecoratingController<FsModel,FsController<?>>name - the file system entry name.times - the access times.true if and only if setting the access time for all
types in times succeeded.IOException - on any I/O error.public void unlink(FsEntryName name, BitField<FsOutputOption> options) throws IOException
FsControllerunlink in class FsDecoratingController<FsModel,FsController<?>>name - the file system entry name.options - output options for this operation.IOException - On any I/O error.Copyright © 2004-2011 Schlichtherle IT Services. All Rights Reserved.