org.eclipse.emf.transaction
Interface TransactionalCommandStack

All Superinterfaces:
CommandStack
All Known Subinterfaces:
InternalTransactionalCommandStack
All Known Implementing Classes:
AbstractTransactionalCommandStack, TransactionalCommandStackImpl

public interface TransactionalCommandStack
extends CommandStack

Extension of the basic CommandStack API providing additional control over (and feed-back from) the transactions used to execute commands.


Method Summary
 void execute(Command command, Map<?,?> options)
          Executes the specified command in a read/write transaction.
 ExceptionHandler getExceptionHandler()
          Obtains my exception handler.
 void setExceptionHandler(ExceptionHandler handler)
          Sets an exception handler.
 
Methods inherited from interface org.eclipse.emf.common.command.CommandStack
addCommandStackListener, canRedo, canUndo, execute, flush, getMostRecentCommand, getRedoCommand, getUndoCommand, redo, removeCommandStackListener, undo
 

Method Detail

execute

void execute(Command command,
             Map<?,?> options)
             throws InterruptedException,
                    RollbackException
Executes the specified command in a read/write transaction. This method is preferred over the inherited CommandStack.execute(Command) method because it provides feed-back when a command fails to complete. The implementation of this latter method simply suppresses (but logs) any checked exception that occurs.

Note that this method will block the caller until a read/write transaction can be started (if other transactions are currently active).

Parameters:
command - the command to execute
options - the options to apply to the command's transaction, or null to select the defaults
Throws:
InterruptedException - if the current thread is interrupted while waiting to start a read/write transaction for the command execution
RollbackException - if the changes performed by the command are rolled back by validation of the transaction

setExceptionHandler

void setExceptionHandler(ExceptionHandler handler)
Sets an exception handler. This object will be notified when exceptions occur, but is not really expected to be able to do anything about them. Its intended purpose is to support an user feed-back mechanism appropriate to the environment.

Parameters:
handler - the exception handler to set

getExceptionHandler

ExceptionHandler getExceptionHandler()
Obtains my exception handler.

Returns:
my exception handler, or null if none
See Also:
setExceptionHandler(ExceptionHandler)

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.