You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ben Anderson <be...@gmail.com> on 2005/06/09 17:36:34 UTC
static method to get a component?
Hi,
I need to hit the database from outside of cocoon, but within the same
webapp. I would like to share the same datasource. My first thought
was to follow this example:
http://cocoon.apache.org/2.1/developing/datasources.html
which is to implement the Composable interface. However, I'm not sure
how to do this because I'll need a static hook somewhere to get my
object. Does anyone have any pointers for doing this?
Thanks,
Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: static method to get a component?
Posted by Irv Salisbury <ir...@gmail.com>.
If you want to share datasources, why not use a jndi type datasource
like those in jboss, tomcat, etc? Then you can simply do a jndi
lookup?
On 6/9/05, Berin Loritsch <bl...@d-haven.org> wrote:
> Ben Anderson wrote:
> > Hi,
> > I need to hit the database from outside of cocoon, but within the same
> > webapp. I would like to share the same datasource. My first thought
> > was to follow this example:
> > http://cocoon.apache.org/2.1/developing/datasources.html
> > which is to implement the Composable interface. However, I'm not sure
> > how to do this because I'll need a static hook somewhere to get my
> > object. Does anyone have any pointers for doing this?
> > Thanks,
> > Ben
>
> Adding a static hook is less than ideal, and it isn't hard to just
> create your system to live as a component inside of the Cocoon world.
>
> Nevertheless, if you are hell-bent on this approach, here is how you
> would do it:
>
> http://cocoon.apache.org/2.1/developing/parent-component-manager.html
>
> Set up the component manager in your static class, with the entry for
> the database, and let cocoon just use it.
>
> --
> Design is a funny word. Some people think design means how it looks.
> But of course, if you dig deeper, it's really how it works.
>
> -- Steve Jobs
>
> ---------------------------------------------------------------------
> 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
Re: static method to get a component?
Posted by Berin Loritsch <bl...@d-haven.org>.
Ben Anderson wrote:
> Hi,
> I need to hit the database from outside of cocoon, but within the same
> webapp. I would like to share the same datasource. My first thought
> was to follow this example:
> http://cocoon.apache.org/2.1/developing/datasources.html
> which is to implement the Composable interface. However, I'm not sure
> how to do this because I'll need a static hook somewhere to get my
> object. Does anyone have any pointers for doing this?
> Thanks,
> Ben
Adding a static hook is less than ideal, and it isn't hard to just
create your system to live as a component inside of the Cocoon world.
Nevertheless, if you are hell-bent on this approach, here is how you
would do it:
http://cocoon.apache.org/2.1/developing/parent-component-manager.html
Set up the component manager in your static class, with the entry for
the database, and let cocoon just use it.
--
Design is a funny word. Some people think design means how it looks.
But of course, if you dig deeper, it's really how it works.
-- Steve Jobs
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org