org.jboss.profileservice.cluster.repository
Class DefaultSynchronizationPolicy

java.lang.Object
  extended by org.jboss.system.server.profileservice.repository.clustered.sync.AbstractSynchronizationPolicy
      extended by org.jboss.profileservice.cluster.repository.DefaultSynchronizationPolicy
All Implemented Interfaces:
SynchronizationPolicy

public class DefaultSynchronizationPolicy
extends AbstractSynchronizationPolicy

Default implementation of SynchronizationPolicy.

Version:
$Revision: $
Author:
Brian Stansberry

Field Summary
 
Fields inherited from class org.jboss.system.server.profileservice.repository.clustered.sync.AbstractSynchronizationPolicy
DEFAULT_REMOVAL_TRACKING_TIME
 
Constructor Summary
DefaultSynchronizationPolicy()
           
 
Method Summary
protected  boolean acceptAddition(RepositoryItemMetadata toAdd, RepositoryItemMetadata joinersPrevious, boolean merge)
          Always accepts merge additions; accepts join additions if the time-discrepancy adjusted timestamp of toAdd is later than the current time minus the maximum period we track item removals.
protected  boolean acceptReincarnation(RepositoryItemMetadata reincarnation, RepositoryItemMetadata current, boolean merge)
          Accepts the reincarnation if the time-discrepancy adjusted timestamp of reincarnation is at least as recent as the time-discrepancy adjusted timestamp of the current item.
protected  boolean acceptRemoval(RepositoryItemMetadata current, RepositoryItemMetadata sendersView, boolean merge)
          Rejects removal if sendersView is null, else accepts the removal if the time-discrepancy adjusted timestamp of sendersView is at least as recent as the time-discrepancy adjusted timestamp of the current item.
protected  boolean acceptUpdate(RepositoryItemMetadata update, RepositoryItemMetadata current, boolean merge)
          Accepts the removal if the time-discrepancy adjusted timestamp of update is at least as recent as the time-discrepancy adjusted timestamp of the current item.
 TimestampDiscrepancyService getTimestampService()
           
 void setTimestampService(TimestampDiscrepancyService timestampService)
           
 
Methods inherited from class org.jboss.system.server.profileservice.repository.clustered.sync.AbstractSynchronizationPolicy
acceptJoinAddition, acceptJoinReincarnation, acceptJoinRemoval, acceptJoinUpdate, acceptMergeAddition, acceptMergeReincarnation, acceptMergeRemoval, acceptMergeUpdate, getAllowJoinAdditions, getAllowJoinReincarnations, getAllowJoinRemovals, getAllowJoinUpdates, getAllowMergeAdditions, getAllowMergeReincarnations, getAllowMergeRemovals, getAllowMergeUpdates, getRemovalTrackingTime, isDeveloperMode, purgeRemovedItems, setAllowJoinAdditions, setAllowJoinReincarnations, setAllowJoinRemovals, setAllowJoinUpdates, setAllowMergeAdditions, setAllowMergeReincarnations, setAllowMergeRemovals, setAllowMergeUpdates, setDeveloperMode, setRemovalTrackingTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSynchronizationPolicy

public DefaultSynchronizationPolicy()
Method Detail

getTimestampService

public TimestampDiscrepancyService getTimestampService()

setTimestampService

public void setTimestampService(TimestampDiscrepancyService timestampService)

acceptAddition

protected boolean acceptAddition(RepositoryItemMetadata toAdd,
                                 RepositoryItemMetadata joinersPrevious,
                                 boolean merge)
Always accepts merge additions; accepts join additions if the time-discrepancy adjusted timestamp of toAdd is later than the current time minus the maximum period we track item removals. The idea of the latter being that if a previous version of toAdd was removed more recently than that then we should have a record of its removal.

Specified by:
acceptAddition in class AbstractSynchronizationPolicy

acceptReincarnation

protected boolean acceptReincarnation(RepositoryItemMetadata reincarnation,
                                      RepositoryItemMetadata current,
                                      boolean merge)
Accepts the reincarnation if the time-discrepancy adjusted timestamp of reincarnation is at least as recent as the time-discrepancy adjusted timestamp of the current item.

Specified by:
acceptReincarnation in class AbstractSynchronizationPolicy

acceptRemoval

protected boolean acceptRemoval(RepositoryItemMetadata current,
                                RepositoryItemMetadata sendersView,
                                boolean merge)
Rejects removal if sendersView is null, else accepts the removal if the time-discrepancy adjusted timestamp of sendersView is at least as recent as the time-discrepancy adjusted timestamp of the current item.

Specified by:
acceptRemoval in class AbstractSynchronizationPolicy

acceptUpdate

protected boolean acceptUpdate(RepositoryItemMetadata update,
                               RepositoryItemMetadata current,
                               boolean merge)
Accepts the removal if the time-discrepancy adjusted timestamp of update is at least as recent as the time-discrepancy adjusted timestamp of the current item.

Specified by:
acceptUpdate in class AbstractSynchronizationPolicy


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.