Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Proxy resolution problem
Proxy resolution problem [message #816877] Fri, 09 March 2012 11:24 Go to next message
Jesper Eskilson is currently offline Jesper EskilsonFriend
Messages: 134
Registered: July 2009
Senior Member
Hi,

I'm trying to run the EMF code generator programmatically (from Java),
but I'm getting weird "Unable to resolve proxy" errors when validating
the genmodel. I tried following the code in
org.eclipse.emf.codegen.ecore.Generator, and came up with something like
this:

> ResourceSet rs = new ResourceSetImpl();
> rs.getURIConverter().getURIMap()
> .putAll(EcorePlugin.computePlatformURIMap());
>
> URI uri = getServiceGenModelURI();
> Resource genModelResource = rs.getResource(uri, true);
> GenModel genModel = (GenModel) genModelResource.getContents().get(0);
> genModel.setCanGenerate(true);
> genModel.setUpdateClasspath(true);
> genModel.setCodeFormatting(true);

When validating ("genModel.validate()"), I get the following errors:

> Unable to resolve proxy 'platform:/plugin/com.iar.ide.debugger.rpc.runtime/model/runtimerpc.ecore#//NativeObject/id'
> Unable to resolve proxy 'platform:/plugin/com.iar.ide.debugger.rpc.runtime/model/runtimerpc.ecore#//NativeObject'

Running the code generator from the GenModel editor works fine. The
genmodel file looks like this:

> <?xml version="1.0" encoding="UTF-8"?>
> <genmodel:GenModel xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/my.service/src-gen"
> modelPluginID="my.service" modelName="MyService" codeFormatting="true" importerID="org.eclipse.emf.importer.ecore"
> copyrightFields="false" usedGenPackages="platform:/plugin/com.iar.ide.debugger.rpc.runtime/model/runtimerpc.genmodel#//runtimerpc">
> <foreignModel>myservice.ecore</foreignModel>
> <genPackages prefix="MyService" basePackage="my.service" disposableProviderFactory="true"
> ecorePackage="myservice.ecore#/">
> <genEnums typeSafeEnumCompatible="false" ecoreEnum="myservice.ecore#//MyServiceMethod"/>
> <genClasses ecoreClass="myservice.ecore#//MyService">
> <genOperations ecoreOperation="myservice.ecore#//MyService/connect">
> <genParameters ecoreParameter="myservice.ecore#//MyService/connect/session"/>
> </genOperations>
> </genClasses>
> </genPackages>
> </genmodel:GenModel>

What am I missing?

--
/Jesper
Re: Proxy resolution problem [message #816894 is a reply to message #816877] Fri, 09 March 2012 11:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Jesper,

Comments below.

On 09/03/2012 12:24 PM, Jesper Eskilson wrote:
>
> Hi,
>
> I'm trying to run the EMF code generator programmatically (from Java),
> but I'm getting weird "Unable to resolve proxy" errors when validating
> the genmodel.
Are you running in the IDE?
> I tried following the code in
> org.eclipse.emf.codegen.ecore.Generator, and came up with something like
> this:
>
>> ResourceSet rs = new ResourceSetImpl();
>> rs.getURIConverter().getURIMap()
>> .putAll(EcorePlugin.computePlatformURIMap());
>>
>> URI uri = getServiceGenModelURI();
>> Resource genModelResource = rs.getResource(uri, true);
>> GenModel genModel = (GenModel)
>> genModelResource.getContents().get(0);
>> genModel.setCanGenerate(true);
>> genModel.setUpdateClasspath(true);
>> genModel.setCodeFormatting(true);
>
> When validating ("genModel.validate()"), I get the following errors:
>
>> Unable to resolve proxy
>> 'platform:/plugin/com.iar.ide.debugger.rpc.runtime/model/runtimerpc.ecore#//NativeObject/id'
>> Unable to resolve proxy
>> 'platform:/plugin/com.iar.ide.debugger.rpc.runtime/model/runtimerpc.ecore#//NativeObject'
>
Are you running in an Eclipse process with these bundles installed?
> Running the code generator from the GenModel editor works fine. The
> genmodel file looks like this:
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <genmodel:GenModel xmi:version="2.0"
>> xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel"
>> modelDirectory="/my.service/src-gen"
>> modelPluginID="my.service" modelName="MyService"
>> codeFormatting="true" importerID="org.eclipse.emf.importer.ecore"
>> copyrightFields="false"
>> usedGenPackages="platform:/plugin/com.iar.ide.debugger.rpc.runtime/model/runtimerpc.genmodel#//runtimerpc">
>> <foreignModel>myservice.ecore</foreignModel>
>> <genPackages prefix="MyService" basePackage="my.service"
>> disposableProviderFactory="true"
>> ecorePackage="myservice.ecore#/">
>> <genEnums typeSafeEnumCompatible="false"
>> ecoreEnum="myservice.ecore#//MyServiceMethod"/>
>> <genClasses ecoreClass="myservice.ecore#//MyService">
>> <genOperations ecoreOperation="myservice.ecore#//MyService/connect">
>> <genParameters
>> ecoreParameter="myservice.ecore#//MyService/connect/session"/>
>> </genOperations>
>> </genClasses>
>> </genPackages>
>> </genmodel:GenModel>
>
> What am I missing?
>
> --
> /Jesper


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Proxy resolution problem [message #816934 is a reply to message #816894] Fri, 09 March 2012 12:41 Go to previous message
Jesper Eskilson is currently offline Jesper EskilsonFriend
Messages: 134
Registered: July 2009
Senior Member
On 03/09/2012 12:49 PM, Ed Merks wrote:
> Jesper,
>
> Comments below.

I seemd to have forgotten to call "reconcile" on the genmodel. I looked
at how GenModelEditor did things, and saw that it called reconcile on
the model when initializing (and before validating).

After adding "genmodel.reconcile()" before the call to validate,
everything looks good.

--
/Jesper
Previous Topic:Executing an EMF command without recording
Next Topic:Combo-Binding for User-Entries
Goto Forum:
  


Current Time: Wed Apr 24 17:26:53 GMT 2024

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

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

Back to the top