Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Event to notify object has become dirty
[CDO] Event to notify object has become dirty [message #1007873] Thu, 07 February 2013 20:37 Go to next message
Jack Lechner is currently offline Jack LechnerFriend
Messages: 12
Registered: December 2012
Junior Member
Hi!

I'm currently using a listener attached the cdoView of my object that updates some objects when the cdoState of my object changes. I receive CDOViewInvalidationEvents for when a passive update makes my object conflicted and CDOTransactionFinishedEvents for when the object is clean after a successful commit. Is there an event I can use to determine that it has become dirty?

Thank you in advance!

Edit: Found a better solution by using this:

cdoView.addObjectHandler(new CDOObjectHandler() {
	@Override
	public void objectStateChanged(CDOView view, CDOObject object,
			CDOState oldState, CDOState newState) {
		System.out.println("Object: " + object.toString()
				+ " transitioned to " + newState);
	}
});

[Updated on: Thu, 07 February 2013 21:08]

Report message to a moderator

Re: [CDO] Event to notify object has become dirty [message #1007989 is a reply to message #1007873] Fri, 08 February 2013 05:20 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5587
Registered: July 2009
Senior Member
Am 07.02.2013 21:37, schrieb Jack Lechner:
> Hi!
>
> I'm currently using a listener attached the cdoView of my object that updates some objects when the cdoState of my
> object changes. I receive CDOViewInvalidationEvents for when a passive update makes my object conflicted and
> CDOTransactionFinishedEvents for when the object is clean after a successful commit. Is there an event I can use to
> determine that it has become dirty?
The general "notification rule" in Net4j and CDO is that low frequency events are fired as IEvents to IListeners and
high frequency "events" are delivered to the application as direct method calls on handler call-backs (to avoid the
creation of events on the heap).Object state changes occur with high frequency, that's why there is
CDOView.addObjectHandler(CDOObjectHandler):

public interface CDOObjectHandler
{
public void objectStateChanged(CDOView view, CDOObject object, CDOState oldState, CDOState newState);
}

There's also CDOTransaction.addTransactionHandler(CDOTransactionHandlerBase):

CDOTransactionHandler1.attachingObject(CDOTransaction, CDOObject)
CDOTransactionHandler1.detachingObject(CDOTransaction, CDOObject)
CDOTransactionHandler1.modifyingObject(CDOTransaction, CDOObject, CDOFeatureDelta)

CDOTransactionHandler2.committingTransaction(CDOTransaction, CDOCommitContext)
CDOTransactionHandler2.committedTransaction(CDOTransaction, CDOCommitContext)
CDOTransactionHandler2.rolledBackTransaction(CDOTransaction)

CDOTransactionHandler3.committedTransaction(CDOTransaction, CDOCommitContext, CDOCommitInfo)

Does that help?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Event to notify object has become dirty [message #1008657 is a reply to message #1007989] Wed, 13 February 2013 13:11 Go to previous message
Jack Lechner is currently offline Jack LechnerFriend
Messages: 12
Registered: December 2012
Junior Member
In my case it appears the CDOObjectHandler will work perfectly. Thank you for pointing out the CDOTransactionHandler, I'm sure I can use that as well.
Previous Topic:Automated Testcase generation from ecore model
Next Topic:Proxy Resolution among Resources
Goto Forum:
  


Current Time: Thu Dec 18 17:26:04 GMT 2014

Powered by FUDForum. Page generated in 0.01690 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software