Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Migrate Datamodel with ecore2Ecore
Migrate Datamodel with ecore2Ecore [message #430232] Wed, 13 May 2009 22:09 Go to next message
Süleyman Vurucu is currently offline Süleyman VurucuFriend
Messages: 34
Registered: July 2009
Member
Hi Ed,
you told me for in the thread with the title "Load EcoreModel with
Dynamic EMF from 12'th May" that I can migrate a Datamodel in a new form
with ecore2ecore.

So I have know 2 metamodels. I create an ecore2ecore model and generate
an ecore2xml file from this.

I understood it in such a way that I must load the Datamodel in normal way
(with generated code) and save it somehow with the second model by using
the ExtendedMetaData(without using the generated code). But I don't know
how I bind the ecore2xml file in the save resource.

I uploaded my tetst Project to:

http://rapidshare.com/files/232649808/Ecore2EcoreTest.rar.ht ml
MD5: 59797168551C400F0C7C73F1160C86AF

Thanks in andvance
Re: Migrate Datamodel with ecore2Ecore [message #430268 is a reply to message #430232] Thu, 14 May 2009 11:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Süleyman,

You've looked at the EMF recipe for this?


Süleyman Vurucu wrote:
> Hi Ed,
> you told me for in the thread with the title "Load EcoreModel with
> Dynamic EMF from 12'th May" that I can migrate a Datamodel in a new form
> with ecore2ecore.
>
> So I have know 2 metamodels. I create an ecore2ecore model and generate
> an ecore2xml file from this.
>
> I understood it in such a way that I must load the Datamodel in normal way
> (with generated code) and save it somehow with the second model by using
> the ExtendedMetaData(without using the generated code). But I don't know
> how I bind the ecore2xml file in the save resource.
>
> I uploaded my tetst Project to:
>
> http://rapidshare.com/files/232649808/Ecore2EcoreTest.rar.ht ml
> MD5: 59797168551C400F0C7C73F1160C86AF
>
> Thanks in andvance
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Migrate Datamodel with ecore2Ecore [message #430321 is a reply to message #430268] Thu, 14 May 2009 20:50 Go to previous messageGo to next message
Süleyman Vurucu is currently offline Süleyman VurucuFriend
Messages: 34
Registered: July 2009
Member
Am Thu, 14 May 2009 07:38:03 -0400 schrieb Ed Merks:

> Süleyman,
>
> You've looked at the EMF recipe for this?
>

Thank you Ed. I'll be looking at this. I'll turn to you back if I've
questions :D
Re: Migrate Datamodel with ecore2Ecore [message #430323 is a reply to message #430321] Thu, 14 May 2009 22:28 Go to previous message
Süleyman Vurucu is currently offline Süleyman VurucuFriend
Messages: 34
Registered: July 2009
Member
Hi,

I found an example at http://wiki.eclipse.org/EMF/
Recipes#XMI.2FXML_Serialization_Recipes

The section what I need is "XMI/XML Serialization Recipes" right?

So if I try this example then I get an exception ""main"
java.lang.RuntimeException: Cannot create a resource for 'platform:/model/
ContainmentMapper.ecore2xml'; a registered resource factory is needed"

I made the folowing modifications the rest is the same with the example:

Namespaces:

public static final String RULES_100_NS_URI = "http://My.Model/1.0.0";
public static final String RULES_PLATFORM_URI = "platform:/model/
EA_ModelContainment.ecore";
public static final String RULES_100_PLATFORM_URI = "platform:/model/
ContainmentMapper.ecore2xml";

plugin.xml
The added entry is:

<extension
point="org.eclipse.emf.ecore.extension_parser">
<parser
class="RulesResourceFactoryImpl"
type="rules"/>
</extension>

I try to use the implementaion like this:

public void saveMofifiedModel() {
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry
().getExtensionToFactoryMap().
put(Resource.Factory.Registry.DEFAULT_EXTENSION,
new RulesResourceFactoryImpl());

File file = new File(PART1);
file.setWritable(true);
URI fileURI = URI.createFileURI(file.getAbsolutePath());

// Create a resource for this file.
Resource resource = resourceSet.createResource(fileURI);

resourceList = resource.getContents();
resourceList.add(sys);

try {
resource.save(saveOptions);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

Thanks in advance
Previous Topic:[CDO] Infos for a Authorisation and Authentication project
Next Topic:Using GMF database editor
Goto Forum:
  


Current Time: Fri Apr 19 04:05:11 GMT 2024

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

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

Back to the top