M
- the type of the file system model.C
- the type of the decorated file system controller.@ThreadSafe public abstract class FsDecoratingController<M extends FsModel,C extends FsController<? extends M>> extends FsAbstractController<M>
Modifier and Type | Field and Description |
---|---|
protected C |
delegate
The decorated file system controller.
|
Modifier | Constructor and Description |
---|---|
protected |
FsDecoratingController(C controller)
Constructs a new decorating file system controller.
|
Modifier and Type | Method and Description |
---|---|
FsEntry |
getEntry(FsEntryName name)
Returns the file system entry for the given name or
null if it
doesn't exist. |
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.
|
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. |
boolean |
isExecutable(FsEntryName name)
Returns
false if the named file system entry is not executable. |
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. |
void |
setReadOnly(FsEntryName name)
Sets the named file system entry as read-only.
|
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.
|
String |
toString()
Returns a string representation of this object for debugging and logging
purposes.
|
void |
unlink(FsEntryName name,
BitField<FsOutputOption> options)
Removes the named file system entry from the file system.
|
getModel, getMountPoint, isMounted, setMounted
equals, hashCode
protected final C extends FsController<? extends M> delegate
protected FsDecoratingController(C controller)
controller
- the decorated file system controller.public FsEntry getEntry(FsEntryName name) throws IOException
FsController
null
if it
doesn't exist.
Modifying the returned entry does not show any effect on the file system
and may result in an UnsupportedOperationException
.getEntry
in class FsController<M extends FsModel>
name
- the name of the file system entry.null
if no file system entry
exists for the given name.IOException
- on any I/O failure.public InputSocket<?> getInputSocket(FsEntryName name, BitField<FsInputOption> options)
FsController
getInputSocket
in class FsController<M extends FsModel>
name
- the file system entry name.options
- the input options.InputSocket
.public OutputSocket<?> getOutputSocket(FsEntryName name, BitField<FsOutputOption> options, Entry template)
FsController
template
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 FsController<M extends FsModel>
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 FsController<?> getParent()
FsController
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.getParent
in class FsController<M extends FsModel>
public boolean isExecutable(FsEntryName name) throws IOException
FsController
false
if the named file system entry is not executable.
The implementation in the class FsController
always returns
false
.
isExecutable
in class FsController<M extends FsModel>
name
- the name of the file system entry.false
if the named file system entry is not executable.IOException
- on any I/O failure.public boolean isReadable(FsEntryName name) throws IOException
FsController
false
if the named file system entry is not readable.isReadable
in class FsController<M extends FsModel>
name
- the name of the file system entry.false
if the named file system entry is not readable.IOException
- on any I/O failure.public boolean isReadOnly() throws IOException
FsController
true
if and only if the file system is read-only.isReadOnly
in class FsController<M extends FsModel>
true
if and only if the file system is read-only.IOException
- on any I/O failure.public boolean isWritable(FsEntryName name) throws IOException
FsController
false
if the named file system entry is not writable.isWritable
in class FsController<M extends FsModel>
name
- the name of the file system entry.false
if the named file system entry is not writable.IOException
- on any I/O failure.public void mknod(FsEntryName name, Entry.Type type, BitField<FsOutputOption> options, Entry template) throws IOException
FsController
name
into the file system.mknod
in class FsController<M extends FsModel>
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 failure, 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 void setReadOnly(FsEntryName name) throws IOException
FsController
setReadOnly
in class FsController<M extends FsModel>
name
- the name of the file system entry.IOException
- on any I/O failure or if this operation is not
supported.public boolean setTime(FsEntryName name, BitField<Entry.Access> types, long value, BitField<FsOutputOption> options) throws IOException
FsController
false
is returned or an IOException
is thrown, then
still some of the last access times may have been set.setTime
in class FsController<M extends FsModel>
name
- the file system entry name.types
- the access types.value
- the last access time.options
- the file system output options.true
if and only if setting the access time for all
types in types
succeeded.IOException
- on any I/O failure.public boolean setTime(FsEntryName name, Map<Entry.Access,Long> times, BitField<FsOutputOption> options) throws IOException
FsController
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.setTime
in class FsController<M extends FsModel>
name
- the file system entry name.times
- the access times.options
- the file system output options.true
if and only if setting the access time for all
types in times
succeeded.IOException
- on any I/O failure.public void sync(BitField<FsSyncOption> options) throws FsSyncException
FsController
sync
in class FsController<M extends FsModel>
options
- the options for synchronizing the file system.FsSyncWarningException
- if only warning conditions
apply.
This implies that the respective parent file system has been
synchronized with constraints, e.g. if an unclosed archive entry
stream gets forcibly closed.FsSyncException
- if any error conditions apply.public String toString()
FsController
toString
in class FsController<M extends FsModel>
public void unlink(FsEntryName name, BitField<FsOutputOption> options) throws IOException
FsController
unlink
in class FsController<M extends FsModel>
name
- the file system entry name.options
- output options for this operation.IOException
- on any I/O failure.Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.