org.entityfs.cap.metadata.file
Class FileBasedMetadataCapabilityProvider

java.lang.Object
  extended by org.entityfs.cap.metadata.file.FileBasedMetadataCapabilityProvider
All Implemented Interfaces:
CapabilityProvider, CapabilityProviderImplementation

public class FileBasedMetadataCapabilityProvider
extends Object
implements CapabilityProviderImplementation

This capability provider adds the ECMetadata and ECNamedMetadata entity capabilities along with the FSCMetadata and the FSCDirectoryMetadata file system capabilities to a file system.

This capability provider changes how the file system is laid out in the backing storage. Each entity is stored in its own directory along with one or several metadata files.

This capability has a MetadataCopyStrategy that determines how metadata is copied to metadata-unaware file systems. Read more on ECMetadata.

If this capability is used together with a symbolic link- enabling capability, that capability must be added to the file system builder before this capability.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-metadata

Field Summary
static MetadataCopyStrategy DEFAULT_COPY_STRATEGY
          The default MetadataCopyStrategy is to ignore metadata when copying to metadata-unaware file systems.
 
Constructor Summary
FileBasedMetadataCapabilityProvider()
           
 
Method Summary
 MetadataCopyStrategy getCopyStrategy()
           
 boolean isReadOnlyFileSystemSupported()
           
 boolean isReadWriteFileSystemSupported()
           
 AdapterFactory proxyAdapterFactory(AdapterFactory af, LogAdapterHolder lah)
          This is called to let the capability provider proxy the file system's adapter factory before the file system is created.
 FileSystemDelegate proxyFileSystemDelegate(FileSystemDelegate fsd, SupportObjects so, boolean readOnly)
          This is used when creating the file system to let the capability provider proxy the file system delegate.
 DirectoryDelegate proxyRootDirectoryDelegate(FileSystemImplementation fs, FileSystemDelegate fsd, DirectoryDelegate dd, LogAdapterHolder lah)
          This is used when creating a file system to let the capability provider proxy the root directory delegate.
 FileBasedMetadataCapabilityProvider setCopyStrategy(MetadataCopyStrategy cs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COPY_STRATEGY

public static final MetadataCopyStrategy DEFAULT_COPY_STRATEGY
The default MetadataCopyStrategy is to ignore metadata when copying to metadata-unaware file systems.

Constructor Detail

FileBasedMetadataCapabilityProvider

public FileBasedMetadataCapabilityProvider()
Method Detail

setCopyStrategy

public FileBasedMetadataCapabilityProvider setCopyStrategy(MetadataCopyStrategy cs)

getCopyStrategy

public MetadataCopyStrategy getCopyStrategy()

proxyAdapterFactory

public AdapterFactory proxyAdapterFactory(AdapterFactory af,
                                          LogAdapterHolder lah)
Description copied from interface: CapabilityProviderImplementation
This is called to let the capability provider proxy the file system's adapter factory before the file system is created.

Specified by:
proxyAdapterFactory in interface CapabilityProviderImplementation
Parameters:
af - The adapter factory.
lah - The (future) file system's log adapter holder.
Returns:
The (future) file system's adapter factory, possibly proxied. If the adapter factory should not be proxied, return the supplied factory, never return null.

proxyFileSystemDelegate

public FileSystemDelegate proxyFileSystemDelegate(FileSystemDelegate fsd,
                                                  SupportObjects so,
                                                  boolean readOnly)
Description copied from interface: CapabilityProviderImplementation
This is used when creating the file system to let the capability provider proxy the file system delegate.

This method can check that all capabilities that the capability provider require in order to work are present in the FileSystemDelegate to proxy. If not, the method throws an FileSystemConfigurationException.

When this method is called, no owning FileSystemImplementation is created yet, so a call to FileSystemDelegate.getOwner() will return null.

Specified by:
proxyFileSystemDelegate in interface CapabilityProviderImplementation
Parameters:
fsd - The file system delegate to proxy.
so - The file system's support objects. Maybe useful for implementations of this method, maybe not.
readOnly - Is the file system read only?
Returns:
A file system delegate. Either a proxy of fsd or fsd itself. Never null.

proxyRootDirectoryDelegate

public DirectoryDelegate proxyRootDirectoryDelegate(FileSystemImplementation fs,
                                                    FileSystemDelegate fsd,
                                                    DirectoryDelegate dd,
                                                    LogAdapterHolder lah)
Description copied from interface: CapabilityProviderImplementation
This is used when creating a file system to let the capability provider proxy the root directory delegate. Most capability providers do this.

Specified by:
proxyRootDirectoryDelegate in interface CapabilityProviderImplementation
Parameters:
fs - The file system object.
fsd - The file system delegate created by CapabilityProviderImplementation.proxyFileSystemDelegate(FileSystemDelegate, SupportObjects, boolean) .
dd - The root directory delegate.
Returns:
A directory delegate. Either a proxy of dd or dd itself. Never null.

isReadOnlyFileSystemSupported

public boolean isReadOnlyFileSystemSupported()
Specified by:
isReadOnlyFileSystemSupported in interface CapabilityProviderImplementation
Returns:
true, always.

isReadWriteFileSystemSupported

public boolean isReadWriteFileSystemSupported()
Specified by:
isReadWriteFileSystemSupported in interface CapabilityProviderImplementation
Returns:
true, always.