Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Edapt] Feature not found
[Edapt] Feature not found [message #1651378] Thu, 05 March 2015 09:15 Go to next message
Matthias Juchmes is currently offline Matthias JuchmesFriend
Messages: 22
Registered: March 2015
Junior Member
Hello,

I have a simple ecore model and created a history and a release, then I deleted a field (using the delete feature operation) and released again. I added the extension point for the migrator and wrote the migration code like in the library example

However, when I try to migrate an xml file from the old version, I get a PackageNotFoundException. I need to manually add a custom ResourceSetFactory to manually add the URI to the package registry:

    protected class ResourceSetFactoryImplCustom extends ResourceSetFactoryImpl {
        @Override
        public ResourceSet createResourceSet() {
            ResourceSet resourceSet = new ResourceSetImpl();

            // manually add package with ns-uri of old version
            resourceSet.getPackageRegistry().put(<ns-uri>,
                    BarPackage.eINSTANCE);
            return resourceSet;
        }
    }

....

    private void performMigration(final Migrator migrator, final URI resourceURI, final Release release) {
        try {
            // use the custom xmlResourceSetFactory
            migrator.setResourceSetFactory(new ResourceSetFactoryImplCustom());
            migrator.migrateAndSave(Collections.singletonList(resourceURI), release, null, new NullProgressMonitor());
        } catch (MigrationException e) {
            e.printStackTrace();
        }
    }


When I do this, migrating a file that doesn't contain the deleted feature works, but some XMI-Attributes are added to the root element:

 xmi:version="2.0" xmlns:xmi="<link-to-xmi>"


Is there a way to avoid adding this to the file?

Also, when I try to migrate a file that contains the deleted feature, I get a FeatureNotFoundException. So something clearly isn't working, I'm guessing that it's probably something with the way I manually add the old ns-uri to the package registry.

I added the example code that reproduces this.

Thanks in advance

Matthias
  • Attachment: example.zip
    (Size: 61.42KB, Downloaded 118 times)
Re: [Edapt] Feature not found [message #1663127 is a reply to message #1651378] Tue, 10 March 2015 09:24 Go to previous messageGo to next message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 101
Registered: December 2013
Senior Member

Hi,

You are registering the generated BarFactoryImpl at the org.eclipse.emf.edapt.factories extension point. This extension point is only needed if you are working with custom EDataTypes and have problems with serializing/deserializing them during migration. Moreover you shouldn't register a generated factory at this extension point.
When you remove the usage of the extension point, you shouldn't get any package- or feature-not-found exceptions any more.

Regarding the problem with additional XMI-Attributes:
You can use the ResourceSetFactoryImpl to control which resource-type is created. Using #migrateAndLoad you get this resource set and cass pass the previsouly used save option to save method. The serialization is pure EMF at this point, so as long as you are performing the migration with the same resourcetypes and load/save options, you will be fine.

Cheers,
Johannes


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [Edapt] Feature not found [message #1666200 is a reply to message #1663127] Wed, 11 March 2015 15:35 Go to previous message
Matthias Juchmes is currently offline Matthias JuchmesFriend
Messages: 22
Registered: March 2015
Junior Member
Thanks, this helped!
Previous Topic:Texo deserialization messes up List order
Next Topic:[EMFForms] RAP Table
Goto Forum:
  


Current Time: Fri Apr 26 05:51:08 GMT 2024

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

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

Back to the top