|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EntityAdapter
This is the base interface for an entity adapter. Entity adapters are used by file system implementations to access entities in the backend implementation.
Entity adapters should not use any synchronization. That is the responsibility of the file system implementation layer.
Entity adapter implementations should be careful with caching data. Especially they should not cache any data that assumes any particular location in the backend file system. Entity adapters (and the entities themselves) are not notified when a parent entity is moved.
If the same entity adapter implementations are used for both read/write and read only entities, the entity adapters do not have to check for write access when writing to an entity. That is a responsibility of the file system implementation layer.
The methods in this interface should only be used by file system and capability implementations.
Unlike EntityDelegate
:s, entity adapters must never
be proxied. Clients should always be able to assume a specific
implementation, if they have reason to know about it. For instance, a
capability implementation that is specific for a file system implementation
must always be able to cast an entity adapter to that file system's
implementation of it.
Once it is created, an entity adapter is tied to and reused by its parent
entity object. For a file system implementation that uses persistent data in
some backend (i.e. does not store any file system data in memory only), the
entity object may be garbage collected if it is not actively used. The next
time the entity is created, a new entity adapter will also be created. See
the discussion in DirectoryAdapter
for more information.
Method Summary | |
---|---|
boolean |
canRead()
Check if the entity can be read from the backend. |
boolean |
canWrite()
Check if the entity can be written to in the backend. |
void |
create()
Create the backend representation for this entity adapter. |
void |
delete()
Delete the entity from the underlying file system. |
boolean |
exists()
Check that the entity exists in the backend. |
EntityType |
getEntityType()
Get the EntityType for this entity. |
FileSystemAdapter |
getFileSystemAdapter()
Get the FileSystemAdapter for the file system where the entity
is. |
long |
getLastModified()
Get the last modification time for an entity. |
String |
getName()
Get the name of the entity. |
DirectoryAdapter |
getParent()
Get the parent DirectoryAdapter . |
void |
init()
This is called after the entity adapter object and all its dependencies have been created, but before the entity object is published. |
void |
rename(String newName,
DirectoryAdapter newParent)
Move and/or rename the entity. |
void |
setLastModified(long time)
Set the entity's last modification time. |
Method Detail |
---|
void init()
boolean exists()
EntityValidityControlStrategy
:s call this often, so make sure
that the implementation is efficient.
true
if the entity exists.String getName()
FileSystemAdapter getFileSystemAdapter()
FileSystemAdapter
for the file system where the entity
is.
FileSystemAdapter
.boolean canRead()
true
if the entity can be read.boolean canWrite()
true
if the entity can be written to.DirectoryAdapter getParent()
DirectoryAdapter
.
DirectoryAdapter
.long getLastModified()
void setLastModified(long time)
time
- The new last modification time.void create() throws FileSystemException
FileSystemException
- On errors.void delete() throws FileSystemException
This method is also responsible for calling
ChildRegisteringDirectoryAdapter.unregisterChild(EntityAdapter)
on its parent directory.
FileSystemException
- On errors.void rename(String newName, DirectoryAdapter newParent)
newName
- The entity's new name.newParent
- The entity adapter's new parent. This is the same as the
old parent if the entity is only renamed.EntityType getEntityType()
EntityType
for this entity.
EntityType
for this entity.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |