org.entityfs.zip
Class ZipDirectoryAdapter

java.lang.Object
  extended by org.entityfs.impl.impl.adapter.AbstractROEntityAdapter<ZipFileSystemAdapter,ZipDirectoryAdapter>
      extended by org.entityfs.zip.ZipDirectoryAdapter
All Implemented Interfaces:
DirectoryAdapter, EntityAdapter, ZipEntityAdapter

public class ZipDirectoryAdapter
extends AbstractROEntityAdapter<ZipFileSystemAdapter,ZipDirectoryAdapter>
implements DirectoryAdapter, ZipEntityAdapter


Constructor Summary
ZipDirectoryAdapter(ZipFileSystemAdapter fs, ZipDirectoryAdapter parent, AbsoluteLocation loc, ZipEntry ze, org.entityfs.zip.ZipFileDirectoryNode myNode)
           
 
Method Summary
 void assertCanBeDeleted(Collection<String> c)
          Check if the directory can be deleted provided that all the childEntitiesToDelete entities were deleted first.
 boolean canRead()
          Subclasses may override as needed.
 boolean containsEntity(String name)
          Check if the directory contains an entity with the given name (case sensitive or insensitive depending on the file system).
 String createTempFile(String prefix, String suffix, String suggestedName)
           
 void deleteChild(String name)
          Delete the named child.
 boolean exists()
          Subclasses may override as needed.
 EntityType getChildEntityType(String name)
          Get the type of the child entity with the given name,
 String[] getEntityNames()
          Get an array with the names of all child entities.
 EntityType getEntityType()
          Get the EntityType for this entity.
 T getFileSystemAdapter()
          Get the FileSystemAdapter for the file system where the entity is.
 long getLastModified()
          Get the last modification time for an entity.
 ZipEntry getZipEntry()
           
 void init()
          This implementation does nothing.
 
Methods inherited from class org.entityfs.impl.impl.adapter.AbstractROEntityAdapter
assertCanBeDeleted, canWrite, create, delete, getName, getParent, rename, setLastModified
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.entityfs.zip.ZipEntityAdapter
getZipEntry
 
Methods inherited from interface org.entityfs.impl.adapter.EntityAdapter
canRead, canWrite, create, delete, exists, getFileSystemAdapter, getLastModified, getName, getParent, init, rename, setLastModified
 

Constructor Detail

ZipDirectoryAdapter

public ZipDirectoryAdapter(ZipFileSystemAdapter fs,
                           ZipDirectoryAdapter parent,
                           AbsoluteLocation loc,
                           ZipEntry ze,
                           org.entityfs.zip.ZipFileDirectoryNode myNode)
Method Detail

getChildEntityType

public EntityType getChildEntityType(String name)
Description copied from interface: DirectoryAdapter
Get the type of the child entity with the given name,

Specified by:
getChildEntityType in interface DirectoryAdapter
Parameters:
name - The name of the entity.
Returns:
The EntityType, or null if no such entity exists.

containsEntity

public boolean containsEntity(String name)
Description copied from interface: DirectoryAdapter
Check if the directory contains an entity with the given name (case sensitive or insensitive depending on the file system).

Specified by:
containsEntity in interface DirectoryAdapter
Parameters:
name - The name of the entity.
Returns:
true if the directory contains the named entity, false otherwise.

getEntityNames

public String[] getEntityNames()
Description copied from interface: DirectoryAdapter
Get an array with the names of all child entities.

Specified by:
getEntityNames in interface DirectoryAdapter
Returns:
An array with the names of all child entities. If the directory is empty, an empty array is returned.

createTempFile

public String createTempFile(String prefix,
                             String suffix,
                             String suggestedName)

getEntityType

public EntityType getEntityType()
Description copied from interface: EntityAdapter
Get the EntityType for this entity.

Specified by:
getEntityType in interface EntityAdapter
Returns:
The EntityType for this entity.

assertCanBeDeleted

public void assertCanBeDeleted(Collection<String> c)
Description copied from interface: DirectoryAdapter
Check if the directory can be deleted provided that all the childEntitiesToDelete entities were deleted first. be empty.

Specified by:
assertCanBeDeleted in interface DirectoryAdapter
Parameters:
c - The names of child entities to delete before deleting the directory. This may be null.

deleteChild

public void deleteChild(String name)
Description copied from interface: DirectoryAdapter
Delete the named child. The caller is responsible for making sure that no entity adapters representing the deleted children will be used in the future.

If the named child entity does not exist, this method exits silently.

Specified by:
deleteChild in interface DirectoryAdapter
Parameters:
name - The name of the child to delete.

getZipEntry

public ZipEntry getZipEntry()

getLastModified

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

Specified by:
getLastModified in interface EntityAdapter
Returns:
The last modification time for an entity.

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.

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.