cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <>
Subject Re: Cocoon Questions...
Date Mon, 31 Jan 2000 23:05:30 GMT
Mike Engelhart wrote:
> Ricky Szeto wrote:
> > Maybe I need to clarify my first question a bit...
> > I need to pass arguments to the producers only once regarding initialization
> > and configuration(ie where the properties file is, where a resource directory
> > is.. etc)
> > I would like to do it such that it is done automatically after the
> > instantiation of the Producer(before it begins service).
> >
> > As for the response obj, looks like I do more reading before I can decide
> > which is the best way to go...
> Sorry about that.  I misunderstood.  hmmm.... have your tried overriding
> init()? I"m not sure I understand where in the chain of events you need to
> initialize the Producer? I mean isn't it potentially created each time it is
> accessed, that is if it's not in the cache somewhere?  I don't really know

Make your producer implement Configurable.

Then write your configurations in such as = zzz


 xxx is the nickname of the producer (for example, "file")
 yyy is the property you want (for example, "binary")
 zzz is the value (for example. "false)



then in your code you write

 public void init(Configurations conf) {
   String binary = (String) conf.get("binary");

NOTE: Cocoon will take care of removing the front stuff from your
configuration keys, so that if you change the nickname of your producer,
your code doesn't change (separation of contexts all over the place :)

All the cocoon modules work that way.

Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<>                             Friedrich Nietzsche
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------

View raw message