M - The type of the file system model.@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public abstract class FsController<M extends FsModel> extends Object
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.
All implementations must be reentrant on exceptions - so clients may
repeatedly call their methods.
Whether an implementation must be thread-safe or not depends on the context,
i.e. its factory.
E.g. the FsManager.getController(de.schlichtherle.truezip.fs.FsMountPoint, de.schlichtherle.truezip.fs.FsCompositeDriver) method requires all returned file
system controllers to be thread-safe.
FsManager| Constructor and Description |
|---|
FsController() |
| Modifier and Type | Method and Description |
|---|---|
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)
Returns a file system entry or
null if no file system entry
exists for the given name. |
abstract 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.
|
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). |
boolean |
isExecutable(FsEntryName name)
Returns
false if the named file system entry is not executable. |
abstract boolean |
isReadable(FsEntryName name)
Returns
false if the named file system entry is not readable. |
abstract boolean |
isReadOnly()
Returns
true if and only if the file system is read-only. |
abstract boolean |
isWritable(FsEntryName name)
Returns
false if the named file system entry is not writable. |
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,
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 |
sync(BitField<FsSyncOption> options)
Commits all unsynchronized changes to the contents of this file system
to its parent file system,
releases the associated resources (e.g. target archive files) for
access by third parties (e.g. other processes), cleans up any temporary
allocated resources (e.g. temporary files) and purges any cached data.
|
abstract <X extends IOException> |
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,
releases the associated resources (e.g. target archive files) for
access by third parties (e.g. other processes), cleans up any temporary
allocated resources (e.g. temporary files) and purges any cached data.
|
String |
toString()
Returns a string representation of this object for debugging and logging
purposes.
|
abstract void |
unlink(FsEntryName name,
BitField<FsOutputOption> options)
Removes the named file system entry from the file system.
|
public final boolean equals(@CheckForNull Object that)
@Nullable public abstract Icon getClosedIcon() throws IOException
IOException@Nullable public abstract FsEntry getEntry(FsEntryName name) throws IOException
null 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.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 abstract InputSocket<?> getInputSocket(FsEntryName name, BitField<FsInputOption> options)
name - the file system entry name.options - the input options.InputSocket.public abstract M getModel()
@Nullable public abstract Icon getOpenIcon() throws IOException
IOExceptionpublic abstract OutputSocket<?> getOutputSocket(FsEntryName name, BitField<FsOutputOption> options, @CheckForNull Entry template)
template is not null, then the output entry shall
have as many of its properties copied as reasonable, e.g. the last
modification time.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.@Nullable public abstract FsController<?> getParent()
null if
and only if this file system is not federated, i.e. not a member of
another file system.
Multiple invocations must return the same object.public final int hashCode()
equals(java.lang.Object).
This can't get overriden.public boolean isExecutable(FsEntryName name) throws IOException
false if the named file system entry is not executable.
The implementation in the class FsController always returns
false.
name - the name of the file system entry.false if the named file system entry is not executable.IOException - On any I/O error.public abstract boolean isReadable(FsEntryName name) throws IOException
false if the named file system entry is not readable.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 abstract boolean isReadOnly()
throws IOException
true if and only if the file system is read-only.true if and only if the file system is read-only.IOException - on any I/O error.public abstract boolean isWritable(FsEntryName name) throws IOException
false if the named file system entry is not writable.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 abstract void mknod(FsEntryName name, Entry.Type type, BitField<FsOutputOption> options, @CheckForNull Entry template) throws IOException
name into the file system.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.
public abstract void setReadOnly(FsEntryName name) throws IOException
IOExceptionpublic abstract boolean setTime(FsEntryName name, BitField<Entry.Access> types, long value, BitField<FsOutputOption> options) throws IOException
false 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.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
false 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.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.NullPointerException - if any key or value in the map is
null.public final void sync(BitField<FsSyncOption> options) throws FsSyncException
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.
options - the synchronization options.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.public abstract <X extends IOException> void sync(BitField<FsSyncOption> options, ExceptionHandler<? super FsSyncException,X> handler) throws X extends IOException
X - The type of the IOException to throw at the
discretion of the exception handler.options - a bit field of synchronization options.handler - the exception handling strategy for consuming input
FsSyncExceptions and/or assembling output
IOExceptions.IOException - at the discretion of the exception handler
upon the occurence of an FsSyncException.IllegalArgumentException - if the combination of synchronization
options is illegal, e.g. if
FsSyncOption.FORCE_CLOSE_INPUT is cleared and
FsSyncOption.FORCE_CLOSE_OUTPUT is set.public String toString()
public abstract void unlink(FsEntryName name, BitField<FsOutputOption> options) throws IOException
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.