At 10:15 PM 12/20/01 +0000, you wrote:
>I only want to instantiate my menu/arealogic class once so, no, not a
>generator/transformer; more *like* a generator/transformer, ie at the same
>time as the <map:generators> section.
>kinda like:
><map:objectModel>
>   <map:object name="menu" src="com.dgreaves.apache.cocoon.ext.Menu"
>method="newfromfile" data="/areamap.xml" poolsize="10"/>
><map:objectModel>
>
>
> > I suppose if you wanted to, though, you could add an object 
> > of your own to the object map (see the generator code above; 
> > you could do this in an action too), and then have that 
> > object get copied over to velocity using the "export-object" parm.
>exactly...
>You mentioned actions ... I've not really looked at them yet - do you think
>that would be fruitful?


Yes.  Given what you've described, it sounds like an action would definitely be the 
way to go.  Actions are perfect for just performing little bits of code (such as 
popping a business object into the object model I would guess, though I've never tried 
it personally) right in the middle of your pipeline.

Take a look at this piece from my sitemap:

<map:match pattern="pd/mergedoc.html">
         <map:generate src="cocoon:/rtf_parse"/>

         <map:transform src="cocoon:/rtf_merge_data"/>

         <map:act type="set_download"/>

         <map:serialize type="rtf"/>
</map:match>


The "set_download" action that I'm calling is really small.  All it does is set a 
response header so that a download gets triggered in the browser.

You should be able to do the same really easily with an action of your own.  Actions 
are really simple.  All you have to do is just fill in one method:

         public Map
         act(    Redirector  redirector, 
                         SourceResolver  resolver, 
                         Map  objectModel, 
                         String  source, 
                         Parameters  params)
         throws ProcessingException;


HTH.  Email back if you need more info.


DR


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to