org.entityfs.impl.impl
Class NonForgettingChildEntityManagerImpl<T>

java.lang.Object
  extended by org.entityfs.impl.impl.AbstractChildEntityManager<T>
      extended by org.entityfs.impl.impl.NonForgettingChildEntityManagerImpl<T>
All Implemented Interfaces:
ChildEntityManager<T>

public class NonForgettingChildEntityManagerImpl<T>
extends AbstractChildEntityManager<T>

This is an implementation of the ChildEntityManager that uses strong references to the entity objects. When using this, entity objects will never be garbage collected as long as the file system lives.

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

Constructor Summary
NonForgettingChildEntityManagerImpl(boolean caseSensitive)
           
 
Method Summary
 void add(String name, T entity)
          Called when a child entity is added (created or moved into the directory).
 boolean contains(T entity)
          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).
 String toString()
           
 
Methods inherited from class org.entityfs.impl.impl.AbstractChildEntityManager
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NonForgettingChildEntityManagerImpl

public NonForgettingChildEntityManagerImpl(boolean caseSensitive)
Method Detail

handleDisappeared

public void handleDisappeared(String name,
                              T entity)
Description copied from interface: ChildEntityManager
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

public void remove(String name,
                   T entity)
Description copied from interface: ChildEntityManager
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

public void add(String name,
                T entity)
Description copied from interface: ChildEntityManager
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.

getEntityOrNull

public T getEntityOrNull(String name)
Description copied from interface: ChildEntityManager
Get the named entity or null if it does not exist.

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

contains

public boolean contains(T entity)
Description copied from interface: ChildEntityManager
Does this child entity manager contain the supplied entity?

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

toString

public String toString()
Overrides:
toString in class Object