Datamodel migration with ecore2ecroe [message #627585] |
Fri, 15 May 2009 19:30 |
Süleyman Vurucu Messages: 34 Registered: July 2009 |
Member |
|
|
Hi @ all,
I need help with migrating datamodel. I found a possible solution at I
found an example at
http://wiki.eclipse.org/EMF/Recipes#XMI.2FXML_Serialization_ Recipes
in section EMF/Reciepe.
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();
}
}
So if I try to excecute 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'm very happy for any help.
Thanks in advance
|
|
|
Powered by
FUDForum. Page generated in 0.02701 seconds