Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 3889 invoked from network); 2 Aug 2005 19:44:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2005 19:44:09 -0000 Received: (qmail 18797 invoked by uid 500); 2 Aug 2005 19:44:02 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 18768 invoked by uid 500); 2 Aug 2005 19:44:02 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 18742 invoked by uid 99); 2 Aug 2005 19:44:02 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Aug 2005 12:44:02 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [209.73.178.196] (HELO web60613.mail.yahoo.com) (209.73.178.196) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 02 Aug 2005 12:43:52 -0700 Received: (qmail 94344 invoked by uid 60001); 2 Aug 2005 19:43:59 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=tPDFhgaOddnV4DYdz5lp0S2hu4lsUQUvjUErvsLL3SP6OdI6j6Y1FoJV+46hIiMhcHdwQlBuc71vBl969aNxHaEGj2O3hc83AJ8GXbjLIwslxu+UOtmo8M9Jjfwf0B41u/6QGMWXaZtvyIIxi7Y7pWJX2o2PtwIs0woJfyhadkI= ; Message-ID: <20050802194359.94342.qmail@web60613.mail.yahoo.com> Received: from [199.249.168.50] by web60613.mail.yahoo.com via HTTP; Tue, 02 Aug 2005 12:43:59 PDT Date: Tue, 2 Aug 2005 12:43:59 -0700 (PDT) From: footh Subject: Re: Accessing App Context from a CronJob To: users@cocoon.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N no problem, I spent many hours over the last week poring over documents and code to figure out something very similar. The least I could do was spare someone else the headache (although I did learn alot). --- Owen Tallman wrote: > Excellent! I don't know how long I would have had to > grope around to > figure that out. Thanks! > > For the record, here's a code snippet of the working > result, after > adding the Contextualizable interface: > > // org.apache.cocoon.environment.Context > (not Avalon context) > private Context cocoonContext = null; > > /** > * Let the container pass me the Avalon > context > */ > public void > contextualize(org.apache.avalon.framework.context.Context > context) { > > Map objectModel = > ContextHelper.getObjectModel(context); > this.cocoonContext = > ObjectModelHelper.getContext(objectModel); > logger.info("contextualize() > completed"); > } > > On 8/2/05, footh wrote: > > Try implementing the Contextualizable interface > which > > will give you the Avalon context. > > > > Then call the "getObjectModel" static method of > the > > ContextHelper class and pass in the Avalon > context. > > > > From there you can use your ObjectModelHelper, or > just > > retrieve the object returned in the Map that is > under > > the "context" key. > > > > --- Owen Tallman wrote: > > > > > Hello, > > > > > > From a CronJob componentI need to access our > > > ApplicationContext object > > > which gets initialized by a > ServletContextListener > > > before Cocoon > > > starts. If this were a sitemap component, it > would > > > have a setup method > > > that got called with an ObjectModel map, so I > could > > > call > > > > > > ObjectModelHelper.getContext(objectModel); > > > > > > The class I defined has this derivation: > > > > > > public class FakeJob extends ServiceableCronJob > > > implements > Configurable, > > > ConfigurableCronJob { ... > > > > > > > > > it has a setup() method which takes parameters > and > > > a map, but if I > > > don't initialize the job entry with them, they > don't > > > have any values. > > > How can I access the context from a component > like > > > this? > > > > > > Thanks in advance for any suggestions, > > > > > > Owen > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > > users-unsubscribe@cocoon.apache.org > > > For additional commands, e-mail: > > > users-help@cocoon.apache.org > > > > > > > > > > > > > > > > __________________________________ > > Yahoo! Mail for Mobile > > Take Yahoo! Mail with you! Check email on your > mobile phone. > > http://mobile.yahoo.com/learn/mail > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > users-unsubscribe@cocoon.apache.org > > For additional commands, e-mail: > users-help@cocoon.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: > users-help@cocoon.apache.org > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org