## org.eclipse.emf.transaction.impl
Class TransactionChangeRecorder

    java.lang.Object
      org.eclipse.emf.ecore.change.util.ListDifferenceAnalyzer
          org.eclipse.emf.ecore.change.util.BasicChangeRecorder
              org.eclipse.emf.ecore.change.util.ChangeRecorder
                  org.eclipse.emf.transaction.impl.TransactionChangeRecorder

All Implemented Interfaces:
  org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal

    public class TransactionChangeRecorder

extends org.eclipse.emf.ecore.change.util.ChangeRecorder

The change recorder for a `TransactionalEditingDomain`, used by transactions to record rollback information and to detect changes that violate the transaction protocol. It also forwards notifications to the domain's currently active transaction.

See Also:
  `InternalTransactionalEditingDomain.getChangeRecorder()`, `TransactionValidator`, `InternalTransaction.add(Notification)`

Nested Class Summary

Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
`org.eclipse.emf.common.notify.Adapter.Internal`

Field Summary

Fields inherited from class org.eclipse.emf.ecore.change.util.ChangeRecorder
`eObjectToProxyURIMap, loadingTargets, originalTargetObjects, resolveProxies, targetObjects`

Fields inherited from class org.eclipse.emf.ecore.change.util.BasicChangeRecorder
`changeDescription, recording, recordingTransientFeatures`

Constructor Summary
`TransactionChangeRecorder(InternalTransactionalEditingDomain domain, org.eclipse.emf.ecore.resource.ResourceSet rset)` Initializes me with the editing domain that I assist and the resource set in which I will record changes.

Method Summary
`protected void` `appendNotification(org.eclipse.emf.common.notify.Notification notification)` Appends the specified notification to the batch for the active transaction, to be distributed when it commits.
`protected void` `assertWriting()` Implements the read/write transaction protocol check.
`void` `beginRecording()` Starts recording changes in my editing domain.
`void` `dispose()` Extends the inherited implementation to remove myself from all adapters that I can find in my editing domain.
`org.eclipse.emf.ecore.change.ChangeDescription` `endRecording()` Extends the inherited implementation to clear the reference to the change description returned.
`InternalTransactionalEditingDomain` `getEditingDomain()` Obtains the editing domain that I assist.
`ValidateEditSupport` `getValidateEditSupport()`
`boolean` `isPaused()` Queries whether I am currently paused in my recording.
`void` `notifyChanged(org.eclipse.emf.common.notify.Notification notification)` Detects whether the change indicated by the specified notification violates the transaction protocol and/or how it changes the load state of a resource (if it all), in addition to recording the change (if I am currently recording) and passing it along to the domain's current transaction (if any).
`void` `pause()` Temporarily pauses the recording of the current change description.
`protected void` `processObjectNotification(org.eclipse.emf.common.notify.Notification notification)` Analyzes an object notification for violations of the transaction protocol before passing it to the active transaction (if any).
`protected void` `processResourceNotification(org.eclipse.emf.common.notify.Notification notification)` Analyzes a resource notification for changes in its load state and violations of the transaction protocol before passing it to the active transaction (if any).
`protected void` `processResourceSetNotification(org.eclipse.emf.common.notify.Notification notification)` Analyzes a resource set notification for changes in the load state of resources and violations of the transaction protocol before passing it to the active transaction (if any).
`void` `resume()` Resumes the paused recording of the current change description.

`void`

`setTarget(org.eclipse.emf.common.notify.Notifier target)`
Overrides the superclass method to ignore the "originalTargetObjects" since we never resume recording a paused change description ignore the "targetObjects" because we will never find, upon upon consolidating changes, that any target object is unexpectedly orphaned (as we always listen to everything in the resource set, so will always get the appropriate removal notifications).

`void` `setValidateEditSupport(ValidateEditSupport validateEdit)` Sets my validate-edit support, if applicable, for the duration of a root transaction.

Methods inherited from class org.eclipse.emf.ecore.change.util.ChangeRecorder
`addAdapter, beginRecording, beginRecording, consolidateChanges, getEObjectToProxyURIMap, getTarget, handleFeature, handleResource, handleTarget, isAdapterForType, isOrphan, isResolveProxies, prepareChangeDescriptionForResume, removeAdapter, setEObjectToProxyURIMap, setResolveProxies, shouldRecord, unsetTarget`

Methods inherited from class org.eclipse.emf.ecore.change.util.BasicChangeRecorder
`createChangeDescription, createFeatureChange, createResourceChange, eliminateEmptyChanges, finalizeChange, finalizeChange, getChangeDescription, getFeatureChange, getFeatureChanges, getResourceChange, getResourceChanges, isRecording, isRecordingTransientFeatures, setChangeDescription, setRecording, setRecordingTransientFeatures, shouldRecord, summarize`

Methods inherited from class org.eclipse.emf.ecore.change.util.ListDifferenceAnalyzer
`analyzeLists, analyzeLists, createAddListChange, createListChange, createListChanges, createMoveListChange, createRemoveListChange, equal`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TransactionChangeRecorder

    public TransactionChangeRecorder(InternalTransactionalEditingDomain domain,
                                     org.eclipse.emf.ecore.resource.ResourceSet rset)

  Initializes me with the editing domain that I assist and the resource set in which I will record changes. Note that I do not begin recording until specifically asked to (unlike the superclass).

  Parameters:
    `domain` - my editing domain
    `rset` - my resource set

Method Detail

### getEditingDomain

    public final InternalTransactionalEditingDomain getEditingDomain()

  Obtains the editing domain that I assist.

  Returns:
    my editing domain

### beginRecording

    public void beginRecording()

  Starts recording changes in my editing domain.

  Throws:
    `IllegalStateException` - if I have been `disposed`

### endRecording

    public org.eclipse.emf.ecore.change.ChangeDescription endRecording()

  Extends the inherited implementation to clear the reference to the change description returned.

  Overrides:
    `endRecording` in class `org.eclipse.emf.ecore.change.util.BasicChangeRecorder`
  Throws:
    `IllegalStateException` - if I have been `disposed`

### setTarget

    public void setTarget(org.eclipse.emf.common.notify.Notifier target)

  Overrides the superclass method to
  - ignore the "originalTargetObjects" since we never resume recording a paused change description
  - ignore the "targetObjects" because we will never find, upon upon consolidating changes, that any target object is unexpectedly orphaned (as we always listen to everything in the resource set, so will always get the appropriate removal notifications). Also, because we manage an entire resource set on behalf of an editing domain, disposal by removing ourselves from the adapters lists of our targets is not an issue because we cannot cause a memory leak outside of the scope of the editing domain and its resource set

  Specified by:
    `setTarget` in interface `org.eclipse.emf.common.notify.Adapter`
  Overrides:
    `setTarget` in class `org.eclipse.emf.ecore.change.util.ChangeRecorder`

### notifyChanged

    public void notifyChanged(org.eclipse.emf.common.notify.Notification notification)

  Detects whether the change indicated by the specified notification violates the transaction protocol and/or how it changes the load state of a resource (if it all), in addition to recording the change (if I am currently recording) and passing it along to the domain's current transaction (if any).

  Specified by:
    `notifyChanged` in interface `org.eclipse.emf.common.notify.Adapter`
  Overrides:
    `notifyChanged` in class `org.eclipse.emf.ecore.change.util.ChangeRecorder`

### processResourceSetNotification

    protected void processResourceSetNotification(org.eclipse.emf.common.notify.Notification notification)

  Analyzes a resource set notification for changes in the load state of resources and violations of the transaction protocol before passing it to the active transaction (if any).

  Parameters:
    `notification` - a notification from the resource set

### processResourceNotification

    protected void processResourceNotification(org.eclipse.emf.common.notify.Notification notification)

  Analyzes a resource notification for changes in its load state and violations of the transaction protocol before passing it to the active transaction (if any).

  Parameters:
    `notification` - a notification from a resource

### processObjectNotification

    protected void processObjectNotification(org.eclipse.emf.common.notify.Notification notification)

  Analyzes an object notification for violations of the transaction protocol before passing it to the active transaction (if any).

  Parameters:
    `notification` - a notification from a model element

### appendNotification

    protected void appendNotification(org.eclipse.emf.common.notify.Notification notification)

  Appends the specified notification to the batch for the active transaction, to be distributed when it commits. If there is no active transaction, then it is sent immediately to post-commit listeners (unbatched). This method applies the read/write transaction protocol check to this notification.

  Parameters:
    `notification` - the notification to append
  Throws:
    `IllegalStateException` - if the notification is not a result of reading the resource set and no transaction is active or the active transaction is read-only

### assertWriting

    protected void assertWriting()

  Implements the read/write transaction protocol check.

  Throws:
    `IllegalStateException` - if no transaction is active or the active transaction is read-only

### pause

    public void pause()

  Temporarily pauses the recording of the current change description.

  Throws:
    `IllegalStateException` - if I am not currently recording
  See Also:
    `BasicChangeRecorder.isRecording()`, `isPaused()`, `resume()`

### isPaused

    public boolean isPaused()

  Queries whether I am currently paused in my recording.

  See Also:
    `BasicChangeRecorder.isRecording()`, `pause()`, `resume()`

### resume

    public void resume()

  Resumes the paused recording of the current change description.

  Throws:
    `IllegalStateException` - if I am not currently paused
  See Also:
    `BasicChangeRecorder.isRecording()`, `pause()`, `isPaused()`

### dispose

    public void dispose()

  Extends the inherited implementation to remove myself from all adapters that I can find in my editing domain.

  Overrides:
    `dispose` in class `org.eclipse.emf.ecore.change.util.ChangeRecorder`
  Since:
    1.1

### getValidateEditSupport

    public ValidateEditSupport getValidateEditSupport()

### setValidateEditSupport

    public void setValidateEditSupport(ValidateEditSupport validateEdit)

  Sets my validate-edit support, if applicable, for the duration of a root transaction.

  Parameters:
    `validateEdit` - my validate-edit support, or `null`
  Since:
    1.2

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