cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Rosenstrauch <>
Subject RE: How do I add objects to the objectModel Map
Date Thu, 20 Dec 2001 22:50:22 GMT
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:object name="menu" src="com.dgreaves.apache.cocoon.ext.Menu"
>method="newfromfile" data="/areamap.xml" poolsize="10"/>
> > 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.
>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"/>

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.


Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message