You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Joerg Heinicke <jo...@gmx.de> on 2005/05/06 18:14:43 UTC
Component vs. ComponentSelector (or Service vs. ServiceSelector)
Hello,
whenever I try to lookup my component I get a ClassCastException when I want to
cast it to the component's class. This is probably due to the intermediate
selector one needs(?), but I don't know exactly. I just don't want to have the
additional selector as there is just one implementation. And from my searches
[1] and comparisons with existing Cocoon code [2] I got the feeling it must be
possible without selectors. Is it? And how must the "thing" be set up (roles
file + xconf)?
Thanks in advance,
Joerg
[1] http://excalibur.apache.org/framework/guide-cop-in-avalon.html (In the
example the result of the lookup is directly casted. Furthermore the text sounds
like the selector being optional.)
[2] http://svn.apache.org/viewcvs.cgi/cocoon/tags/RELEASE_2_1_7/src/blocks/forms/
java/org/apache/cocoon/forms/flow/javascript/Form.js?rev=158761&view=markup (The
lookup result of FormManager.ROLE or BindingManager.ROLE is directly casted to
FormManager or BindingManager. Though its flow script here, in the method in
FOM_Cocoon nothing else is done than manager.lookup(String). The same is true
for the javaflow example at
http://svn.apache.org/viewcvs.cgi/cocoon/tags/RELEASE_2_1_7/src/blocks/javaflow/
java/org/apache/cocoon/forms/flow/java/FormInstance.java?rev=158761&view=markup.)
Re: Component vs. ComponentSelector (or Service vs. ServiceSelector)
Posted by Joerg Heinicke <jo...@gmx.de>.
Vadim Gritsenko <vadim <at> reverycodes.com> writes:
> > Hello,
> >
> > whenever I try to lookup my component I get a ClassCastException when I want
> > to cast it to the component's class.
>
> Does your component implementation implements Component interface? Try if it
> does not.
Of course (it did not, does now and works now)! Sometimes it is so easy. Thank
you very much.
Joerg
Re: Component vs. ComponentSelector (or Service vs. ServiceSelector)
Posted by Vadim Gritsenko <va...@reverycodes.com>.
Joerg Heinicke wrote:
> Hello,
>
> whenever I try to lookup my component I get a ClassCastException when I want to
> cast it to the component's class.
Does your component implementation implements Component interface? Try if it
does not.
Vadim
> This is probably due to the intermediate
> selector one needs(?), but I don't know exactly. I just don't want to have the
> additional selector as there is just one implementation. And from my searches
> [1] and comparisons with existing Cocoon code [2] I got the feeling it must be
> possible without selectors. Is it? And how must the "thing" be set up (roles
> file + xconf)?
>
> Thanks in advance,
>
> Joerg
>
> [1] http://excalibur.apache.org/framework/guide-cop-in-avalon.html (In the
> example the result of the lookup is directly casted. Furthermore the text sounds
> like the selector being optional.)
>
> [2] http://svn.apache.org/viewcvs.cgi/cocoon/tags/RELEASE_2_1_7/src/blocks/forms/
> java/org/apache/cocoon/forms/flow/javascript/Form.js?rev=158761&view=markup (The
> lookup result of FormManager.ROLE or BindingManager.ROLE is directly casted to
> FormManager or BindingManager. Though its flow script here, in the method in
> FOM_Cocoon nothing else is done than manager.lookup(String). The same is true
> for the javaflow example at
> http://svn.apache.org/viewcvs.cgi/cocoon/tags/RELEASE_2_1_7/src/blocks/javaflow/
> java/org/apache/cocoon/forms/flow/java/FormInstance.java?rev=158761&view=markup.)