org.jboss.system.server.profileservice.repository.clustered.sync
Class AbstractSynchronizationAction<T extends SynchronizationActionContext>

java.lang.Object
  extended by org.jboss.system.server.profileservice.repository.clustered.sync.AbstractSynchronizationAction<T>
All Implemented Interfaces:
SynchronizationAction<T>, TwoPhaseCommitAction<T>
Direct Known Subclasses:
AbstractContentMetadataMutatorAction, FileReadAction, NoOpSynchronizationAction

public abstract class AbstractSynchronizationAction<T extends SynchronizationActionContext>
extends Object
implements TwoPhaseCommitAction<T>

Abstract superclass of SynchronizationAction implementations.

Version:
$Revision: $
Author:
Brian Stansberry

Nested Class Summary
static class AbstractSynchronizationAction.State
           
 
Constructor Summary
protected AbstractSynchronizationAction(T context, ContentModification modification)
          Create a new AbstractSynchronizationAction.
 
Method Summary
 void cancel()
          Cancel the action.
 void commit()
           
 void complete()
          Execute the action and if successful mark it as complete.
protected abstract  void doCancel()
           
protected abstract  void doCommit()
           
protected abstract  void doComplete()
           
protected abstract  boolean doPrepare()
           
protected abstract  void doRollbackFromCancelled()
           
protected abstract  void doRollbackFromComplete()
           
protected abstract  void doRollbackFromOpen()
           
protected abstract  void doRollbackFromPrepared()
           
protected abstract  void doRollbackFromRollbackOnly()
           
 T getContext()
          Gets the contextual information for the set of actions of which this object is a member.
protected static RepositoryItemMetadata getMarkedRemovedItem(ContentModification base)
           
 ContentModification getRepositoryContentModification()
          Gets the metadata describing this action.
 AbstractSynchronizationAction.State getState()
           
 boolean isCancelled()
          Gets whether SynchronizationAction.complete() has been invoked.
 boolean isComplete()
          Gets whether SynchronizationAction.complete() has been invoked.
 boolean prepare()
           
 void rollback()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSynchronizationAction

protected AbstractSynchronizationAction(T context,
                                        ContentModification modification)
Create a new AbstractSynchronizationAction.

Parameters:
context - the overall context of the modification
modification - the modification
Method Detail

getRepositoryContentModification

public ContentModification getRepositoryContentModification()
Description copied from interface: SynchronizationAction
Gets the metadata describing this action.

Specified by:
getRepositoryContentModification in interface SynchronizationAction<T extends SynchronizationActionContext>
Returns:
the metadata. Will not be null

getContext

public T getContext()
Description copied from interface: SynchronizationAction
Gets the contextual information for the set of actions of which this object is a member.

Specified by:
getContext in interface SynchronizationAction<T extends SynchronizationActionContext>
Returns:
the context. Will not be null

cancel

public void cancel()
Description copied from interface: SynchronizationAction
Cancel the action.

Specified by:
cancel in interface SynchronizationAction<T extends SynchronizationActionContext>

complete

public void complete()
Description copied from interface: SynchronizationAction
Execute the action and if successful mark it as complete.

Specified by:
complete in interface SynchronizationAction<T extends SynchronizationActionContext>

prepare

public boolean prepare()
Specified by:
prepare in interface TwoPhaseCommitAction<T extends SynchronizationActionContext>

commit

public void commit()
Specified by:
commit in interface TwoPhaseCommitAction<T extends SynchronizationActionContext>

rollback

public void rollback()
Specified by:
rollback in interface TwoPhaseCommitAction<T extends SynchronizationActionContext>

isCancelled

public boolean isCancelled()
Description copied from interface: SynchronizationAction
Gets whether SynchronizationAction.complete() has been invoked.

Specified by:
isCancelled in interface SynchronizationAction<T extends SynchronizationActionContext>
Returns:
true if SynchronizationAction.complete() has been invoked

isComplete

public boolean isComplete()
Description copied from interface: SynchronizationAction
Gets whether SynchronizationAction.complete() has been invoked.

Specified by:
isComplete in interface SynchronizationAction<T extends SynchronizationActionContext>
Returns:
true if SynchronizationAction.complete() has been invoked

getState

public AbstractSynchronizationAction.State getState()

doCancel

protected abstract void doCancel()

doComplete

protected abstract void doComplete()
                            throws Exception
Throws:
Exception

doPrepare

protected abstract boolean doPrepare()

doCommit

protected abstract void doCommit()

doRollbackFromOpen

protected abstract void doRollbackFromOpen()

doRollbackFromCancelled

protected abstract void doRollbackFromCancelled()

doRollbackFromRollbackOnly

protected abstract void doRollbackFromRollbackOnly()

doRollbackFromComplete

protected abstract void doRollbackFromComplete()

doRollbackFromPrepared

protected abstract void doRollbackFromPrepared()

getMarkedRemovedItem

protected static RepositoryItemMetadata getMarkedRemovedItem(ContentModification base)


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