RSA: Capture Changes and Replay Them
Hi,
I am a PhD student researching collaborative software modeling.
I use RSAv8 for my research to develop a prototype, and I would like to ask a few questions regarding the internals of RSA, and some EMF related questions.
To get to the point, I am developing an eclipse plug-in to synchronize two instances of RSA through a middleware, and I am wondering what is the best way to (1) capture new changes at one side and (2) replay it on the other side so that eventually the two copies of the model will be identical in the end. I've tried a bunch of approaches, none was successful. Below is what I've tried. They all might be completely wrong direction; would you please let me know if there is a better way?
I first tried to use the extension to the ResourceSet (by implementing ResourceSetListener) to grab the new changes. As a result, any time there is a change to the ResourceSet, the plug-in receives a call-back, and I can see that something has changed within the model.
The first obstacle I had was it was hard to analyze which exact change was made by only looking at the set of Notifications that are attached to the call-backs. For example, when I change a name attribute of a class in a class diagram, the single call-back had over 400 Notifications, which did not provide enough information to distinguish which one of them is the notification of the name change. I was able to see that one of the Notifications indicating the previous name as the previous value and the new name as the new value, but I wouldn't be able to say that the particular Notification was the one that carries the change information among the hundreds of them without knowing in advance the previous and new values.
Some changes such as creating a class element to an empty class diagram produces a small number of Notifications like 2 while some other changes such as the one above produces a large number of them. Changes that create a large number of Notifications would be because there are that many changes made to the ResourceSet, not because the change was that complicated.
My first question is:
Would it be possible to recognize which operation, e.g. creation of an element or modification of an attribute or so, has been committed by analyzing a call-back?
Then I looked at Command and CommandStack. I thought RSA would maintain an EditingDomain and its CommandStack somewhere because RSA supports undo/redo, and I might be able to simply execute the most recent Command and execute it on the other side.
I've tried to access to the CommandStack, hoping that RSA would use it, (1) from the ResourceSetChangeEvent instance "event" of the transitionAboutToCommit() method in the ResourceSetListener extension and the Transition that is attached to "event", (2) from the EditingDomain that is attached to ResourceSetListener extension, and (3) from the global UMLModeler instance. None worked (the getMostRecentCommand methods all returned null), and my guess was (1) maybe RSA does not utilize the CommandStack architecture, or (2) I am looking at wrong CommandStacks.
My second question is:
Does RSA use CommandStack? Would it be possible to grab the most recent Command, pass it to the other instance of RSA, and execute it?
My third question is:
If the answer for is yes and yes, would it be possible to recognize which type of change it is (such as if it is a creation of an element, update of an attribute, removal of an element, or etc.) from a Command?
Lastly, if you have a better approach to it (or if it is not possible at all to do what I am trying to do), please advise me.
Thank you very much!
I am a PhD student researching collaborative software modeling.
I use RSAv8 for my research to develop a prototype, and I would like to ask a few questions regarding the internals of RSA, and some EMF related questions.
To get to the point, I am developing an eclipse plug-in to synchronize two instances of RSA through a middleware, and I am wondering what is the best way to (1) capture new changes at one side and (2) replay it on the other side so that eventually the two copies of the model will be identical in the end. I've tried a bunch of approaches, none was successful. Below is what I've tried. They all might be completely wrong direction; would you please let me know if there is a better way?
I first tried to use the extension to the ResourceSet (by implementing ResourceSetListener) to grab the new changes. As a result, any time there is a change to the ResourceSet, the plug-in receives a call-back, and I can see that something has changed within the model.
The first obstacle I had was it was hard to analyze which exact change was made by only looking at the set of Notifications that are attached to the call-backs. For example, when I change a name attribute of a class in a class diagram, the single call-back had over 400 Notifications, which did not provide enough information to distinguish which one of them is the notification of the name change. I was able to see that one of the Notifications indicating the previous name as the previous value and the new name as the new value, but I wouldn't be able to say that the particular Notification was the one that carries the change information among the hundreds of them without knowing in advance the previous and new values.
Some changes such as creating a class element to an empty class diagram produces a small number of Notifications like 2 while some other changes such as the one above produces a large number of them. Changes that create a large number of Notifications would be because there are that many changes made to the ResourceSet, not because the change was that complicated.
My first question is:
Would it be possible to recognize which operation, e.g. creation of an element or modification of an attribute or so, has been committed by analyzing a call-back?
Then I looked at Command and CommandStack. I thought RSA would maintain an EditingDomain and its CommandStack somewhere because RSA supports undo/redo, and I might be able to simply execute the most recent Command and execute it on the other side.
I've tried to access to the CommandStack, hoping that RSA would use it, (1) from the ResourceSetChangeEvent instance "event" of the transitionAboutToCommit() method in the ResourceSetListener extension and the Transition that is attached to "event", (2) from the EditingDomain that is attached to ResourceSetListener extension, and (3) from the global UMLModeler instance. None worked (the getMostRecentCommand methods all returned null), and my guess was (1) maybe RSA does not utilize the CommandStack architecture, or (2) I am looking at wrong CommandStacks.
My second question is:
Does RSA use CommandStack? Would it be possible to grab the most recent Command, pass it to the other instance of RSA, and execute it?
My third question is:
If the answer for is yes and yes, would it be possible to recognize which type of change it is (such as if it is a creation of an element, update of an attribute, removal of an element, or etc.) from a Command?
Lastly, if you have a better approach to it (or if it is not possible at all to do what I am trying to do), please advise me.
Thank you very much!
2 answers
If you want the models to be identical, would it be easiest to copy the model from one instance to the other?
Nevertheless, your question would probably be better answered on the RSA forum at http://www.ibm.com/developerworks/forums/forum.jspa?forumID=430
Nevertheless, your question would probably be better answered on the RSA forum at http://www.ibm.com/developerworks/forums/forum.jspa?forumID=430
If you want the models to be identical, would it be easiest to copy the model from one instance to the other?
Nevertheless, your question would probably be better answered on the RSA forum at http://www.ibm.com/developerworks/forums/forum.jspa?forumID=430
I am making it to "copy" new changes for each change as soon as it is made. It would be very inefficient to copy the entire model for every change ...
I will try the developerWorks forum. Thank you for your recommendation! :D