jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Maven Doxia
  • Maven Doxia
  • DOXIA-387

Add RandomAccessSink

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.1.2
  • Fix Version/s: 1.3
  • Component/s: Core
  • Labels:
    None
  • Number of attachments :
    3

Description

In some cases components have to write to different parts of a page. With the current implementation you can only keep appending the page.
I've attached a new class, with which it should be possible to add subsinks to which you can write at any time.

Code might look like this

baseSink.text("Hello World");
Sink top = baseSink.addSink();
baseSink.horizontalRule();
Sink content = baseSink.addSink();
baseSink.text("So long, farewell");

After flushing the basesink, subsinks will flush to the basesink.
Closing the basesink will close al subsinks as well.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    DOXIA-387.patch
    06/May/10 3:24 PM
    24 kB
    Robert Scholte
  2. Text File
    DOXIA-387.patch
    28/Apr/10 6:12 AM
    19 kB
    Robert Scholte
  3. Text File
    randomaccesssink.patch
    21/Apr/10 4:06 PM
    15 kB
    Robert Scholte

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Robert Scholte added a comment - 26/Apr/10 4:19 PM

Hmm, tried to write some tests, where I'd like to use the SinkAdapter. But that class seems to be part of the doxia-core, so that would result in a circular dependency. The RandomAccessSink itself only uses Sink and SinkFactory, no specific implementation so the Sink API looked like a valid location. Should I move this patch or just use an anonymous implementation classes for the tests?

Show
Robert Scholte added a comment - 26/Apr/10 4:19 PM Hmm, tried to write some tests, where I'd like to use the SinkAdapter. But that class seems to be part of the doxia-core, so that would result in a circular dependency. The RandomAccessSink itself only uses Sink and SinkFactory, no specific implementation so the Sink API looked like a valid location. Should I move this patch or just use an anonymous implementation classes for the tests?
Hide
Permalink
Lukas Theussl added a comment - 27/Apr/10 1:46 AM

Your sink is itself an implementation so it should go into core. A test case will help as I don't quite understand the use case (yet).

Show
Lukas Theussl added a comment - 27/Apr/10 1:46 AM Your sink is itself an implementation so it should go into core. A test case will help as I don't quite understand the use case (yet).
Hide
Permalink
Robert Scholte added a comment - 27/Apr/10 7:36 AM

I have to dive a bit more into this. It seems like a lot of files have been moved.
First let me explain it with a concrete example. Although I need this for the dashboard-m-p, for the explanation the surefire-report-m-p will work as well.
A surefire is divided into 3 sections: Summary, Package List and Test Cases. Every next section contains more detail than it's previous.
Since you can only build the page from start to end, you have to iterate over all entries once per section.
With the RandomAccessSink you only have to iterate once over these entries and directly write to it's specific sectionsink. Code would look like this:

//prepare RandomAccessSink structure
RandomAccessSink baseSink = new RandomAccessSink(); //some arguments required here, at least a SinkFactory
Sink summarySink = baseSink.addSink();
baseSink.horizontalRule(); // some divider-stuff
Sink packageListSink= baseSink.addSink();
baseSink.horizontalRule(); // some divider-stuff
Sink testCasesSink = baseSink.addSink();

//get packageList Iterator
while ( packageListIter.hasNext() )
{
  writePackageList(packageListSink, packageListIter.next()  )
  
  //get testCases Iterator
  while ( testCasesIter.hasNext() )
  {
    writeTestCases(testCasesSink , testCasesIter.next()  )
  }  
}
Show
Robert Scholte added a comment - 27/Apr/10 7:36 AM I have to dive a bit more into this. It seems like a lot of files have been moved. First let me explain it with a concrete example. Although I need this for the dashboard-m-p, for the explanation the surefire-report-m-p will work as well. A surefire is divided into 3 sections: Summary, Package List and Test Cases. Every next section contains more detail than it's previous. Since you can only build the page from start to end, you have to iterate over all entries once per section. With the RandomAccessSink you only have to iterate once over these entries and directly write to it's specific sectionsink. Code would look like this: //prepare RandomAccessSink structure RandomAccessSink baseSink = new RandomAccessSink(); //some arguments required here, at least a SinkFactory Sink summarySink = baseSink.addSink(); baseSink.horizontalRule(); // some divider-stuff Sink packageListSink= baseSink.addSink(); baseSink.horizontalRule(); // some divider-stuff Sink testCasesSink = baseSink.addSink(); //get packageList Iterator while ( packageListIter.hasNext() ) { writePackageList(packageListSink, packageListIter.next() ) //get testCases Iterator while ( testCasesIter.hasNext() ) { writeTestCases(testCasesSink , testCasesIter.next() ) } }
Hide
Permalink
Robert Scholte added a comment - 28/Apr/10 6:12 AM

Moved RandomAccessSink to doxia-core and added two tests. If you want to use this with the AbstractMavenReport, it could to nice to be able to get a reference to the SinkFactory next to the getSink()

Show
Robert Scholte added a comment - 28/Apr/10 6:12 AM Moved RandomAccessSink to doxia-core and added two tests. If you want to use this with the AbstractMavenReport, it could to nice to be able to get a reference to the SinkFactory next to the getSink()
Hide
Permalink
Lukas Theussl added a comment - 06/May/10 6:46 AM

As a new feature, schedule for a minor release. A minor note: please add license header and javadocs to any future patches, see http://maven.apache.org/developers/conventions/code.html.

Show
Lukas Theussl added a comment - 06/May/10 6:46 AM As a new feature, schedule for a minor release. A minor note: please add license header and javadocs to any future patches, see http://maven.apache.org/developers/conventions/code.html .
Hide
Permalink
Robert Scholte added a comment - 06/May/10 3:24 PM

You're absolutely right. It's just not in my system yet, but it's getting better day by day . Here's a new patch.

Show
Robert Scholte added a comment - 06/May/10 3:24 PM You're absolutely right. It's just not in my system yet, but it's getting better day by day . Here's a new patch.
Hide
Permalink
Robert Scholte added a comment - 07/Jan/12 7:52 AM

Fixed in rev. 1228615

Show
Robert Scholte added a comment - 07/Jan/12 7:52 AM Fixed in rev. 1228615

People

  • Assignee:
    Robert Scholte
    Reporter:
    Robert Scholte
Vote (0)
Watch (0)

Dates

  • Created:
    21/Apr/10 4:06 PM
    Updated:
    07/Jan/12 8:00 AM
    Resolved:
    07/Jan/12 7:52 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.