Daniel Fagerstrom wrote:

I have continued Vadim's and Sylvain's work and added a first, hopefully working version of virtual sitemap components (VPCs) to the trunk.


Good job!

Use
===

To use VPCs one define them in the components section in the sitemap, e.g.:

<map:components>
<map:readers>
<map:reader name="virtual1" src="org.apache.cocoon.reading.VirtualPipelineReader">
<map:generate type="file" src="vpc-test.xml"/>
<map:serialize type="xml"/>
</map:reader>
</map:readers>


<map:transformers default="xslt">
<map:transformer name="virtual2" src="org.apache.cocoon.transformation.VirtualPipelineTransformer">
<map:source param="src2"/>
<map:transform src="vpc-include.xsl">
<map:parameter name="file" value="{src}"/>
</map:transform>
<map:transform src="vpc-include.xsl">
<map:parameter name="file" value="{src2}"/>
</map:transform>
</map:transformer>
</map:transformers>
</map:components>


It seems weird to me to see sitemap statements in the <map:components> section. But they're also used as any other component. Hmm...

What about either:
- leave them in <map:components> but with special element names, e.g. <map:virtual-generator> that maps to the VirtualPipelineGenerator class
- or separate them in a <map:virtual-components> section just as we have today <map:resources> and <map:views>?


I would favor the second solution, even if this doesn't seem to be absolutely necessary for the implementation.

then they can be used as any component:

  <map:read type="virtual1"/>

  <map:transform type="virtual2" src="vpc-test.xml">
    <map:parameter name="src2" value="vpc-test2.xml"/>
  </map:transform>

in the sitemap where they are defined and in all its subsitemaps.

One of the complicated things with VPCs was how and where to resolve sources that are given to VPCs. I followed Sylvain's aproach in http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=110064557022481&w=2 modified with my ideas (http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=110539791029866&w=2) about how to increase the level of isolation between the caller and the callee. This will be needed when we use them from "real" blocks.

To use a source as a parameter one have to declare it with

  <map:source param="src2"/>

in the definition. The "src" is always supposed to be a source. Sources are alwas resolved in the calling sitemap.

                --- o0o ---

More examples of use can be found in the sitemaps for the test cases in src/test/org/apache/cocoon/[generation|transformation|serialization|reading].


I didn't research old mails about VPCs about what things are supposed to be called. So suggestions about better names and syntax are welcome.


Looks good so far except the location of VPCs definition (see above).

VPCs are not cacheable yet. Its probably not that hard to add caching, but it requires that we extend the ProcessingPipeline interface with some methods that are needed for VPCs. It also requires that we find some syntax for declaring what pipeline type that should be used for a specific VPC.


Why do we have to choose a particular pipeline type? Isn't this defined by the <map:pipeline type=""> surrounding the call to the VPC?

Implementation


<snip/>

Sorry, not much time to dig into the implementation for now, but I will :-)

Sylvain

--
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director



Reply via email to