Carsten Ziegeler wrote:
If all existing Serializers extend AbstractSerializer then you could make the Serializer interface implement the SitemapModelComponent and simply add an empty setup method to the AbstractSerializer.Paul Duffin wrote:Yes, this discussion was held several times - now, if you can come upWhy is the Serializer not an instance of SitemapModelComponent when both generators and transformations are ? <snip/> The following link shows a discussion which took place in April this year which seemed to indicate that this was going to be changed but unfortunately it does not seem to have changed at all. http://www.mail-archive.com/cocoon-dev@xml.apache.org/msg14047.html
with a solution which is compatible, which means that this solution does not break already existing serializers.
If only binary compatability is required then the code which calls the setup method could catch NoSuchMethodError.
If source compatability is also required then you could create a SerializerSitemapModelComponent interface which extends Serializer and implements SitemapModelComponent. The code which initializes the Serializer in AbstractStreamPipeline would check before it casted the Serializer to a SitemapModelComponent and called the setup method.
If you do not want to create the SerializerSitemapModelComponent interface (which thinking about it is probably a bad idea) you could just document that if a Serializer implements SitemapModelComponent then its setup method will be called. You could also say that in future the Serializer interface will be extended to implement the SitemapModelComponent and anyone writing their own Serializer which does not extend AbstractSerializer would then have the time to implement the interface and provide a dummy setup method. They could do this immediately without breaking backwards compatability.
The AbstractSerializer class should in any case be modified to implement SitemapModelComponent and implement a dummy setup method.
Eventually the Serializer interface could be modified and the extra checks removed from the AbstractStreamPipeline.
I have only spent less than a day looking at the code so there may be all sorts of implications which I have not considered but based on what I know the above seems like a workable solution.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]