org.entityfs.cap.metadata.entity
Interface ECNamedMetadata

All Superinterfaces:
EntityCapability
All Known Implementing Classes:
ECNamedMetadataImpl

public interface ECNamedMetadata
extends EntityCapability

This is a capability for entities that support metadata.

There are two flavors of the metadata capability, ECMetadata and ECNamedMetadata (this). Metadata-enabled entities usually support both. Entities that support this capability act as a directory for metadata files (ReadWritableFile:s, not file entities).

The parent entity's lock is used for locking all metadata files too. When locking a metadata file object for reading, for instance, the parent entity is also locked for reading.

When copying metadata enabled entities to another file system, several things can happen. If the target file system is also metadata enabled, the metadata is copied too. If not, the result depends on this file system's metadata capability's MetadataCopyStrategy. If the strategy is MetadataCopyStrategy.IGNORE, no metadata is copied, if the strategy is MetadataCopyStrategy.COPY, the target entity is put in a separate directory along with a file containing the metadata. The created entity layout is such that a metadata enabled file system can be created on it.

Since:
1.0
Author:
Karl Gustafsson
See Also:
FSCMetadata, ECMetadata, ECNamedMetadataUtil
In_jar:
entityfs-metadata

Method Summary
 void deleteMetadataFile(String name)
          Delete the named metadata file.
 ReadWritableFile getMetadataFile(String name)
          Get the named metadata file.
 Set<String> getMetadataFileNames()
          Get a set containing all metadata file names for the entity.
 boolean hasMetadataFile(String name)
          Check if the entity has a metadata file with the supplied name.
 ReadWritableFile newMetadataFile(String name)
          Create a new metadata file.
 
Methods inherited from interface org.entityfs.cap.EntityCapability
getEntity, isValid
 

Method Detail

getMetadataFileNames

Set<String> getMetadataFileNames()
Get a set containing all metadata file names for the entity.

Returns:
A set with all metadata file names. This set may be empty, but never null.
Permissions_required:
Read access to the entity owning the metadata.

hasMetadataFile

boolean hasMetadataFile(String name)
Check if the entity has a metadata file with the supplied name.

Parameters:
name - The name of the metadata file to look for. This name is case-sensitive.
Returns:
true if the entity has a metadata file with the supplied name, false if not.
Permissions_required:
Read access to the entity owning the metadata.

getMetadataFile

ReadWritableFile getMetadataFile(String name)
                                 throws EntityNotFoundException
Get the named metadata file.

Parameters:
name - The name of the metadata file. This must be a valid file name in the backing file system.
Returns:
The metadata file with the supplied name,
Throws:
EntityNotFoundException - If no metadata file with the supplied name exists for the entity.
Permissions_required:
Read access to the entity owning the metadata.

newMetadataFile

ReadWritableFile newMetadataFile(String name)
                                 throws EntityFoundException,
                                        ReadOnlyException
Create a new metadata file.

Parameters:
name - The name of the metadata file. This must be a valid file name in the backing file system.
Returns:
The new metadata file.
Throws:
EntityFoundException - If the entity already has a metadata file with the supplied name.
ReadOnlyException - If the file system is read only.
Permissions_required:
Write access to the entity owning the metadata.

deleteMetadataFile

void deleteMetadataFile(String name)
                        throws EntityNotFoundException,
                               ReadOnlyException
Delete the named metadata file.

Parameters:
name - The name of the metadata file.
Throws:
EntityNotFoundException - If no such metadata file exists.
ReadOnlyException - If the file system is read only.
Permissions_required:
Write access to the entity owning the metadata.