cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Fagnani <just...@fagnani.com>
Subject Re: 'Hello World' for Cocoon component builders?
Date Mon, 17 Oct 2005 02:22:06 GMT
I haven't done this in quite a while, but I'm pretty sure you need to  
add a role for your class in user.roles

-Justin

On Oct 16, 2005, at 7:15 PM, David Legg wrote:

> 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">
> </component>
>
> 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.
>
> Regards,
> David Legg.
>
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message