org.entityfs.util
Class EntityAcceptingEntities

java.lang.Object
  extended by org.entityfs.util.EntityAcceptingEntities

public final class EntityAcceptingEntities
extends Object

This contains static methods for working with EntityAcceptingEntity:s and EntityView:s.

The methods in this class will use the locking strategy for utility classes described in EntityLock.

Since:
1.0
Author:
Karl Gustafsson
See Also:
EntityAcceptingEntity, EntityAcceptingEntityView

Method Summary
static EntityView unroll(EntityAcceptingEntityView<?> eae)
          Unroll the entity-accepting entity, i.e.
static EntityView unrollOrNull(EntityAcceptingEntityView<?> eae)
          Unroll the chain of entity-accepting entities, i.e.
static boolean unrollTargetExists(EntityAcceptingEntityView<?> eae)
          Check to see if the unroll target of the entity-accepting entity chain starting with the given entity-accepting entity exists.
static DirectoryView unrollToDirectory(EntityAcceptingEntityView<?> eae)
          Unroll a chain of entity-accepting entities to a directory.
static DirectoryView unrollToDirectoryOrNull(EntityAcceptingEntityView<?> eae)
          Unroll a chain of entity-accepting entities to a directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

unrollOrNull

public static EntityView unrollOrNull(EntityAcceptingEntityView<?> eae)
                               throws CircularReferenceException,
                                      AccessDeniedException
Unroll the chain of entity-accepting entities, i.e. dereference a chain of entity-accepting entities (symbolic links) until the referenced entity cannot be dereferenced (is not a symbolic link).

To illustrate the difference between unroll and EntityAcceptingEntityView.dereferenceOrNull(), use the following directory contents:
l1 -> l2 (symbolic link)
l2 -> d1 (symbolic link)
d1 (not a symbolic link)
Unrolling l1 will return d1, but calling dereferenceOrNull on it will return l2.

Parameters:
eae - The first entity-accepting entity in the chain to unroll.
Returns:
The last entity in the chain, or null if there is no entity in the location referenced by the last entity-accepting entity in the chain.
Throws:
CircularReferenceException - If there is a circular reference somewhere in the chain of entity-accepting entities.
AccessDeniedException - If the calling thread does not have execute access to an entity in the entity chain.
See Also:
unroll(EntityAcceptingEntityView), EntityAcceptingEntityView.dereferenceOrNull()
Permissions_required:
Execute access to all entities in the entity chain.

unroll

public static EntityView unroll(EntityAcceptingEntityView<?> eae)
                         throws EntityNotFoundException,
                                CircularReferenceException,
                                AccessDeniedException
Unroll the entity-accepting entity, i.e. dereference a chain of dereferencable entity-accepting entities (symbolic links) until the referenced entity cannot be dereferenced. See unrollOrNull(EntityAcceptingEntityView).

Parameters:
eae - The first entity-accepting entity in the entity-accepting entity chain to unroll
Returns:
The last entity in the chain. The entity cannot be dereferenced.
Throws:
EntityNotFoundException - If there is not an entity in the location referenced by the last entity-accepting entity in the chain.
CircularReferenceException - If there is a circular reference somewhere in the entity-accepting entity chain.
AccessDeniedException - If the calling thread does not have execute access to an entity in the entity chain.
See Also:
unrollOrNull(EntityAcceptingEntityView), unrollTargetExists(EntityAcceptingEntityView), unrollToDirectory(EntityAcceptingEntityView), EntityAcceptingEntityView.dereferenceOrNull()
Permissions_required:
Execute access to all entities in the entity chain.

unrollTargetExists

public static boolean unrollTargetExists(EntityAcceptingEntityView<?> eae)
                                  throws CircularReferenceException,
                                         AccessDeniedException
Check to see if the unroll target of the entity-accepting entity chain starting with the given entity-accepting entity exists.

Parameters:
eae - The first entity-accepting entity in the entity-accepting entity chain to unroll
Returns:
true if the last entity-accepting entity in the entity accepting entity chain references an existing entity.
Throws:
AccessDeniedException - If the calling thread does not have execute access to an entity in the entity chain.
CircularReferenceException - If there is a circular reference somewhere in the entity-accepting entity chain.
See Also:
unroll(EntityAcceptingEntityView)
Permissions_required:
Execute access to all entities in the entity chain.

unrollToDirectoryOrNull

public static DirectoryView unrollToDirectoryOrNull(EntityAcceptingEntityView<?> eae)
                                             throws NotADirectoryException,
                                                    CircularReferenceException,
                                                    AccessDeniedException
Unroll a chain of entity-accepting entities to a directory.

Parameters:
eae - An entity-accepting entity.
Returns:
The directory referenced by the entity-accepting entity chain, or null if the entity-accepting entity chain does not reference an entity.
Throws:
NotADirectoryException - If the target of the entity-accepting entity chain is not a directory.
CircularReferenceException - If there is a circular reference somewhere in the entity-accepting entity chain.
AccessDeniedException - If the calling thread does not have execute access to an entity in the entity chain.
Permissions_required:
Execute access to all entities in the entity chain.

unrollToDirectory

public static DirectoryView unrollToDirectory(EntityAcceptingEntityView<?> eae)
                                       throws EntityNotFoundException,
                                              NotADirectoryException,
                                              CircularReferenceException,
                                              AccessDeniedException
Unroll a chain of entity-accepting entities to a directory.

Parameters:
eae - An entity-accepting entity.
Returns:
The Directory referenced by the last entity-accepting entity.
Throws:
EntityNotFoundException - If the last entity-accepting entity in the chain references a nonexisting entity.
NotADirectoryException - If the entity referenced by the last entity in the chain is not a directory.
AccessDeniedException - If the calling thread does not have execute access to an entity in the entity chain.
CircularReferenceException
See Also:
unroll(EntityAcceptingEntityView)
Permissions_required:
Execute access to all entities in the entity chain.