[extension to] DirectoryGenerator [...]
That's interesting. I guess, however, than that the best solution would be patching the real DirectoryGenerator (in doing so please sync the *TraversableGenerator in scratchpad too).
OK, but where should I post the patch?

another question: I separated the real directory-scanner from the
generator code. in what package should I put this helper-classes?


=======================
[...] PipelineDirectoryGenerator [...]
Delegating the inclusion to another pipeline looks pretty neat and definitely useful, but I don't feel like this should be the job of a monolithic generator. How about turning that part into a transformer who reads the DG/TG output and does exactly what you're planning?
I thougt of it, but this approach leads to the current design (I think):
a special directory-scanner for XML files,
a special directory-scanner for HTML files,
a special directory-scanner for Image files
etc...
and the merge the output via aggregation and apply a advanced stylesheet...


or in addition to the XIncludeTransformer a HTMLIncludeTransformer, a ImagePropertyIncludeTransformer a XXXIncludeTransformer.

and the switching between the different files must
also be done in the transformers.

the current design:

<map:pipeline>
    <map:generate type="pipeline-directory" src=".">
        <map:parameter name="include" value="\.(xml|html|jpg|gif|png)$" />
        <map:parameter name="contentPipeline" value="cocoon:/content-pipeline" />
    </map:generate>

    <map:serialize type="xml"/>
</map:pipeline>


<map:pipeline internal-only="true"> <map:match pattern="content-pipeline**">

        <map:match pattern="content-pipeline/**other**.xml">
            <map:generate src="{1}other{2}.xml"/>
            <map:transform src="extractOtherTitles.xsl"/>
            <map:serialize type="xml"/>
        </map:match>

        <map:match pattern="content-pipeline/**.xml">
            <map:generate src="{1}.xml"/>
            <map:transform src="extractTitles.xsl"/>
            <map:serialize type="xml"/>
        </map:match>

        <map:match pattern="content-pipeline/**.html">
            <map:generate type="html" src="{1}.html"/>
            <map:transform src="extractTitles.xsl"/>
            <map:serialize type="xml"/>
        </map:match>

        <map:match pattern="content-pipeline/**">
            <map:generate type="fileinfo" src="{1}"/>
            <map:serialize type="xml"/>
        </map:match>
    </map:match>
</map:pipeline>



would then look like this (?)

<map:pipeline>
        <map:generate type="directory" src=".">
                <map:parameter name="include" value="\.(xml|html|jpg|gif|png)$" />

                <map:parameter name="mime-type-match:text/xml"       value="\.xml$" />
                <map:parameter name="mime-type-match:text/xml/other" 
value=".*other.*\.xml$" />
                <map:parameter name="mime-type-match:text/html"      value="\.html$" />
                <map:parameter name="mime-type-match:image"          
value="\.(jpg|gif|png)$ />
        </map:generate>

<map:transform src="prepareIncludeTransformers.xsl"/>

        <map:transform type="xinclude"/>
        <map:transform type="htmlinclude"/>
        <map:transform type="imageinfoinclude"/>

        <map:transform src="extractTitlesAndFileInfo.xsl"/>
        
        <map:serialize type="xml"/>
</map:pipeline>


the advantage of the second approach is, that all is together in one pipe.

the disadvantage is, that for all generators we need a
equivalent transformer.


best regards, alfred







Reply via email to