Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null(What are the subtle differences?)
ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #886305] Thu, 14 June 2012 17:22 Go to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 26
Registered: July 2009
Junior Member
Hi there,

ResourceSetImpl.createResource(URI) hands a contentType=null down the resource creation. In ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate) this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether the type is to be computed.

In my case I have an ecore model that I ammended with an alternative ResourceFactory with an second content-type.

I give an URI with an extension that is registered against the alternative content-type as output parameter to a QVTo transformation. When debugging that run I see that both of my content types are well listed in the contentTypeIdentifierToFactoryMap but as the null does not cause the content-type for my URI to be computed the correct ResourceFactory is not looked up but I run into the fallback Resource.Factory.Registry.DEFAULT_EXTENSION with returns the deault XMI Resource Factory.

What should I change so that my URI is mapped to the correct ResourceFactory?

Or is it a bug? And if so: of EMF or of QVTo?

Thanks in advance,

Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #886347 is a reply to message #886305] Thu, 14 June 2012 19:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

content-types were a late addition and needed to be compatible and so
the priorities are not always perfect.

You should avoid Resource.Factory.Registry.DEFAULT_EXTENSION if using
content-types. You may need to programmatically remove it if you cannot
avoid its addition.

Regards

Ed Willink


On 14/06/2012 18:22, Uwe Ritzmann wrote:
> Hi there,
>
> ResourceSetImpl.createResource(URI) hands a contentType=null down the
> resource creation. In
> ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate)
> this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether the
> type is to be computed.
>
> In my case I have an ecore model that I ammended with an alternative
> ResourceFactory with an second content-type.
>
> I give an URI with an extension that is registered against the
> alternative content-type as output parameter to a QVTo transformation.
> When debugging that run I see that both of my content types are well
> listed in the contentTypeIdentifierToFactoryMap but as the null does
> not cause the content-type for my URI to be computed the correct
> ResourceFactory is not looked up but I run into the fallback
> Resource.Factory.Registry.DEFAULT_EXTENSION with returns the deault
> XMI Resource Factory.
>
> What should I change so that my URI is mapped to the correct
> ResourceFactory?
>
> Or is it a bug? And if so: of EMF or of QVTo?
>
> Thanks in advance,
>
> Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #886516 is a reply to message #886305] Fri, 15 June 2012 04:57 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Uwe,

Comments below.

On 14/06/2012 7:22 PM, Uwe Ritzmann wrote:
> Hi there,
>
> ResourceSetImpl.createResource(URI) hands a contentType=null down the
> resource creation. In
> ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate)
> this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether the
> type is to be computed.
>
> In my case I have an ecore model that I ammended with an alternative
> ResourceFactory with an second content-type.
>
> I give an URI with an extension that is registered against the
> alternative content-type as output parameter to a QVTo transformation.
> When debugging that run I see that both of my content types are well
> listed in the contentTypeIdentifierToFactoryMap but as the null does
> not cause the content-type for my URI to be computed the correct
> ResourceFactory is not looked up but I run into the fallback
> Resource.Factory.Registry.DEFAULT_EXTENSION with returns the deault
> XMI Resource Factory.
>
> What should I change so that my URI is mapped to the correct
> ResourceFactory?
Who is calling createResource? Note that there are two createResource
methods so if you need to specific a content type, you should call the
one that lets you specify a content type. Keep in mind that for
existing resource one would generally expect you'd use
ResourceSet.getResource(uri, true) to load it and that will end up
calling ResourceSetImpl.demandCreate which calls createResource(uri,
ContentHandler.UNSPECIFIED_CONTENT_TYPE). For the case that you're
creating a new resource, it's obviously not possible to determine the
content type from the non-existent content so it would generally be
pointless to try to determine a content type when creating a new resource.
>
> Or is it a bug? And if so: of EMF or of QVTo?
>
> Thanks in advance,
>
> Uwe


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #886692 is a reply to message #886516] Fri, 15 June 2012 13:07 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Ed,

I have a project in which I am working with XMI files having varying
content types requiring different Resource implementations, but which
all bear the *.xmi file extension (because they're XMI files :-) ).

I have found that, even though I register ContentHandlers for the
content-types I need to deal with, I end up with plain XMIResourceImpls
because someone in my JVM registered the "xmi" file extension in the
shared resource-factory registry. The registry prefers registrations
by extension over registrations by content-type.

Currently, I am working around this by creating resources myself,
describing the content of a file and looking up the factory by
content-type in the registry before falling back to file-extension
registrations.

Is there a recommended better way? Can I configure something in the
resource-factory registry to prefer content-types over extensions?
Should I look into getting the "xmi" extension removed from the shared
registry in my VM? (it's a J2EE container hosting other applications,
so that may be hard)? Or is the way I'm doing it just the way to do it?

Thanks,

Christian
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #886696 is a reply to message #886692] Fri, 15 June 2012 13:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Christian

To get some of the UML stuff working before UMLREsourceUtil.init() was
sorted out, I removed the global "xmi" entry programmatically and added
the corresponding backstop content type for "xmi" in its place so that
the resolution priorities were more sensible.

Regards

Ed Willink

On 15/06/2012 14:07, Christian W. Damus wrote:
> Hi, Ed,
>
> I have a project in which I am working with XMI files having varying
> content types requiring different Resource implementations, but which
> all bear the *.xmi file extension (because they're XMI files :-) ).
>
> I have found that, even though I register ContentHandlers for the
> content-types I need to deal with, I end up with plain
> XMIResourceImpls because someone in my JVM registered the "xmi" file
> extension in the shared resource-factory registry. The registry
> prefers registrations by extension over registrations by content-type.
>
> Currently, I am working around this by creating resources myself,
> describing the content of a file and looking up the factory by
> content-type in the registry before falling back to file-extension
> registrations.
>
> Is there a recommended better way? Can I configure something in the
> resource-factory registry to prefer content-types over extensions?
> Should I look into getting the "xmi" extension removed from the shared
> registry in my VM? (it's a J2EE container hosting other applications,
> so that may be hard)? Or is the way I'm doing it just the way to do it?
>
> Thanks,
>
> Christian
>
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #886824 is a reply to message #886516] Fri, 15 June 2012 17:43 Go to previous messageGo to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 26
Registered: July 2009
Junior Member
Ed, thank you very much for your answer.


> > [...]
> > What should I change so that my URI is mapped to the correct
> > ResourceFactory?
> Who is calling createResource?

The QVT Launch Configuration is.

Quote:

ResourceSetImpl.createResource(URI) line: 423
EmfUtil.createResource(URI, ResourceSet) line: 397
QvtLaunchConfigurationDelegateBase.saveTransformationResult(ModelExtentContents, TargetUriData, ResourceSet) line: 239
QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation, List<ModelContent>, List<TargetUriData>, String, IContext) line: 203
QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation, ILaunchConfiguration, IContext) line: 140
QvtLaunchConfigurationDelegate$1.run() line: 65
SafeRunner$SameThreadRunner.run(BaseProcess$IRunnable) line: 33
SafeRunner$1.run() line: 26
QvtLaunchConfigurationDelegate$2(ShallowProcess).run(IDebugTarget) line: 41
QvtLaunchConfigurationDelegate$2(ShallowProcess).run() line: 32
QvtLaunchConfigurationDelegate$3.run() line: 98
Thread.run() line: not available


> [...]
> For the case that you're creating a new resource, it's obviously not possible
> to determine the content type from the non-existent content so it would generally
> be pointless to try to determine a content type when creating a new resource.

Obviously. The subtle point between createResource(uri,null)
and createResource(uri,UNSPECIFIED_CONTENT_TYPE) in this
pointless situation is then what?

Regards,

Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887088 is a reply to message #886824] Sat, 16 June 2012 03:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Uwe,

Comments below.

On 15/06/2012 7:43 PM, Uwe Ritzmann wrote:
> Ed, thank you very much for your answer.
>
>
>> > [...]
>> > What should I change so that my URI is mapped to the correct >
>> ResourceFactory?
>> Who is calling createResource?
>
> The QVT Launch Configuration is.
>
> Quote:
>> ResourceSetImpl.createResource(URI) line: 423
>> EmfUtil.createResource(URI, ResourceSet) line: 397
>> QvtLaunchConfigurationDelegateBase.saveTransformationResult(ModelExtentContents,
>> TargetUriData, ResourceSet) line: 239
>> QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation,
>> List<ModelContent>, List<TargetUriData>, String, IContext) line: 203
>> QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation,
>> ILaunchConfiguration, IContext) line: 140
>> QvtLaunchConfigurationDelegate$1.run() line: 65
>> SafeRunner$SameThreadRunner.run(BaseProcess$IRunnable) line: 33
>> SafeRunner$1.run() line: 26
>> QvtLaunchConfigurationDelegate$2(ShallowProcess).run(IDebugTarget)
>> line: 41
>> QvtLaunchConfigurationDelegate$2(ShallowProcess).run() line: 32
>> QvtLaunchConfigurationDelegate$3.run() line: 98
>> Thread.run() line: not available
>
>
>> [...]
>> For the case that you're creating a new resource, it's obviously not
>> possible
>> to determine the content type from the non-existent content so it
>> would generally
>> be pointless to try to determine a content type when creating a new
>> resource.
>
> Obviously. The subtle point between createResource(uri,null)
> and createResource(uri,UNSPECIFIED_CONTENT_TYPE) in this
> pointless situation is then what?
So best you specify the content type when you create a new resource and
you know the purpose of that new resource is to store your known content
type.
>
> Regards,
>
> Uwe


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887091 is a reply to message #886692] Sat, 16 June 2012 03:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Christian,<br>
<br>
If you do this<br>
<blockquote>resourceSet.getResourceFactoryRegistry().getContentTypeToFactoryMap().putAll<br>
&nbsp;
(Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap())<br>
</blockquote>
Then in your resource set, all content type registrations will take
precedence over all other (global) registrations.<br>
<br>
<br>
On 15/06/2012 3:07 PM, Christian W. Damus wrote:
<blockquote cite="mid:jrfc2o$j88$1@xxxxxxxxe.org" type="cite">Hi,
Ed,
<br>
<br>
I have a project in which I am working with XMI files having
varying content types requiring different Resource
implementations, but which all bear the *.xmi file extension
(because they're XMI files :-) ).
<br>
<br>
I have found that, even though I register ContentHandlers for the
content-types I need to deal with, I end up with plain
XMIResourceImpls because someone in my JVM registered the "xmi"
file extension in the shared resource-factory registry.&nbsp; The
registry prefers registrations by extension over registrations by
content-type.
<br>
<br>
Currently, I am working around this by creating resources myself,
describing the content of a file and looking up the factory by
content-type in the registry before falling back to file-extension
registrations.
<br>
<br>
Is there a recommended better way?&nbsp; Can I configure something in
the resource-factory registry to prefer content-types over
extensions?&nbsp; Should I look into getting the "xmi" extension
removed from the shared registry in my VM? (it's a J2EE container
hosting other applications, so that may be hard)?&nbsp; Or is the way
I'm doing it just the way to do it?
<br>
<br>
Thanks,
<br>
<br>
Christian
<br>
<br>
</blockquote>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887259 is a reply to message #887088] Sat, 16 June 2012 09:39 Go to previous messageGo to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 26
Registered: July 2009
Junior Member
Ed, thanks again for the reply.

> So best you specify the content type when you create a new resource and
> you know the purpose of that new resource is to store your known content
> type.

I will certainly do that whenever I access ResourceSetImpl.createResource(.) programmatically.

But currently, while having developed my own metamodel, I am only a mere user of the QVTo engine and an URI is the only thing I can give for the output model.
And that does not work as expected (outlined in my original post).

Is this a fault of QVTo? Should they offer a content-type combo in the ui?

The interesting source is in
QvtLaunchConfigurationDelegateBase.saveTransformationResult(,,)
        	case NEW_MODEL: {
        		try {
            		URI modelUri = outUri.trimFragment();
           	    	Resource outExtent = resSet.getResource(modelUri, false);
           	    	if(outExtent == null) {
           	    		outExtent = EmfUtil.createResource(modelUri, resSet);       	    	


Should QVTo better use loadOnDemand=true for getResource?
Or should QVTo drop the EmfUtil.createResource implementation and rather compute the content-type beforehand and use ResourceSet.getResource(uri,type)?

On the other hand you still did not answer what the semantic difference of contentType=null vs contentType=UNSPECIFIED_CONTENT_TYPE is. So I can't help feeling that the real issue is an imprecision or inconsistency in the EMF API that should better be fixed instead of worked around by other parties (e.g. QVTo).

What would be the problem if ResourceSetImpl.createResource(uri) would be changed to call createResource(uri, UNSPECIFIED_CONTENT_TYPE)?

Regards,

Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887279 is a reply to message #887259] Sat, 16 June 2012 10:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Uwe,

Comments below.

On 16/06/2012 11:39 AM, Uwe Ritzmann wrote:
> Ed, thanks again for the reply.
>
>> So best you specify the content type when you create a new resource and
>> you know the purpose of that new resource is to store your known content
>> type.
>
> I will certainly do that whenever I access
> ResourceSetImpl.createResource(.) programmatically.
>
> But currently, while having developed my own metamodel, I am only a
> mere user of the QVTo engine and an URI is the only thing I can give
> for the output model.
> And that does not work as expected (outlined in my original post).
>
> Is this a fault of QVTo? Should they offer a content-type combo in the
> ui?
>
> The interesting source is in
> QvtLaunchConfigurationDelegateBase.saveTransformationResult(,,)
>
> case NEW_MODEL: {
> try {
> URI modelUri = outUri.trimFragment();
> Resource outExtent =
> resSet.getResource(modelUri, false);
> if(outExtent == null) {
> outExtent = EmfUtil.createResource(modelUri,
> resSet);
Not sure what this does...
>
>
>
> Should QVTo better use loadOnDemand=true for getResource?
Well, this is an output resource to it's likely that it doesn't already
exist and even if it does, that you'll just overwrite it regardless of
the current content.
> Or should QVTo drop the EmfUtil.createResource implementation and
> rather compute the content-type beforehand and use
> ResourceSet.getResource(uri,type)?
It seems to be fully general, it ought to provide a way to specify the
content type of the output resource.
>
> On the other hand you still did not answer what the semantic
> difference of contentType=null vs contentType=UNSPECIFIED_CONTENT_TYPE
> is.
One says there is no content type; the other says I've not specified it
but there likely is one so try to determine it from the content.
> So I can't help feeling that the real issue is an imprecision or
> inconsistency in the EMF API that should better be fixed instead of
> worked around by other parties (e.g. QVTo).
Imagine the output resource doesn't exist, which is likely the common
case. In this case, there is no way to determine the content type from
the content. So it must be specified along with the URI.
>
> What would be the problem if ResourceSetImpl.createResource(uri) would
> be changed to call createResource(uri, UNSPECIFIED_CONTENT_TYPE)?
It wouldn't solve your problem because you're creating new outputs, in
general.
>
> Regards,
>
> Uwe
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887340 is a reply to message #886305] Sat, 16 June 2012 12:33 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Uwe

Abstracting away from the details for a moment the problem seems to be:

Given a URI and a forest of EObjects, create a suitable Resource for
those EObjects and assign them to Resource.contents.

If you're writing the code you may know the content-type and so you can
do it right.

A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend may
not have a content-type concept to enable you to get it right.

So, today, such tools could examine all the EPackages and use Java
reflection to get the eCONTENT_TYPE and endeavour to find a content-type
that is compatible with all the EPackages; quite easy when there's only
one or it's homogeneous.

If this is the required solution, EMF could provide an eContentType()
API to avoid reflection and/or a createResource(URI, List<EObject>) method.

Regards

Ed Willink




On 14/06/2012 18:22, Uwe Ritzmann wrote:
> Hi there,
>
> ResourceSetImpl.createResource(URI) hands a contentType=null down the
> resource creation. In
> ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate)
> this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether the
> type is to be computed.
>
> In my case I have an ecore model that I ammended with an alternative
> ResourceFactory with an second content-type.
>
> I give an URI with an extension that is registered against the
> alternative content-type as output parameter to a QVTo transformation.
> When debugging that run I see that both of my content types are well
> listed in the contentTypeIdentifierToFactoryMap but as the null does
> not cause the content-type for my URI to be computed the correct
> ResourceFactory is not looked up but I run into the fallback
> Resource.Factory.Registry.DEFAULT_EXTENSION with returns the deault
> XMI Resource Factory.
>
> What should I change so that my URI is mapped to the correct
> ResourceFactory?
>
> Or is it a bug? And if so: of EMF or of QVTo?
>
> Thanks in advance,
>
> Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887509 is a reply to message #887279] Sat, 16 June 2012 19:03 Go to previous messageGo to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 26
Registered: July 2009
Junior Member
Hi Ed,

> > What would be the problem if ResourceSetImpl.createResource(uri) would
> > be changed to call createResource(uri, UNSPECIFIED_CONTENT_TYPE)?
> It wouldn't solve your problem because you're creating new outputs, in
> general.

Well, yes and no.

I used the debugger to sneak UNSPECIFIED_CONTENT_TYPE into createResource(uri,type).

In the first run, when the resource is not existing, an exception is thrown
File(Resource).checkExists(int, boolean) line: 341	
File(Resource).checkAccessible(int) line: 215	
File.getContentDescription() line: 263	
PlatformResourceURIHandlerImpl$WorkbenchHelper.getContentDescription(String, Map<?,?>) line: 399	
PlatformContentHandlerImpl.contentDescription(URI, InputStream, Map<?,?>, Map<Object,Object>) line: 82	
PlatformResourceURIHandlerImpl(URIHandlerImpl).contentDescription(URI, Map<?,?>) line: 261	
ExtensibleURIConverterImpl.contentDescription(URI, Map<?,?>) line: 366	
ResourceSetImpl$2(ResourceFactoryRegistryImpl).getContentTypeIdentifier(URI) line: 158	
ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI, Map<String,Object>, Map<String,Object>, Map<String,Object>, String, boolean) line: 124	
ResourceSetImpl$2.delegatedGetFactory(URI, String) line: 459	
ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI, Map<String,Object>, Map<String,Object>, Map<String,Object>, String, boolean) line: 145	
ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI, String) line: 86	
ResourceSetImpl.createResource(URI, String) line: 431	
ResourceSetImpl.createResource(URI) line: 423	
EmfUtil.createResource(URI, ResourceSet) line: 397	
QvtLaunchConfigurationDelegateBase.saveTransformationResult(ModelExtentContents, TargetUriData, ResourceSet) line: 239	
QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation, List<ModelContent>, List<TargetUriData>, String, IContext) line: 203	
QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation, ILaunchConfiguration, IContext) line: 140	
QvtLaunchConfigurationDelegate$1.run() line: 65	
SafeRunner$SameThreadRunner.run(BaseProcess$IRunnable) line: 33	
SafeRunner$1.run() line: 26	
QvtLaunchConfigurationDelegate$2(ShallowProcess).run(IDebugTarget) line: 41	
QvtLaunchConfigurationDelegate$2(ShallowProcess).run() line: 32	
QvtLaunchConfigurationDelegate$3.run() line: 98	
Thread.run() line: not available	

and no content type computed, my ResourceFactory not found, the default XMIFactory used and the XMI version of the output model written.

In the second run no exception is thrown and File.getContentDescription() uses
ContentTypeManager to derive my content-type from the URI extension, hence my Factory is found and the text version of the output model is written happily overwriting the XMI version.
ContentTypeCatalog.getDirectlyAssociated(String, int) line: 527	
ContentTypeCatalog.internalFindContentTypesFor(ContentTypeMatcher, String, Comparator) line: 477	
ContentTypeCatalog.findContentTypesFor(ContentTypeMatcher, String) line: 307	
ContentTypeManager(ContentTypeMatcher).findContentTypeFor(String) line: 48	
ContentDescriptionManager.getDescriptionFor(File, ResourceInfo, boolean) line: 334	
File.getContentDescription() line: 271	
PlatformResourceURIHandlerImpl$WorkbenchHelper.getContentDescription(String, Map<?,?>) line: 399	
PlatformContentHandlerImpl.contentDescription(URI, InputStream, Map<?,?>, Map<Object,Object>) line: 82	
PlatformResourceURIHandlerImpl(URIHandlerImpl).contentDescription(URI, Map<?,?>) line: 261	
ExtensibleURIConverterImpl.contentDescription(URI, Map<?,?>) line: 366	
ResourceSetImpl$2(ResourceFactoryRegistryImpl).getContentTypeIdentifier(URI) line: 158	
ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI, Map<String,Object>, Map<String,Object>, Map<String,Object>, String, boolean) line: 124	
ResourceSetImpl$2.delegatedGetFactory(URI, String) line: 459	
ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI, Map<String,Object>, Map<String,Object>, Map<String,Object>, String, boolean) line: 145	
ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI, String) line: 86	
ResourceSetImpl.createResource(URI, String) line: 431	
ResourceSetImpl.createResource(URI) line: 423	
EmfUtil.createResource(URI, ResourceSet) line: 397	
QvtLaunchConfigurationDelegateBase.saveTransformationResult(ModelExtentContents, TargetUriData, ResourceSet) line: 239	
QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation, List<ModelContent>, List<TargetUriData>, String, IContext) line: 203	
QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation, ILaunchConfiguration, IContext) line: 140	
QvtLaunchConfigurationDelegate$1.run() line: 65	
SafeRunner$SameThreadRunner.run(BaseProcess$IRunnable) line: 33	
SafeRunner$1.run() line: 26	
QvtLaunchConfigurationDelegate$2(ShallowProcess).run(IDebugTarget) line: 41	
QvtLaunchConfigurationDelegate$2(ShallowProcess).run() line: 32	
QvtLaunchConfigurationDelegate$3.run() line: 98	
Thread.run() line: not available	


This second behaviour is what I would generally expect. I do not see the point why filename-from-URI based and file-extension-from-URI based content-type lookup is shortcut by the existence/non-existence of the file.

So, while certainly a strange solution and leaving the feeling that content type handling has room for improvements, nevertheless it would be a solution for my, admittedly very specific, problem.

Regards

Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887870 is a reply to message #887509] Sun, 17 June 2012 09:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Uwe,

Comments below.

On 16/06/2012 9:03 PM, Uwe Ritzmann wrote:
> Hi Ed,
>
>> > What would be the problem if ResourceSetImpl.createResource(uri)
>> would > be changed to call createResource(uri,
>> UNSPECIFIED_CONTENT_TYPE)?
>> It wouldn't solve your problem because you're creating new outputs, in
>> general.
>
> Well, yes and no.
>
> I used the debugger to sneak UNSPECIFIED_CONTENT_TYPE into
> createResource(uri,type).
>
> In the first run, when the resource is not existing, an exception is
> thrown
>
> File(Resource).checkExists(int, boolean) line: 341
> File(Resource).checkAccessible(int) line: 215
> File.getContentDescription() line: 263
> PlatformResourceURIHandlerImpl$WorkbenchHelper.getContentDescription(String,
> Map<?,?>) line: 399
> PlatformContentHandlerImpl.contentDescription(URI, InputStream,
> Map<?,?>, Map<Object,Object>) line: 82
> PlatformResourceURIHandlerImpl(URIHandlerImpl).contentDescription(URI,
> Map<?,?>) line: 261
> ExtensibleURIConverterImpl.contentDescription(URI, Map<?,?>) line: 366
> ResourceSetImpl$2(ResourceFactoryRegistryImpl).getContentTypeIdentifier(URI)
> line: 158
> ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI,
> Map<String,Object>, Map<String,Object>, Map<String,Object>, String,
> boolean) line: 124
> ResourceSetImpl$2.delegatedGetFactory(URI, String) line: 459
> ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI,
> Map<String,Object>, Map<String,Object>, Map<String,Object>, String,
> boolean) line: 145
> ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI, String)
> line: 86
> ResourceSetImpl.createResource(URI, String) line: 431
> ResourceSetImpl.createResource(URI) line: 423
> EmfUtil.createResource(URI, ResourceSet) line: 397
> QvtLaunchConfigurationDelegateBase.saveTransformationResult(ModelExtentContents,
> TargetUriData, ResourceSet) line: 239
> QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation,
> List<ModelContent>, List<TargetUriData>, String, IContext) line: 203
> QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation,
> ILaunchConfiguration, IContext) line: 140
> QvtLaunchConfigurationDelegate$1.run() line: 65
> SafeRunner$SameThreadRunner.run(BaseProcess$IRunnable) line: 33
> SafeRunner$1.run() line: 26
> QvtLaunchConfigurationDelegate$2(ShallowProcess).run(IDebugTarget)
> line: 41
> QvtLaunchConfigurationDelegate$2(ShallowProcess).run() line: 32
> QvtLaunchConfigurationDelegate$3.run() line: 98
> Thread.run() line: not available
>
> and no content type computed, my ResourceFactory not found, the
> default XMIFactory used and the XMI version of the output model written.
Yes, if there is nothing there, a content type can't be computed.

>
> In the second run no exception is thrown and
> File.getContentDescription() uses
> ContentTypeManager to derive my content-type from the URI extension,
> hence my Factory is found and the text version of the output model is
> written happily overwriting the XMI version.
Not from the content, which is XMI?
>
> ContentTypeCatalog.getDirectlyAssociated(String, int) line: 527
> ContentTypeCatalog.internalFindContentTypesFor(ContentTypeMatcher,
> String, Comparator) line: 477
> ContentTypeCatalog.findContentTypesFor(ContentTypeMatcher, String)
> line: 307
> ContentTypeManager(ContentTypeMatcher).findContentTypeFor(String)
> line: 48
> ContentDescriptionManager.getDescriptionFor(File, ResourceInfo,
> boolean) line: 334
> File.getContentDescription() line: 271
> PlatformResourceURIHandlerImpl$WorkbenchHelper.getContentDescription(String,
> Map<?,?>) line: 399
> PlatformContentHandlerImpl.contentDescription(URI, InputStream,
> Map<?,?>, Map<Object,Object>) line: 82
> PlatformResourceURIHandlerImpl(URIHandlerImpl).contentDescription(URI,
> Map<?,?>) line: 261
> ExtensibleURIConverterImpl.contentDescription(URI, Map<?,?>) line: 366
> ResourceSetImpl$2(ResourceFactoryRegistryImpl).getContentTypeIdentifier(URI)
> line: 158
> ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI,
> Map<String,Object>, Map<String,Object>, Map<String,Object>, String,
> boolean) line: 124
> ResourceSetImpl$2.delegatedGetFactory(URI, String) line: 459
> ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI,
> Map<String,Object>, Map<String,Object>, Map<String,Object>, String,
> boolean) line: 145
> ResourceSetImpl$2(ResourceFactoryRegistryImpl).getFactory(URI, String)
> line: 86
> ResourceSetImpl.createResource(URI, String) line: 431
> ResourceSetImpl.createResource(URI) line: 423
> EmfUtil.createResource(URI, ResourceSet) line: 397
> QvtLaunchConfigurationDelegateBase.saveTransformationResult(ModelExtentContents,
> TargetUriData, ResourceSet) line: 239
> QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation,
> List<ModelContent>, List<TargetUriData>, String, IContext) line: 203
> QvtLaunchConfigurationDelegateBase.doLaunch(QvtTransformation,
> ILaunchConfiguration, IContext) line: 140
> QvtLaunchConfigurationDelegate$1.run() line: 65
> SafeRunner$SameThreadRunner.run(BaseProcess$IRunnable) line: 33
> SafeRunner$1.run() line: 26
> QvtLaunchConfigurationDelegate$2(ShallowProcess).run(IDebugTarget)
> line: 41
> QvtLaunchConfigurationDelegate$2(ShallowProcess).run() line: 32
> QvtLaunchConfigurationDelegate$3.run() line: 98
> Thread.run() line: not available
>
>
> This second behaviour is what I would generally expect.
Deriving a content type purely from the extension?
> I do not see the point why filename-from-URI based and
> file-extension-from-URI based content-type lookup is shortcut by the
> existence/non-existence of the file.
Content type is about looking at what's in the underlying storage to
determine the content. If the extension is sufficient, register your
resource factory with that extension.
>
> So, while certainly a strange solution and leaving the feeling that
> content type handling has room for improvements, nevertheless it would
> be a solution for my, admittedly very specific, problem.
>
> Regards
>
> Uwe
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887871 is a reply to message #887340] Sun, 17 June 2012 09:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ed,

Comments below.

On 16/06/2012 2:33 PM, Ed Willink wrote:
> Hi Uwe
>
> Abstracting away from the details for a moment the problem seems to be:
>
> Given a URI and a forest of EObjects, create a suitable Resource for
> those EObjects and assign them to Resource.contents.
>
> If you're writing the code you may know the content-type and so you
> can do it right.
>
> A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend may
> not have a content-type concept to enable you to get it right.
Should they have such a thing? The platform hasn't always had that
concept nor EMF, but we added them...
>
> So, today, such tools could examine all the EPackages and use Java
> reflection to get the eCONTENT_TYPE and endeavour to find a
> content-type that is compatible with all the EPackages; quite easy
> when there's only one or it's homogeneous.
Or should it consider just the root object?
>
> If this is the required solution, EMF could provide an eContentType()
> API to avoid reflection and/or a createResource(URI, List<EObject>)
> method.
We could add such a utility method to EcoreUtil; it could use reflection
as you suggest...
>
> Regards
>
> Ed Willink
>
>
>
>
> On 14/06/2012 18:22, Uwe Ritzmann wrote:
>> Hi there,
>>
>> ResourceSetImpl.createResource(URI) hands a contentType=null down the
>> resource creation. In
>> ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate)
>> this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether the
>> type is to be computed.
>>
>> In my case I have an ecore model that I ammended with an alternative
>> ResourceFactory with an second content-type.
>>
>> I give an URI with an extension that is registered against the
>> alternative content-type as output parameter to a QVTo
>> transformation. When debugging that run I see that both of my content
>> types are well listed in the contentTypeIdentifierToFactoryMap but as
>> the null does not cause the content-type for my URI to be computed
>> the correct ResourceFactory is not looked up but I run into the
>> fallback Resource.Factory.Registry.DEFAULT_EXTENSION with returns the
>> deault XMI Resource Factory.
>>
>> What should I change so that my URI is mapped to the correct
>> ResourceFactory?
>>
>> Or is it a bug? And if so: of EMF or of QVTo?
>>
>> Thanks in advance,
>>
>> Uwe
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887908 is a reply to message #887871] Sun, 17 June 2012 10:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Comments below

On 17/06/2012 10:19, Ed Merks wrote:
> Ed,
>
> Comments below.
>
> On 16/06/2012 2:33 PM, Ed Willink wrote:
>> A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend
>> may not have a content-type concept to enable you to get it right.
> Should they have such a thing? The platform hasn't always had that
> concept nor EMF, but we added them...
Arguably they do. It's the meta-model. The outer Resource mapping is an
implementation detail. We just need to provide the algorithm to deduce
the Resource content type from the meta-model.
>>
>> So, today, such tools could examine all the EPackages and use Java
>> reflection to get the eCONTENT_TYPE and endeavour to find a
>> content-type that is compatible with all the EPackages; quite easy
>> when there's only one or it's homogeneous.
> Or should it consider just the root object?
For 99% of uses the output forest is a tree so there is a single root,
but with language extension it is quite feasible that the root is a UML
Model, one of whose Packages is a QVT transformation for which some
ValueSpecification is an OCL expression. Examining the UML Model root
might be simplistic. But the subtleties are of two forms. XMI details
and meta-model evolution. XMI requires the right resource serialization.
Meta-model evolution just needs a version converter that can perhaps be
sorted out later.

So perhaps it sufficient for createResource(URI, List<EObject>) to
select the best content-type that is compatible with each root EObject,
where best is the first (in content handler registration order) content
type with a namespace pattern, else the default content type for the
extension, else normal extension-based selection.
>>
>> If this is the required solution, EMF could provide an eContentType()
>> API to avoid reflection and/or a createResource(URI, List<EObject>)
>> method.
> We could add such a utility method to EcoreUtil; it could use
> reflection as you suggest...
That would be good.

Regards

Ed Willink
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887913 is a reply to message #887908] Sun, 17 June 2012 10:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Ed

A createResource(URI, EPackage) method avoids the tree/forest
complexities and the inefficient challenge of finding the most demanding
EPackage used by a forest.

Regards

Ed Willink

On 17/06/2012 11:38, Ed Willink wrote:
> Hi
>
> Comments below
>
> On 17/06/2012 10:19, Ed Merks wrote:
>> Ed,
>>
>> Comments below.
>>
>> On 16/06/2012 2:33 PM, Ed Willink wrote:
>>> A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend
>>> may not have a content-type concept to enable you to get it right.
>> Should they have such a thing? The platform hasn't always had that
>> concept nor EMF, but we added them...
> Arguably they do. It's the meta-model. The outer Resource mapping is
> an implementation detail. We just need to provide the algorithm to
> deduce the Resource content type from the meta-model.
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887946 is a reply to message #887908] Sun, 17 June 2012 11:57 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ed,

Comments below.


On 17/06/2012 12:38 PM, Ed Willink wrote:
> Hi
>
> Comments below
>
> On 17/06/2012 10:19, Ed Merks wrote:
>> Ed,
>>
>> Comments below.
>>
>> On 16/06/2012 2:33 PM, Ed Willink wrote:
>>> A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend
>>> may not have a content-type concept to enable you to get it right.
>> Should they have such a thing? The platform hasn't always had that
>> concept nor EMF, but we added them...
> Arguably they do. It's the meta-model. The outer Resource mapping is
> an implementation detail. We just need to provide the algorithm to
> deduce the Resource content type from the meta-model.
>>>
>>> So, today, such tools could examine all the EPackages and use Java
>>> reflection to get the eCONTENT_TYPE and endeavour to find a
>>> content-type that is compatible with all the EPackages; quite easy
>>> when there's only one or it's homogeneous.
>> Or should it consider just the root object?
> For 99% of uses the output forest is a tree so there is a single root,
> but with language extension it is quite feasible that the root is a
> UML Model, one of whose Packages is a QVT transformation for which
> some ValueSpecification is an OCL expression. Examining the UML Model
> root might be simplistic. But the subtleties are of two forms. XMI
> details and meta-model evolution. XMI requires the right resource
> serialization. Meta-model evolution just needs a version converter
> that can perhaps be sorted out later.
>
> So perhaps it sufficient for createResource(URI, List<EObject>) to
> select the best content-type that is compatible with each root
> EObject, where best is the first (in content handler registration
> order) content type with a namespace pattern, else the default content
> type for the extension, else normal extension-based selection.
How one decides the content type of a list of objects isn't clear and,
in any case, I'd rather provide something that doesn't introduce new
methods on interfaces....
>>>
>>> If this is the required solution, EMF could provide an
>>> eContentType() API to avoid reflection and/or a createResource(URI,
>>> List<EObject>) method.
>> We could add such a utility method to EcoreUtil; it could use
>> reflection as you suggest...
> That would be good.
>
> Regards
>
> Ed Willink
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887947 is a reply to message #887913] Sun, 17 June 2012 11:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ed,

Using something like resourceSet.createResource(uri,
EcoreUtil.getContentType(ePackage)) seems equivalent. I wonder if the
getContentType method returning UNSPECIFIED_CONTENT_TYPE would be best...


On 17/06/2012 12:47 PM, Ed Willink wrote:
> Hi Ed
>
> A createResource(URI, EPackage) method avoids the tree/forest
> complexities and the inefficient challenge of finding the most
> demanding EPackage used by a forest.
>
> Regards
>
> Ed Willink
>
> On 17/06/2012 11:38, Ed Willink wrote:
>> Hi
>>
>> Comments below
>>
>> On 17/06/2012 10:19, Ed Merks wrote:
>>> Ed,
>>>
>>> Comments below.
>>>
>>> On 16/06/2012 2:33 PM, Ed Willink wrote:
>>>> A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend
>>>> may not have a content-type concept to enable you to get it right.
>>> Should they have such a thing? The platform hasn't always had that
>>> concept nor EMF, but we added them...
>> Arguably they do. It's the meta-model. The outer Resource mapping is
>> an implementation detail. We just need to provide the algorithm to
>> deduce the Resource content type from the meta-model.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #887994 is a reply to message #887947] Sun, 17 June 2012 13:43 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Ed

That works for me.

There are a variety of modeling tools (Acceleo, Xtext and to a lesser
extent OCL) that now try to support the current tool on an old EMF,
platform, so additional static methods cannot easily be used.

Since this code could easily work on Helios, is it worth putting it in
EcoreUtilHelios.java so that it can be used on old platforms? Perhaps
EcoreUtil extends EcoreUtilJuno extends EcoreUtilIndigo extends
EcoreUtilHelios with the new code in an emf.compatibility plugin? Not
worth it for just this routine, but perhaps the packaging supports the
more general future usage of a stable EMF.

Regards

Ed Willink

On 17/06/2012 12:59, Ed Merks wrote:
> Ed,
>
> Using something like resourceSet.createResource(uri,
> EcoreUtil.getContentType(ePackage)) seems equivalent. I wonder if the
> getContentType method returning UNSPECIFIED_CONTENT_TYPE would be best...
>
>
> On 17/06/2012 12:47 PM, Ed Willink wrote:
>> Hi Ed
>>
>> A createResource(URI, EPackage) method avoids the tree/forest
>> complexities and the inefficient challenge of finding the most
>> demanding EPackage used by a forest.
>>
>> Regards
>>
>> Ed Willink
>>
>> On 17/06/2012 11:38, Ed Willink wrote:
>>> Hi
>>>
>>> Comments below
>>>
>>> On 17/06/2012 10:19, Ed Merks wrote:
>>>> Ed,
>>>>
>>>> Comments below.
>>>>
>>>> On 16/06/2012 2:33 PM, Ed Willink wrote:
>>>>> A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend
>>>>> may not have a content-type concept to enable you to get it right.
>>>> Should they have such a thing? The platform hasn't always had that
>>>> concept nor EMF, but we added them...
>>> Arguably they do. It's the meta-model. The outer Resource mapping is
>>> an implementation detail. We just need to provide the algorithm to
>>> deduce the Resource content type from the meta-model.
>>
>
>
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888045 is a reply to message #887870] Sun, 17 June 2012 15:43 Go to previous messageGo to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 26
Registered: July 2009
Junior Member
Ed,

> > [...]
> > In the first run, when the resource is not existing, an exception is
> > thrown
> >
> > [...]
> >
> > and no content type computed, my ResourceFactory not found, the
> > default XMIFactory used and the XMI version of the output model written.
> Yes, if there is nothing there, a content type can't be computed.
Not from actual content, but nevertheless the current implementation of the platforms ContentTypeManager not only uses content, but the URI as well.

> > In the second run no exception is thrown and
> > File.getContentDescription() uses
> > ContentTypeManager to derive my content-type from the URI extension,
> > hence my Factory is found and the text version of the output model is
> > written happily overwriting the XMI version.
> Not from the content, which is XMI?
Certainly not, as the XMI is registered against another content-type as the text version with is in this case successfully derived from the URI extension.

> > [..]
>
> > This second behaviour is what I would generally expect.
> Deriving a content type purely from the extension?
I did not say that, but even files who are thought of as having a content-type must be created at first. And that's what I am talking about all the time. And at that point of time the user must be able to give a desired content-type.

One could have thought of a query segment in the URI like "?contenttype=my.meta.model.text-content-type", but in contrast it at least seems to me that someone thought it would make sense to allow extensions to be associated with content-types (see Preferences > General > Content Types).

> > I do not see the point why filename-from-URI based and
> > file-extension-from-URI based content-type lookup is shortcut by the
> > existence/non-existence of the file.
> Content type is about looking at what's in the underlying storage to
> determine the content.
I just showed you the stack trace that that is not the full truth or other implementors share not your philosophy on content-type computation.

> If the extension is sufficient, register your resource factory with that extension.
Actually, I did that. I did it via the preferences, not via the plugin xml as extension-parser.
And I'd prefer the first solution because this registration can be done by the user.

Regards

Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888050 is a reply to message #887908] Sun, 17 June 2012 15:53 Go to previous messageGo to next message
Uwe Ritzmann is currently offline Uwe RitzmannFriend
Messages: 26
Registered: July 2009
Junior Member
Hi Ed,

Edward Willink wrote on Sun, 17 June 2012 06:38
> Arguably they do. It's the meta-model. The outer Resource mapping is an
> implementation detail. We just need to provide the algorithm to deduce
> the Resource content type from the meta-model.
I disagree. The meta-model does not have a content type. It is the ResourceFactory which maps between content-type and metamodel.

Regards,

Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888057 is a reply to message #888045] Sun, 17 June 2012 16:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Uwe,

Comments below.

On 17/06/2012 5:43 PM, Uwe Ritzmann wrote:
> Ed,
>
>> > [...]
>> > In the first run, when the resource is not existing, an exception
>> is > thrown
>> >
>> > [...]
>> >
>> > and no content type computed, my ResourceFactory not found, the >
>> default XMIFactory used and the XMI version of the output model written.
>> Yes, if there is nothing there, a content type can't be computed.
> Not from actual content, but nevertheless the current implementation
> of the platforms ContentTypeManager not only uses content, but the URI
> as well.
What does it do if there are multiple content types registered for the
same extension? That's pretty much the only interesting case...
>
>> > In the second run no exception is thrown and >
>> File.getContentDescription() uses
>> > ContentTypeManager to derive my content-type from the URI
>> extension, > hence my Factory is found and the text version of the
>> output model is > written happily overwriting the XMI version.
>> Not from the content, which is XMI?
> Certainly not, as the XMI is registered against another content-type
> as the text version with is in this case successfully derived from the
> URI extension.
>
>> > [..]
>>
>> > This second behaviour is what I would generally expect.
>> Deriving a content type purely from the extension?
> I did not say that, but even files who are thought of as having a
> content-type must be created at first. And that's what I am talking
> about all the time. And at that point of time the user must be able to
> give a desired content-type.
>
> One could have thought of a query segment in the URI like
> "?contenttype=my.meta.model.text-content-type", but in contrast it at
> least seems to me that someone thought it would make sense to allow
> extensions to be associated with content-types (see Preferences >
> General > Content Types).
>
>> > I do not see the point why filename-from-URI based and >
>> file-extension-from-URI based content-type lookup is shortcut by the
>> > existence/non-existence of the file.
>> Content type is about looking at what's in the underlying storage to
>> determine the content.
> I just showed you the stack trace that that is not the full truth or
> other implementors share not your philosophy on content-type computation.
>
>> If the extension is sufficient, register your resource factory with
>> that extension.
> Actually, I did that. I did it via the preferences, not via the plugin
> xml as extension-parser.
Even in the preferences you'll see programmed entries that are locked.
> And I'd prefer the first solution because this registration can be
> done by the user.
>
> Regards
>
> Uwe


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888060 is a reply to message #887994] Sun, 17 June 2012 16:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ed,

Comments below.

On 17/06/2012 3:43 PM, Ed Willink wrote:
> Hi Ed
>
> That works for me.
>
> There are a variety of modeling tools (Acceleo, Xtext and to a lesser
> extent OCL) that now try to support the current tool on an old EMF,
> platform, so additional static methods cannot easily be used.
The latest version of EMF is compatible with Eclipse 3.5, i.e., the
lower bound is 3.5.
>
> Since this code could easily work on Helios, is it worth putting it in
> EcoreUtilHelios.java so that it can be used on old platforms?
I'm not sure what you're suggesting...
> Perhaps EcoreUtil extends EcoreUtilJuno extends EcoreUtilIndigo
> extends EcoreUtilHelios with the new code in an emf.compatibility
> plugin? Not worth it for just this routine, but perhaps the packaging
> supports the more general future usage of a stable EMF.
I'm not sure why this is needed or how it would be used...
>
> Regards
>
> Ed Willink
>
> On 17/06/2012 12:59, Ed Merks wrote:
>> Ed,
>>
>> Using something like resourceSet.createResource(uri,
>> EcoreUtil.getContentType(ePackage)) seems equivalent. I wonder if
>> the getContentType method returning UNSPECIFIED_CONTENT_TYPE would be
>> best...
>>
>>
>> On 17/06/2012 12:47 PM, Ed Willink wrote:
>>> Hi Ed
>>>
>>> A createResource(URI, EPackage) method avoids the tree/forest
>>> complexities and the inefficient challenge of finding the most
>>> demanding EPackage used by a forest.
>>>
>>> Regards
>>>
>>> Ed Willink
>>>
>>> On 17/06/2012 11:38, Ed Willink wrote:
>>>> Hi
>>>>
>>>> Comments below
>>>>
>>>> On 17/06/2012 10:19, Ed Merks wrote:
>>>>> Ed,
>>>>>
>>>>> Comments below.
>>>>>
>>>>> On 16/06/2012 2:33 PM, Ed Willink wrote:
>>>>>> A modeling tool such as QVTo, ATL, Epsilon and probably even
>>>>>> Xtend may not have a content-type concept to enable you to get it
>>>>>> right.
>>>>> Should they have such a thing? The platform hasn't always had
>>>>> that concept nor EMF, but we added them...
>>>> Arguably they do. It's the meta-model. The outer Resource mapping
>>>> is an implementation detail. We just need to provide the algorithm
>>>> to deduce the Resource content type from the meta-model.
>>>
>>
>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888083 is a reply to message #888050] Sun, 17 June 2012 16:59 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Of course a meta-model (as specified by some standards authority) does
not have an Eclipse content-type.

Until recently UML Packages didn't even have a namespace URI.

content-types are an Eclipse-ism to enable the Eclipse platform to
handle overloaded file extensions. This was extended by EMF to XML
namespaces.

If this problem was being tackled today for e4 that uses EMF, nsURIs
might well have been used as the content-type. But they aren't.

So we have a number of largely 1:1 relationships between
meta-model intellectual content
meta-model nsURI
content-type

So arguably, as I wrote, on an Eclipse platform a meta-model has an
associated content-type that you may find as the eCONTENT_TYPE field.

Regards

Ed Willink

On 17/06/2012 16:53, Uwe Ritzmann wrote:
> Hi Ed,
>
> Edward Willink wrote on Sun, 17 June 2012 06:38
>> Arguably they do. It's the meta-model. The outer Resource mapping is
>> an implementation detail. We just need to provide the algorithm to
>> deduce the Resource content type from the meta-model.
> I disagree. The meta-model does not have a content type. It is the
> ResourceFactory which maps between content-type and metamodel.
>
> Regards,
>
> Uwe
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888088 is a reply to message #888060] Sun, 17 June 2012 17:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Ed

If applications that are shipped to run on EMF >= 2.5 use the proposed
EcoreUtil.getContentType, they suddenly acquire an EMF 2.9 lower bound.
So applications can only use the new EMF routine by cloning the new
utility routine into their own code base.

My suggestion, first of an EcoreUtilHelios class, allows the
applications to get the functionality from EMF without cloning.

My further suggestion of packaging it in an emf.compatibility plugin
with a 2.5 lower bound would allow applications to bundle the Kepler
emf.compatibility plugin for use in polymorphic
Helios/Indigo/Juno/Kepler distributions.

Regards

Ed Willink



On 17/06/2012 17:07, Ed Merks wrote:
> Ed,
>
> Comments below.
>
> On 17/06/2012 3:43 PM, Ed Willink wrote:
>> Hi Ed
>>
>> That works for me.
>>
>> There are a variety of modeling tools (Acceleo, Xtext and to a lesser
>> extent OCL) that now try to support the current tool on an old EMF,
>> platform, so additional static methods cannot easily be used.
> The latest version of EMF is compatible with Eclipse 3.5, i.e., the
> lower bound is 3.5.
>>
>> Since this code could easily work on Helios, is it worth putting it
>> in EcoreUtilHelios.java so that it can be used on old platforms?
> I'm not sure what you're suggesting...
>> Perhaps EcoreUtil extends EcoreUtilJuno extends EcoreUtilIndigo
>> extends EcoreUtilHelios with the new code in an emf.compatibility
>> plugin? Not worth it for just this routine, but perhaps the packaging
>> supports the more general future usage of a stable EMF.
> I'm not sure why this is needed or how it would be used...
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888167 is a reply to message #888088] Sun, 17 June 2012 19:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ed,

Comments below.

On 17/06/2012 7:10 PM, Ed Willink wrote:
> Hi Ed
>
> If applications that are shipped to run on EMF >= 2.5 use the proposed
> EcoreUtil.getContentType, they suddenly acquire an EMF 2.9 lower bound.
It's 2.8 actually. From that type of reasoning, one can never add new
things. If EMF 2.8 installs and works well in Eclipse 3.5, then
there's no (direct) problem using it in a Helios context.
> So applications can only use the new EMF routine by cloning the new
> utility routine into their own code base.
So no routine can ever be added, or at least can ever be used.
>
> My suggestion, first of an EcoreUtilHelios class, allows the
> applications to get the functionality from EMF without cloning.
> My further suggestion of packaging it in an emf.compatibility plugin
> with a 2.5 lower bound would allow applications to bundle the Kepler
> emf.compatibility plugin for use in polymorphic
> Helios/Indigo/Juno/Kepler distributions.
Why is that better than ensuring that all parts of EMF can run in 3.5?
Is there any precedent in the platform for this type of pattern?
>
> Regards
>
> Ed Willink
>
>
>
> On 17/06/2012 17:07, Ed Merks wrote:
>> Ed,
>>
>> Comments below.
>>
>> On 17/06/2012 3:43 PM, Ed Willink wrote:
>>> Hi Ed
>>>
>>> That works for me.
>>>
>>> There are a variety of modeling tools (Acceleo, Xtext and to a
>>> lesser extent OCL) that now try to support the current tool on an
>>> old EMF, platform, so additional static methods cannot easily be used.
>> The latest version of EMF is compatible with Eclipse 3.5, i.e., the
>> lower bound is 3.5.
>>>
>>> Since this code could easily work on Helios, is it worth putting it
>>> in EcoreUtilHelios.java so that it can be used on old platforms?
>> I'm not sure what you're suggesting...
>>> Perhaps EcoreUtil extends EcoreUtilJuno extends EcoreUtilIndigo
>>> extends EcoreUtilHelios with the new code in an emf.compatibility
>>> plugin? Not worth it for just this routine, but perhaps the
>>> packaging supports the more general future usage of a stable EMF.
>> I'm not sure why this is needed or how it would be used...
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888251 is a reply to message #887340] Sun, 17 June 2012 23:00 Go to previous messageGo to next message
Alan McMorran is currently offline Alan McMorranFriend
Messages: 55
Registered: July 2009
Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1138.47">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #002391}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #008d12}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
p.p6 {margin: 0.0px 0.0px 0.0px 12.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #002390}
p.p7 {margin: 0.0px 0.0px 0.0px 12.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p8 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12}
p.p9 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12; min-height: 14.0px}
p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; min-height: 14.0px}
span.s1 {color: #000000}
span.s2 {color: #002391}
span.s3 {color: #008d12}
</style>
</head>
<body>
<p class="p1">Interesting this has come up as I faced a similar situation about 18 months ago (I think asked about it in the newsgroup) as I'm using QVTo heavily within our RCP app and I wanted an automated way of ensuring only valid ResourceImpl could be used with the outputs as our UI is built automatically from the QVTo AST.<span class="Apple-converted-space">  </span>This is primarily because some of our transforms are to very specific models that are reverse engineered from existing legacy data formats so our users don't care or need to know that they can save the output to an XMI file when they want it in the legacy column-delimited format.</p>
<p class="p2"><br></p>
<p class="p1">My solution is an extension point where an EPackage URI has one or more ResourceFactory's associated with it (and for those that are universal e.g. XMI it simply has the URI as *).<span class="Apple-converted-space">  </span>I also added some additional meta-data around about them to give more human-readable names, the file extensions etc. Within the UI now it can look out the output parameter from QVTo (or from CDO when exporting from the repository) programatically then from this EPackage find the ResourceFactorys that go with that EPackage. The extension also includes an "isDefault" and "priority" attributes so I can set the EPackage-specific ResourceFactorys as default and also change the priority of the agnostic ones to determine what is used by default.</p>
<p class="p2"><br></p>
<p class="p1">A lot of this was aimed at providing an extensible way of building the UI hence the inclusion of human-readable names.<span class="Apple-converted-space">  </span>Works quite nicely for our needs!</p>
<p class="p2"><br></p>
<p class="p1">A couple of examples are below.</p>
<p class="p2"><br></p>
<p class="p1">Alan</p>
<p class="p2"><br></p>
<p class="p3">&lt;extension</p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">         </span></span><span class="s2">point=</span>"com.cimphony.core.emf.schema_resource"<span class="s2">&gt;</span></p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">      </span></span>&lt;schema</p>
<p class="p5"><span class="Apple-converted-space">            </span><span class="s2">uri=</span><span class="s3">"*"</span><span class="s2">&gt;</span></p>
<p class="p5"><span class="Apple-converted-space">         </span><span class="s2">&lt;parser</span></p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">               </span></span><span class="s2">class=</span>"org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl"</p>
<p class="p5"><span class="Apple-converted-space">               </span><span class="s2">priority=</span><span class="s3">"5"</span></p>
<p class="p5"><span class="Apple-converted-space">               </span><span class="s2">type=</span><span class="s3">"xmi"</span></p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">               </span></span><span class="s2">name=</span>"OMG XMI 2.0 Format"<span class="s2">&gt;</span></p>
<p class="p5"><span class="Apple-converted-space">         </span><span class="s2">&lt;/parser&gt;</span></p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">      </span></span>&lt;/schema&gt;</p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">      </span></span>&lt;schema</p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">            </span></span><span class="s2">uri=</span>"http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"<span class="s2">&gt;</span></p>
<p class="p5"><span class="Apple-converted-space">         </span><span class="s2">&lt;parser</span></p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">               </span></span><span class="s2">class=</span>"com.cimphony.schemas.gridlabd.v2.powerflow.Distribution.util.DistributionResourceFactoryImpl"</p>
<p class="p5"><span class="Apple-converted-space">               </span><span class="s2">isDefault=</span><span class="s3">"true"</span></p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">               </span></span><span class="s2">name=</span>"GridLAB-D Powerflow Format"</p>
<p class="p5"><span class="Apple-converted-space">               </span><span class="s2">type=</span><span class="s3">"glm"</span><span class="s2">/&gt;</span></p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">      </span></span>&lt;/schema&gt;</p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">   </span></span>&lt;/extension&gt;</p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p1">On 2012-06-16 12:33:38 +0000, Ed Willink said:</p>
<p class="p2"><br></p>
<p class="p6">Hi Uwe</p>
<p class="p7"><br></p>
<p class="p6">Abstracting away from the details for a moment the problem seems to be:</p>
<p class="p7"><br></p>
<p class="p6">Given a URI and a forest of EObjects, create a suitable Resource for those EObjects and assign them to Resource.contents.</p>
<p class="p7"><br></p>
<p class="p6">If you're writing the code you may know the content-type and so you can do it right.</p>
<p class="p7"><br></p>
<p class="p6">A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend may not have a content-type concept to enable you to get it right.</p>
<p class="p7"><br></p>
<p class="p6">So, today, such tools could examine all the EPackages and use Java reflection to get the eCONTENT_TYPE and endeavour to find a content-type that is compatible with all the EPackages; quite easy when there's only one or it's homogeneous.</p>
<p class="p7"><br></p>
<p class="p6">If this is the required solution, EMF could provide an eContentType() API to avoid reflection and/or a createResource(URI, List&lt;EObject&gt;) method.</p>
<p class="p7"><br></p>
<p class="p6"><span class="Apple-converted-space">     </span>Regards</p>
<p class="p7"><br></p>
<p class="p6"><span class="Apple-converted-space">         </span>Ed Willink</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p6">On 14/06/2012 18:22, Uwe Ritzmann wrote:</p>
<p class="p8">Hi there,</p>
<p class="p9"><br></p>
<p class="p8">ResourceSetImpl.createResource(URI) hands a contentType=null down the resource creation. In ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate) this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether the type is to be computed.</p>
<p class="p9"><br></p>
<p class="p8">In my case I have an ecore model that I ammended with an alternative ResourceFactory with an second content-type.</p>
<p class="p9"><br></p>
<p class="p8">I give an URI with an extension that is registered against the alternative content-type as output parameter to a QVTo transformation. When debugging that run I see that both of my content types are well listed in the contentTypeIdentifierToFactoryMap but as the null does not cause the content-type for my URI to be computed the correct ResourceFactory is not looked up but I run into the fallback Resource.Factory.Registry.DEFAULT_EXTENSION with returns the deault XMI Resource Factory.</p>
<p class="p9"><br></p>
<p class="p8">What should I change so that my URI is mapped to the correct ResourceFactory?</p>
<p class="p9"><br></p>
<p class="p8">Or is it a bug? And if so: of EMF or of QVTo?</p>
<p class="p9"><br></p>
<p class="p8">Thanks in advance,</p>
<p class="p9"><br></p>
<p class="p8">Uwe</p>
<p class="p10"><br></p>
</body>
</html>
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888465 is a reply to message #888167] Mon, 18 June 2012 06:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Below

On 17/06/2012 20:51, Ed Merks wrote:
> Ed,
>
> Comments below.
>
> On 17/06/2012 7:10 PM, Ed Willink wrote:
>> Hi Ed
>>
>> If applications that are shipped to run on EMF >= 2.5 use the
>> proposed EcoreUtil.getContentType, they suddenly acquire an EMF 2.9
>> lower bound.
> It's 2.8 actually. From that type of reasoning, one can never add new
> things. If EMF 2.8 installs and works well in Eclipse 3.5, then
> there's no (direct) problem using it in a Helios context.
2.8 is Juno; nothing new is now going to go into Juno. So an
EcoreUtil.getContentType would be in Kepler which is probably EMF 2.9.
>> So applications can only use the new EMF routine by cloning the new
>> utility routine into their own code base.
> So no routine can ever be added, or at least can ever be used.
Yes. It's a real pain. The ability to create branded Eclipse solutions
is one of Eclipse's successes, but it means that users of those
solutions must wait until the branded solution updates and until their
corporate authority approves the upgrade for production use. It is
really depressing how many Galileo questions appear on the newsgroups.

Such users may not be allowed to upgrade any of the plugins that form
part of the branded solution, but they may be able to add new plugins.
So it is desirable to support new plugins on old platforms. As from
Juno, EMF is partially part of the platform, so upgrading EMF to support
modeling applications may become difficult for some users. It would be
nice to try to help.
>>
>> My suggestion, first of an EcoreUtilHelios class, allows the
>> applications to get the functionality from EMF without cloning.
>> My further suggestion of packaging it in an emf.compatibility plugin
>> with a 2.5 lower bound would allow applications to bundle the Kepler
>> emf.compatibility plugin for use in polymorphic
>> Helios/Indigo/Juno/Kepler distributions.
> Why is that better than ensuring that all parts of EMF can run in
> 3.5? Is there any precedent in the platform for this type of pattern?
Don't know. It would be nice to hear from anyone from Acceleo or Xtext
here to understand their pains and workarounds for polymorphic
distributions.

Regards

Ed Willink
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888468 is a reply to message #888251] Mon, 18 June 2012 06:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Alan<br>
<br>
I'm not clear that your solution achieves anything that could not be
achieved by the standard content type declarations. Your extension
point may be easier to read but it creates a confusion between
alternate declaration mechanisms.<br>
<br>
&nbsp;&nbsp;&nbsp; Regards<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink<br>
<br>
On 18/06/2012 00:00, Alan McMorran wrote:
<blockquote cite="mid:jrlnit$g49$1@xxxxxxxxe.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1138.47">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #002391}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #008d12}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
p.p6 {margin: 0.0px 0.0px 0.0px 12.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #002390}
p.p7 {margin: 0.0px 0.0px 0.0px 12.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p8 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12}
p.p9 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12; min-height: 14.0px}
p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #000000; min-height: 14.0px}
span.s1 {color: #000000}
span.s2 {color: #002391}
span.s3 {color: #008d12}
</style>
<p class="p1">Interesting this has come up as I faced a similar
situation about 18 months ago (I think asked about it in the
newsgroup) as I'm using QVTo heavily within our RCP app and I
wanted an automated way of ensuring only valid ResourceImpl
could be used with the outputs as our UI is built automatically
from the QVTo AST.<span class="Apple-converted-space">&nbsp; </span>This
is primarily because some of our transforms are to very specific
models that are reverse engineered from existing legacy data
formats so our users don't care or need to know that they can
save the output to an XMI file when they want it in the legacy
column-delimited format.</p>
<p class="p2"><br>
</p>
<p class="p1">My solution is an extension point where an EPackage
URI has one or more ResourceFactory's associated with it (and
for those that are universal e.g. XMI it simply has the URI as
*).<span class="Apple-converted-space">&nbsp; </span>I also added
some additional meta-data around about them to give more
human-readable names, the file extensions etc. Within the UI now
it can look out the output parameter from QVTo (or from CDO when
exporting from the repository) programatically then from this
EPackage find the ResourceFactorys that go with that EPackage.
The extension also includes an "isDefault" and "priority"
attributes so I can set the EPackage-specific ResourceFactorys
as default and also change the priority of the agnostic ones to
determine what is used by default.</p>
<p class="p2"><br>
</p>
<p class="p1">A lot of this was aimed at providing an extensible
way of building the UI hence the inclusion of human-readable
names.<span class="Apple-converted-space">&nbsp; </span>Works quite
nicely for our needs!</p>
<p class="p2"><br>
</p>
<p class="p1">A couple of examples are below.</p>
<p class="p2"><br>
</p>
<p class="p1">Alan</p>
<p class="p2"><br>
</p>
<p class="p3">&lt;extension</p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp; &nbsp; &nbsp; </span></span><span class="s2">point=</span>"com.cimphony.core.emf.schema_resource"<span
class="s2">&gt;</span></p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">&nbsp;
&nbsp; &nbsp; </span></span>&lt;schema</p>
<p class="p5"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
class="s2">uri=</span><span class="s3">"*"</span><span
class="s2">&gt;</span></p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span
class="s2">&lt;parser</span></p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></span><span class="s2">class=</span>"org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
class="s2">priority=</span><span class="s3">"5"</span></p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
class="s2">type=</span><span class="s3">"xmi"</span></p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></span><span class="s2">name=</span>"OMG
XMI 2.0 Format"<span class="s2">&gt;</span></p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span
class="s2">&lt;/parser&gt;</span></p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">&nbsp;
&nbsp; &nbsp; </span></span>&lt;/schema&gt;</p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">&nbsp;
&nbsp; &nbsp; </span></span>&lt;schema</p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></span><span class="s2">uri=</span><a class="moz-txt-link-rfc2396E" href="http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution">"http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"</a><span
class="s2">&gt;</span></p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span
class="s2">&lt;parser</span></p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></span><span class="s2">class=</span>"com.cimphony.schemas.gridlabd.v2.powerflow.Distribution.util.DistributionResourceFactoryImpl"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
class="s2">isDefault=</span><span class="s3">"true"</span></p>
<p class="p4"><span class="s1"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></span><span class="s2">name=</span>"GridLAB-D
Powerflow Format"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span
class="s2">type=</span><span class="s3">"glm"</span><span
class="s2">/&gt;</span></p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">&nbsp;
&nbsp; &nbsp; </span></span>&lt;/schema&gt;</p>
<p class="p3"><span class="s1"><span class="Apple-converted-space">&nbsp;&nbsp;
</span></span>&lt;/extension&gt;</p>
<p class="p2"><br>
</p>
<p class="p2"><br>
</p>
<p class="p2"><br>
</p>
<p class="p1">On 2012-06-16 12:33:38 +0000, Ed Willink said:</p>
<p class="p2"><br>
</p>
<p class="p6">Hi Uwe</p>
<p class="p7"><br>
</p>
<p class="p6">Abstracting away from the details for a moment the
problem seems to be:</p>
<p class="p7"><br>
</p>
<p class="p6">Given a URI and a forest of EObjects, create a
suitable Resource for those EObjects and assign them to
Resource.contents.</p>
<p class="p7"><br>
</p>
<p class="p6">If you're writing the code you may know the
content-type and so you can do it right.</p>
<p class="p7"><br>
</p>
<p class="p6">A modeling tool such as QVTo, ATL, Epsilon and
probably even Xtend may not have a content-type concept to
enable you to get it right.</p>
<p class="p7"><br>
</p>
<p class="p6">So, today, such tools could examine all the
EPackages and use Java reflection to get the eCONTENT_TYPE and
endeavour to find a content-type that is compatible with all the
EPackages; quite easy when there's only one or it's homogeneous.</p>
<p class="p7"><br>
</p>
<p class="p6">If this is the required solution, EMF could provide
an eContentType() API to avoid reflection and/or a
createResource(URI, List&lt;EObject&gt;) method.</p>
<p class="p7"><br>
</p>
<p class="p6"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; </span>Regards</p>
<p class="p7"><br>
</p>
<p class="p6"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>Ed
Willink</p>
<p class="p7"><br>
</p>
<p class="p7"><br>
</p>
<p class="p7"><br>
</p>
<p class="p7"><br>
</p>
<p class="p6">On 14/06/2012 18:22, Uwe Ritzmann wrote:</p>
<p class="p8">Hi there,</p>
<p class="p9"><br>
</p>
<p class="p8">ResourceSetImpl.createResource(URI) hands a
contentType=null down the resource creation. In
ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate)
this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether
the type is to be computed.</p>
<p class="p9"><br>
</p>
<p class="p8">In my case I have an ecore model that I ammended
with an alternative ResourceFactory with an second content-type.</p>
<p class="p9"><br>
</p>
<p class="p8">I give an URI with an extension that is registered
against the alternative content-type as output parameter to a
QVTo transformation. When debugging that run I see that both of
my content types are well listed in the
contentTypeIdentifierToFactoryMap but as the null does not cause
the content-type for my URI to be computed the correct
ResourceFactory is not looked up but I run into the fallback
Resource.Factory.Registry.DEFAULT_EXTENSION with returns the
deault XMI Resource Factory.</p>
<p class="p9"><br>
</p>
<p class="p8">What should I change so that my URI is mapped to the
correct ResourceFactory?</p>
<p class="p9"><br>
</p>
<p class="p8">Or is it a bug? And if so: of EMF or of QVTo?</p>
<p class="p9"><br>
</p>
<p class="p8">Thanks in advance,</p>
<p class="p9"><br>
</p>
<p class="p8">Uwe</p>
<p class="p10"><br>
</p>
</blockquote>
<br>
</body>
</html>
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888714 is a reply to message #888468] Mon, 18 June 2012 14:25 Go to previous messageGo to next message
Alan McMorran is currently offline Alan McMorranFriend
Messages: 55
Registered: July 2009
Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1138.47">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390}
p.p4 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390; min-height: 19.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390}
p.p6 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12}
p.p8 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12; min-height: 14.0px}
p.p9 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04}
p.p10 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04; min-height: 14.0px}
p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; min-height: 14.0px}
span.s1 {text-decoration: underline}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1">Ed,</p>
<p class="p2"><br></p>
<p class="p1">I couldn't see any existing extension points that let you set a ResourceFactory for an EPackage <span class="Apple-converted-space">  </span>My situation is that I know I have a bunch of EObjects from a particular EPackage but I wasn't aware of an existing extension point that let me select the ResourceFactory.<span class="Apple-converted-space">  </span>I asked about this about 18 months ago:</p>
<p class="p1"><span class="Apple-tab-span"> </span>http://www.eclipse.org/forums/index.php/mv/tree/173386/</p>
<p class="p2"><br></p>
<p class="p1">What existing content type declarations let you find valid ResourceFactorys for a particular EPackage?<span class="Apple-converted-space">  </span>I use them heavily for the other way around (when I have an existing resource and want to find the ResourceFactory to parse it), but I couldn't see how to use them to create new, blank Resources that could then be populated with EObjects.</p>
<p class="p2"><br></p>
<p class="p1">Apologies if I've misunderstood this thread and gone off on a tangent</p>
<p class="p2"><br></p>
<p class="p1">Alan</p>
<p class="p2"><br></p>
<p class="p1">On 2012-06-18 06:54:39 +0000, Ed Willink said:</p>
<p class="p2"><br></p>
<p class="p3">Hi Alan</p>
<p class="p4"><br></p>
<p class="p3">I'm not clear that your solution achieves anything that could not be achieved by the standard content type declarations. Your extension point may be easier to read but it creates a confusion between alternate declaration mechanisms.</p>
<p class="p4"><br></p>
<p class="p3">    Regards</p>
<p class="p4"><br></p>
<p class="p3">        Ed Willink</p>
<p class="p4"><br></p>
<p class="p3">On 18/06/2012 00:00, Alan McMorran wrote:</p>
<p class="p5">Interesting this has come up as I faced a similar situation about 18 months ago (I think asked about it in the newsgroup) as I'm using QVTo heavily within our RCP app and I wanted an automated way of ensuring only valid ResourceImpl could be used with the outputs as our UI is built automatically from the QVTo AST.<span class="Apple-converted-space">  </span>This is primarily because some of our transforms are to very specific models that are reverse engineered from existing legacy data formats so our users don't care or need to know that they can save the output to an XMI file when they want it in the legacy column-delimited format.</p>
<p class="p6"><br></p>
<p class="p5">My solution is an extension point where an EPackage URI has one or more ResourceFactory's associated with it (and for those that are universal e.g. XMI it simply has the URI as *).<span class="Apple-converted-space">  </span>I also added some additional meta-data around about them to give more human-readable names, the file extensions etc. Within the UI now it can look out the output parameter from QVTo (or from CDO when exporting from the repository) programatically then from this EPackage find the ResourceFactorys that go with that EPackage. The extension also includes an "isDefault" and "priority" attributes so I can set the EPackage-specific ResourceFactorys as default and also change the priority of the agnostic ones to determine what is used by default.</p>
<p class="p6"><br></p>
<p class="p5">A lot of this was aimed at providing an extensible way of building the UI hence the inclusion of human-readable names.<span class="Apple-converted-space">  </span>Works quite nicely for our needs!</p>
<p class="p6"><br></p>
<p class="p5">A couple of examples are below.</p>
<p class="p6"><br></p>
<p class="p5">Alan</p>
<p class="p6"><br></p>
<p class="p5">&lt;extension</p>
<p class="p5"><span class="Apple-converted-space">         </span>point="com.cimphony.core.emf.schema_resource"&gt;</p>
<p class="p5"><span class="Apple-converted-space">      </span>&lt;schema</p>
<p class="p5"><span class="Apple-converted-space">            </span>uri="*"&gt;</p>
<p class="p5"><span class="Apple-converted-space">         </span>&lt;parser</p>
<p class="p5"><span class="Apple-converted-space">               </span>class="org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl"</p>
<p class="p5"><span class="Apple-converted-space">               </span>priority="5"</p>
<p class="p5"><span class="Apple-converted-space">               </span>type="xmi"</p>
<p class="p5"><span class="Apple-converted-space">               </span>name="OMG XMI 2.0 Format"&gt;</p>
<p class="p5"><span class="Apple-converted-space">         </span>&lt;/parser&gt;</p>
<p class="p5"><span class="Apple-converted-space">      </span>&lt;/schema&gt;</p>
<p class="p5"><span class="Apple-converted-space">      </span>&lt;schema</p>
<p class="p5"><span class="Apple-converted-space">            </span>uri=<a href="http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"><span class="s1">"http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"</span></a>&gt;</p>
<p class="p5"><span class="Apple-converted-space">         </span>&lt;parser</p>
<p class="p5"><span class="Apple-converted-space">               </span>class="com.cimphony.schemas.gridlabd.v2.powerflow.Distribution.util.DistributionResourceFactoryImpl"</p>
<p class="p5"><span class="Apple-converted-space">               </span>isDefault="true"</p>
<p class="p5"><span class="Apple-converted-space">               </span>name="GridLAB-D Powerflow Format"</p>
<p class="p5"><span class="Apple-converted-space">               </span>type="glm"/&gt;</p>
<p class="p5"><span class="Apple-converted-space">      </span>&lt;/schema&gt;</p>
<p class="p5"><span class="Apple-converted-space">   </span>&lt;/extension&gt;</p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p5">On 2012-06-16 12:33:38 +0000, Ed Willink said:</p>
<p class="p6"><br></p>
<p class="p7">Hi Uwe</p>
<p class="p8"><br></p>
<p class="p7">Abstracting away from the details for a moment the problem seems to be:</p>
<p class="p8"><br></p>
<p class="p7">Given a URI and a forest of EObjects, create a suitable Resource for those EObjects and assign them to Resource.contents.</p>
<p class="p8"><br></p>
<p class="p7">If you're writing the code you may know the content-type and so you can do it right.</p>
<p class="p8"><br></p>
<p class="p7">A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend may not have a content-type concept to enable you to get it right.</p>
<p class="p8"><br></p>
<p class="p7">So, today, such tools could examine all the EPackages and use Java reflection to get the eCONTENT_TYPE and endeavour to find a content-type that is compatible with all the EPackages; quite easy when there's only one or it's homogeneous.</p>
<p class="p8"><br></p>
<p class="p7">If this is the required solution, EMF could provide an eContentType() API to avoid reflection and/or a createResource(URI, List&lt;EObject&gt;) method.</p>
<p class="p8"><br></p>
<p class="p7"><span class="Apple-converted-space">     </span>Regards</p>
<p class="p8"><br></p>
<p class="p7"><span class="Apple-converted-space">         </span>Ed Willink</p>
<p class="p8"><br></p>
<p class="p8"><br></p>
<p class="p8"><br></p>
<p class="p8"><br></p>
<p class="p7">On 14/06/2012 18:22, Uwe Ritzmann wrote:</p>
<p class="p9">Hi there,</p>
<p class="p10"><br></p>
<p class="p9">ResourceSetImpl.createResource(URI) hands a contentType=null down the resource creation. In ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate) this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether the type is to be computed.</p>
<p class="p10"><br></p>
<p class="p9">In my case I have an ecore model that I ammended with an alternative ResourceFactory with an second content-type.</p>
<p class="p10"><br></p>
<p class="p9">I give an URI with an extension that is registered against the alternative content-type as output parameter to a QVTo transformation. When debugging that run I see that both of my content types are well listed in the contentTypeIdentifierToFactoryMap but as the null does not cause the content-type for my URI to be computed the correct ResourceFactory is not looked up but I run into the fallback Resource.Factory.Registry.DEFAULT_EXTENSION with returns the deault XMI Resource Factory.</p>
<p class="p10"><br></p>
<p class="p9">What should I change so that my URI is mapped to the correct ResourceFactory?</p>
<p class="p10"><br></p>
<p class="p9">Or is it a bug? And if so: of EMF or of QVTo?</p>
<p class="p10"><br></p>
<p class="p9">Thanks in advance,</p>
<p class="p10"><br></p>
<p class="p9">Uwe</p>
<p class="p11"><br></p>
</body>
</html>
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888740 is a reply to message #888714] Mon, 18 June 2012 15:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Alan<br>
<br>
I'm sure Ed will correct this...<br>
<br>
For major examples that really work see UML2's plugin.xml.<br>
<br>
A relatively simple set of declarations are:<br>
<br>
&nbsp;&nbsp; &lt;extension point="org.eclipse.emf.ecore.generated_package"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;package<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uri=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/ocl/3.1.0/Pivot">"http://www.eclipse.org/ocl/3.1.0/Pivot"</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class="org.eclipse.ocl.examples.pivot.PivotPackage"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; genModel="model/Pivot.merged.genmodel"/&gt;<br>
&nbsp;&nbsp; &lt;/extension&gt;<br>
<br>
&nbsp;&nbsp; &lt;extension point="org.eclipse.emf.ecore.content_parser"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parser<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; contentTypeIdentifier="org.eclipse.ocl.examples.pivot"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
class="org.eclipse.ocl.examples.pivot.utilities.PivotResourceFactoryImpl"/&gt;<br>
&nbsp;&nbsp; &lt;/extension&gt;<br>
<br>
&nbsp;&nbsp; &lt;extension
point="org.eclipse.core.contenttype.contentTypes"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;content-type<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base-type="org.eclipse.emf.ecore.xmi"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file-extensions="pivot"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; id="org.eclipse.ocl.examples.pivot"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="%_UI_Pivot_content_type"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; priority="normal"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;describer
class="org.eclipse.emf.ecore.xmi.impl.RootXMLContentHandlerImpl$Describer"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter name="namespace"
value=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/ocl/3.1.0/Pivot">"http://www.eclipse.org/ocl/3.1.0/Pivot"</a>/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter name="kind" value="xmi"/&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/describer&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/content-type&gt;<br>
&nbsp;&nbsp; &lt;/extension&gt;<br>
<br>
org.eclipse.emf.ecore.generated_package: EPackage &lt;=&gt; nsURI<br>
org.eclipse.core.contenttype.contentTypes: nsURI &lt;=&gt; cTI<br>
org.eclipse.emf.ecore.content_parser: cTI &lt;=&gt; ResourceFactory<br>
<br>
&nbsp;&nbsp;&nbsp; Regards<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink<br>
<br>
On 18/06/2012 15:25, Alan McMorran wrote:
<blockquote cite="mid:jrndpg$n7n$1@xxxxxxxxe.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1138.47">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390}
p.p4 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390; min-height: 19.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390}
p.p6 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12}
p.p8 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12; min-height: 14.0px}
p.p9 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04}
p.p10 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04; min-height: 14.0px}
p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; min-height: 14.0px}
span.s1 {text-decoration: underline}
span.Apple-tab-span {white-space:pre}
</style>
<p class="p1">Ed,</p>
<p class="p2"><br>
</p>
<p class="p1">I couldn't see any existing extension points that
let you set a ResourceFactory for an EPackage <span
class="Apple-converted-space">&nbsp; </span>My situation is that I
know I have a bunch of EObjects from a particular EPackage but I
wasn't aware of an existing extension point that let me select
the ResourceFactory.<span class="Apple-converted-space">&nbsp; </span>I
asked about this about 18 months ago:</p>
<p class="p1"><span class="Apple-tab-span"> </span><a class="moz-txt-link-freetext" href="http://www.eclipse.org/forums/index.php/mv/tree/173386/">http://www.eclipse.org/forums/index.php/mv/tree/173386/</a></p>
<p class="p2"><br>
</p>
<p class="p1">What existing content type declarations let you find
valid ResourceFactorys for a particular EPackage?<span
class="Apple-converted-space">&nbsp; </span>I use them heavily for
the other way around (when I have an existing resource and want
to find the ResourceFactory to parse it), but I couldn't see how
to use them to create new, blank Resources that could then be
populated with EObjects.</p>
<p class="p2"><br>
</p>
<p class="p1">Apologies if I've misunderstood this thread and gone
off on a tangent</p>
<p class="p2"><br>
</p>
<p class="p1">Alan</p>
<p class="p2"><br>
</p>
<p class="p1">On 2012-06-18 06:54:39 +0000, Ed Willink said:</p>
<p class="p2"><br>
</p>
<p class="p3">Hi Alan</p>
<p class="p4"><br>
</p>
<p class="p3">I'm not clear that your solution achieves anything
that could not be achieved by the standard content type
declarations. Your extension point may be easier to read but it
creates a confusion between alternate declaration mechanisms.</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp;&nbsp; Regards</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink</p>
<p class="p4"><br>
</p>
<p class="p3">On 18/06/2012 00:00, Alan McMorran wrote:</p>
<p class="p5">Interesting this has come up as I faced a similar
situation about 18 months ago (I think asked about it in the
newsgroup) as I'm using QVTo heavily within our RCP app and I
wanted an automated way of ensuring only valid ResourceImpl
could be used with the outputs as our UI is built automatically
from the QVTo AST.<span class="Apple-converted-space">&nbsp; </span>This
is primarily because some of our transforms are to very specific
models that are reverse engineered from existing legacy data
formats so our users don't care or need to know that they can
save the output to an XMI file when they want it in the legacy
column-delimited format.</p>
<p class="p6"><br>
</p>
<p class="p5">My solution is an extension point where an EPackage
URI has one or more ResourceFactory's associated with it (and
for those that are universal e.g. XMI it simply has the URI as
*).<span class="Apple-converted-space">&nbsp; </span>I also added
some additional meta-data around about them to give more
human-readable names, the file extensions etc. Within the UI now
it can look out the output parameter from QVTo (or from CDO when
exporting from the repository) programatically then from this
EPackage find the ResourceFactorys that go with that EPackage.
The extension also includes an "isDefault" and "priority"
attributes so I can set the EPackage-specific ResourceFactorys
as default and also change the priority of the agnostic ones to
determine what is used by default.</p>
<p class="p6"><br>
</p>
<p class="p5">A lot of this was aimed at providing an extensible
way of building the UI hence the inclusion of human-readable
names.<span class="Apple-converted-space">&nbsp; </span>Works quite
nicely for our needs!</p>
<p class="p6"><br>
</p>
<p class="p5">A couple of examples are below.</p>
<p class="p6"><br>
</p>
<p class="p5">Alan</p>
<p class="p6"><br>
</p>
<p class="p5">&lt;extension</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>point="com.cimphony.core.emf.schema_resource"&gt;</p>
<p class="p5"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;schema</p>
<p class="p5"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>uri="*"&gt;</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;parser</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>class="org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>priority="5"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>type="xmi"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>name="OMG
XMI 2.0 Format"&gt;</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;/parser&gt;</p>
<p class="p5"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;/schema&gt;</p>
<p class="p5"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;schema</p>
<p class="p5"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>uri=<a
moz-do-not-send="true"
href="http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"><span
class="s1">"http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"</span></a>&gt;</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;parser</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>class="com.cimphony.schemas.gridlabd.v2.powerflow.Distribution.util.DistributionResourceFactoryImpl"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>isDefault="true"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>name="GridLAB-D
Powerflow Format"</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>type="glm"/&gt;</p>
<p class="p5"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;/schema&gt;</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;&nbsp; </span>&lt;/extension&gt;</p>
<p class="p6"><br>
</p>
<p class="p6"><br>
</p>
<p class="p6"><br>
</p>
<p class="p5">On 2012-06-16 12:33:38 +0000, Ed Willink said:</p>
<p class="p6"><br>
</p>
<p class="p7">Hi Uwe</p>
<p class="p8"><br>
</p>
<p class="p7">Abstracting away from the details for a moment the
problem seems to be:</p>
<p class="p8"><br>
</p>
<p class="p7">Given a URI and a forest of EObjects, create a
suitable Resource for those EObjects and assign them to
Resource.contents.</p>
<p class="p8"><br>
</p>
<p class="p7">If you're writing the code you may know the
content-type and so you can do it right.</p>
<p class="p8"><br>
</p>
<p class="p7">A modeling tool such as QVTo, ATL, Epsilon and
probably even Xtend may not have a content-type concept to
enable you to get it right.</p>
<p class="p8"><br>
</p>
<p class="p7">So, today, such tools could examine all the
EPackages and use Java reflection to get the eCONTENT_TYPE and
endeavour to find a content-type that is compatible with all the
EPackages; quite easy when there's only one or it's homogeneous.</p>
<p class="p8"><br>
</p>
<p class="p7">If this is the required solution, EMF could provide
an eContentType() API to avoid reflection and/or a
createResource(URI, List&lt;EObject&gt;) method.</p>
<p class="p8"><br>
</p>
<p class="p7"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; </span>Regards</p>
<p class="p8"><br>
</p>
<p class="p7"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>Ed
Willink</p>
<p class="p8"><br>
</p>
<p class="p8"><br>
</p>
<p class="p8"><br>
</p>
<p class="p8"><br>
</p>
<p class="p7">On 14/06/2012 18:22, Uwe Ritzmann wrote:</p>
<p class="p9">Hi there,</p>
<p class="p10"><br>
</p>
<p class="p9">ResourceSetImpl.createResource(URI) hands a
contentType=null down the resource creation. In
ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate)
this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether
the type is to be computed.</p>
<p class="p10"><br>
</p>
<p class="p9">In my case I have an ecore model that I ammended
with an alternative ResourceFactory with an second content-type.</p>
<p class="p10"><br>
</p>
<p class="p9">I give an URI with an extension that is registered
against the alternative content-type as output parameter to a
QVTo transformation. When debugging that run I see that both of
my content types are well listed in the
contentTypeIdentifierToFactoryMap but as the null does not cause
the content-type for my URI to be computed the correct
ResourceFactory is not looked up but I run into the fallback
Resource.Factory.Registry.DEFAULT_EXTENSION with returns the
deault XMI Resource Factory.</p>
<p class="p10"><br>
</p>
<p class="p9">What should I change so that my URI is mapped to the
correct ResourceFactory?</p>
<p class="p10"><br>
</p>
<p class="p9">Or is it a bug? And if so: of EMF or of QVTo?</p>
<p class="p10"><br>
</p>
<p class="p9">Thanks in advance,</p>
<p class="p10"><br>
</p>
<p class="p9">Uwe</p>
<p class="p11"><br>
</p>
</blockquote>
<br>
</body>
</html>
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888747 is a reply to message #888740] Mon, 18 June 2012 15:21 Go to previous messageGo to next message
Alan McMorran is currently offline Alan McMorranFriend
Messages: 55
Registered: July 2009
Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1138.47">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390}
p.p4 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390; min-height: 19.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390}
p.p6 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 24.0px; font: 16.0px Helvetica; color: #008d12}
p.p8 {margin: 0.0px 0.0px 0.0px 24.0px; font: 16.0px Helvetica; color: #008d12; min-height: 19.0px}
p.p9 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12}
p.p10 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12; min-height: 14.0px}
p.p11 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04}
p.p12 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04; min-height: 14.0px}
p.p13 {margin: 0.0px 0.0px 0.0px 48.0px; font: 12.0px Helvetica; color: #002390}
p.p14 {margin: 0.0px 0.0px 0.0px 48.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; min-height: 14.0px}
span.s1 {text-decoration: underline}
</style>
</head>
<body>
<p class="p1">Thanks Ed, I wasn't aware of the standard namespace parameter on the Content Describer for providing this functionality. Is this new?</p>
<p class="p2"><br></p>
<p class="p1">Alan</p>
<p class="p2"><br></p>
<p class="p1">On 2012-06-18 15:10:24 +0000, Ed Willink said:</p>
<p class="p2"><br></p>
<p class="p3">Hi Alan</p>
<p class="p4"><br></p>
<p class="p3">I'm sure Ed will correct this...</p>
<p class="p4"><br></p>
<p class="p3">For major examples that really work see UML2's plugin.xml.</p>
<p class="p4"><br></p>
<p class="p3">A relatively simple set of declarations are:</p>
<p class="p4"><br></p>
<p class="p3">   &lt;extension point="org.eclipse.emf.ecore.generated_package"&gt;</p>
<p class="p3">      &lt;package</p>
<p class="p3">            uri=<a href="http://www.eclipse.org/ocl/3.1.0/Pivot"><span class="s1">"http://www.eclipse.org/ocl/3.1.0/Pivot"</span></a></p>
<p class="p3">            class="org.eclipse.ocl.examples.pivot.PivotPackage"</p>
<p class="p3">            genModel="model/Pivot.merged.genmodel"/&gt;</p>
<p class="p3">   &lt;/extension&gt;</p>
<p class="p4"><br></p>
<p class="p3">   &lt;extension point="org.eclipse.emf.ecore.content_parser"&gt;</p>
<p class="p3">      &lt;parser</p>
<p class="p3">            contentTypeIdentifier="org.eclipse.ocl.examples.pivot"</p>
<p class="p3">            class="org.eclipse.ocl.examples.pivot.utilities.PivotResourceFactoryImpl"/&gt;</p>
<p class="p3">   &lt;/extension&gt;</p>
<p class="p4"><br></p>
<p class="p3">   &lt;extension point="org.eclipse.core.contenttype.contentTypes"&gt;</p>
<p class="p3">      &lt;content-type</p>
<p class="p3">            base-type="org.eclipse.emf.ecore.xmi"</p>
<p class="p3">            file-extensions="pivot"</p>
<p class="p3">            id="org.eclipse.ocl.examples.pivot"</p>
<p class="p3">            name="%_UI_Pivot_content_type"</p>
<p class="p3">            priority="normal"&gt;</p>
<p class="p3">         &lt;describer class="org.eclipse.emf.ecore.xmi.impl.RootXMLContentHandlerImpl$Describer"&gt;</p>
<p class="p3">            &lt;parameter name="namespace" value=<a href="http://www.eclipse.org/ocl/3.1.0/Pivot"><span class="s1">"http://www.eclipse.org/ocl/3.1.0/Pivot"</span></a>/&gt;</p>
<p class="p3">            &lt;parameter name="kind" value="xmi"/&gt;</p>
<p class="p3">         &lt;/describer&gt;</p>
<p class="p3">      &lt;/content-type&gt;</p>
<p class="p3">   &lt;/extension&gt;</p>
<p class="p4"><br></p>
<p class="p3">org.eclipse.emf.ecore.generated_package: EPackage &lt;=&gt; nsURI</p>
<p class="p3">org.eclipse.core.contenttype.contentTypes: nsURI &lt;=&gt; cTI</p>
<p class="p3">org.eclipse.emf.ecore.content_parser: cTI &lt;=&gt; ResourceFactory</p>
<p class="p4"><br></p>
<p class="p3">    Regards</p>
<p class="p4"><br></p>
<p class="p3">        Ed Willink</p>
<p class="p4"><br></p>
<p class="p3">On 18/06/2012 15:25, Alan McMorran wrote:</p>
<p class="p5">Ed,</p>
<p class="p6"><br></p>
<p class="p5">I couldn't see any existing extension points that let you set a ResourceFactory for an EPackage <span class="Apple-converted-space">  </span>My situation is that I know I have a bunch of EObjects from a particular EPackage but I wasn't aware of an existing extension point that let me select the ResourceFactory.<span class="Apple-converted-space">  </span>I asked about this about 18 months ago:</p>
<p class="p5"><span class="Apple-converted-space"> </span><a href="http://www.eclipse.org/forums/index.php/mv/tree/173386/"><span class="s1">http://www.eclipse.org/forums/index.php/mv/tree/173386/</span></a></p>
<p class="p6"><br></p>
<p class="p5">What existing content type declarations let you find valid ResourceFactorys for a particular EPackage?<span class="Apple-converted-space">  </span>I use them heavily for the other way around (when I have an existing resource and want to find the ResourceFactory to parse it), but I couldn't see how to use them to create new, blank Resources that could then be populated with EObjects.</p>
<p class="p6"><br></p>
<p class="p5">Apologies if I've misunderstood this thread and gone off on a tangent</p>
<p class="p6"><br></p>
<p class="p5">Alan</p>
<p class="p6"><br></p>
<p class="p5">On 2012-06-18 06:54:39 +0000, Ed Willink said:</p>
<p class="p6"><br></p>
<p class="p7">Hi Alan</p>
<p class="p8"><br></p>
<p class="p7">I'm not clear that your solution achieves anything that could not be achieved by the standard content type declarations. Your extension point may be easier to read but it creates a confusion between alternate declaration mechanisms.</p>
<p class="p8"><br></p>
<p class="p7">    Regards</p>
<p class="p8"><br></p>
<p class="p7">        Ed Willink</p>
<p class="p8"><br></p>
<p class="p7">On 18/06/2012 00:00, Alan McMorran wrote:</p>
<p class="p9">Interesting this has come up as I faced a similar situation about 18 months ago (I think asked about it in the newsgroup) as I'm using QVTo heavily within our RCP app and I wanted an automated way of ensuring only valid ResourceImpl could be used with the outputs as our UI is built automatically from the QVTo AST.<span class="Apple-converted-space">  </span>This is primarily because some of our transforms are to very specific models that are reverse engineered from existing legacy data formats so our users don't care or need to know that they can save the output to an XMI file when they want it in the legacy column-delimited format.</p>
<p class="p10"><br></p>
<p class="p9">My solution is an extension point where an EPackage URI has one or more ResourceFactory's associated with it (and for those that are universal e.g. XMI it simply has the URI as *).<span class="Apple-converted-space">  </span>I also added some additional meta-data around about them to give more human-readable names, the file extensions etc. Within the UI now it can look out the output parameter from QVTo (or from CDO when exporting from the repository) programatically then from this EPackage find the ResourceFactorys that go with that EPackage. The extension also includes an "isDefault" and "priority" attributes so I can set the EPackage-specific ResourceFactorys as default and also change the priority of the agnostic ones to determine what is used by default.</p>
<p class="p10"><br></p>
<p class="p9">A lot of this was aimed at providing an extensible way of building the UI hence the inclusion of human-readable names.<span class="Apple-converted-space">  </span>Works quite nicely for our needs!</p>
<p class="p10"><br></p>
<p class="p9">A couple of examples are below.</p>
<p class="p10"><br></p>
<p class="p9">Alan</p>
<p class="p10"><br></p>
<p class="p9">&lt;extension</p>
<p class="p9"><span class="Apple-converted-space">         </span>point="com.cimphony.core.emf.schema_resource"&gt;</p>
<p class="p9"><span class="Apple-converted-space">      </span>&lt;schema</p>
<p class="p9"><span class="Apple-converted-space">            </span>uri="*"&gt;</p>
<p class="p9"><span class="Apple-converted-space">         </span>&lt;parser</p>
<p class="p9"><span class="Apple-converted-space">               </span>class="org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl"</p>
<p class="p9"><span class="Apple-converted-space">               </span>priority="5"</p>
<p class="p9"><span class="Apple-converted-space">               </span>type="xmi"</p>
<p class="p9"><span class="Apple-converted-space">               </span>name="OMG XMI 2.0 Format"&gt;</p>
<p class="p9"><span class="Apple-converted-space">         </span>&lt;/parser&gt;</p>
<p class="p9"><span class="Apple-converted-space">      </span>&lt;/schema&gt;</p>
<p class="p9"><span class="Apple-converted-space">      </span>&lt;schema</p>
<p class="p9"><span class="Apple-converted-space">            </span>uri=<a href="http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"><span class="s1">"http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"</span></a>&gt;</p>
<p class="p9"><span class="Apple-converted-space">         </span>&lt;parser</p>
<p class="p9"><span class="Apple-converted-space">               </span>class="com.cimphony.schemas.gridlabd.v2.powerflow.Distribution.util.DistributionResourceFactoryImpl"</p>
<p class="p9"><span class="Apple-converted-space">               </span>isDefault="true"</p>
<p class="p9"><span class="Apple-converted-space">               </span>name="GridLAB-D Powerflow Format"</p>
<p class="p9"><span class="Apple-converted-space">               </span>type="glm"/&gt;</p>
<p class="p9"><span class="Apple-converted-space">      </span>&lt;/schema&gt;</p>
<p class="p9"><span class="Apple-converted-space">   </span>&lt;/extension&gt;</p>
<p class="p10"><br></p>
<p class="p10"><br></p>
<p class="p10"><br></p>
<p class="p9">On 2012-06-16 12:33:38 +0000, Ed Willink said:</p>
<p class="p10"><br></p>
<p class="p11">Hi Uwe</p>
<p class="p12"><br></p>
<p class="p11">Abstracting away from the details for a moment the problem seems to be:</p>
<p class="p12"><br></p>
<p class="p11">Given a URI and a forest of EObjects, create a suitable Resource for those EObjects and assign them to Resource.contents.</p>
<p class="p12"><br></p>
<p class="p11">If you're writing the code you may know the content-type and so you can do it right.</p>
<p class="p12"><br></p>
<p class="p11">A modeling tool such as QVTo, ATL, Epsilon and probably even Xtend may not have a content-type concept to enable you to get it right.</p>
<p class="p12"><br></p>
<p class="p11">So, today, such tools could examine all the EPackages and use Java reflection to get the eCONTENT_TYPE and endeavour to find a content-type that is compatible with all the EPackages; quite easy when there's only one or it's homogeneous.</p>
<p class="p12"><br></p>
<p class="p11">If this is the required solution, EMF could provide an eContentType() API to avoid reflection and/or a createResource(URI, List&lt;EObject&gt;) method.</p>
<p class="p12"><br></p>
<p class="p11"><span class="Apple-converted-space">     </span>Regards</p>
<p class="p12"><br></p>
<p class="p11"><span class="Apple-converted-space">         </span>Ed Willink</p>
<p class="p12"><br></p>
<p class="p12"><br></p>
<p class="p12"><br></p>
<p class="p12"><br></p>
<p class="p11">On 14/06/2012 18:22, Uwe Ritzmann wrote:</p>
<p class="p13">Hi there,</p>
<p class="p14"><br></p>
<p class="p13">ResourceSetImpl.createResource(URI) hands a contentType=null down the resource creation. In ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate) this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether the type is to be computed.</p>
<p class="p14"><br></p>
<p class="p13">In my case I have an ecore model that I ammended with an alternative ResourceFactory with an second content-type.</p>
<p class="p14"><br></p>
<p class="p13">I give an URI with an extension that is registered against the alternative content-type as output parameter to a QVTo transformation. When debugging that run I see that both of my content types are well listed in the contentTypeIdentifierToFactoryMap but as the null does not cause the content-type for my URI to be computed the correct ResourceFactory is not looked up but I run into the fallback Resource.Factory.Registry.DEFAULT_EXTENSION with returns the deault XMI Resource Factory.</p>
<p class="p14"><br></p>
<p class="p13">What should I change so that my URI is mapped to the correct ResourceFactory?</p>
<p class="p14"><br></p>
<p class="p13">Or is it a bug? And if so: of EMF or of QVTo?</p>
<p class="p14"><br></p>
<p class="p13">Thanks in advance,</p>
<p class="p14"><br></p>
<p class="p13">Uwe</p>
<p class="p15"><br></p>
</body>
</html>
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888786 is a reply to message #888747] Mon, 18 June 2012 16:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Alan<br>
<br>
CVS shows RootXMLContentHandlerImpl unchanged since 2008.<br>
<br>
&nbsp;&nbsp;&nbsp; Regards<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink<br>
<br>
On 18/06/2012 16:21, Alan McMorran wrote:
<blockquote cite="mid:jrnh1o$toi$1@xxxxxxxxe.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1138.47">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390}
p.p4 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390; min-height: 19.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390}
p.p6 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 24.0px; font: 16.0px Helvetica; color: #008d12}
p.p8 {margin: 0.0px 0.0px 0.0px 24.0px; font: 16.0px Helvetica; color: #008d12; min-height: 19.0px}
p.p9 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12}
p.p10 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12; min-height: 14.0px}
p.p11 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04}
p.p12 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04; min-height: 14.0px}
p.p13 {margin: 0.0px 0.0px 0.0px 48.0px; font: 12.0px Helvetica; color: #002390}
p.p14 {margin: 0.0px 0.0px 0.0px 48.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; min-height: 14.0px}
span.s1 {text-decoration: underline}
</style>
<p class="p1">Thanks Ed, I wasn't aware of the standard namespace
parameter on the Content Describer for providing this
functionality. Is this new?</p>
<p class="p2"><br>
</p>
<p class="p1">Alan</p>
<p class="p2"><br>
</p>
<p class="p1">On 2012-06-18 15:10:24 +0000, Ed Willink said:</p>
<p class="p2"><br>
</p>
<p class="p3">Hi Alan</p>
<p class="p4"><br>
</p>
<p class="p3">I'm sure Ed will correct this...</p>
<p class="p4"><br>
</p>
<p class="p3">For major examples that really work see UML2's
plugin.xml.</p>
<p class="p4"><br>
</p>
<p class="p3">A relatively simple set of declarations are:</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp; &lt;extension
point="org.eclipse.emf.ecore.generated_package"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;package</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uri=<a moz-do-not-send="true"
href="http://www.eclipse.org/ocl/3.1.0/Pivot"><span class="s1">"http://www.eclipse.org/ocl/3.1.0/Pivot"</span></a></p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
class="org.eclipse.ocl.examples.pivot.PivotPackage"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
genModel="model/Pivot.merged.genmodel"/&gt;</p>
<p class="p3">&nbsp;&nbsp; &lt;/extension&gt;</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp; &lt;extension
point="org.eclipse.emf.ecore.content_parser"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parser</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
contentTypeIdentifier="org.eclipse.ocl.examples.pivot"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
class="org.eclipse.ocl.examples.pivot.utilities.PivotResourceFactoryImpl"/&gt;</p>
<p class="p3">&nbsp;&nbsp; &lt;/extension&gt;</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp; &lt;extension
point="org.eclipse.core.contenttype.contentTypes"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;content-type</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base-type="org.eclipse.emf.ecore.xmi"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file-extensions="pivot"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; id="org.eclipse.ocl.examples.pivot"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="%_UI_Pivot_content_type"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; priority="normal"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;describer
class="org.eclipse.emf.ecore.xmi.impl.RootXMLContentHandlerImpl$Describer"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter name="namespace" value=<a
moz-do-not-send="true"
href="http://www.eclipse.org/ocl/3.1.0/Pivot"><span class="s1">"http://www.eclipse.org/ocl/3.1.0/Pivot"</span></a>/&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter name="kind"
value="xmi"/&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/describer&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/content-type&gt;</p>
<p class="p3">&nbsp;&nbsp; &lt;/extension&gt;</p>
<p class="p4"><br>
</p>
<p class="p3">org.eclipse.emf.ecore.generated_package: EPackage
&lt;=&gt; nsURI</p>
<p class="p3">org.eclipse.core.contenttype.contentTypes: nsURI
&lt;=&gt; cTI</p>
<p class="p3">org.eclipse.emf.ecore.content_parser: cTI &lt;=&gt;
ResourceFactory</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp;&nbsp; Regards</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink</p>
<p class="p4"><br>
</p>
<p class="p3">On 18/06/2012 15:25, Alan McMorran wrote:</p>
<p class="p5">Ed,</p>
<p class="p6"><br>
</p>
<p class="p5">I couldn't see any existing extension points that
let you set a ResourceFactory for an EPackage <span
class="Apple-converted-space">&nbsp; </span>My situation is that I
know I have a bunch of EObjects from a particular EPackage but I
wasn't aware of an existing extension point that let me select
the ResourceFactory.<span class="Apple-converted-space">&nbsp; </span>I
asked about this about 18 months ago:</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;</span><a
moz-do-not-send="true"
href="http://www.eclipse.org/forums/index.php/mv/tree/173386/"><span
class="s1">http://www.eclipse.org/forums/index.php/mv/tree/173386/</span></a></p>
<p class="p6"><br>
</p>
<p class="p5">What existing content type declarations let you find
valid ResourceFactorys for a particular EPackage?<span
class="Apple-converted-space">&nbsp; </span>I use them heavily for
the other way around (when I have an existing resource and want
to find the ResourceFactory to parse it), but I couldn't see how
to use them to create new, blank Resources that could then be
populated with EObjects.</p>
<p class="p6"><br>
</p>
<p class="p5">Apologies if I've misunderstood this thread and gone
off on a tangent</p>
<p class="p6"><br>
</p>
<p class="p5">Alan</p>
<p class="p6"><br>
</p>
<p class="p5">On 2012-06-18 06:54:39 +0000, Ed Willink said:</p>
<p class="p6"><br>
</p>
<p class="p7">Hi Alan</p>
<p class="p8"><br>
</p>
<p class="p7">I'm not clear that your solution achieves anything
that could not be achieved by the standard content type
declarations. Your extension point may be easier to read but it
creates a confusion between alternate declaration mechanisms.</p>
<p class="p8"><br>
</p>
<p class="p7">&nbsp;&nbsp;&nbsp; Regards</p>
<p class="p8"><br>
</p>
<p class="p7">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink</p>
<p class="p8"><br>
</p>
<p class="p7">On 18/06/2012 00:00, Alan McMorran wrote:</p>
<p class="p9">Interesting this has come up as I faced a similar
situation about 18 months ago (I think asked about it in the
newsgroup) as I'm using QVTo heavily within our RCP app and I
wanted an automated way of ensuring only valid ResourceImpl
could be used with the outputs as our UI is built automatically
from the QVTo AST.<span class="Apple-converted-space">&nbsp; </span>This
is primarily because some of our transforms are to very specific
models that are reverse engineered from existing legacy data
formats so our users don't care or need to know that they can
save the output to an XMI file when they want it in the legacy
column-delimited format.</p>
<p class="p10"><br>
</p>
<p class="p9">My solution is an extension point where an EPackage
URI has one or more ResourceFactory's associated with it (and
for those that are universal e.g. XMI it simply has the URI as
*).<span class="Apple-converted-space">&nbsp; </span>I also added
some additional meta-data around about them to give more
human-readable names, the file extensions etc. Within the UI now
it can look out the output parameter from QVTo (or from CDO when
exporting from the repository) programatically then from this
EPackage find the ResourceFactorys that go with that EPackage.
The extension also includes an "isDefault" and "priority"
attributes so I can set the EPackage-specific ResourceFactorys
as default and also change the priority of the agnostic ones to
determine what is used by default.</p>
<p class="p10"><br>
</p>
<p class="p9">A lot of this was aimed at providing an extensible
way of building the UI hence the inclusion of human-readable
names.<span class="Apple-converted-space">&nbsp; </span>Works quite
nicely for our needs!</p>
<p class="p10"><br>
</p>
<p class="p9">A couple of examples are below.</p>
<p class="p10"><br>
</p>
<p class="p9">Alan</p>
<p class="p10"><br>
</p>
<p class="p9">&lt;extension</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>point="com.cimphony.core.emf.schema_resource"&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;schema</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>uri="*"&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;parser</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>class="org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>priority="5"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>type="xmi"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>name="OMG
XMI 2.0 Format"&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;/parser&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;/schema&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;schema</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>uri=<a
moz-do-not-send="true"
href="http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"><span
class="s1">"http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"</span></a>&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;parser</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>class="com.cimphony.schemas.gridlabd.v2.powerflow.Distribution.util.DistributionResourceFactoryImpl"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>isDefault="true"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>name="GridLAB-D
Powerflow Format"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>type="glm"/&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;/schema&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; </span>&lt;/extension&gt;</p>
<p class="p10"><br>
</p>
<p class="p10"><br>
</p>
<p class="p10"><br>
</p>
<p class="p9">On 2012-06-16 12:33:38 +0000, Ed Willink said:</p>
<p class="p10"><br>
</p>
<p class="p11">Hi Uwe</p>
<p class="p12"><br>
</p>
<p class="p11">Abstracting away from the details for a moment the
problem seems to be:</p>
<p class="p12"><br>
</p>
<p class="p11">Given a URI and a forest of EObjects, create a
suitable Resource for those EObjects and assign them to
Resource.contents.</p>
<p class="p12"><br>
</p>
<p class="p11">If you're writing the code you may know the
content-type and so you can do it right.</p>
<p class="p12"><br>
</p>
<p class="p11">A modeling tool such as QVTo, ATL, Epsilon and
probably even Xtend may not have a content-type concept to
enable you to get it right.</p>
<p class="p12"><br>
</p>
<p class="p11">So, today, such tools could examine all the
EPackages and use Java reflection to get the eCONTENT_TYPE and
endeavour to find a content-type that is compatible with all the
EPackages; quite easy when there's only one or it's homogeneous.</p>
<p class="p12"><br>
</p>
<p class="p11">If this is the required solution, EMF could provide
an eContentType() API to avoid reflection and/or a
createResource(URI, List&lt;EObject&gt;) method.</p>
<p class="p12"><br>
</p>
<p class="p11"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; </span>Regards</p>
<p class="p12"><br>
</p>
<p class="p11"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>Ed
Willink</p>
<p class="p12"><br>
</p>
<p class="p12"><br>
</p>
<p class="p12"><br>
</p>
<p class="p12"><br>
</p>
<p class="p11">On 14/06/2012 18:22, Uwe Ritzmann wrote:</p>
<p class="p13">Hi there,</p>
<p class="p14"><br>
</p>
<p class="p13">ResourceSetImpl.createResource(URI) hands a
contentType=null down the resource creation. In
ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate)
this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether
the type is to be computed.</p>
<p class="p14"><br>
</p>
<p class="p13">In my case I have an ecore model that I ammended
with an alternative ResourceFactory with an second content-type.</p>
<p class="p14"><br>
</p>
<p class="p13">I give an URI with an extension that is registered
against the alternative content-type as output parameter to a
QVTo transformation. When debugging that run I see that both of
my content types are well listed in the
contentTypeIdentifierToFactoryMap but as the null does not cause
the content-type for my URI to be computed the correct
ResourceFactory is not looked up but I run into the fallback
Resource.Factory.Registry.DEFAULT_EXTENSION with returns the
deault XMI Resource Factory.</p>
<p class="p14"><br>
</p>
<p class="p13">What should I change so that my URI is mapped to
the correct ResourceFactory?</p>
<p class="p14"><br>
</p>
<p class="p13">Or is it a bug? And if so: of EMF or of QVTo?</p>
<p class="p14"><br>
</p>
<p class="p13">Thanks in advance,</p>
<p class="p14"><br>
</p>
<p class="p13">Uwe</p>
<p class="p15"><br>
</p>
</blockquote>
<br>
</body>
</html>
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888824 is a reply to message #888465] Mon, 18 June 2012 17:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ed,

Comments below.


On 18/06/2012 8:49 AM, Ed Willink wrote:
> Hi
>
> Below
>
> On 17/06/2012 20:51, Ed Merks wrote:
>> Ed,
>>
>> Comments below.
>>
>> On 17/06/2012 7:10 PM, Ed Willink wrote:
>>> Hi Ed
>>>
>>> If applications that are shipped to run on EMF >= 2.5 use the
>>> proposed EcoreUtil.getContentType, they suddenly acquire an EMF 2.9
>>> lower bound.
>> It's 2.8 actually. From that type of reasoning, one can never add
>> new things. If EMF 2.8 installs and works well in Eclipse 3.5, then
>> there's no (direct) problem using it in a Helios context.
> 2.8 is Juno; nothing new is now going to go into Juno. So an
> EcoreUtil.getContentType would be in Kepler which is probably EMF 2.9.
Yes, it's too late for Juno.
>>> So applications can only use the new EMF routine by cloning the new
>>> utility routine into their own code base.
>> So no routine can ever be added, or at least can ever be used.
> Yes. It's a real pain. The ability to create branded Eclipse solutions
> is one of Eclipse's successes, but it means that users of those
> solutions must wait until the branded solution updates and until their
> corporate authority approves the upgrade for production use. It is
> really depressing how many Galileo questions appear on the newsgroups.
Such is life, but I can't make that my problem.
>
> Such users may not be allowed to upgrade any of the plugins that form
> part of the branded solution, but they may be able to add new plugins.
Then again, maybe not.
> So it is desirable to support new plugins on old platforms.
Yes, we support Eclipse 3.5.
> As from Juno, EMF is partially part of the platform, so upgrading EMF
> to support modeling applications may become difficult for some users.
> It would be nice to try to help.
Yes, but not to the point of butchering API.
>>>
>>> My suggestion, first of an EcoreUtilHelios class, allows the
>>> applications to get the functionality from EMF without cloning.
>>> My further suggestion of packaging it in an emf.compatibility plugin
>>> with a 2.5 lower bound would allow applications to bundle the Kepler
>>> emf.compatibility plugin for use in polymorphic
>>> Helios/Indigo/Juno/Kepler distributions.
>> Why is that better than ensuring that all parts of EMF can run in
>> 3.5? Is there any precedent in the platform for this type of pattern?
> Don't know. It would be nice to hear from anyone from Acceleo or
> Xtext here to understand their pains and workarounds for polymorphic
> distributions.
I tried to make that easier but broadening the range of platforms in
which EMF will install. That's will have to suffice.
>
> Regards
>
> Ed Willink
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ContentHandler.UNSPECIFIED_CONTENT_TYPE vs null [message #888827 is a reply to message #888786] Mon, 18 June 2012 17:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Yes, the general idea is that the namespace of the root XML element
(or the element nested within the XMI root element) will use a
namespace that corresponds to a package's nsURI so using that to
recognize content type deals with the common case.<br>
<br>
<br>
<div class="moz-cite-prefix">On 18/06/2012 6:04 PM, Ed Willink
wrote:<br>
</div>
<blockquote cite="mid:jrnjje$35j$1@xxxxxxxxe.org" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Hi Alan<br>
<br>
CVS shows RootXMLContentHandlerImpl unchanged since 2008.<br>
<br>
&nbsp;&nbsp;&nbsp; Regards<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink<br>
<br>
On 18/06/2012 16:21, Alan McMorran wrote:
<blockquote cite="mid:jrnh1o$toi$1@xxxxxxxxe.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1138.47">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390}
p.p4 {margin: 0.0px 0.0px 0.0px 12.0px; font: 16.0px Helvetica; color: #002390; min-height: 19.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390}
p.p6 {margin: 0.0px 0.0px 0.0px 12.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 24.0px; font: 16.0px Helvetica; color: #008d12}
p.p8 {margin: 0.0px 0.0px 0.0px 24.0px; font: 16.0px Helvetica; color: #008d12; min-height: 19.0px}
p.p9 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12}
p.p10 {margin: 0.0px 0.0px 0.0px 24.0px; font: 12.0px Helvetica; color: #008d12; min-height: 14.0px}
p.p11 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04}
p.p12 {margin: 0.0px 0.0px 0.0px 36.0px; font: 12.0px Helvetica; color: #930f04; min-height: 14.0px}
p.p13 {margin: 0.0px 0.0px 0.0px 48.0px; font: 12.0px Helvetica; color: #002390}
p.p14 {margin: 0.0px 0.0px 0.0px 48.0px; font: 12.0px Helvetica; color: #002390; min-height: 14.0px}
p.p15 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; min-height: 14.0px}
span.s1 {text-decoration: underline}
</style>
<p class="p1">Thanks Ed, I wasn't aware of the standard
namespace parameter on the Content Describer for providing
this functionality. Is this new?</p>
<p class="p2"><br>
</p>
<p class="p1">Alan</p>
<p class="p2"><br>
</p>
<p class="p1">On 2012-06-18 15:10:24 +0000, Ed Willink said:</p>
<p class="p2"><br>
</p>
<p class="p3">Hi Alan</p>
<p class="p4"><br>
</p>
<p class="p3">I'm sure Ed will correct this...</p>
<p class="p4"><br>
</p>
<p class="p3">For major examples that really work see UML2's
plugin.xml.</p>
<p class="p4"><br>
</p>
<p class="p3">A relatively simple set of declarations are:</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp; &lt;extension
point="org.eclipse.emf.ecore.generated_package"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;package</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uri=<a moz-do-not-send="true"
href="http://www.eclipse.org/ocl/3.1.0/Pivot"><span
class="s1">"http://www.eclipse.org/ocl/3.1.0/Pivot"</span></a></p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
class="org.eclipse.ocl.examples.pivot.PivotPackage"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
genModel="model/Pivot.merged.genmodel"/&gt;</p>
<p class="p3">&nbsp;&nbsp; &lt;/extension&gt;</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp; &lt;extension
point="org.eclipse.emf.ecore.content_parser"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parser</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
contentTypeIdentifier="org.eclipse.ocl.examples.pivot"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
class="org.eclipse.ocl.examples.pivot.utilities.PivotResourceFactoryImpl"/&gt;</p>
<p class="p3">&nbsp;&nbsp; &lt;/extension&gt;</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp; &lt;extension
point="org.eclipse.core.contenttype.contentTypes"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;content-type</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; base-type="org.eclipse.emf.ecore.xmi"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file-extensions="pivot"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; id="org.eclipse.ocl.examples.pivot"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="%_UI_Pivot_content_type"</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; priority="normal"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;describer
class="org.eclipse.emf.ecore.xmi.impl.RootXMLContentHandlerImpl$Describer"&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter name="namespace" value=<a
moz-do-not-send="true"
href="http://www.eclipse.org/ocl/3.1.0/Pivot"><span
class="s1">"http://www.eclipse.org/ocl/3.1.0/Pivot"</span></a>/&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;parameter name="kind"
value="xmi"/&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/describer&gt;</p>
<p class="p3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/content-type&gt;</p>
<p class="p3">&nbsp;&nbsp; &lt;/extension&gt;</p>
<p class="p4"><br>
</p>
<p class="p3">org.eclipse.emf.ecore.generated_package: EPackage
&lt;=&gt; nsURI</p>
<p class="p3">org.eclipse.core.contenttype.contentTypes: nsURI
&lt;=&gt; cTI</p>
<p class="p3">org.eclipse.emf.ecore.content_parser: cTI
&lt;=&gt; ResourceFactory</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp;&nbsp; Regards</p>
<p class="p4"><br>
</p>
<p class="p3">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink</p>
<p class="p4"><br>
</p>
<p class="p3">On 18/06/2012 15:25, Alan McMorran wrote:</p>
<p class="p5">Ed,</p>
<p class="p6"><br>
</p>
<p class="p5">I couldn't see any existing extension points that
let you set a ResourceFactory for an EPackage <span
class="Apple-converted-space">&nbsp; </span>My situation is that
I know I have a bunch of EObjects from a particular EPackage
but I wasn't aware of an existing extension point that let me
select the ResourceFactory.<span class="Apple-converted-space">&nbsp;
</span>I asked about this about 18 months ago:</p>
<p class="p5"><span class="Apple-converted-space">&nbsp;</span><a
moz-do-not-send="true"
href="http://www.eclipse.org/forums/index.php/mv/tree/173386/"><span
class="s1">http://www.eclipse.org/forums/index.php/mv/tree/173386/</span></a></p>
<p class="p6"><br>
</p>
<p class="p5">What existing content type declarations let you
find valid ResourceFactorys for a particular EPackage?<span
class="Apple-converted-space">&nbsp; </span>I use them heavily
for the other way around (when I have an existing resource and
want to find the ResourceFactory to parse it), but I couldn't
see how to use them to create new, blank Resources that could
then be populated with EObjects.</p>
<p class="p6"><br>
</p>
<p class="p5">Apologies if I've misunderstood this thread and
gone off on a tangent</p>
<p class="p6"><br>
</p>
<p class="p5">Alan</p>
<p class="p6"><br>
</p>
<p class="p5">On 2012-06-18 06:54:39 +0000, Ed Willink said:</p>
<p class="p6"><br>
</p>
<p class="p7">Hi Alan</p>
<p class="p8"><br>
</p>
<p class="p7">I'm not clear that your solution achieves anything
that could not be achieved by the standard content type
declarations. Your extension point may be easier to read but
it creates a confusion between alternate declaration
mechanisms.</p>
<p class="p8"><br>
</p>
<p class="p7">&nbsp;&nbsp;&nbsp; Regards</p>
<p class="p8"><br>
</p>
<p class="p7">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Ed Willink</p>
<p class="p8"><br>
</p>
<p class="p7">On 18/06/2012 00:00, Alan McMorran wrote:</p>
<p class="p9">Interesting this has come up as I faced a similar
situation about 18 months ago (I think asked about it in the
newsgroup) as I'm using QVTo heavily within our RCP app and I
wanted an automated way of ensuring only valid ResourceImpl
could be used with the outputs as our UI is built
automatically from the QVTo AST.<span
class="Apple-converted-space">&nbsp; </span>This is primarily
because some of our transforms are to very specific models
that are reverse engineered from existing legacy data formats
so our users don't care or need to know that they can save the
output to an XMI file when they want it in the legacy
column-delimited format.</p>
<p class="p10"><br>
</p>
<p class="p9">My solution is an extension point where an
EPackage URI has one or more ResourceFactory's associated with
it (and for those that are universal e.g. XMI it simply has
the URI as *).<span class="Apple-converted-space">&nbsp; </span>I
also added some additional meta-data around about them to give
more human-readable names, the file extensions etc. Within the
UI now it can look out the output parameter from QVTo (or from
CDO when exporting from the repository) programatically then
from this EPackage find the ResourceFactorys that go with that
EPackage. The extension also includes an "isDefault" and
"priority" attributes so I can set the EPackage-specific
ResourceFactorys as default and also change the priority of
the agnostic ones to determine what is used by default.</p>
<p class="p10"><br>
</p>
<p class="p9">A lot of this was aimed at providing an extensible
way of building the UI hence the inclusion of human-readable
names.<span class="Apple-converted-space">&nbsp; </span>Works
quite nicely for our needs!</p>
<p class="p10"><br>
</p>
<p class="p9">A couple of examples are below.</p>
<p class="p10"><br>
</p>
<p class="p9">Alan</p>
<p class="p10"><br>
</p>
<p class="p9">&lt;extension</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>point="com.cimphony.core.emf.schema_resource"&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;schema</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>uri="*"&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;parser</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>class="org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>priority="5"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>type="xmi"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>name="OMG XMI 2.0 Format"&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;/parser&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;/schema&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;schema</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>uri=<a
moz-do-not-send="true"
href="http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"><span
class="s1">"http://www.pnnl.gov/gridlabd/2.1/powerflow/distribution"</span></a>&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>&lt;parser</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>class="com.cimphony.schemas.gridlabd.v2.powerflow.Distribution.util.DistributionResourceFactoryImpl"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>isDefault="true"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>name="GridLAB-D Powerflow Format"</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>type="glm"/&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp; &nbsp; &nbsp; </span>&lt;/schema&gt;</p>
<p class="p9"><span class="Apple-converted-space">&nbsp;&nbsp; </span>&lt;/extension&gt;</p>
<p class="p10"><br>
</p>
<p class="p10"><br>
</p>
<p class="p10"><br>
</p>
<p class="p9">On 2012-06-16 12:33:38 +0000, Ed Willink said:</p>
<p class="p10"><br>
</p>
<p class="p11">Hi Uwe</p>
<p class="p12"><br>
</p>
<p class="p11">Abstracting away from the details for a moment
the problem seems to be:</p>
<p class="p12"><br>
</p>
<p class="p11">Given a URI and a forest of EObjects, create a
suitable Resource for those EObjects and assign them to
Resource.contents.</p>
<p class="p12"><br>
</p>
<p class="p11">If you're writing the code you may know the
content-type and so you can do it right.</p>
<p class="p12"><br>
</p>
<p class="p11">A modeling tool such as QVTo, ATL, Epsilon and
probably even Xtend may not have a content-type concept to
enable you to get it right.</p>
<p class="p12"><br>
</p>
<p class="p11">So, today, such tools could examine all the
EPackages and use Java reflection to get the eCONTENT_TYPE and
endeavour to find a content-type that is compatible with all
the EPackages; quite easy when there's only one or it's
homogeneous.</p>
<p class="p12"><br>
</p>
<p class="p11">If this is the required solution, EMF could
provide an eContentType() API to avoid reflection and/or a
createResource(URI, List&lt;EObject&gt;) method.</p>
<p class="p12"><br>
</p>
<p class="p11"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; </span>Regards</p>
<p class="p12"><br>
</p>
<p class="p11"><span class="Apple-converted-space">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span>Ed

Willink</p>
<p class="p12"><br>
</p>
<p class="p12"><br>
</p>
<p class="p12"><br>
</p>
<p class="p12"><br>
</p>
<p class="p11">On 14/06/2012 18:22, Uwe Ritzmann wrote:</p>
<p class="p13">Hi there,</p>
<p class="p14"><br>
</p>
<p class="p13">ResourceSetImpl.createResource(URI) hands a
contentType=null down the resource creation. In
ResourceFactoryRegistryImpl.getFactory(uri,protoMap,extMap,contentMap,contentTypeIdentifier,delegate)

this is compared to UNSPECIFIED_CONTENT_TYPE to decide whether
the type is to be computed.</p>
<p class="p14"><br>
</p>
<p class="p13">In my case I have an ecore model that I ammended
with an alternative ResourceFactory with an second
content-type.</p>
<p class="p14"><br>
</p>
<p class="p13">I give an URI with an extension that is
registered against the alternative content-type as output
parameter to a QVTo transformation. When debugging that run I
see that both of my content types are well listed in the
contentTypeIdentifierToFactoryMap but as the null does not
cause the content-type for my URI to be computed the correct
ResourceFactory is not looked up but I run into the fallback
Resource.Factory.Registry.DEFAULT_EXTENSION with returns the
deault XMI Resource Factory.</p>
<p class="p14"><br>
</p>
<p class="p13">What should I change so that my URI is mapped to
the correct ResourceFactory?</p>
<p class="p14"><br>
</p>
<p class="p13">Or is it a bug? And if so: of EMF or of QVTo?</p>
<p class="p14"><br>
</p>
<p class="p13">Thanks in advance,</p>
<p class="p14"><br>
</p>
<p class="p13">Uwe</p>
<p class="p15"><br>
</p>
</blockquote>
<br>
</blockquote>
<br>
<br>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO/Dawn] Deadlock on accessing CDOView
Next Topic:[CDO] setting a reference feature unique not allowed while advised in performance tip
Goto Forum:
  


Current Time: Thu Mar 28 07:57:29 GMT 2024

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

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

Back to the top