org.entityfs.impl
Interface DirectoryImplementation

All Superinterfaces:
Comparable<EntityView>, Deletable, Directory, DirectoryView, DirectoryViewImplementation, Entity, EntityAcceptingEntity<DirectoryView>, EntityAcceptingEntityImplementation<DirectoryView>, EntityAcceptingEntityView<DirectoryView>, EntityAcceptingEntityViewImplementation<DirectoryView>, EntityHolder, EntityImplementation, EntityListable, EntityRepository, EntityView, EntityViewImplementation, Iterable<EntityView>, Lockable, Named, Observable, ReadLockable, ReadWriteLockable, ViewCapable<DirectoryView>, WriteLockable
All Known Implementing Classes:
DirectoryImpl

public interface DirectoryImplementation
extends Directory, DirectoryViewImplementation, EntityAcceptingEntityImplementation<DirectoryView>

This is the interface for a Directory implementation. It contains methods that are only used by file system implementations; not by file system clients. A Directory object can always be cast to a DirectoryImplementation object.

The methods in this interface should only be used by file system and capability implementations.

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

Field Summary
 
Fields inherited from interface org.entityfs.Directory
DEFAULT_TEMP_FILE_SUFFIX, MINIMUM_TEMP_FILE_PREFIX_LENGTH
 
Method Summary
 void addChildEntity(String name, EntityImplementation entity)
          Used to add a new entity to the directory when an entity is created.
 void assertNoChildEntityWithName(String name)
          Assert that an entity with the given name does not exist in the directory.
 void handleDisappearingChild(EntityImplementation entity)
          This is called by a child entity when its entity object has detected that the entity has disappeared from the backing file system.
 void removeChildEntity(EntityImplementation entity, DirectoryImplementation newParent)
          Called by the child entity when it should be removed from the directory.
 void renameChildEntity(String name, EntityImplementation entity, DirectoryImplementation oldParent, String oldName)
          Called by a child entity when it is renamed.
 
Methods inherited from interface org.entityfs.impl.DirectoryViewImplementation
copyFrom
 
Methods inherited from interface org.entityfs.DirectoryView
getUniqueEntityName, newEntity
 
Methods inherited from interface org.entityfs.EntityListable
isEmpty, listEntities
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.entityfs.EntityAcceptingEntityView
canBeDereferenced, dereferenceOrNull
 
Methods inherited from interface org.entityfs.ViewCapable
getFilter, hasFilters, newView
 
Methods inherited from interface org.entityfs.EntityHolder
containsEntity, containsEntity, getEntityOrNull
 
Methods inherited from interface org.entityfs.impl.EntityImplementation
assertIsReadLocked, assertIsWriteLocked, assertNotReadOnly, assertOk, assertParentIsReadLocked, assertParentIsWriteLocked, createLockInternal, fireEvent, getDelegate, getDelegateOfType, getDelegateOfTypeOrNull, getEntityAdapter, init, verifyHasExecuteAccess, verifyHasExecuteAccessToParent, verifyHasReadAccess, verifyHasReadAccessToParent, verifyHasWriteAccess, verifyHasWriteAccessToParent
 
Methods inherited from interface org.entityfs.impl.EntityViewImplementation
getAbsoluteLocationNoLocking, getFileSystemImplementation, getNameNoLocking, getObserverList
 
Methods inherited from interface org.entityfs.Entity
hasExecuteAccess, hasReadAccess, hasWriteAccess
 
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
 

Method Detail

removeChildEntity

void removeChildEntity(EntityImplementation entity,
                       DirectoryImplementation newParent)
Called by the child entity when it should be removed from the directory. Responsible for removing the entity from the directory's ChildEntityManager and for firing the EntityModifiedEvent and ChildEntityRemovedEvent events.

Parameters:
entity - The entity to remove.
newParent - The entity's parent directory after the current operation if the entity is being moved. This is set to null if the entity is deleted.

renameChildEntity

void renameChildEntity(String name,
                       EntityImplementation entity,
                       DirectoryImplementation oldParent,
                       String oldName)
Called by a child entity when it is renamed. If renamed within the same directory, the child entity should have removed itself by calling removeChildEntity(EntityImplementation, DirectoryImplementation) before calling this method, so it should not be present in the child entity manager by the time that this method is called. This method is responsible for adding the child entity to the child entity manager and for firing the ChildEntityRenamedEvent if the entity was renamed within the same directory, or the ChildEntityAddedEvent if the entity was moved in from another directory.

Parameters:
name - The entity's (new) name.
entity - The entity.
oldParent - The old parent directory.
oldName - The old name.

addChildEntity

void addChildEntity(String name,
                    EntityImplementation entity)
Used to add a new entity to the directory when an entity is created. This method is responsible for adding the entity to the ChildEntityManager and for firing the ChildEntityAddedEvent and EntityModifiedEvent events.

Parameters:
name - The entity's name.
entity - The entity.

handleDisappearingChild

void handleDisappearingChild(EntityImplementation entity)
This is called by a child entity when its entity object has detected that the entity has disappeared from the backing file system. This method is responsible for removing the entity from the child entity manager and for firing the ChildEntityDisappearedEvent.

Parameters:
entity - The entity that has disappeared.

assertNoChildEntityWithName

void assertNoChildEntityWithName(String name)
                                 throws EntityFoundException
Assert that an entity with the given name does not exist in the directory.

Parameters:
name - The name of the entity.
Throws:
EntityFoundException - If an entity with the same name exists in the directory.