|
|
|
|
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:
-
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)
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 java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
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
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
|
|
|