|Re: BasicExtendedMetaData.demandRegistry delegation [message #1032818 is a reply to message #1032805]
||Wed, 03 April 2013 13:19
| Ed Merks
Registered: July 2009
On 03/04/2013 3:01 PM, Ed Willink wrote:
> Hi Ed
> Yes, you're right, there is a preceding getPackage() guarding the
> delegateRegistry usage..
> The failure to use the already initialized XtextPackageImpl is because
> BasicExtendedMetaData.registry doesn't delegate.
> XMLContentHandlerImpl initializes it as
> ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(new
> Is this intentional or an oversight?
Yes, the content handlers just want to do simple XML processing to
determine things like the namespace of the root element in the
document. They don't want to do any "real" processing of the document
and don't want to create any real instances of any models.
> Ed Willink
> On 03/04/2013 12:56, Ed Merks wrote:
>> The API is documented like this:
>> * Returns a package from the demand package registry, creating it
>> (with a document root class) if necessary.
>> EPackage demandPackage(String namespace);
>> So yes, it should demand create a new package or reuse a previously
>> demand created package. It should not consult any other registry.
>> If you look at the callers, it's generally is things like
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleMissingPackage(String) where
>> the resource set's registry or global registry have already been
>> consulted or like this in the QName support in XMLHelper:
>> ePackage = extendedMetaData.getPackage(namespace);
>> if (ePackage == null)
>> ePackage = extendedMetaData.demandPackage(namespace);
>> On 03/04/2013 12:41 PM, Ed Willink wrote:
>>> Hi Ed
>>> While trying to debug a UML profile issue I started watching
>>> BasicExtendedMetaData.demandPackage and was surprised to see a
>>> demand package being created for http://www.eclipse.org/2008/Xtext.
>>> This occurs when opening an Xtext editor loads its grammar file. The
>>> demand package is needed because the demand package registry does
>>> not delegate to the global registry. Is this intentional or an
>>> Ed Willink
Powered by FUDForum
. Page generated in 0.01650 seconds