se.entitymanager.logic.file
Class FileLogicFacade

java.lang.Object
  extended by se.entitymanager.logic.file.FileLogicFacade
All Implemented Interfaces:
LogicFacade

public class FileLogicFacade
extends java.lang.Object
implements LogicFacade

A LogicFacade that provides an interface to file systems.


Field Summary
private  EntityInterface clipboardEntity
          The entity of the file to be copied or cutted (to the clipboard).
private  boolean deleteAfterPaste
          The entity of the file to be copied or cutted (to the clipboard).
private  java.util.List entityChangedListeners
          List of listeners for changed entities.
private static FileLogicFacade facade
          Static instance.
 
Constructor Summary
private FileLogicFacade()
          Änderung: auskommentiert ***
 
Method Summary
 void addEntityChangeListener(EntityChangedListener listener)
          Adds listener for changed entites.
 void copy(EntityInterface entity)
          Copies an entity.
 void delete(EntityInterface entity)
          Deletes an entity.
 java.util.Collection getAllChildren(EntityInterface entity)
          Returns sub-entities of folderish entity.
 EntityInterface getClipboardEntity()
          Returns entity to be pasted.
 java.io.File getClipboardFile()
           
 java.util.Comparator getComparator()
          Returns a comparator for entity interfaces.
 boolean getDeleteAfterPaste()
           
 java.lang.String getEntityLastModified(EntityInterface entity)
          Returns date of last modification of entity.
 java.lang.String getEntityName(EntityInterface entity)
          Returns name of entity.
 java.lang.String getEntitySize(EntityInterface entity)
          Returns size of entity.
static FileLogicFacade getInstance()
          Returns the instance of class FileLogicFacade.
 EntityInterface getRootEntity()
          Returns root entity.
 boolean isEntityReadable(EntityInterface entity)
          Returns if file is readable.
 boolean isEntityWriteable(EntityInterface entity)
          Returns if file is writable.
 boolean isFolderish(EntityInterface entity)
          Returns whether entity is folderish.
private  void notifyChangedEntity(EntityInterface entity)
          Notifies all listeners for changed entities about a changed entity.
 void paste(EntityInterface destinationEntity)
          Pastes to an entity.
 void removeEntityChangeListener(EntityChangedListener listener)
          Removes listener for changed entities.
 void rename(EntityInterface entity, java.lang.String newName)
          Renames an entity.
 void setDeleteAfterPaste(boolean shouldBeDeleted)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

facade

private static FileLogicFacade facade
Static instance.

See Also:
getInstance()

entityChangedListeners

private java.util.List entityChangedListeners
List of listeners for changed entities.


clipboardEntity

private EntityInterface clipboardEntity
The entity of the file to be copied or cutted (to the clipboard).


deleteAfterPaste

private boolean deleteAfterPaste
The entity of the file to be copied or cutted (to the clipboard).

Constructor Detail

FileLogicFacade

private FileLogicFacade()
Änderung: auskommentiert ***

See Also:
getInstance()
Method Detail

getInstance

public static FileLogicFacade getInstance()
Returns the instance of class FileLogicFacade.


getRootEntity

public EntityInterface getRootEntity()
Description copied from interface: LogicFacade
Returns root entity.

All entities must be within a tree like hierarchy. This method returns the root of this hierarchy.

Specified by:
getRootEntity in interface LogicFacade
Returns:
root entity

getClipboardFile

public java.io.File getClipboardFile()

getEntityName

public java.lang.String getEntityName(EntityInterface entity)
Description copied from interface: LogicFacade
Returns name of entity.

All entities must have name. This method returns the name of the given entity.

Specified by:
getEntityName in interface LogicFacade
Parameters:
entity - the entity
Returns:
name of entity

getEntitySize

public java.lang.String getEntitySize(EntityInterface entity)
Description copied from interface: LogicFacade
Returns size of entity.

All entities must have size. This method returns the size of the given entity.

Specified by:
getEntitySize in interface LogicFacade
Parameters:
entity - the entity
Returns:
size of entity

getEntityLastModified

public java.lang.String getEntityLastModified(EntityInterface entity)
Description copied from interface: LogicFacade
Returns date of last modification of entity.

All entities must have date of last modification. This method returns the date of last modification of the given entity.

Specified by:
getEntityLastModified in interface LogicFacade
Parameters:
entity - the entity
Returns:
date of last modification of entity

isEntityReadable

public boolean isEntityReadable(EntityInterface entity)
Description copied from interface: LogicFacade
Returns if file is readable.

Specified by:
isEntityReadable in interface LogicFacade
Parameters:
entity - the entity
Returns:
true if file associated with entity is redable

isEntityWriteable

public boolean isEntityWriteable(EntityInterface entity)
Description copied from interface: LogicFacade
Returns if file is writable.

Specified by:
isEntityWriteable in interface LogicFacade
Parameters:
entity - the entity
Returns:
true if file associated with entity is writable

isFolderish

public boolean isFolderish(EntityInterface entity)
Description copied from interface: LogicFacade
Returns whether entity is folderish.

Folderish entities may contain other entities. These may be accessed with method getAllChildren.

Specified by:
isFolderish in interface LogicFacade
Parameters:
entity - the entity
Returns:
true if entity is folderish, false otherwise
See Also:
LogicFacade.getAllChildren(EntityInterface)

getAllChildren

public java.util.Collection getAllChildren(EntityInterface entity)
                                    throws EntityNotFolderishException
Description copied from interface: LogicFacade
Returns sub-entities of folderish entity.

Specified by:
getAllChildren in interface LogicFacade
Parameters:
entity - the entity
Returns:
sub-entities
Throws:
EntityNotFolderishException

rename

public void rename(EntityInterface entity,
                   java.lang.String newName)
            throws EntityRenameFailedException
Description copied from interface: LogicFacade
Renames an entity.

Specified by:
rename in interface LogicFacade
Parameters:
entity - the entity
newName - new name for the entity
Throws:
EntityRenameFailedException - if an error occured

delete

public void delete(EntityInterface entity)
            throws EntityDeletionFailedException
Description copied from interface: LogicFacade
Deletes an entity.

Specified by:
delete in interface LogicFacade
Parameters:
entity - the entity
Throws:
EntityDeletionFailedException - if an error occured

setDeleteAfterPaste

public void setDeleteAfterPaste(boolean shouldBeDeleted)
Specified by:
setDeleteAfterPaste in interface LogicFacade

getDeleteAfterPaste

public boolean getDeleteAfterPaste()
Specified by:
getDeleteAfterPaste in interface LogicFacade

copy

public void copy(EntityInterface entity)
          throws EntityCopyCutFailedException
Description copied from interface: LogicFacade
Copies an entity.

Specified by:
copy in interface LogicFacade
Parameters:
entity - the entity
Throws:
EntityCopyCutFailedException - if an error occured

getClipboardEntity

public EntityInterface getClipboardEntity()
Description copied from interface: LogicFacade
Returns entity to be pasted.

Specified by:
getClipboardEntity in interface LogicFacade
Returns:
name of entity to be pasted

paste

public void paste(EntityInterface destinationEntity)
           throws EntityPasteFailedException
Description copied from interface: LogicFacade
Pastes to an entity.

Specified by:
paste in interface LogicFacade
Throws:
EntityPasteFailedException - if an error occured

getComparator

public java.util.Comparator getComparator()
Description copied from interface: LogicFacade
Returns a comparator for entity interfaces. The sort criteria depends on implementation.

Specified by:
getComparator in interface LogicFacade
Returns:
comparator for entity interfaces

addEntityChangeListener

public void addEntityChangeListener(EntityChangedListener listener)
Description copied from interface: LogicFacade
Adds listener for changed entites.

Specified by:
addEntityChangeListener in interface LogicFacade
Parameters:
listener - the listener to add
See Also:
LogicFacade.addEntityChangeListener(se.entitymanager.logic.EntityChangedListener)

removeEntityChangeListener

public void removeEntityChangeListener(EntityChangedListener listener)
Description copied from interface: LogicFacade
Removes listener for changed entities.

Specified by:
removeEntityChangeListener in interface LogicFacade
Parameters:
listener - the listener to remove
See Also:
LogicFacade.removeEntityChangeListener(se.entitymanager.logic.EntityChangedListener)

notifyChangedEntity

private void notifyChangedEntity(EntityInterface entity)
Notifies all listeners for changed entities about a changed entity.

Parameters:
entity - the entity that has changed