org.entityfs
Interface Deletable

All Superinterfaces:
Lockable, WriteLockable
All Known Subinterfaces:
Directory, DirectoryImplementation, DirectoryView, DirectoryViewImplementation, ECMetadata, EFile, EFileImplementation, Entity, EntityAcceptingEntity<T>, EntityAcceptingEntityImplementation<T>, EntityAcceptingEntityView<T>, EntityAcceptingEntityViewImplementation<T>, EntityImplementation, EntityView, EntityViewImplementation, ReadWritableFile, SymbolicLink, SymbolicLinkImplementation, SymbolicLinkView, SymbolicLinkViewImplementation
All Known Implementing Classes:
AbstractEntityAcceptingEntityImpl, AbstractEntityAcceptingEntityView, AbstractEntityImpl, AbstractEntityViewImpl, AbstractReadWritableFile, DirectoryImpl, DirectoryViewImpl, ECMetadataImpl, FileDelegateReadWritableFileAdapter, FileImpl, MetadataFileAdapter, ReadWritableFileAdapter, SymbolicLinkImpl, SymbolicLinkViewImpl

public interface Deletable
extends WriteLockable

This interface defines something that can be deleted. It is implemented by EFile and Directory.

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

Method Summary
 void delete()
          Delete the entity from the file system.
 boolean isDeleted()
          Check if the entity has been deleted.
 
Methods inherited from interface org.entityfs.lock.WriteLockable
getWriteLock, isWriteLockedByCurrentThread, lockForWriting
 

Method Detail

isDeleted

boolean isDeleted()
                  throws IllegalStateException,
                         ReadLockRequiredException
Check if the entity has been deleted. Unlike EntityView.isValid() , this method does not do any backend validation, so if the entity has been deleted in the backend storage without going through the EntityFS API, use that method instead.

Returns:
true if the entity object has been deleted.
Throws:
IllegalStateException - If the view is disconnected.
ReadLockRequiredException - If the client does not have a read lock for the viewed entity.
Locks_required:
A read lock on the entity or on its parent directory.
Permissions_required:
none

delete

void delete()
            throws IllegalStateException,
                   WriteLockRequiredException,
                   AccessDeniedException,
                   DirectoryNotEmptyException
Delete the entity from the file system. If it is a directory, it has to be empty before it can be deleted. When the entity is deleted, the entity object is invalidated (EntityView.isValid() will return false from now on).

Throws:
IllegalStateException - If the view is disconnected.
WriteLockRequiredException - If the client does not have a write lock for the viewed entity and a write lock for its parent.
AccessDeniedException - If the client does not have write access to the entity and to its parent.
DirectoryNotEmptyException - If the entity is a non-empty directory.
Locks_required:
A write lock on the entity and on its parent directory.
Permissions_required:
Write access to the entity and to its parent directory.
Generates_events:
EntityDeletedEvent on this., ChildEntityRemovedEvent on this's parent.