org.entityfs.impl
Interface FileSystemDelegate

All Known Implementing Classes:
AbstractEntityAttributesEnablingFileSystemDelegate, AbstractFileSystemDelegate, AbstractFileSystemDelegateProxy, CompressionEnablingFileSystemDelegate, NtfsEntityAttributesFileSystemDelegate, SymbolicLinkEnablingFileSystemDelegateProxy, UnixEntityAttributesFileSystemDelegate

public interface FileSystemDelegate

The file system delegate is EntityFS' mechanism for a extensible file system implementation without having an extensible file system object. The default FileSystem implementation delegates all call that might involve implementation-dependent logic to a FileSystemDelegate.

A file system's FileSystemDelegate implementation is mostly used for introducing new FileSystemCapability:s. Calls to other methods are commonly forwarded to the file system's FileSystemAdapter. The abstract implementation in AbstractFileSystemDelegate contain default implementations of most methods in this interface.

Capability providers may proxy a file system's FileSystemDelegate to introduce new FileSystemCapability:s. A default proxy implementation exists in AbstractFileSystemDelegateProxy.

File system objects use their delegate's Object.toString() method.

Since:
1.0
Author:
Karl Gustafsson
See Also:
EntityDelegate
In_jar:
entityfs-core

Method Summary
 void close()
          Close the file system.
<T extends EntityCapability>
T
getCapabilityForEntityOrNull(EntityImplementation ei, EntityCapabilityType<T> ect)
          Get the entity capability object for the requested capability.
<T extends FileSystemCapability>
T
getCapabilityOrNull(FileSystemCapabilityType<T> fsct)
          Get the file system capability object for the requested capability.
 FileSystemAdapter getFileSystemAdapter()
          Get the adapter to the backend implementation.
 FileSystemImplementation getOwner()
          Get the file system object that owns this delegate.
 Set<FileSystemCapabilityType<?>> getSupportedCapabilities()
          Get the set of supported file system capability types for the file system.
 Set<EntityCapabilityType<?>> getSupportedEntityCapabilities()
          Get the set of supported entity capability types for this file system.
 void init()
          This is called by the file system implementation after the object has been created but before the file system object is published.
 void setOwner(FileSystemImplementation fs)
          This is called when the owning file system object has been created.
 TriState supportsCapability(FileSystemCapabilityType<?> fsct)
          Does the file system support the specified capability?
 TriState supportsCapabilityForEntity(EntityImplementation ei, EntityCapabilityType<?> ect)
          Does the file system or capability provider support the requested entity capability for the supplied entity?
 TriState supportsCapabilityForEntityType(EntityType et, EntityCapabilityType<?> ect)
          Does the file system or capability provider support the requested entity capability for entities of the supplied type?
 void validateEntityName(String name, EntityType et)
          Validate that the entity name is valid in this file system.
 

Method Detail

init

void init()
This is called by the file system implementation after the object has been created but before the file system object is published.

It is the responsibility of this method to call init on either its proxied FileSystemDelegate or on the file system's FileSystemAdapter.


setOwner

void setOwner(FileSystemImplementation fs)
This is called when the owning file system object has been created.

Parameters:
fs - The file system object.

getOwner

FileSystemImplementation getOwner()
Get the file system object that owns this delegate.

Returns:
The file system.

getFileSystemAdapter

FileSystemAdapter getFileSystemAdapter()
Get the adapter to the backend implementation. This should only be used by delegate proxies.

Returns:
The file system adapter.

supportsCapability

TriState supportsCapability(FileSystemCapabilityType<?> fsct)
Does the file system support the specified capability?

Parameters:
fsct - The file system capability type identifier.
Returns:
YES, NO or DONT_CARE

getCapabilityOrNull

<T extends FileSystemCapability> T getCapabilityOrNull(FileSystemCapabilityType<T> fsct)
                                                   throws UnsupportedCapabilityException
Get the file system capability object for the requested capability. This may be called with unsupported file system capability types. In that case, the method should return null.

Parameters:
fsct - The file system capability type.
Returns:
The file system capability object or null if the file system capability is not supported by this capability visitor.
Throws:
UnsupportedCapabilityException - If a capability is explicitly disabled by this visitor (supportsCapability returns NO).

getSupportedCapabilities

Set<FileSystemCapabilityType<?>> getSupportedCapabilities()
Get the set of supported file system capability types for the file system.

Returns:
The set of supported file system capability types.

supportsCapabilityForEntity

TriState supportsCapabilityForEntity(EntityImplementation ei,
                                     EntityCapabilityType<?> ect)
Does the file system or capability provider support the requested entity capability for the supplied entity?

Parameters:
ect - The entity capability type.
ei - The entity.
Returns:
YES, NO or DONT_CARE
See Also:
FileSystem.supportsCapabilityForEntity(org.entityfs.EntityView, EntityCapabilityType)

supportsCapabilityForEntityType

TriState supportsCapabilityForEntityType(EntityType et,
                                         EntityCapabilityType<?> ect)
Does the file system or capability provider support the requested entity capability for entities of the supplied type?

This method should return true also if the file system supports the capability for only some of the entities of the supplied type.

Parameters:
et - The entity type.
ect - The entity capability type.
Returns:
YES, NO or DONT_CARE.
See Also:
FileSystem.supportsCapabilityForEntityType(EntityType, EntityCapabilityType)

getCapabilityForEntityOrNull

<T extends EntityCapability> T getCapabilityForEntityOrNull(EntityImplementation ei,
                                                            EntityCapabilityType<T> ect)
                                                        throws UnsupportedCapabilityException
Get the entity capability object for the requested capability. This may be called with unsupported entity capability types. In that case, the method should return null.

Parameters:
ect - The entity capability type.
ei - The entity.
Returns:
The entity capability object or null if the entity capability is not supported by this capability visitor.
Throws:
UnsupportedCapabilityException - If a capability is explicitly disabled by this visitor (supportsCapabilityForEntity returns NO ).

getSupportedEntityCapabilities

Set<EntityCapabilityType<?>> getSupportedEntityCapabilities()
Get the set of supported entity capability types for this file system.

Returns:
The set of supported entity capability types.

validateEntityName

void validateEntityName(String name,
                        EntityType et)
                        throws IllegalArgumentException
Validate that the entity name is valid in this file system.

Parameters:
name - The entity name.
et - The entity type.
Throws:
IllegalArgumentException - If the entity name is invalid.

close

void close()
Close the file system. This method is responsible for calling close on either its proxied file system delegate or on the file system adapter if it is not a proxy.