Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTo] Failed to resolve meta model during standalone execution
[QVTo] Failed to resolve meta model during standalone execution [message #630190] Fri, 01 October 2010 00:50 Go to next message
Simon harrer is currently offline Simon harrerFriend
Messages: 25
Registered: August 2010
Junior Member
How to register the meta models that QVTo can resolve them? If I run my project from inside eclipse, QVTo can resolve the meta models and execute the transformations.

However, if I package everything in a jar, this does not work anymore. Any idea, how I can get this to work?

Error is: Failed to resolve metamodel!

The meta models are shipped in generated form in jar files that are included into the classpath.
Re: [QVTo] Failed to resolve meta model during standalone execution [message #630200 is a reply to message #630190] Fri, 01 October 2010 05:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Simon

When you run within Eclipse, the plugin.xml for each project
automatically registers plugin facilities.

When you run standalone, you must register these facilities yourself.
Documentation on this can usually be found by reading the extension
point description that is accessible from the plugin/manifest editor.

Some Eclipse plugins provide, or autogenerate, special setup routines to
assist in standalone usage.

For EMF meta-models access you need to initialise either the global
Resource.Registry.INSTANCE, or the local registry within your
ResourceSet. For file loading you will need to register a
ResourceFactory again st a file extension or content type. For
URI-mapping you will need to register your URI map. many options -
follow the extension point documentation.

Regards

Ed Willink

On 01/10/2010 01:50, Simon harrer wrote:
> How to register the meta models that QVTo can resolve them? If I run my
> project from inside eclipse, QVTo can resolve the meta models and
> execute the transformations.
> However, if I package everything in a jar, this does not work anymore.
> Any idea, how I can get this to work?
>
> Error is: Failed to resolve metamodel!
>
> The meta models are shipped in generated form in jar files that are
> included into the classpath.
Re: [QVTo] Failed to resolve meta model during standalone execution [message #633925 is a reply to message #630190] Tue, 19 October 2010 21:58 Go to previous messageGo to next message
Macca1892 is currently offline Macca1892Friend
Messages: 14
Registered: May 2010
Junior Member
Simon harrer wrote on Fri, 01 October 2010 02:50
How to register the meta models that QVTo can resolve them?



Hi Simon,

This way works for me. It is programmable as follows:

First, you need to instantiate a Registry:
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(Resource.Factory.Registry.DEFAULT_EXTENSION,
new XMIResourceFactoryImpl());

EPackage.Registry registry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);

Then, there should be a ResourceSet
ResourceSet rs = new ResourceSetImpl();

which is used to register the meta-models
EPackage mm1 = (EPackage) rs.getResource(URI.createURI("file:///C:/temp/A.ecore"), true).getContents().get(0);

EPackage mm2 = (EPackage) rs.getResource(URI.createURI("file:///C:/temp/B.ecore"), true).getContents().get(0);

registry.put(mm1.getNsURI(), mm1);
registry.put(mm2.getNsURI(), mm2);
Re: [QVTo] Failed to resolve meta model during standalone execution [message #633969 is a reply to message #633925] Wed, 20 October 2010 06:20 Go to previous message
Eclipse UserFriend
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl

Hi all,

seems like too much work. I used only this:

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( )
.put(fileExt, fact);

while fileExt can be "*", and fact can be new XMIResourceFactoryImpl(),
like this:

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( )
.put("*", new XMIResourceFactoryImpl());

This registers XMI resource factory for all 'other' file extensions.

Then you need to register the namespace URI of your language, like this:

EPackage.Registry.INSTANCE.put(nsURI, pkg);

For any language X, code generation (using genmodel), generates an
XPackage class. You can use it like this:

EPackage.Registry.INSTANCE.put(XPackage.eNS_URI,
XPackage.eINSTANCE);

Two lines of code (well, 2 statements), that should be all there is to
it... (or 3 lines if you register 2 metamodels). Note that subpackages
are automatically registered.

Hope this helps,
Dennis



Macca1892 wrote:
> Simon harrer wrote on Fri, 01 October 2010 02:50
>> How to register the meta models that QVTo can resolve them?
>
>
> Hi Simon,
>
> This way works for me. It is programmable as follows:
>
> First, you need to instantiate a Registry:
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(
> ).put(Resource.Factory.Registry.DEFAULT_EXTENSION,
> new XMIResourceFactoryImpl());
>
> EPackage.Registry registry = new
> EPackageRegistryImpl(EPackage.Registry.INSTANCE);
>
> Then, there should be a ResourceSet
> ResourceSet rs = new ResourceSetImpl();
>
> which is used to register the meta-models
> EPackage mm1 = (EPackage)
> rs.getResource(URI.createURI("file:///C:/temp/A.ecore"),
> true).getContents().get(0);
> EPackage mm2 = (EPackage)
> rs.getResource(URI.createURI("file:///C:/temp/B.ecore"),
> true).getContents().get(0);
>
> registry.put(mm1.getNsURI(), mm1);
> registry.put(mm2.getNsURI(), mm2);
>
Previous Topic:[ATL] Query in HOT transformation
Next Topic:[ATL] injection problem in a programmatic launch
Goto Forum:
  


Current Time: Fri Mar 29 07:11:58 GMT 2024

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

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

Back to the top