Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » Serialize a ChangeDescription
Serialize a ChangeDescription [message #384682] Mon, 18 May 2009 14:40 Go to next message
Mark Gunnels is currently offline Mark Gunnels
Messages: 7
Registered: July 2009
Junior Member
I am attempting to serialize a ChangeDescription along with the model it
is performing a "change recording" on. The resulting XML contains the
description of the model but lacks the ChangeDescription. Can anyone
provide example code of a successful ChangeDescription serialization or
review the below code and tell me where I'm erring?


ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "*",
new XMLResourceFactoryImpl());
Resource resource =
resourceSet.createResource(URI.createURI("/Users/markgunnels/temp/cd5.xml "));
resource.getContents().add(sr);

ChangeRecorder cr = new ChangeRecorder(resourceSet);

sr.setAction("GET");
sr.setChangeReason("MA");

ChangeDescription cd = cr.endRecording();
resource.getContents().add(cd);
try
{
resource.save(null);
}
catch (IOException e)
{
e.printStackTrace();
}

I am using org.eclipse.emf.ecore.change_2.4.0.v200808251517.jar.

Thanks very much for any assistance.
Re: Serialize a ChangeDescription [message #384684 is a reply to message #384682] Mon, 18 May 2009 15:03 Go to previous messageGo to next message
Mark Gunnels is currently offline Mark Gunnels
Messages: 7
Registered: July 2009
Junior Member
I should mention that I have successfully retrieved the changes to the
SubscriberRecord (the 'sr' in the code) so I know it is recording.

Thanks again.
Re: Serialize a ChangeDescription [message #384686 is a reply to message #384682] Mon, 18 May 2009 16:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Mark,

It's best to ask EMF questions in the EMF newsgroup, which I've added to
the "to" list of the reply.


Mark Gunnels wrote:
> I am attempting to serialize a ChangeDescription along with the model
> it is performing a "change recording" on. The resulting XML contains
> the description of the model but lacks the ChangeDescription. Can
> anyone provide example code of a successful ChangeDescription
> serialization or review the below code and tell me where I'm erring?
>
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "*",
> new XMLResourceFactoryImpl());
> Resource resource =
> resourceSet.createResource(URI.createURI("/Users/markgunnels/temp/cd5.xml "));
>
> resource.getContents().add(sr);
>
> ChangeRecorder cr = new ChangeRecorder(resourceSet);
>
> sr.setAction("GET");
> sr.setChangeReason("MA");
>
> ChangeDescription cd = cr.endRecording();
> resource.getContents().add(cd);
An XMLResource will only serialize a single root object. Use
XMIResourceFactoryImpl if you intend to use multiple root objects.
> try
> {
> resource.save(null);
> }
> catch (IOException e)
> {
> e.printStackTrace();
> }
>
> I am using org.eclipse.emf.ecore.change_2.4.0.v200808251517.jar.
>
> Thanks very much for any assistance.
>
Re: Serialize a ChangeDescription [message #384687 is a reply to message #384686] Mon, 18 May 2009 18:30 Go to previous message
Mark Gunnels is currently offline Mark Gunnels
Messages: 7
Registered: July 2009
Junior Member
Thanks, Ed. Sorry about posting in the wrong place.
Re: Serialize a ChangeDescription [message #616441 is a reply to message #384682] Mon, 18 May 2009 15:03 Go to previous message
Mark Gunnels is currently offline Mark Gunnels
Messages: 7
Registered: July 2009
Junior Member
I should mention that I have successfully retrieved the changes to the
SubscriberRecord (the 'sr' in the code) so I know it is recording.

Thanks again.
Re: Serialize a ChangeDescription [message #616444 is a reply to message #384682] Mon, 18 May 2009 16:59 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
Mark,

It's best to ask EMF questions in the EMF newsgroup, which I've added to
the "to" list of the reply.


Mark Gunnels wrote:
> I am attempting to serialize a ChangeDescription along with the model
> it is performing a "change recording" on. The resulting XML contains
> the description of the model but lacks the ChangeDescription. Can
> anyone provide example code of a successful ChangeDescription
> serialization or review the below code and tell me where I'm erring?
>
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put( "*",
> new XMLResourceFactoryImpl());
> Resource resource =
> resourceSet.createResource(URI.createURI("/Users/markgunnels/temp/cd5.xml "));
>
> resource.getContents().add(sr);
>
> ChangeRecorder cr = new ChangeRecorder(resourceSet);
>
> sr.setAction("GET");
> sr.setChangeReason("MA");
>
> ChangeDescription cd = cr.endRecording();
> resource.getContents().add(cd);
An XMLResource will only serialize a single root object. Use
XMIResourceFactoryImpl if you intend to use multiple root objects.
> try
> {
> resource.save(null);
> }
> catch (IOException e)
> {
> e.printStackTrace();
> }
>
> I am using org.eclipse.emf.ecore.change_2.4.0.v200808251517.jar.
>
> Thanks very much for any assistance.
>
Re: Serialize a ChangeDescription [message #616447 is a reply to message #384686] Mon, 18 May 2009 18:30 Go to previous message
Mark Gunnels is currently offline Mark Gunnels
Messages: 7
Registered: July 2009
Junior Member
Thanks, Ed. Sorry about posting in the wrong place.
Previous Topic:Serialize a ChangeDescription
Next Topic:Should UML be used in an Agile Project ?
Goto Forum:
  


Current Time: Sat Sep 20 04:12:26 GMT 2014

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

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