Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


org.eclipse.emf.transaction.impl
Class AbstractTransactionalCommandStack

java.lang.Object
  extended by 

org.eclipse.emf.common.command.BasicCommandStack
      extended by 
org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack
All Implemented Interfaces:
CommandStack, InternalTransactionalCommandStack, TransactionalCommandStack
Direct Known Subclasses:
TransactionalCommandStackImpl

public abstract class AbstractTransactionalCommandStack
extends BasicCommandStack
implements InternalTransactionalCommandStack

Partial implementation of the TransactionalCommandStack interface, useful for subclasses to define their specific handling of transactions and other concerns.

Since:
1.1

Field Summary
protected   ExceptionHandler exceptionHandler
           
 
Fields inherited from class org.eclipse.emf.common.command. BasicCommandStack
commandList, listeners, mostRecentCommand, saveIndex, top
 
Constructor Summary
AbstractTransactionalCommandStack ()
          Initializes me.
 
Method Summary
protected  void basicExecute ( Command command)
          Provides access to the BasicCommandStack implementation of the execute(Command) method, as this class overrides it to delegate to the TransactionalCommandStack.execute(Command, Map) method.
protected abstract  void doExecute ( Command command, Map<?,?> options)
          Implemented by subclasses to perform the execution of the specified command.
 void execute ( Command command)
          Redefines the inherited method by forwarding to the TransactionalCommandStack.execute(Command, Map) method.
 void execute ( Command command, Map<?,?> options)
          Default implementation delegates to the subclass implementation of doExecute(Command, Map), handling the roll-back exception if the command is rolled back.
  InternalTransactionalEditingDomain getDomain ()
          Obtains the editing domain in which I create transactions.
  ExceptionHandler getExceptionHandler ()
          Obtains my exception handler.
protected   Map<?,?> getUndoRedoOptions ()
          Obtains my editing domain's default undo/redo transaction options.
protected  void handleError ( Exception exception)
          Extends the inherited method by first aborting the active transaction (if any) and passing the exception along to the registered exception handler (if any).
protected  void handleRollback ( Command command, RollbackException rbe)
          Handles the roll-back of the specified command execution.
static  Map< Object, Object> makeTriggerTransactionOptions ( Map<?,?> options)
          Customizes the specified options for the case of a transaction that executes trigger commands.
protected  void rollback ( Transaction tx)
          Ensures that the specified transaction is rolled back, first rolling back a nested transaction (if any).
 void setEditingDomain ( InternalTransactionalEditingDomain domain)
          Assigns the editing domain in which I create transactions.
 void setExceptionHandler ( ExceptionHandler handler)
          Sets an exception handler.
 
Methods inherited from class org.eclipse.emf.common.command. BasicCommandStack
addCommandStackListener, canRedo, canUndo, flush, getMostRecentCommand, getRedoCommand, getUndoCommand, isSaveNeeded, notifyListeners, redo, removeCommandStackListener, saveIsDone, undo
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.transaction.impl. InternalTransactionalCommandStack
createTransaction, dispose, executeTriggers
 
Methods inherited from interface org.eclipse.emf.common.command. CommandStack
addCommandStackListener, canRedo, canUndo, flush, getMostRecentCommand, getRedoCommand, getUndoCommand, redo, removeCommandStackListener, undo
 

Field Detail

exceptionHandler

protected 
ExceptionHandler exceptionHandler
Constructor Detail

AbstractTransactionalCommandStack

public AbstractTransactionalCommandStack()
Initializes me.

Method Detail

getDomain

public 
InternalTransactionalEditingDomain getDomain()
Description copied from interface: InternalTransactionalCommandStack
Obtains the editing domain in which I create transactions.

Specified by:
getDomain in interface InternalTransactionalCommandStack
Returns:
my editing domain
See Also:
InternalTransactionalCommandStack.createTransaction(Command, Map)

setEditingDomain

public void setEditingDomain(
InternalTransactionalEditingDomain domain)
Description copied from interface: InternalTransactionalCommandStack
Assigns the editing domain in which I create transactions.

Specified by:
setEditingDomain in interface InternalTransactionalCommandStack
Parameters:
domain - my editing domain
See Also:
InternalTransactionalCommandStack.createTransaction(Command, Map)

rollback

protected void rollback(
Transaction tx)
Ensures that the specified transaction is rolled back, first rolling back a nested transaction (if any).

Parameters:
tx - a transaction to roll back

setExceptionHandler

public void setExceptionHandler(
ExceptionHandler handler)
Description copied from interface: TransactionalCommandStack
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.

Specified by:
setExceptionHandler in interface TransactionalCommandStack
Parameters:
handler - the exception handler to set

getExceptionHandler

public 
ExceptionHandler getExceptionHandler()
Description copied from interface: TransactionalCommandStack
Obtains my exception handler.

Specified by:
getExceptionHandler in interface TransactionalCommandStack
Returns:
my exception handler, or null if none
See Also:
TransactionalCommandStack.setExceptionHandler(ExceptionHandler)

handleError

protected void handleError(
Exception exception)
Extends the inherited method by first aborting the active transaction (if any) and passing the exception along to the registered exception handler (if any).

Overrides:
handleError in class BasicCommandStack

execute

public void execute(
Command command,
                    
Map<?,?> options)
             throws 
InterruptedException,
                    
RollbackException
Default implementation delegates to the subclass implementation of doExecute(Command, Map), handling the roll-back exception if the command is rolled back. Note that doExecute() is only called if the command is executable.

Specified by:
execute in interface TransactionalCommandStack
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

doExecute

protected abstract void doExecute(
Command command,
                                  
Map<?,?> options)
                           throws 
InterruptedException,
                                  
RollbackException
Implemented by subclasses to perform the execution of the specified command. Invoked by the execute(Command, Map) method.

Parameters:
command - the command to execute
options - the transaction options to apply to execution of the command
Throws:
InterruptedException - if the current thread is interrupted while waiting to start the transaction
RollbackException - if the execution of the command is rolled back

handleRollback

protected void handleRollback(
Command command,
                              
RollbackException rbe)
Handles the roll-back of the specified command execution. This default implementation disposes the command and notifies command-stack listeners so that they may get the latest information, in case they were already notified of command execution, for example.

Parameters:
command - the command whose execution was rolled back (may be null if not known)
rbe - the roll-back exception (may be null if no exception is to be thrown)

execute

public void execute(
Command command)
Redefines the inherited method by forwarding to the TransactionalCommandStack.execute(Command, Map) method. Any checked exception thrown by that method is handled by handleError(Exception) but is not propagated.

Specified by:
execute in interface CommandStack
Overrides:
execute in class BasicCommandStack

basicExecute

protected void basicExecute(
Command command)
Provides access to the BasicCommandStack implementation of the execute(Command) method, as this class overrides it to delegate to the TransactionalCommandStack.execute(Command, Map) method.

Parameters:
command - the command to execute

getUndoRedoOptions

protected 
Map<?,?> getUndoRedoOptions()
Obtains my editing domain's default undo/redo transaction options.

Returns:
my editing domain's transaction options for undo/redo

makeTriggerTransactionOptions

public static final 
Map<
Object,
Object> makeTriggerTransactionOptions(
Map<?,?> options)
Customizes the specified options for the case of a transaction that executes trigger commands. The original map is not affected.

Parameters:
options - a client-supplied options map
Returns:
a derived map of options suitable for trigger transactions

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire