org.entityfs.cap.entityattrs
Interface ECEntityAttributes<T extends EntityAttributes>

All Superinterfaces:
EntityCapability
All Known Subinterfaces:
ECEntityAttributesImplementation<T>, ECNtfsAttributes, ECUnixAttributes
All Known Implementing Classes:
ECEntityAttributesImpl

public interface ECEntityAttributes<T extends EntityAttributes>
extends EntityCapability

This interface defines an entity capability that associates some kind of EntityAttributes with an entity.

This interface is inherited by interfaces that define concrete implementations of the generic types specified in this interface, such as the ECUnixAttributes interface.

Entity attributes are metadata attributes that are handled by a dedicated capability provider. Two implementations are the MetadataNtfsAttributesCapabilityProvider for NTFS attributes and the MetadataUnixAttributesCapabilityProvider for Unix attributes such as the owner UID and GID and the entity's UnixEntityMode (permissions).

The attributes of an entity is a property of its parent directory. A consequence of this is that a file system's root directory does not support entity attributes since it does not have a parent directory.

Clients that expect a certain entity attribute capability type should use that capability directly. This interface can be used by clients that don't want to make assumptions about the specific entity attribute implementation that an entity supports. Clients using this interface can test the EntityAttributes instance returned from getAttributes() by checking it if it is instanceof anything, for instance instanceof UidGidAttributes.

Changes made to an EntityAttributes object are not automatically saved to its parent entity. Clients must call setAttributes(EntityAttributes) to update the parent entity with the new attributes.

When copying an entity with EntityAttributes, the attributes are not copied. Instead, the target entity is given a default set of attributes.

Since:
1.0
Author:
Karl Gustafsson
See Also:
ECTEntityAttributes, ECNamedEntityAttributes, EntityAttributes
In_jar:
entityfs-entity_attributes

Method Summary
 T getAttributes()
          Get the attributes for an entity.
 Class<T> getAttributesType()
          Get the type of attributes stored by this capability.
 void setAttributes(T attr)
          Set the attributes for an entity.
 
Methods inherited from interface org.entityfs.cap.EntityCapability
getEntity, isValid
 

Method Detail

getAttributes

T getAttributes()
                                         throws AccessDeniedException,
                                                ReadLockRequiredException
Get the attributes for an entity.

The returned object is only guaranteed to represent the real attributes of the entity as long as the calling thread has an EntityLock on the entity's parent directory.

Returns:
The entity's attributes.
Throws:
AccessDeniedException - If the current Subject does not have execute access to the entity's parent directory.
ReadLockRequiredException - If the client does not have a read lock on the entity's parent directory.
Locks_required:
A read lock on the entity's parent directory.
Permissions_required:
Execute access to the entity's parent directory.

setAttributes

void setAttributes(T attr)
                   throws ReadOnlyException,
                          AccessDeniedException,
                          WriteLockRequiredException
Set the attributes for an entity. Previous attributes are overwritten.

Parameters:
attr - The new attributes.
Throws:
ReadOnlyException - If the entity is read only.
AccessDeniedException - If the current Subject does not have write and execute access to the entity's parent directory.
WriteLockRequiredException - If the client does not have a write lock on the entity's parent directory.
Locks_required:
A write lock on the entity's parent directory.
Permissions_required:
Write and execute access to the entity's parent directory.

getAttributesType

Class<T> getAttributesType()
Get the type of attributes stored by this capability.

Returns:
The type of attributes.