Re: Registering a resource factory on a file name [message #399092] |
Mon, 06 March 2006 18:09  |
Eclipse User |
|
|
|
I dredged this up from the depths (dated Tue, 13 Apr 2004):
> Stefan,
>
> We may consider adding support for this to Resource.Factory.Registry in the
> future. For now you can override ResourceFactoryRegistryImpl.getFactory() to
> detect this case.
>
>
> Stefan wrote:
>
> > Hi,
> >
> > I'd like to use my own resource / resource factory implementation for
> > ejb-jar.xml files. Of course I don't want to register the factory on the
> > ".xml" file extension, and I also don't want to invent my own URI protocol
> > for this, but use standard 'file:' URIs. Is it possible to register a
> > factory on a complete file name instead, i.e. "ejb-jar.xml" ? Which EMF
> > class would I need to subclass for accomplishing this?
> >
> > bye,
> > Stefan
I have the exact same question. I want to do this for my particular
foo.xml file, but I don't want to register the factory on the entire
".xml" extension. Is there now extended support for this?
- Paul
|
|
|
Re: Registering a resource factory on a file name [message #399096 is a reply to message #399092] |
Tue, 07 March 2006 07:01   |
Eclipse User |
|
|
|
Paul,
You can register a factory for *.xml by extending the existing
XMLResourceFactoryImpl and overriding createResource to do something
special for certain special files and call super for the rest.
Paul Fullbright wrote:
> I dredged this up from the depths (dated Tue, 13 Apr 2004):
>
>> Stefan,
>>
>> We may consider adding support for this to Resource.Factory.Registry
>> in the
>> future. For now you can override
>> ResourceFactoryRegistryImpl.getFactory() to
>> detect this case.
>>
>>
>> Stefan wrote:
>>
>> > Hi,
>> >
>> > I'd like to use my own resource / resource factory implementation for
>> > ejb-jar.xml files. Of course I don't want to register the factory
>> on the
>> > ".xml" file extension, and I also don't want to invent my own URI
>> protocol
>> > for this, but use standard 'file:' URIs. Is it possible to register a
>> > factory on a complete file name instead, i.e. "ejb-jar.xml" ? Which
>> EMF
>> > class would I need to subclass for accomplishing this?
>> >
>> > bye,
>> > Stefan
>
> I have the exact same question. I want to do this for my particular
> foo.xml file, but I don't want to register the factory on the entire
> ".xml" extension. Is there now extended support for this?
>
> - Paul
>
|
|
|
|
Re: Registering a resource factory on a file name [message #399423 is a reply to message #399422] |
Thu, 16 March 2006 15:42   |
Eclipse User |
|
|
|
Paul,
You'd register it only local to your resource set where you have
complete control, not in the global registry that effects everyone,
which would be very rude indeed!
Paul Fullbright wrote:
> Ed Merks wrote:
>
>> Paul,
>
>> You can register a factory for *.xml by extending the existing
>> XMLResourceFactoryImpl and overriding createResource to do something
>> special for certain special files and call super for the rest.
>
> Hi Ed,
>
> Isn't that a bit impolite? How about the others out there using the
> .xml extension? Won't I potentially be replacing somebody else's use
> of an extension of XMLResourceFactoryImpl?
>
> For instance, if somebody is trying to do something similar for
> foo.xml, and they implement FooXMLResourceFactoryImpl, which they then
> register to the *.xml extension, which factory would be retrieved in
> the lookup for an *.xml file? Theirs or mine?
>
> - Paul
>
|
|
|
|
Re: Registering a resource factory on a file name [message #1069711 is a reply to message #1069701] |
Tue, 16 July 2013 08:43  |
Eclipse User |
|
|
|
Am 16.07.2013 14:24, schrieb Wladimir Safonov:
> Hi Ed,
>
> I ran now into the same situation where support of file name matching for resource factories lookup is needed. I
> cannot simply use my local resource set for registering "xml" extension factory, because we have several *.xml files
> containing models of different types, which all need to be loaded into the same resource set. So I am looking now at
> the possibility of implementing another extension point which would provide support for configuring resource factory
> using file name patterns and hook it into the ResourceFactoryRegistryImpl.getFactory() method.
>
> Is there something similar planned in EMF for the future? Or is there meanwhile a better way to solve the problem? Of
> course, name patterns can still lead to overlapping, but this is a trade-off for giving more flexibility to the user.
> I can imagine that the resource factory registration based on name patterns can replace those based on file extensions
> and make the corresponding extension point obsolete after a while.
This thread might be interesting for you: http://www.eclipsezone.com/eclipse/forums/t107605.html
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.04742 seconds