cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Legg" <>
Subject 'Hello World' for Cocoon component builders?
Date Mon, 17 Oct 2005 02:15:14 GMT
I'm exhausted!  I've spent the last week wading through terse web pages and 
trying everything I can think of with little to show for it.

All I want to do is create a component that gets configured with parameters 
from cocoon.xconf and initialized at startup.  The trouble is I seem to have 
fallen into a maze of twisting passageways!  I can't find any native Cocoon 
component tutorial so I'm having to pick my way through obsolete Avalon, 
Pico, YAAFI stuff and it's doing my head in!

In theory I love the idea of component management.  In practice I'm finding 
the entry price is too high.

So... can anyone point me to somewhere that explains in simple terms how to 
create and add a Cocoon component?

I've tried creating a simple class which extends AbstractLogEnabled and 
implements Initializable but I think I must be doing something wrong in the 
cocoon.xconf file because try as I might the initialize() method is never 
being called.

Here's an extract of my component class: -

public class MyComponent extends AbstractLogEnabled implements Initializable 
    public MyComponent() {
        getLogger().debug("HELLO WORLD - Constructor has been called");
        throw new Exception("This is a test within constructor");
    public void initialize() throws Exception {
        getLogger().debug("HELLO WORLD - initialize has been called");
        throw new Exception("This is a test within initialize");

and here's what I've put in cocoon.xconf: -

<component class="com.test.MyComponent" logger="core.startup">
  <parameter name="my-path" value="/a/path/to/somewhere">

I never see either of the exceptions triggered or the strings appearing in 
any log file.  I am assuming that for this simple class I don't need to 
define a role?

Any advice would be appreciated.

David Legg.

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

View raw message