org.entityfs.impl.adapter
Interface ChildRegisteringDirectoryAdapter

All Superinterfaces:
DirectoryAdapter, EntityAdapter
All Known Implementing Classes:
RamDirectoryAdapter

public interface ChildRegisteringDirectoryAdapter
extends DirectoryAdapter

This interface is implemented by DirectoryAdapter:s that have to keep track of all their children themselves. A directory adapter must do that when there is no backing storage that can be used to find the child. This is true for the RAM file system directory adapter.

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

Method Summary
 EntityAdapter getChild(String name)
          Get the adapter for a child entity.
 void registerChild(EntityAdapter child)
          This is used by directory adapters that have to keep track of child entities themselves (the RAM file system directory adapters, for instance).
 void unregisterChild(EntityAdapter child)
          For directory adapters that keep track of all child entities themselves, this method is used to unregister a child entity that is deleted or moved from the directory.
 
Methods inherited from interface org.entityfs.impl.adapter.DirectoryAdapter
assertCanBeDeleted, containsEntity, deleteChild, getChildEntityType, getEntityNames
 
Methods inherited from interface org.entityfs.impl.adapter.EntityAdapter
canRead, canWrite, create, delete, exists, getEntityType, getFileSystemAdapter, getLastModified, getName, getParent, init, rename, setLastModified
 

Method Detail

registerChild

void registerChild(EntityAdapter child)
This is used by directory adapters that have to keep track of child entities themselves (the RAM file system directory adapters, for instance).

This method is called by the directory entity implementation when a new entity is created or an existing entity is found.

Parameters:
child - The child entity adapter to register.
See Also:
unregisterChild(EntityAdapter), getChild(String)

unregisterChild

void unregisterChild(EntityAdapter child)
For directory adapters that keep track of all child entities themselves, this method is used to unregister a child entity that is deleted or moved from the directory.

This method should be called by entity adapter methods that move or delete entities.

Parameters:
child - The child to unregister.
See Also:
registerChild(EntityAdapter), getChild(String), EntityAdapter.delete(), EntityAdapter.rename(String, DirectoryAdapter)

getChild

EntityAdapter getChild(String name)
                       throws EntityNotFoundException,
                              UnsupportedOperationException
Get the adapter for a child entity. This can only be used on directory adapters that keep track of their child adapters.

Parameters:
name - The name of the child entity.
Returns:
The child entity adapter.
Throws:
EntityNotFoundException - If no child entity with the given name exists.
UnsupportedOperationException - If this method cannot be used with this directory adapter implementation.
See Also:
registerChild(EntityAdapter), unregisterChild(EntityAdapter)