@ThreadSafe public final class FsConcurrentController extends FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
FsConcurrentModel| Modifier and Type | Class and Description |
|---|---|
private class |
FsConcurrentController.Input |
private class |
FsConcurrentController.Output |
| Modifier and Type | Field and Description |
|---|---|
private ReentrantReadWriteLock.ReadLock |
readLock |
private ReentrantReadWriteLock.WriteLock |
writeLock |
delegate| Constructor and Description |
|---|
FsConcurrentController(FsController<? extends FsConcurrentModel> controller)
Constructs a new concurrent file system controller.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
assertNotReadLockedByCurrentThread(FsNotWriteLockedException ex) |
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.
|
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. |
private ReentrantReadWriteLock.ReadLock |
readLock() |
void |
setReadOnly(FsEntryName name) |
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.
|
<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.
|
void |
unlink(FsEntryName name) |
private ReentrantReadWriteLock.WriteLock |
writeLock() |
getModel, getParent, toStringequals, hashCode, syncprivate volatile ReentrantReadWriteLock.ReadLock readLock
private volatile ReentrantReadWriteLock.WriteLock writeLock
public FsConcurrentController(@NonNull
FsController<? extends FsConcurrentModel> controller)
controller - the decorated file system controller.private ReentrantReadWriteLock.ReadLock readLock()
private ReentrantReadWriteLock.WriteLock writeLock()
private void assertNotReadLockedByCurrentThread(FsNotWriteLockedException ex) throws FsNotWriteLockedException
FsNotWriteLockedExceptionpublic Icon getOpenIcon() throws IOException
getOpenIcon in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>IOExceptionpublic Icon getClosedIcon() throws IOException
getClosedIcon in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>IOExceptionpublic boolean isReadOnly()
throws IOException
isReadOnly in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>IOExceptionpublic FsEntry getEntry(FsEntryName name) throws IOException
FsControllernull 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.getEntry in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>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 boolean isReadable(FsEntryName name) throws IOException
isReadable in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>IOExceptionpublic boolean isWritable(FsEntryName name) throws IOException
isWritable in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>IOExceptionpublic void setReadOnly(FsEntryName name) throws IOException
setReadOnly in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>IOExceptionpublic boolean setTime(FsEntryName name, BitField<Entry.Access> types, long value) throws IOException
FsControllerfalse 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.setTime in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>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 InputSocket<?> getInputSocket(FsEntryName name, BitField<FsInputOption> options)
FsControllergetInputSocket in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>name - the file system entry name.options - the input options.InputSocket.public OutputSocket<?> getOutputSocket(FsEntryName name, BitField<FsOutputOption> options, 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<FsConcurrentModel,FsController<? extends FsConcurrentModel>>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 void mknod(@NonNull
FsEntryName name,
@NonNull
Entry.Type type,
@NonNull
BitField<FsOutputOption> options,
@CheckForNull
Entry template)
throws IOException
FsControllername into the file system.mknod in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>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 void unlink(FsEntryName name) throws IOException
unlink in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>IOExceptionpublic <X extends IOException> void sync(@NonNull BitField<FsSyncOption> options, @NonNull ExceptionHandler<? super FsSyncException,X> handler) throws X extends IOException
FsControllersync in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>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.X extends IOExceptionCopyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.