|
|
|
|
|
Re: ResourceImpl and delegation to XMIResourceImpl [message #502779 is a reply to message #502763] |
Wed, 09 December 2009 16:46 |
Gregoire Cacheux Messages: 9 Registered: July 2009 |
Junior Member |
|
|
Ed Merks wrote on Wed, 09 December 2009 11:10 | Gregoire,
Comments below.
Gregoire Cacheux wrote:
> I have a CustomResource that extends ResourceImpl.
>
> Let's say I want to serialize both in xmi and in binary format. I can
> not extend XMIResourceImpl and BinaryResourceImpl.
Is that the real example? BinaryResourceImpl has easily reusable parts
whereas XMIResourceImpl is pretty tightly integrated with various
classes like XMISaveImpl and XMIHandler so best to extend
XMIResourceImpl and reuse the parts of BinaryResourceImpl.
>
Yes it is close to the real example. I would like to have a zip archive that can contain xmi and binary, along with other non strictly emf based info.I think need more control on the zip format that what the XMIResourceImpl gives , but i am going to have a second look at it.
> As inheritance can not work, i want to use composition and delegate at
> runtime the save and load operations to an instance of the right
> resource.
>
> I managed to cheat the inner resource by routing calls to the
> CustomResource.
>
> It is working well up to the point where XMIResourceImpl is cheking if
> a reference is cross document or not. There, the XMLSaveImpl is using
> == (identity) to check if the resource of the target object
> (CustomResource) is the current resource (XMIResource).
>
> Is there a way to delegate that check so that i can re-use the
> XMIResourceImpl implementation while having my own Resource
> Implementation.
Delegation involves specializing the class, and the classes that create
it, and then overriding the method to behave differently. There's no
special EMF magic I can offer.
>
> I can try overloading XMISaveImpl ... but then i wonder what is going
> to be next hurdle. Thus the more generic question about Resource
> extensibility. It looks like existing Resource (XML or XMI) are to be
> extended through inheritance more than through composition/delegation.
Yes, composition was not a design goal.
|
|
|
|
Re: ResourceImpl and delegation to XMIResourceImpl [message #502812 is a reply to message #502779] |
Wed, 09 December 2009 18:56 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Gregoire,
Comments below.
Gregoire Cacheux wrote:
> Ed Merks wrote on Wed, 09 December 2009 11:10
>> Gregoire,
>>
>> Comments below.
>>
>> Gregoire Cacheux wrote:
>> > I have a CustomResource that extends ResourceImpl.
>> >
>> > Let's say I want to serialize both in xmi and in binary format. I
>> can > not extend XMIResourceImpl and BinaryResourceImpl.
>> Is that the real example? BinaryResourceImpl has easily reusable
>> parts whereas XMIResourceImpl is pretty tightly integrated with
>> various classes like XMISaveImpl and XMIHandler so best to extend
>> XMIResourceImpl and reuse the parts of BinaryResourceImpl.
>> >
>>
>> Yes it is close to the real example. I would like to have a zip
>> archive that can contain xmi and binary, along with other non
>> strictly emf based info.I think need more control on the zip format
>> that what the XMIResourceImpl gives , but i am going to have a second
>> look at it.
Note that you can use URIs to access parts of a zip, e.g.,
archive:platform:/resource/project/file.zip!/path/file.exten sion
>>
>> > As inheritance can not work, i want to use composition and delegate
>> at > runtime the save and load operations to an instance of the right
>> > resource.
>> >
>> > I managed to cheat the inner resource by routing calls to the >
>> CustomResource.
>> >
>> > It is working well up to the point where XMIResourceImpl is cheking
>> if > a reference is cross document or not. There, the XMLSaveImpl is
>> using > == (identity) to check if the resource of the target object >
>> (CustomResource) is the current resource (XMIResource).
>> >
>> > Is there a way to delegate that check so that i can re-use the >
>> XMIResourceImpl implementation while having my own Resource >
>> Implementation.
>> Delegation involves specializing the class, and the classes that
>> create it, and then overriding the method to behave differently.
>> There's no special EMF magic I can offer.
>> >
>> > I can try overloading XMISaveImpl ... but then i wonder what is
>> going > to be next hurdle. Thus the more generic question about
>> Resource > extensibility. It looks like existing Resource (XML or
>> XMI) are to be > extended through inheritance more than through
>> composition/delegation.
>> Yes, composition was not a design goal.
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.06155 seconds