Home » Archived » M2M (model-to-model transformation) » [ATL] Using own model implementation instances instead of DynamicEObjImpl as in/output
| |
Re: [ATL] Using own model implementation instances instead of DynamicEObjImpl as in/output [message #698404 is a reply to message #698018] |
Tue, 19 July 2011 12:32 |
Eszter Hofmann Messages: 16 Registered: July 2011 |
Junior Member |
|
|
Hi,
for launching the transformation I am using the main method generated by the New > ATL Plugin Wizard.
In the method loadModels I registered my packages:
public void loadModels(String inModelPath) throws ATLCoreException {
ModelFactory factory = new EMFModelFactory();
ResourceSet resourceSet = factory.getResourceSet();
Registry registry = factory.getResourceSet().getPackageRegistry();
Map<String, Object> extMap = resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap();
extMap.put("ecore", new EcoreResourceFactoryImpl()); //$NON-NLS-1$
extMap.put("cache", new CacheResourceFactoryImpl());
extMap.put("om", new OMResourceFactoryImpl());
CachePackage.eINSTANCE.eClass();
OmPackage.eINSTANCE.eClass();
registry.put(CachePackage.eNS_URI, CachePackage.eINSTANCE);
registry.put(OmPackage.eNS_URI, OmPackage.eINSTANCE);
// the generated code
IInjector injector = new EMFInjector();
IReferenceModel cacheMetamodel = factory.newReferenceModel();
injector.inject(cacheMetamodel, getMetamodelUri("cache"));
IReferenceModel omMetamodel = factory.newReferenceModel();
injector.inject(omMetamodel, getMetamodelUri("om"));
this.inModel = factory.newModel(cacheMetamodel);
injector.inject(inModel, inModelPath);
this.outModel = factory.newModel(omMetamodel);
}
Now loading works fine, but as result I still get DynamicEObjImpl instances.
I also tried to register my packages to the global package registry, but the result didn't change.
What else am I missing?
Eszter
|
|
|
Re: [ATL] Using own model implementation instances instead of DynamicEObjImpl as in/output [message #698537 is a reply to message #698404] |
Tue, 19 July 2011 16:08 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
What's the nsURI of the model for which you're ending up with dynamic
instances, i.e., what's the value of
eObject.eClass().getEPackage().getNsURI() for the problematic
instance? Is that URI registered?
On 19/07/2011 5:32 AM, Eszter Hofmann wrote:
> Hi,
>
> for launching the transformation I am using the main method generated
> by the New > ATL Plugin Wizard.
> In the method loadModels I registered my packages:
> public void loadModels(String inModelPath) throws ATLCoreException {
> ModelFactory factory = new EMFModelFactory();
> ResourceSet resourceSet = factory.getResourceSet();
> Registry registry = factory.getResourceSet().getPackageRegistry();
>
> Map<String, Object> extMap =
> resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap();
> extMap.put("ecore", new EcoreResourceFactoryImpl()); //$NON-NLS-1$
> extMap.put("cache", new CacheResourceFactoryImpl());
> extMap.put("om", new OMResourceFactoryImpl());
>
> CachePackage.eINSTANCE.eClass();
> OmPackage.eINSTANCE.eClass();
>
> registry.put(CachePackage.eNS_URI, CachePackage.eINSTANCE);
> registry.put(OmPackage.eNS_URI, OmPackage.eINSTANCE);
>
> // the generated code
> IInjector injector = new EMFInjector();
> IReferenceModel cacheMetamodel = factory.newReferenceModel();
> injector.inject(cacheMetamodel, getMetamodelUri("cache"));
> IReferenceModel omMetamodel = factory.newReferenceModel();
> injector.inject(omMetamodel, getMetamodelUri("om"));
> this.inModel = factory.newModel(cacheMetamodel);
> injector.inject(inModel, inModelPath);
> this.outModel = factory.newModel(omMetamodel);
> }
>
> Now loading works fine, but as result I still get DynamicEObjImpl
> instances.
> I also tried to register my packages to the global package registry,
> but the result didn't change.
> What else am I missing?
>
> Eszter
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| | | | |
Goto Forum:
Current Time: Fri Apr 26 01:06:12 GMT 2024
Powered by FUDForum. Page generated in 0.03468 seconds
|