|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EntityImplementation
Implementation of an Entity
. It contains methods that are only used
by file system implementations; not by file system clients. An Entity
object can always be cast to EntityImplementation
.
All entity implementations should be designed to be proxied (see the developer's guide).
See the developer's guide for how copy
should be implemented.
Entity implementations are divided into two layers; the implementation layer
and the backend implementation layer (see EntityAdapter
). See the
developer's guide for how the layers are separated.
For the implementation layer, the objects implementing this interface
implements the entity aspects of each entity type, such as object identity,
locking and access controls. Implementations of behaviors of each entity type
are delegated to EntityDelegate
implementations.
Each entity object has a chain of EntityDelegates
. Capability
providers can introduced new delegates in the chain.
The methods in this interface should only be used by file system and capability implementations.
Method Summary | |
---|---|
void |
assertIsReadLocked()
Entity methods call this to verify that the client has locked the entity for reading. |
void |
assertIsWriteLocked()
Entity methods call this to verify that the client has locked the entity for writing. |
void |
assertNotReadOnly()
Entity methods call this to verify that the file system is not read only. |
void |
assertOk()
Entity methods call this to verify that the entity is ok. |
void |
assertParentIsReadLocked()
Entity methods call this to verify that the client has locked the entity's parent directory for reading. |
void |
assertParentIsWriteLocked()
Entity methods call this to verify that the client has locked the entity's parent directory for writing. |
void |
createLockInternal(Object identifier)
This method can be used by entity delegates to create their own entity locks. |
void |
fireEvent(EntityEvent<?> ev)
Use the file system's EventManager to fire an event with this
entity as its sender. |
EntityDelegate |
getDelegate()
|
EntityDelegate |
getDelegateOfType(Class<? extends EntityDelegate> c)
Get the delegate implementation of the specified type. |
EntityDelegate |
getDelegateOfTypeOrNull(Class<? extends EntityDelegate> c)
Get the delegate implementation of the specified type. |
EntityAdapter |
getEntityAdapter()
This method is used by capability implementations that require a specific adapter implementation. |
void |
init()
This method is called when the object has been fully created but before it is used by any clients. |
void |
verifyHasExecuteAccess()
Verify that the caller has execute access to this entity. |
void |
verifyHasExecuteAccessToParent()
Verify that the caller has execute access to this entity's parent directory. |
void |
verifyHasReadAccess()
Verify that the caller has read access to this entity. |
void |
verifyHasReadAccessToParent()
Verify that the caller has read access to this entity's parent directory. |
void |
verifyHasWriteAccess()
Verify that the caller has write access to this entity. |
void |
verifyHasWriteAccessToParent()
Verify that the caller has write access to this entity's parent directory. |
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 |
---|
EntityDelegate getDelegate()
EntityDelegate getDelegateOfType(Class<? extends EntityDelegate> c) throws NoSuchDelegateException
c
- The type of the delegate.
NoSuchDelegateException
- If the entity does not have any such
delegate.getDelegateOfTypeOrNull(Class)
EntityDelegate getDelegateOfTypeOrNull(Class<? extends EntityDelegate> c)
c
- The type of the delegate.
null
if no matching delegate can be found.getDelegateOfType(Class)
EntityAdapter getEntityAdapter()
EntityAdapter
instance for the entity.void assertIsReadLocked() throws ReadLockRequiredException
ReadLockRequiredException
- If the entity is not locked for reading
by the calling thread.void assertParentIsReadLocked() throws ReadLockRequiredException, UnsupportedOperationException
ReadLockRequiredException
- If the entity's parent is not locked
for reading by the calling thread.
UnsupportedOperationException
void assertIsWriteLocked() throws WriteLockRequiredException
WriteLockRequiredException
- If the entity is not locked for
writing by the calling thread.void assertParentIsWriteLocked() throws WriteLockRequiredException, UnsupportedOperationException
WriteLockRequiredException
- If the entity's parent directory is
not locked for writing by the calling thread.
UnsupportedOperationException
- If this is called on the file
system's root directory.void assertNotReadOnly() throws ReadOnlyException
ReadOnlyException
- If the file system is read only.void assertOk() throws EntityNotFoundException
EntityValidityControlStrategy
.
It must be verified that the entity is at least locked for reading before this method is called.
EntityNotFoundException
- If the entity has disappeared from the
backend.void fireEvent(EntityEvent<?> ev)
EventManager
to fire an event with this
entity as its sender.
ev
- The event.void createLockInternal(Object identifier)
identifier
- The lock identifier.void init()
Implementations are required to call init
on the first delegate
in their delegate chain.
void verifyHasReadAccess() throws AccessDeniedException
Before calling this method, make sure that the caller has at least a read lock on the entity.
AccessDeniedException
- If the caller does not have read access to
this entity.AccessController
,
assertIsReadLocked()
,
assertIsWriteLocked()
,
verifyHasWriteAccess()
,
verifyHasExecuteAccess()
,
verifyHasReadAccessToParent()
void verifyHasWriteAccess() throws AccessDeniedException
Before calling this method, make sure that the caller has at least a read lock on the entity.
AccessDeniedException
- If the caller does not have write access to
this entity.AccessController
,
assertIsReadLocked()
,
assertIsWriteLocked()
,
verifyHasReadAccess()
,
verifyHasExecuteAccess()
,
verifyHasWriteAccessToParent()
void verifyHasExecuteAccess() throws AccessDeniedException
Before calling this method, make sure that the caller has at least a read lock on the entity.
AccessDeniedException
- If the caller does not have execute access
to this entity.AccessController
,
assertIsReadLocked()
,
assertIsWriteLocked()
,
verifyHasReadAccess()
,
verifyHasWriteAccess()
,
verifyHasExecuteAccessToParent()
void verifyHasReadAccessToParent() throws AccessDeniedException, EntityNotFoundException
Before calling this method, make sure that the caller has at least a read lock on the parent entity.
AccessDeniedException
- If the caller does not have read access to
this entity's parent directory.
EntityNotFoundException
- If this method is called on the root
directory of a file system.AccessController
,
assertParentIsReadLocked()
,
assertParentIsWriteLocked()
,
verifyHasWriteAccessToParent()
,
verifyHasExecuteAccessToParent()
,
verifyHasReadAccess()
void verifyHasWriteAccessToParent() throws AccessDeniedException, EntityNotFoundException
Before calling this method, make sure that the caller has at least a read lock on the parent entity.
AccessDeniedException
- If the caller does not have write access to
this entity's parent directory.
EntityNotFoundException
- If this method is called on the root
directory of a file system.AccessController
,
assertParentIsReadLocked()
,
assertParentIsWriteLocked()
,
verifyHasReadAccessToParent()
,
verifyHasExecuteAccessToParent()
,
verifyHasWriteAccess()
void verifyHasExecuteAccessToParent() throws AccessDeniedException, EntityNotFoundException
Before calling this method, make sure that the caller has at least a read lock on the parent directory.
AccessDeniedException
- If the caller does not have execute access
to this entity's parent directory.
EntityNotFoundException
- If this method is called on the root
directory of a file system.AccessController
,
assertParentIsReadLocked()
,
assertParentIsWriteLocked()
,
verifyHasWriteAccessToParent()
,
verifyHasReadAccessToParent()
,
verifyHasExecuteAccess()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |