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). |
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)
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.
|
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) |
public abstract M getModel()
@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.@Nullable public abstract Icon getOpenIcon() throws IOException
IOException@Nullable public abstract Icon getClosedIcon() throws IOException
IOExceptionpublic abstract boolean isReadOnly()
throws IOException
IOException@CheckForNull public abstract FsEntry getEntry(FsEntryName name) throws IOException
null if no file system entry
exists for the given name.
Modifying the returned object graph 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 to look up.null if no file system entry
exists for the given name.IOException - on any I/O error.public abstract boolean isReadable(FsEntryName name) throws IOException
IOExceptionpublic abstract boolean isWritable(FsEntryName name) throws IOException
IOExceptionpublic abstract void setReadOnly(FsEntryName name) throws IOException
IOExceptionpublic abstract boolean setTime(FsEntryName name, BitField<Entry.Access> types, long value) throws IOException
false is returned or an IOException is thrown, then
still some of the last access times may have been set.
In other words, this is not an atomic operation if multiple access types
are given.
To make this operation atomic, set the last access time for a single
type only.name - the file system entry name.types - the access typesvalue - 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 abstract InputSocket<?> getInputSocket(FsEntryName name, BitField<FsInputOption> options)
name - the file system entry name.options - the input options.InputSocket.public 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.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 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.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 unlink(FsEntryName name) throws IOException
IOExceptionpublic 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 final boolean equals(@CheckForNull
Object that)
public final int hashCode()
equals(java.lang.Object).
This can't get overriden.Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.