|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FileSystemBuilder<T extends FileSystemBuilder<T>>
A file system builder encapsulates the logic for creating a
FileSystem
. Every file system implementation has one or more builder
classes. Implementations of this interface add their own file system
implementation-specific setter methods.
The builder objects are designed to be single-use; use them once and then discard them.
File system builders are designed using a variant of the builder pattern that
returns the builder from setter methods. This gives the builders a compact
and readable notation. For instance:
FileSystem myfs = new FSROFileSystemBuilder().
setRoot(new File("../..")).
setName("My protected files").
enableLocking().
create();
Implementations are encouraged to inherit
AbstractFileSystemBuilderImpl
.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
When files are copied, data may be temporarily stored in a memory buffer. |
Method Summary | |
---|---|
T |
addCapabilityProvider(CapabilityProvider cp)
Add a capability provider to the file system. |
T |
addCapabilityProviders(Collection<? extends CapabilityProvider> cps)
Add all capability providers in the collection. |
FileSystem |
create()
Create the file system that is being built by this builder object. |
T |
disableAccessControls()
This is a shorter form for setAccessController(DisabledAccessController.INSTANCE) . |
T |
disableEntityValidityControls()
A short form for setEntityValidityControlStrategy(null) . |
T |
enableEvents()
Enable event handling for the file system. |
T |
enableLocking()
Enable entity locking with the default settings for lock adapter factory (a NonFairReadWriteEntityLockAdapterFactory
and lock acquiring strategy. |
AccessController |
getAccessController()
Get the access controller to use for controlling access to entities. |
int |
getBufferSize()
Set the size in bytes of internal buffers used for various tasks such as copying files (for some implementations). |
Collection<CapabilityProvider> |
getCapabilityProviders()
Get the capability providers. |
EntityValidityControlStrategy |
getEntityValidityControlStrategy()
Get the file system's entity validity control strategy. |
LockAcquiringStrategy |
getLockAcquiringStrategy()
Get the lock acquiring strategy. |
EntityLockAdapterFactory |
getLockAdapterFactory()
Get the lock adapter factory. |
LogAdapter |
getLogAdapter()
Get the log adapter that the file system will use. |
String |
getName()
Get the file system's name. |
boolean |
isLockingSupported()
Does the file system being built support locking? |
T |
setAccessController(AccessController ac)
Set the access controller to use for controlling access to entities. |
T |
setBufferSize(int sz)
Set the size in bytes of internal buffers used for various tasks such as copying files (for some implementations). |
T |
setEntityValidityControlStrategy(EntityValidityControlStrategy evcs)
Set the file system's entity validity control strategy. |
T |
setLockAcquiringStrategy(LockAcquiringStrategy las)
Set the lock acquiring strategy that the file system will use. |
T |
setLockAdapterFactory(EntityLockAdapterFactory laf)
Set the lock adapter factory that the file system will use. |
T |
setLogAdapter(LogAdapter l)
Set the log adapter to use for the file system. |
T |
setName(String n)
Set the name of the file system. |
Field Detail |
---|
static final int DEFAULT_BUFFER_SIZE
setBufferSize(int)
Method Detail |
---|
T setLogAdapter(LogAdapter l)
LogAdapterHolder
.
l
- The log adapter.
FileSystem.getLogAdapterHolder()
LogAdapter getLogAdapter()
T setLockAcquiringStrategy(LockAcquiringStrategy las)
null
, locking will be disabled for
the file system. For read-only file systems, the default strategy is
null
.
las
- The lock acquiring strategy or null
if entity locking
should be disabled.
LockAcquiringStrategy getLockAcquiringStrategy()
null
if no strategy is set.
T setLockAdapterFactory(EntityLockAdapterFactory laf)
null
, locking will be disabled for the file
system. For read-only file systems, the default factory is null
.
laf
- The lock adapter factory or null
if entity locking
should be disabled.
EntityLockAdapterFactory getLockAdapterFactory()
null
if no factory is set.
boolean isLockingSupported()
true
if the file system being built supports locking.enableLocking()
T enableLocking() throws UnsupportedOperationException
NonFairReadWriteEntityLockAdapterFactory
and lock acquiring strategy. (a
SimpleLockAcquiringStrategy
).
This is equivalent to calling
setLockAcquiringStrategy(LockAcquiringStrategy)
and then
setLockAdapterFactory(EntityLockAdapterFactory)
.
UnsupportedOperationException
- If the file system does not support
lockingisLockingSupported()
T setAccessController(AccessController ac)
ac
- The access controller.
T disableAccessControls()
setAccessController(DisabledAccessController.INSTANCE)
.
AccessController getAccessController()
DisabledAccessController
.
T setName(String n)
This property is mandatory.
n
- The file system name,
String getName()
T addCapabilityProvider(CapabilityProvider cp)
The order in which capability providers are added is significant. A capability provider will only see the effects of capability providers added before it. The documentation of each capability provider should describe how it should be used together with other capability providers.
cp
- The capability provider.
T addCapabilityProviders(Collection<? extends CapabilityProvider> cps)
cps
- The collection of capability providers.
Collection<CapabilityProvider> getCapabilityProviders()
T setEntityValidityControlStrategy(EntityValidityControlStrategy evcs)
evcs
- The entity validity control strategy. Set to null
to
disable entity validity controlling altogether.
T disableEntityValidityControls()
setEntityValidityControlStrategy(null)
.
EntityValidityControlStrategy getEntityValidityControlStrategy()
null
for file systems that (think that they)
completely own their own backends, such as the Ram file system or the Zip
file system.
T enableEvents()
Observable
for
EntityEvent
:s.
T setBufferSize(int sz)
sz
- The size of the buffers in bytes.
int getBufferSize()
FileSystem create() throws FileSystemConfigurationException
FileSystemConfigurationException
- On configuration errors.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |