Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Requirements Modeling Framework  » RMF Standalone
RMF Standalone [message #997246] Fri, 04 January 2013 16:43 Go to next message
Peter Pedron is currently offline Peter PedronFriend
Messages: 3
Registered: January 2013
Junior Member
Hi all,

I want to create a standalone app, which uses *only* the RMF core to create a Model (programmatically) and to save it in an appropriate reqif-file.

My code so far looks like this:

//Register ReqIF in EMF
Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap().put("reqif", new ReqIF10FactoryImpl());
EPackage.Registry.INSTANCE.put(ReqIF10Package.eNS_URI, ReqIF10Package.eINSTANCE);

//create ReqIF Model
ReqIF reqif = createReqIF(...);
ResourceSet set = new ResourceSetImpl();
Resource res =set.createResource(URI.createFileURI("C:\\dummy.reqif"));
res.getContents().add(reqif);
try {
	res.save(null);
} catch (IOException e) {e.printStackTrace();}


Actually a valid reqif file should be written, but I get instead a serialized xmi-file of the created model (which is indeed reqif). Somehow it seems that the appropriate Serializer does not get invoked. Could somebody help me?

Regards, Peter
Re: RMF Standalone [message #997320 is a reply to message #997246] Sat, 05 January 2013 19:26 Go to previous messageGo to next message
Michael Jastram is currently offline Michael JastramFriend
Messages: 235
Registered: April 2010
Location: Düsseldorf, Germany
Senior Member
Hi Peter,

What you did is not enough, as it will invoke the default persister (which writes xmi, as you have noticed). We have a few unit tests that write .reqif and don't even need to run as Eclipse Plug-In-Tests. If you look at them, you should be able to figure it out fairly quickly.

Specifically, have a look at the following, which is a very simple example that does exactly what you want (I believe):

org.eclipse.rmf.reqif10.tests/src/org/eclipse/rmf/reqif10/tests/uc000/tc1000

Hope this helps!

- Michael
Re: RMF Standalone [message #997348 is a reply to message #997246] Sun, 06 January 2013 17:52 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
Hi Peter,

without having checked if that still works, here is a fragment that I used for Excel2ReqIf conversion last year:

 ResourceSet rs = new ReqIFResourceSetImpl();


Regards,

Andreas
Re: RMF Standalone [message #997448 is a reply to message #997348] Mon, 07 January 2013 14:51 Go to previous message
Peter Pedron is currently offline Peter PedronFriend
Messages: 3
Registered: January 2013
Junior Member
OK some findings I found out during testing:
In order to serialize a ReqIF model in a standalone app, you have to use the ReqIFResourceSetImpl. That is NOT enough though: you have to register as well the appropriate ResourceFactory to the ResourceSet:
ResourceSet set = new ReqIFResourceSetImpl();
set.getResourceFactoryRegistry().getExtensionToFactoryMap().put("reqif", new ReqIFResourceFactoryImpl());

Using an eclipse-plugin project environment, everything is well initilialized and works transparently if the plugin depends on the pror.editor plugin.
There you can use the simple ResourcSetImpl without any factory registrations.

It would be interesting to know what the pror.editor does in order to enable this transparent use of the resourceset, I haven't figured it out yet...

Cheers,
Peter

[Updated on: Tue, 08 January 2013 13:38]

Report message to a moderator

Previous Topic:xmi serialization of reqif model
Next Topic:RIF <-> ReqIF
Goto Forum:
  


Current Time: Fri Mar 29 15:33:45 GMT 2024

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

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

Back to the top