|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface OverwriteStrategy
This interface is implemented by different strategy objects that are used for overwriting existing entities when a new entity should be created at the same location as the old.
| Method Summary | |
|---|---|
OverwriteResult |
overwrite(Directory dir,
String name,
EntityType typeOfNewEntity)
If there is an existing entity in the directory with the specified name, deal with it according to the overwrite strategy. |
OverwriteResult |
overwrite(File dir,
String name,
EntityType typeOfNewEntity,
LogAdapter la)
This method does the same as the overwrite(Directory, String, EntityType) method, but it uses a
File variable for the target directory. |
| Method Detail |
|---|
OverwriteResult overwrite(Directory dir,
String name,
EntityType typeOfNewEntity)
throws EntityFoundException,
DirectoryNotEmptyException
If this method logs a warning, the directory's file system's log adapter should preferably be used.
dir - The directory. The directory must be locked for writing when
this method is called.name - The name of the entity.typeOfNewEntity - The type of the new entity that will be created
after an old entity, if there is one, is overwritten. This may be a
factor in the decision to overwrite an entity, especially if both the old
and the new entities are directories.
OverwriteResult.CAN_CREATE_NEW_ENTITY a new entity can
be created at the target location. This may mean that the overwrite
strategy deleted an old entityOverwriteResult.CANNOT_CREATE_NEW_ENTITY a new entity
cannot be created at the target location. This means that the overwrite
strategy found an entity that it was not allowed to delete.OverwriteResult.KEPT_OLD_DIRECTORY the client wanted to
create a new directory in the same place as an old directory. The
overwrite strategy kept the old directory.EntityFoundException - If there is an entity in the target location
and the strategy tells us to react by throwing an exception.
DirectoryNotEmptyException - If this method attempts to overwrite a
non-empty directory.
OverwriteResult overwrite(File dir,
String name,
EntityType typeOfNewEntity,
LogAdapter la)
throws EntityNotFoundException,
NotADirectoryException,
EntityFoundException,
FileSystemException
overwrite(Directory, String, EntityType) method, but it uses a
File variable for the target directory.
dir - The target directory. This must exist and be a directory.name - The name of the entity.typeOfNewEntity - The type of the new entity that will be created
after an old entity, if there is one, is overwritten. This may be a
factor in the decision to overwrite an entity, especially if both the old
and the new entities are directories.la - An adapter to log to.
OverwriteResult.CAN_CREATE_NEW_ENTITY a new entity can
be created at the target location. This may mean that the overwrite
strategy deleted an old entityOverwriteResult.CANNOT_CREATE_NEW_ENTITY a new entity
cannot be created at the target location. This means that the overwrite
strategy found an entity that it was not allowed to delete.OverwriteResult.KEPT_OLD_DIRECTORY the client wanted
to create a new directory in the same place as an old directory. The
overwrite strategy kept the old directory.EntityNotFoundException - If the target directory does not exist.
NotADirectoryException - If the target is not a directory.
EntityFoundException - If there is an entity in the target location
and the strategy tells us to react by throwing an exception.
FileSystem - If an existing entity cannot be deleted.
FileSystemException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||