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 TransactionChangeRecorder

java.lang.Object
  extended by 

org.eclipse.emf.ecore.change.util.ListDifferenceAnalyzer
      extended by 

org.eclipse.emf.ecore.change.util.BasicChangeRecorder
          extended by 

org.eclipse.emf.ecore.change.util.ChangeRecorder
              extended by 
org.eclipse.emf.transaction.impl.TransactionChangeRecorder
All Implemented Interfaces:
Adapter, Adapter.Internal

public class TransactionChangeRecorder
extends 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
Adapter.Internal
 
Field Summary
 
Fields inherited from class org.eclipse.emf.ecore.change.util. ChangeRecorder
loadingTargets, originalTargetObjects, resolveProxies, targetObjects
 
Fields inherited from class org.eclipse.emf.ecore.change.util. BasicChangeRecorder
changeDescription, recording
 
Constructor Summary
TransactionChangeRecorder ( InternalTransactionalEditingDomain domain, 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 ( 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.
  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 ( 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 ( Notification notification)
          Analyzes an object notification for violations of the transaction protocol before passing it to the active transaction (if any).
protected  void processResourceNotification ( 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 ( 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 ( 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, getTarget, handleFeature, handleResource, isAdapterForType, isOrphan, isResolveProxies, prepareChangeDescriptionForResume, removeAdapter, 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, setChangeDescription, setRecording, shouldRecord, summarize
 
Methods inherited from class org.eclipse.emf.ecore.change.util. ListDifferenceAnalyzer
analyzeLists, analyzeLists, createAddListChange, createListChange, createListChanges, createMoveListChange, createRemoveListChange
 
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,
                                 
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 
ChangeDescription endRecording()
Extends the inherited implementation to clear the reference to the change description returned.

Overrides:
endRecording in class BasicChangeRecorder
Throws:
IllegalStateException - if I have been disposed

setTarget

public void setTarget(
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 Adapter
Overrides:
setTarget in class ChangeRecorder

notifyChanged

public void notifyChanged(
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 Adapter
Overrides:
notifyChanged in class ChangeRecorder

processResourceSetNotification

protected void processResourceSetNotification(
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(
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(
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(
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 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.


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