maven-doxia-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juan F. Codagnone (JIRA)" <>
Subject [jira] Resolved: (DOXIA-27) sink validation (sink advisor)
Date Sun, 11 Dec 2005 17:26:47 GMT
     [ ]
Juan F. Codagnone resolved DOXIA-27:

     Resolution: Fixed
    Fix Version: 1.0-alpha-6

Jason commited the files in revision 349241, so i consider that it has been fixed. (the only
things missings are the two unit tests).

> sink validation (sink advisor)
> ------------------------------
>          Key: DOXIA-27
>          URL:
>      Project: doxia
>         Type: Improvement

>     Reporter: Juan F. Codagnone
>      Fix For: 1.0-alpha-6
>  Attachments: DOXIA-27.tar.gz
> Hi,
>  in the past day i've been writting a twiki parser for doxia. It isn't done 
> yet, but i started to convert some text using existing Sinks, and while doing 
> that i've found some problems:
>   None of the sinks tries to validates a correct usage. For example in most of 
> sinks,
>       sink.list();
>       sint.listItem_();
> would generate an invalid output, and you don't find that until you process 
> the output. I found this a bit fragile.
> To solve it, i've created an AdvicedSink class that is a proxy implementation 
> of a Sink, where you can inject some Advisors to do some crosscutting 
> validations. The advisors are like AOP and you only must implement one method 
> instead of the 89 of the Sink.
> I've implemented two advisors: one that prints the the sink calls with 
> indentation:
>         head
>         head_
>         body
>            section1
>               sectionTitle
>                  text
>         ...
> usefull for debuging, and one that throws a runtime exception if the closing 
> element doesn't match with the starting, in cases like:
>       sink.list();
>       sint.listItem_();
> In the future i would like to see an advisor that check in a fine grain the 
> sink events. For example in the XdocSink if i do
>       sink.listItem();
>       sink.text("foo");
>       sink.listItem_();
> wrong code is generated, and i must do:
>       sink.listItem();
>       sink.paragraph();
>       sink.text("foo");
>       sink._paragraph();
>       sink.listItem_();
> to get the correct content. And state machine advisor would only allow to call 
> paragraph item a listitem and that would be reusable for all the sinks.
> Example of use:
>      final Sink sink = new AdvicedSink(new MethodBeforeAdvice[] {
>                 new PrintAdvisor(System.out),
>                 new HangingElementAdvice(),
>      }, new XdocSink(writer));
> I hope you found it usefull as i do. 
> Regards,
>     Juan.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message