org.entityfs.ram
Class AbstractRamEntityAdapter

java.lang.Object
  extended by org.entityfs.impl.impl.adapter.AbstractRWEntityAdapter<RamFileSystemAdapter,RamDirectoryAdapter>
      extended by org.entityfs.ram.AbstractRamEntityAdapter
All Implemented Interfaces:
EntityAdapter
Direct Known Subclasses:
RamDirectoryAdapter, RamFileAdapter, RamSymbolicLinkAdapter

public abstract class AbstractRamEntityAdapter
extends AbstractRWEntityAdapter<RamFileSystemAdapter,RamDirectoryAdapter>

This is an abstract base class for entity adapters in a RAM file system.

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

Constructor Summary
protected AbstractRamEntityAdapter(RamFileSystemAdapter fs, RamDirectoryAdapter parent, String name)
           
 
Method Summary
 boolean canRead()
          Subclasses may override as needed.
 boolean canWrite()
          Subclasses may override as needed.
 void create()
          Create the backend representation for this entity adapter.
 void delete()
          Delete the entity from the underlying file system.
 boolean exists()
          Subclasses may override as needed.
 T getFileSystemAdapter()
          Get the FileSystemAdapter for the file system where the entity is.
 long getLastModified()
          Get the last modification time for an entity.
 void init()
          This implementation does nothing.
 void rename(String newName, DirectoryAdapter newParent)
          Move and/or rename the entity.
 void setLastModified(long time)
          Set the entity's last modification time.
 
Methods inherited from class org.entityfs.impl.impl.adapter.AbstractRWEntityAdapter
getName, getParent, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.entityfs.impl.adapter.EntityAdapter
getEntityType
 

Constructor Detail

AbstractRamEntityAdapter

protected AbstractRamEntityAdapter(RamFileSystemAdapter fs,
                                   RamDirectoryAdapter parent,
                                   String name)
Method Detail

exists

public boolean exists()
Subclasses may override as needed.

Specified by:
exists in interface EntityAdapter
Returns:
true if the entity exists.

canRead

public boolean canRead()
Subclasses may override as needed.

Specified by:
canRead in interface EntityAdapter
Returns:
true if the entity can be read.

canWrite

public boolean canWrite()
Description copied from class: AbstractRWEntityAdapter
Subclasses may override as needed.

Specified by:
canWrite in interface EntityAdapter
Overrides:
canWrite in class AbstractRWEntityAdapter<RamFileSystemAdapter,RamDirectoryAdapter>
Returns:
true if the entity can be written to.

getLastModified

public long getLastModified()
Description copied from interface: EntityAdapter
Get the last modification time for an entity.

Returns:
The last modification time for an entity.

setLastModified

public void setLastModified(long time)
Description copied from interface: EntityAdapter
Set the entity's last modification time.

Parameters:
time - The new last modification time.

delete

public void delete()
Description copied from interface: EntityAdapter
Delete the entity from the underlying file system.

This method is also responsible for calling ChildRegisteringDirectoryAdapter.unregisterChild(EntityAdapter) on its parent directory.


rename

public void rename(String newName,
                   DirectoryAdapter newParent)
Description copied from interface: EntityAdapter
Move and/or rename the entity.

Parameters:
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.

create

public void create()
Description copied from interface: EntityAdapter
Create the backend representation for this entity adapter. (New file, new directory, new symbolic link, etc.)


init

public void init()
This implementation does nothing. Override if necessary.

Specified by:
init in interface EntityAdapter

getFileSystemAdapter

public T getFileSystemAdapter()
Description copied from interface: EntityAdapter
Get the FileSystemAdapter for the file system where the entity is.

Specified by:
getFileSystemAdapter in interface EntityAdapter
Returns:
The entity adapter's FileSystemAdapter.