cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Ratcliffe" <>
Subject RE: Using Cocoon's build system for my webappThanks Ada,
Date Fri, 14 Jan 2005 03:56:17 GMT
Hi Justin

Your component doesn't need to be a singleton, unless you want it to be, in
case it should implement the Avalon
org.apache.avalon.framework.thread.ThreadSafe interface.

My understanding is that the container (ECM) pools component instances, with
the pool
parameters configurable in cocoon.xconf. Maybe someone who is more familiar
with Cocoon
internals can give you some more pointers on pool configuration, to date I
haven't had any
problems with running with the system defaults.

The example I gave of looking up a component was using the flowscript
syntax. If you haven't
already read about flow it fulfils the controller role in cocoon MVC
applications, see The sitemap matches
URIs to top-level
functions in the flow layer which in turn typically delegate business
functions to Java objects.

If you wanted to lookup your Avalon component from another component such as
a customer generator
you would use this syntax:

MyComponent comp =

In this example your sitemap component would need to implement the
interface so that it would be provided with a reference to the
ServiceManager when it was

As you may know the Avalon project has been closed, I believe some of the
docs have since been posted
to the Apache Excalibur site.


-----Original Message-----
From: Justin Fagnani []
Sent: Friday, 8 July 2005 2:36 a.m.
Subject: Re: Using Cocoon's build system for my webappThanks Ada,

Thanks Adam,

You answered most of my questions.

The only thing left (assuming I understand the wiki docs) is that the
component I'm setting up need to be a singleton instantiated when Cocoon

I remember using a ComponentManager to get my components. I didn't use XSP
much though, so I'm wondering if this:

> var myComp = cocoon.getComponent(;

Is how I would do it inside a Generator, or if that's maybe XSP specific. Is
the cocoon object now passed to pipeline components through the objectModel?

Also, I need to make sure that the instance I get is the same that was
at launch time. This is setup in the sitemap, right?

Ahh, knockin the rust off.

Thanks again,

On Thursday 13 January 2005 19:05, Adam Ratcliffe wrote:
> Hi Justin
> The Cocoon wiki has some good resources on tailoring the Cocoon webapp and
> developing your project
> against it, see
> and
> The first doc has a link to an Ant build script that will help with
> up a directory structure
> that decouples your project's resources from the cocoon source tree, and
> targets for patching the
> cocoon configuration files with your project's specific configuration.
> I've successfully used this approach to upgrade a webapp from the 2.1.5 to
> 2.1.6 release.
> If you're already familiar with developing Avalon components for Cocoon
> deploying them is
> not too difficult.  Briefly:
> - Create your component roles file e.g.
> <role-list>
>   <role name="com.example.MyComponent"
> 	shorthand="myComp"
> 	default-class="com.example.MyComponent"/>
> ...
> </role-list>
> - Register these with Cocoon by adding a 'user-roles' attribute to the
> element in cocoon.xconf
> <cocoon user-roles="my.roles">
> - The component's lifecycle methods will be invoked when you
> the component, for example
> in flowscript:
> var myComp = cocoon.getComponent(;
> Adam
> -----Original Message-----
> From: Justin Fagnani []
> Sent: Friday, 8 July 2005 1:33 a.m.
> To:
> Subject: Using Cocoon's build system for my webapp
> Hello Cocoon'ers,
> It's been a long while since I've done any Cocoon work. I've been playing
> with
> the new (to me) build system and so far I like it. I've been able to
> pair down the build with the local blocks and build properties.
> Now I want to start setting up the sitemap and writing some custom
> components.
> I'd like to use the current build system but I'm getting some errors.
> it's not the right way to do it, but so far I haven't seen any
> documentation on what the suggested build setup is.
> First I figured I'd edit the sitemap in src/webapp. I removed some
> matchers and quickly got errors with confpatch, specifically mount-table.
> added back the api section to the sitemap just to get going, but I wonder
> what the correct solution is.
> Should I create my own target xml file? Should I remove mount-table.xmap
> from
> src/confpatch ?
> My second issue has to do with components. I want to wrap an object as an
> Avalon component and have it instantiated when Cocoon is launched. Before
> did this with a user.roles file and editing cocoon.xconf. I went to the
> documentation to make sure I remembered how to do it, but I couldn't find
> much, just one reference to creating a my.roles file. To use the build
> system
> would I just put my.roles in the src/webapp/WEB-INF directory?
> My big concern is that it'll be difficult to upgrade when a new version of
> Cocoon comes out. On the other hand I've created a nice minimal Cocoon
> setup,
> but I might need more blocks later. I like the idea of being able to edit
> and get the blocks I need, and then rebuild my
> whole webapp.
> Any suggestions or advice would be greatly appreciated.
> Thanks,
>   Justin
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

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

View raw message