You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeff Turner <je...@apache.org> on 2003/03/19 15:26:38 UTC
Strengthening setup() contract
Hi,
Generator, Reader and Transformer all inherit from
SitemapModelComponent, which declares the setup() method:
public interface SitemapModelComponent extends Component {
/**
* Set the <code>SourceResolver</code>, objectModel
* <code>Map</code>, the source and sitemap <code>Parameters</code>
* used to process the request.
*/
void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
throws ProcessingException, SAXException, IOException;
}
If there's no objections, I would like to:
- assert in the Javadoc that 'src' will never be null
- modify AbstractProcessingPipeline to ensure this, and throw meaningful
exceptions otherwise.
Currently, leaving out the 'src' attribute causes a typically unhelpful
Cocoon error message:
java.net.MalformedURLException: Invalid System ID
Strengthening this contract should at least improve the error message.
--Jeff
Re: Strengthening setup() contract
Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Jeff Turner" <je...@apache.org>
> Hi,
>
> Generator, Reader and Transformer all inherit from
> SitemapModelComponent, which declares the setup() method:
>
> public interface SitemapModelComponent extends Component {
> /**
> * Set the <code>SourceResolver</code>, objectModel
> * <code>Map</code>, the source and sitemap <code>Parameters</code>
> * used to process the request.
> */
> void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
> throws ProcessingException, SAXException, IOException;
> }
>
> If there's no objections, I would like to:
> - assert in the Javadoc that 'src' will never be null
> - modify AbstractProcessingPipeline to ensure this, and throw meaningful
> exceptions otherwise.
E.g. I18nTransformer does not require 'src' attribute.
--
Konstantin
>
> Currently, leaving out the 'src' attribute causes a typically unhelpful
> Cocoon error message:
>
> java.net.MalformedURLException: Invalid System ID
>
> Strengthening this contract should at least improve the error message.
>
>
> --Jeff
>
>
Re: Strengthening setup() contract
Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Vadim Gritsenko wrote:
> Jeff Turner wrote:
>
>> Hi,
>>
>> Generator, Reader and Transformer all inherit from
>> SitemapModelComponent, which declares the setup() method:
>>
>> public interface SitemapModelComponent extends Component {
>> /**
>> * Set the <code>SourceResolver</code>, objectModel
>> * <code>Map</code>, the source and sitemap <code>Parameters</code>
>> * used to process the request.
>> */
>> void setup(SourceResolver resolver, Map objectModel, String src,
>> Parameters par)
>> throws ProcessingException, SAXException, IOException;
>> }
>>
>> If there's no objections, I would like to:
>> - assert in the Javadoc that 'src' will never be null
>>
>
> Some generators do not require src attribute.
Yep.
>> - modify AbstractProcessingPipeline to ensure this, and throw meaningful
>> exceptions otherwise.
>>
>> Currently, leaving out the 'src' attribute causes a typically unhelpful
>> Cocoon error message:
>>
>> java.net.MalformedURLException: Invalid System ID
>>
>
> May be add more helpful message to the AbstractGenerator /
> AbstractTransformer?
Nope, as we still don't know there if the "src" attribute will be of
real use. This is the job of each concrete implementation, or at least a
common superclass that actually does something with the "src".
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Re: Strengthening setup() contract
Posted by Jeff Turner <je...@apache.org>.
On Wed, Mar 19, 2003 at 04:40:20PM +0100, Sylvain Wallez wrote:
> Jeff Turner wrote:
>
> >At that level, there isn't enough info to provide a user-friendly error
> >message. I think the best solution is to add a check in the
> >treeprocessor's ReadNodeBuilder. I've now got it displaying:
> >
> > Reader at
> > file:/home/jeff/apache/xml/xml-forrest/build/webapp/sitemap.xmap:135:50
> > must have a 'src' attribute
> >
> >
>
> Same applies to readers : you may have some readers that don't need an
> 'src' attribute. Please, let this be handled by the components that
> actually require it.
Bugger ;P
Perhaps components should provide the container with a mini schema,
specifying what they expect from a Configuration object. Then the
container could validate the component's input, and generate meaningful
error messages.
I'll have a play and maybe follow up on avalon-dev.
thanks,
--Jeff
> Sylvain
>
Re: Strengthening setup() contract
Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Jeff Turner wrote:
>At that level, there isn't enough info to provide a user-friendly error
>message. I think the best solution is to add a check in the
>treeprocessor's ReadNodeBuilder. I've now got it displaying:
>
> Reader at
> file:/home/jeff/apache/xml/xml-forrest/build/webapp/sitemap.xmap:135:50
> must have a 'src' attribute
>
>
Same applies to readers : you may have some readers that don't need an
'src' attribute. Please, let this be handled by the components that
actually require it.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Re: Strengthening setup() contract
Posted by Jeff Turner <je...@apache.org>.
On Wed, Mar 19, 2003 at 09:29:05AM -0500, Vadim Gritsenko wrote:
> Jeff Turner wrote:
...
> > void setup(SourceResolver resolver, Map objectModel, String src,
> > Parameters par)
...
> >If there's no objections, I would like to:
> >- assert in the Javadoc that 'src' will never be null
> >
>
> Some generators do not require src attribute.
Ah yes.. just as well I asked ;)
> >- modify AbstractProcessingPipeline to ensure this, and throw meaningful
> > exceptions otherwise.
> >
> >Currently, leaving out the 'src' attribute causes a typically unhelpful
> >Cocoon error message:
> >
> >java.net.MalformedURLException: Invalid System ID
> >
>
> May be add more helpful message to the AbstractGenerator /
> AbstractTransformer?
At that level, there isn't enough info to provide a user-friendly error
message. I think the best solution is to add a check in the
treeprocessor's ReadNodeBuilder. I've now got it displaying:
Reader at
file:/home/jeff/apache/xml/xml-forrest/build/webapp/sitemap.xmap:135:50
must have a 'src' attribute
--Jeff
> Vadim
>
Re: Strengthening setup() contract
Posted by Vadim Gritsenko <va...@verizon.net>.
Jeff Turner wrote:
>Hi,
>
>Generator, Reader and Transformer all inherit from
>SitemapModelComponent, which declares the setup() method:
>
>public interface SitemapModelComponent extends Component {
> /**
> * Set the <code>SourceResolver</code>, objectModel
> * <code>Map</code>, the source and sitemap <code>Parameters</code>
> * used to process the request.
> */
> void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
> throws ProcessingException, SAXException, IOException;
>}
>
>If there's no objections, I would like to:
> - assert in the Javadoc that 'src' will never be null
>
Some generators do not require src attribute.
> - modify AbstractProcessingPipeline to ensure this, and throw meaningful
> exceptions otherwise.
>
>Currently, leaving out the 'src' attribute causes a typically unhelpful
>Cocoon error message:
>
>java.net.MalformedURLException: Invalid System ID
>
May be add more helpful message to the AbstractGenerator /
AbstractTransformer?
Vadim
>Strengthening this contract should at least improve the error message.
>
>
>--Jeff
>
Re: Strengthening setup() contract
Posted by Stefano Mazzocchi <st...@apache.org>.
Jeff Turner wrote:
> Hi,
>
> Generator, Reader and Transformer all inherit from
> SitemapModelComponent, which declares the setup() method:
>
> public interface SitemapModelComponent extends Component {
> /**
> * Set the <code>SourceResolver</code>, objectModel
> * <code>Map</code>, the source and sitemap <code>Parameters</code>
> * used to process the request.
> */
> void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
> throws ProcessingException, SAXException, IOException;
> }
>
> If there's no objections, I would like to:
> - assert in the Javadoc that 'src' will never be null
> - modify AbstractProcessingPipeline to ensure this, and throw meaningful
> exceptions otherwise.
+1000!
> Currently, leaving out the 'src' attribute causes a typically unhelpful
> Cocoon error message:
>
> java.net.MalformedURLException: Invalid System ID
>
> Strengthening this contract should at least improve the error message.
I love it.