cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Coboos" <cromo...@gmx.net>
Subject Re: Getting the componentmanager (was Re: access defaultsmetamodule variables from java code)
Date Thu, 30 Oct 2003 17:20:32 GMT
Hello,

better you should use the interface Serviceable to get the ServiceManager,
not the ComponentManager (is deprecated?). The interface Component is just a
marker interface (no definitions) and has only the affect for mark a
component. The ServiceManager handles now all java objects not only Objects
of type Component.

A short example:

...
...
public myClass extends ... implements Serviceable {

    ServiceManager manager;

    public void service(ServiceManager manager) {

        this.manager = manager;
    }

    public aMethod() {

        MyObject object = (MyObject)this.manager.lookup(MyObject.ROLE);
    }
}

Regards
Stephan

----- Original Message ----- 
From: "Jorg Heymans" <jh@domek.be>
To: <users@cocoon.apache.org>
Sent: Thursday, October 30, 2003 5:43 PM
Subject: Re: Getting the componentmanager (was Re: access defaultsmetamodule
variables from java code)


> Nearly there :)
>
> My transformer is extending AbstractDOMTransformer so i already have
> access to this manager object.
>
> So would i do:
> Component c = manager.lookup(
> "org.apache.cocoon.components.modules.input.DefaultsMetaModule");
>
> the Component seems like a class without any methods.. so maybe do some
> casting here?
>
>
> Jorg
> Reinhard Poetz wrote:
> > From: Jorg Heymans
> >
> >
> >>Using cocoon 2.04, how can I retrieve the componentmanager
> >>from within a
> >>transformer? Do i need to use the sourceresolver or something
> >>from setup()? My knowledge on avalon components is poor, so
> >>i'm hoping someone can enlighten me here .
> >
> >
> > Use the Composable interface in your component and implement the method
> > compose:
> >
> >     public void compose(ComponentManager manager) throws
> > ComponentException {
> >         this.manager = manager;
> >     }
> >
> > HTH
> >
> > --
> > Reinhard
> >
> >
> > ---------------------------------------------------------------------
> > 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
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message