org.entityfs
Interface EntityAcceptingEntityView<T extends EntityAcceptingEntityView<?>>

All Superinterfaces:
Comparable<EntityView>, Deletable, EntityHolder, EntityView, Lockable, Named, Observable, ReadLockable, ReadWriteLockable, ViewCapable<T>, WriteLockable
All Known Subinterfaces:
Directory, DirectoryImplementation, DirectoryView, DirectoryViewImplementation, EntityAcceptingEntity<T>, EntityAcceptingEntityImplementation<T>, EntityAcceptingEntityViewImplementation<T>, SymbolicLink, SymbolicLinkImplementation, SymbolicLinkView, SymbolicLinkViewImplementation
All Known Implementing Classes:
AbstractEntityAcceptingEntityImpl, AbstractEntityAcceptingEntityView, DirectoryImpl, DirectoryViewImpl, SymbolicLinkImpl, SymbolicLinkViewImpl

public interface EntityAcceptingEntityView<T extends EntityAcceptingEntityView<?>>
extends EntityView, ViewCapable<T>, EntityHolder

This interface defines an abstract view of an EntityAcceptingEntity. The entity-accepting entity is an abstraction of a class of entities that may have child entities, given the right conditions.

An entity-accepting entity can be dereferenced to another entity. A directory dereferences to itself and a symbolic link dereferences to its target.

Since:
1.0
Author:
Karl Gustafsson
See Also:
Entities, EntityAcceptingEntities
In_jar:
entityfs-core

Method Summary
 boolean canBeDereferenced()
          Can the entity-accepting entity be dereferenced.
 EntityView dereferenceOrNull()
          Get the entity referenced by this entity.
 
Methods inherited from interface org.entityfs.EntityView
canRead, canWrite, copy, copy, copyAttributes, createLock, disconnect, getCapability, getFileSystem, getLastModified, getParent, getType, getViewed, getViewedEntity, isConnected, isRootDirectory, isValid, lock, rename, setLastModified, supportsCapability, touch
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.entityfs.event.Observable
addObserver, countObservers, deleteObserver, deleteObservers
 
Methods inherited from interface org.entityfs.Named
getName
 
Methods inherited from interface org.entityfs.lock.ReadLockable
getReadLock, isReadLockedByCurrentThread, lockForReading
 
Methods inherited from interface org.entityfs.Deletable
delete, isDeleted
 
Methods inherited from interface org.entityfs.lock.WriteLockable
getWriteLock, isWriteLockedByCurrentThread, lockForWriting
 
Methods inherited from interface org.entityfs.ViewCapable
getFilter, hasFilters, newView
 
Methods inherited from interface org.entityfs.EntityHolder
containsEntity, containsEntity, getEntityOrNull
 

Method Detail

dereferenceOrNull

EntityView dereferenceOrNull()
                             throws ReadLockRequiredException,
                                    AccessDeniedException,
                                    NotADirectoryException,
                                    IllegalStateException,
                                    CircularReferenceException
Get the entity referenced by this entity. For a directory (view), this returns the directory (view). For a symbolic link (view), this returns (the same view of) the link target.

This method handles symbolic links in the symbolic link target correctly. For instance, if the symbolic link l1 has the target /d1/l2/f1 and the symbolic link l2 has the target ../d2, l1 will be dereferenced to the entity with the location /d2/f1 (given that d1 and d2 are directories).

Returns:
The entity referenced by this entity
Throws:
IllegalStateException - If the view is disconnected.
ReadLockRequiredException - If the client does not have a read lock for the viewed entity.
AccessDeniedException - If the client dereferences a symbolic link and it has not execute access to a visited entity.
NotADirectoryException - If an entity in the symbolic link target path is not a directory or cannot be dereferenced to a directory.
CircularReferenceException - If the symbolic link references are circular. For instance l1 -> l2, l2 -> l1.
Locks_required:
A read lock on this entity and, for symbolic links, read locks on all entities visited while dereferencing it.
Permissions_required:
For directories: none, for symbolic links: execute access to every entity visited while dereferencing

canBeDereferenced

boolean canBeDereferenced()
Can the entity-accepting entity be dereferenced. An entity-accepting entity can be dereferenced if it is a reference to another entity (if it is a symbolic link, for instance).

Returns:
true if the entity-accepting entity can be dereferenced.
Locks_required:
None
Permissions_required:
None