org.entityfs.impl
Interface ChildEntityManager<T>

All Known Implementing Classes:
AbstractChildEntityManager, ChildEntityManagerImpl, NonForgettingChildEntityManagerImpl

public interface ChildEntityManager<T>

The child entity manager is used by DirectoryImplementation:s to manage their child entity objects. This is not the same as the child files and directories themselves; those are handled by the DirectoryAdapter.

It is the child entity manager's responsibility that there will never be several entity objects for one entity.

Entity objects are created as needed. That means that a directory might contain children that its child entity manager does not have entity objects for.

Implementations do not have to be thread safe. Entity locking should make sure that the child entity manager is never accessed concurrently from different threads.

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

Method Summary
 void add(String name, T entity)
          Called when a child entity is added (created or moved into the directory).
 boolean contains(T ei)
          Does this child entity manager contain the supplied entity?
 T getEntityOrNull(String name)
          Get the named entity or null if it does not exist.
 void handleDisappeared(String name, T entity)
          Called whenever it is detected that a child entity has disappeared in an unnatural way.
 void remove(String name, T entity)
          This is called when an entity is removed (deleted or moved to another directory).
 

Method Detail

handleDisappeared

void handleDisappeared(String name,
                       T entity)
Called whenever it is detected that a child entity has disappeared in an unnatural way. (E.g. a file that has been deleted from the file system manually, not through any of the EntityFS methods.)

Parameters:
name - The name of the disappeared entity.
entity - The disappeared entity.

remove

void remove(String name,
            T entity)
This is called when an entity is removed (deleted or moved to another directory).

Parameters:
name - The name of the removed entity.
entity - The removed entity

add

void add(String name,
         T entity)
         throws EntityFoundException
Called when a child entity is added (created or moved into the directory). It is guaranteed (provided that a working locking strategy is used) that an entity with the same name does not previously exist in the directory.

Parameters:
name - The entity's name.
entity - The added entity.
Throws:
EntityFoundException

getEntityOrNull

T getEntityOrNull(String name)
Get the named entity or null if it does not exist.

Parameters:
name - The name of the entity.
Returns:
The entity or null.

contains

boolean contains(T ei)
Does this child entity manager contain the supplied entity?

Parameters:
ei - The entity.
Returns:
true if the entity exists in this child entity manager.