org.electrocodeogram.cpc.core.api.hub.event
Class ClonePersistenceEvent

java.lang.Object
  extended by org.electrocodeogram.cpc.core.api.hub.event.CPCEvent
      extended by org.electrocodeogram.cpc.core.api.hub.event.CloneEvent
          extended by org.electrocodeogram.cpc.core.api.hub.event.ClonePersistenceEvent
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<CPCEvent>

public class ClonePersistenceEvent
extends CloneEvent

This event is generated by the IStoreProvider whenever the clone data is persisted to stable storage.
Typically this happens whenever the user saves a file. This event is also generated, if the clone data for a file is purged.

The CloneEvent.getCloneFile() value will be NULL if all clone data was purged.

IMPORTANT: This event is generated from within an exclusive write lock block inside of the IStoreProvider. A receiver is not allowed to make any calls to the store provider for the duration of the event dispatching.
Furthermore, as an exclusive lock is held, all receivers are urged to return as fast as possible.
Care should be taken to ensure that a receiver does not inadvertently trigger events which might lead to not absolutely necessary work being done during the lifetime of this event (and therefore the exclusive write lock).

Author:
vw
See Also:
IStoreProvider.persistData(ICloneFile), IStoreProvider.purgeData(ICloneFile, boolean)

Constructor Summary
ClonePersistenceEvent(ICloneFile cloneFile)
          Creates a new ClonePersistenceEvent for the given file.
 
Method Summary
 java.util.List<IClone> getClones()
          Retrieves a list with the new persisted clone data for this file.
 void setClones(java.util.List<IClone> clones)
          Sets the list of persisted clones.
 java.lang.String toString()
          Every event should implement a sensible toString method for use in debugging log messages.
 
Methods inherited from class org.electrocodeogram.cpc.core.api.hub.event.CloneEvent
getCloneFile, subToString
 
Methods inherited from class org.electrocodeogram.cpc.core.api.hub.event.CPCEvent
checkSeal, clone, compareTo, getCreationTime, isValid, seal
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClonePersistenceEvent

public ClonePersistenceEvent(ICloneFile cloneFile)
Creates a new ClonePersistenceEvent for the given file.

Parameters:
cloneFile - the file for which clone data was persisted, never null.
Method Detail

getClones

public java.util.List<IClone> getClones()
Retrieves a list with the new persisted clone data for this file.
The list may be empty, if no clones are persisted for this file.

IMPORTANT: the IClone instances may not me modified in any way.

Returns:
a list with the latest versions of all IClone instances for this file, never null.

setClones

public void setClones(java.util.List<IClone> clones)
Sets the list of persisted clones.

NOTE: For performance reasons IClone instances do not need to be cloned or sealed for use in this event. Receivers of this event are not allowed to modify the instances in any way.

Parameters:
clones - a list with the latest versions of all IClone instances for this file, never null.

toString

public java.lang.String toString()
Description copied from class: CPCEvent
Every event should implement a sensible toString method for use in debugging log messages.

Specified by:
toString in class CPCEvent
Returns:
debug string representation, never null.