[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Model Migration

Hi Ed

Thus, the generated model cannot be contacted and a dynamic model should be generated with the assistance of the configured ExtendedMetaData while deserializing, right?
In theory. When you load the resource and do resource.getContents().get(0).eClass() and print it out. Is it an instance of your new generated model? Is it a dynamic instance?

It is a dynamic instance (instanceof AnyType)

The loading of an old-model-resource still works with this approach, immediately saving after load does too, but the model is still serialized in the old format.
You've verified that the resource being used to do the loading is really the one configured by your factory. (A breakpoint would help verify that.)

Yes, I'm currently using the factory directly.

When saving the resource, I expect, for example, Ecore2XMLExtendedMetaData.getNamespace(EPackage) to be called when the Resource is about to write the package's NS URI attribute. It actually gets called with an instance of EPackageImpl (nsURI="<the old model version uri>") as parameter. So I expect this method to look it up and return the new model's NS URI, right?
But that does not happen.


Ecore2XMLExtendedMetaData.java:

public String getNamespace(EPackage ePackage)
{
  XMLResource.XMLInfo xmlInfo = getInfo(ePackage);

  if (xmlInfo != null)
  {
    return xmlInfo.getTargetNamespace();
  }

  return super.getNamespace(ePackage);
}

getInfo returns a null reference, leading the method to return the same NS URI as passed in by the parameter.