Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 51536 invoked by uid 500); 22 Dec 2001 17:58:21 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 51258 invoked from network); 22 Dec 2001 17:58:19 -0000 Date: Sat, 22 Dec 2001 17:21:16 +0100 (CET) From: giacomo X-X-Sender: To: Subject: RE: How do I add objects to the objectModel Map In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Fri, 21 Dec 2001, Michael McKibben wrote: > The action approach is the easiest way to add custom objects to the cocoon > object model (at least that I know of, perhaps there is a better way?) I wouldn't propose to use the objectModel as a container for business objects. The fact is it should be a read-only object where one finds the important object of the environment Cocoon is running in. Instead I'd use the Request, Session and Context objects to put your BOs in depending on the scope you need (normal Servlet programming approach). Giacomo > I > don't think that this adds any significant overhead to the request since > actions are thread safe and can be pooled (now if your action has to do a > lot of work to create the business object-- e.g. calling a database-- > then this could add to the overall response time.) > > Regards, > > --mike > > On Fri, 21 Dec 2001 david.greaves@idl-bt.com wrote: > > > Thanks - I've been discussing this on the user list too. > > > > what I want to do is instantiate myBusinessObject and place it into the > > objectModel so I can do exactly that (except you do it in the pipeline not > > the section unless I'm mistaken :) > > > > Why? > > I would like to create an object that provides metadata about the site > > structure that can be accessed by various Velocity or JSP (or whatever) > > components. This (these) may also provide interfaces to other business > > logic. > > > > The sensible place seems to be the objectModel. > > > > David Rosenstrauch suggested I use actions to populate the Map. > > This seems good and we now have a custom action that simply adds a component > > to the map where Velocity can be confgigured to look for it. > > > > However, this requires we stick an action in every ; I'm still > > looking for a place to ensure that the objectModel is updated for *every* > > request. > > > > One approach that may work is to have a pattern that matches every request > > and simply calls an action that modifies the objectModel and returns null. > > But that sounds like it could be inefficient. > > > > David > > > > > > > -----Original Message----- > > > From: Michael McKibben [mailto:mmckibben@ncube.com] > > > Sent: 21 December 2001 18:28 > > > To: cocoon-dev > > > Subject: Re: How do I add objects to the objectModel Map > > > > > > > > > > > > This feature is for exporting objects already in the Cocoon object map > > > to > > > the Velocity template context. So they must already exist. > > > But let's say > > > you knew that, then in your sitemap, here is how you would make some > > > object named "myBusinessObject" in the cocoon object map available to > > > your > > > velocity template as "$myBusinessObject": > > > > > > (in your sitemap.xmap) > > > > > > ... > > > > > src="org.apache.cocoon.generation.VelocityGenerator" pool-max="32" > > > pool-min="16" pool-grow="4"> > > > > > > > > > ... > > > > > > > > > Hope this helps! > > > > > > --mike > > > > > > On Tue, 18 Dec 2001 david.greaves@idl-bt.com wrote: > > > > > > > Hi > > > > > > > > I hope this is straightforward... > > > > > > > > How do I add objects to the objectModel Map? > > > > > > > > > > > http://xml.apache.org/cocoon/userdocs/generators/velocity-gene > > rator.html > > > says: > > > > > (optional; > > > 0..n) - Export the object specified by key from the Cocoon object map > > to the > > > Velocity context of the template. The object can be accessed from the > > > template as name. Be careful to use a valid VTL variable name. > > > > > > I've looked through the code but can't figure this one out. > > > > > > David > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org > > > For additional commands, email: cocoon-dev-help@xml.apache.org > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org > > For additional commands, email: cocoon-dev-help@xml.apache.org > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org > > For additional commands, email: cocoon-dev-help@xml.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org > For additional commands, email: cocoon-dev-help@xml.apache.org > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org