## org.eclipse.emf.transaction.impl
Interface InternalTransactionalEditingDomain

All Superinterfaces:
  EditingDomain, TransactionalEditingDomain

All Known Implementing Classes:
  TransactionalEditingDomainImpl

    public interface InternalTransactionalEditingDomain

extends TransactionalEditingDomain

Internal interface that must be provided by any implementation of the public `TransactionalEditingDomain` API, in order to function correctly in the transactional editing domain framework.

Nested Class Summary

Nested classes/interfaces inherited from interface org.eclipse.emf.transaction.TransactionalEditingDomain
`TransactionalEditingDomain.DefaultOptions, TransactionalEditingDomain.Factory, TransactionalEditingDomain.Registry`

Method Summary
`void` `activate(InternalTransaction tx)` Activates (starts) the specified transaction.
`void` `broadcastUnbatched(Notification notification)` Broadcasts the specified notification to listeners as a singleton list, in a situation where batching is not possible because events are occurring outside of any transaction context.
`void` `deactivate(InternalTransaction tx)` Deactivates the specified transaction.
`void` `endPrivileged(PrivilegedRunnable<?> runnable)` Returns me to my previous owner, upon completion of the specified privileged runnable.
`InternalTransaction` `getActiveTransaction()` Obtains the transaction that currently has access to me, and whose thread of execution is active.
`TransactionChangeRecorder` `getChangeRecorder()` Obtains the change recorder that I use to track changes in my resource set.
`Map<Object,Object>` `getUndoRedoOptions()` Retrieves the undo/redo options that should be used when creating transactions.
`TransactionValidator` `getValidator()` Gets the validator that transactions should use to validate themselves upon committing.
`void` `precommit(InternalTransaction tx)` Performs the pre-commit notifications and processing of trigger comamnds.
`void` `startPrivileged(PrivilegedRunnable<?> runnable)` Transfers ownership of this editing domain to the specified privileged runnable.
`InternalTransaction` `startTransaction(boolean readOnly, Map<?,?> options)` Creates and starts a new transaction.

Methods inherited from interface org.eclipse.emf.transaction.TransactionalEditingDomain
`addResourceSetListener, createPrivilegedRunnable, dispose, getID, removeResourceSetListener, runExclusive, setID, yield`

Methods inherited from interface org.eclipse.emf.edit.domain.EditingDomain
`createCommand, createOverrideCommand, createResource, getChildren, getClipboard, getCommandStack, getNewChildDescriptors, getOptimizeCopy, getParent, getResourceSet, getRoot, getTreePath, isControllable, isReadOnly, loadResource, setClipboard, treeIterator`

Method Detail

### startTransaction

    InternalTransaction startTransaction(boolean readOnly,
                                         Map<?,?> options)
                                         throws InterruptedException

  Creates and starts a new transaction. The current thread is blocked until I grant it exclusive access to my resource set.

  Parameters:
    `readOnly` - `true` if the transaction is intended only to read the resource set; `false` if it will modify it
    `options` - the options to apply to the transaction (as specified by the `TransactionalCommandStack` interface
  Returns:
    the newly started transaction
  Throws:
    `InterruptedException` - if the current thread is interrupted while waiting for the transaction to start
    `IllegalArgumentException` - if the current thread does not `own` the transaction that it wants to start or if it is attempting to start a transaction in an inappropriate context
  See Also:
    `activate(InternalTransaction)`

### getActiveTransaction

    InternalTransaction getActiveTransaction()

  Obtains the transaction that currently has access to me, and whose thread of execution is active.

  Returns:
    my active transaction, or `null` if no transaction is currently active

### activate

    void activate(InternalTransaction tx)
                  throws InterruptedException

  Activates (starts) the specified transaction. The current thread is blocked until the transaction is activated, at which point it will be my active transaction until it either yields (in the case of a read-only transaction) or closes.

  Note that only the thread that owns a transaction may activate it. Also, a nested read-write transaction cannot be activated if its parent transaction is read-only, unless the read-write transaction has the 'unprotected' option.

  Parameters:
    `tx` - the transaction to activate
  Throws:
    `InterruptedException` - if the current thread is interrupted while waiting for me to activate its transaction
    `IllegalArgumentException` - if the current thread does not own the transaction that it wants to activate or if it is attempting to activate a transaction in an inappropriate context
  See Also:
    `getActiveTransaction()`, `TransactionalEditingDomain.yield()`, `startTransaction(boolean, Map)`, `deactivate(InternalTransaction)`

### precommit

    void precommit(InternalTransaction tx)
                   throws RollbackException

  Performs the pre-commit notifications and processing of trigger comamnds. This method must be called at the beginning of the commit of a read/write transaction (not a read-only transaction), unless it has the 'no triggers' option.

  Parameters:
    `tx` - the transaction that is being committed
  Throws:
    `RollbackException` - if any of the pre-commit listeners forces rollback of the transaction. The caller must honour this rollback request by actually rolling back the transaction
  See Also:
    `Transaction.commit()`, `Transaction.rollback()`, `ResourceSetListener.transactionAboutToCommit(org.eclipse.emf.transaction.ResourceSetChangeEvent)`

### deactivate

    void deactivate(InternalTransaction tx)

  Deactivates the specified transaction. After this method completes, the transaction is no longer my `active transaction`.

  The current thread must own the transaction that it is attempting to deactivate and this transaction must currently be my active transaction.

  Note that a transaction must ensure that this method is called when it closes, either by commit or by rollback, and at most once.

  Parameters:
    `tx` - the transaction to deactivate
  Throws:
    `IllegalArgumentException` - if either the transaction is not the active transaction, or the current thread does not own it
  See Also:
    `activate(InternalTransaction)`, `Transaction.commit()`, `Transaction.rollback()`

### getChangeRecorder

    TransactionChangeRecorder getChangeRecorder()

  Obtains the change recorder that I use to track changes in my resource set. Transactions are expected to use this change recorder as follows:
  - Start recording a fresh change description on starting and resuming
  - End recording (storing the change description) on committing and pausing
  - End recording (applying the change description) on rolling back

  Returns:
    my change recorder

### getValidator

    TransactionValidator getValidator()

  Gets the validator that transactions should use to validate themselves upon committing. A transaction must ask the validator to validate after performing the pre-commit phase (if needed), unless it has the 'no validation' option.

  Returns:
    my transaction validator

### broadcastUnbatched

    void broadcastUnbatched(Notification notification)

  Broadcasts the specified notification to listeners as a singleton list, in a situation where batching is not possible because events are occurring outside of any transaction context. This can only occur in the case of read notifications.

  Parameters:
    `notification` - the notification to send to resource set listeners
  See Also:
    `NotificationFilter.READ`, `ResourceSetListener`, `FilterManager.selectUnbatched(java.util.List, NotificationFilter)`

### getUndoRedoOptions

    Map<Object,Object> getUndoRedoOptions()

  Retrieves the undo/redo options that should be used when creating transactions.

  Returns:
    A map with undo/redo options.

### startPrivileged

    void startPrivileged(PrivilegedRunnable<?> runnable)

  Transfers ownership of this editing domain to the specified privileged runnable.

  Parameters:
    `runnable` - the runnable whose thread is to borrow me

### endPrivileged

    void endPrivileged(PrivilegedRunnable<?> runnable)

  Returns me to my previous owner, upon completion of the specified privileged runnable.

  Parameters:
    `runnable` - the runnable whose thread had borrowed me

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