You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by AlanFoster <al...@alanfoster.me> on 2013/05/28 12:41:41 UTC

Difference between method attribute 'bean' and 'ref'

Hi,

I was just wondering what the differences between the 'ref' and 'bean'
attribute are within the method XML type.

For example

    <method ref="beanName" method="methodName" />

and

    <method bean="beanName" method="methodName" />

Thanks,
Alan



--
View this message in context: http://camel.465427.n5.nabble.com/Difference-between-method-attribute-bean-and-ref-tp5733348.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Difference between method attribute 'bean' and 'ref'

Posted by AlanFoster <al...@alanfoster.me>.
Thanks for the great answer Babak :)



--
View this message in context: http://camel.465427.n5.nabble.com/Difference-between-method-attribute-bean-and-ref-tp5733348p5733371.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Difference between method attribute 'bean' and 'ref'

Posted by Babak Vahdat <ba...@swissonline.ch>.

Am 28.05.13 15:57 schrieb "AlanFoster" unter <al...@alanfoster.me>:

>Hi,
>
>I wonder if there a way to provide any sort of deprecated metadata within
>the generated Camel xsd? For instance this metadata would be great for
>tooling, as I would really like to highlight elements/attributes as being
>deprecated within camel routes when inside an IDE; Having this information
>in the XSD would really help with that.
>
>Is this possible to do within an XSD?

Hi

We make use of JAXB Schema generator through the Ant <schemagen> Task
(com.sun.tools.jxc.SchemaGenTask) inside Maven (see camel-spring POM for
details). AFAIK the possibility you're asking for has not (yet) got into
the JAXB world. As an example see:

https://java.net/jira/browse/JAXB-273

That said please note that the vice versa is already possible today,
that's arbitrary annotations being generated into the Java source from
Schema using JAXB XJC. For example I used this one for one of my client
projects:

http://confluence.highsource.org/display/J2B/Annotate+Plugin

See how nicely & fine-grained we can customize the generated source for
the "foobar" property.

Babak

>
>Alan
>
>
>
>--
>View this message in context:
>http://camel.465427.n5.nabble.com/Difference-between-method-attribute-bean
>-and-ref-tp5733348p5733359.html
>Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Difference between method attribute 'bean' and 'ref'

Posted by AlanFoster <al...@alanfoster.me>.
Hi,

I wonder if there a way to provide any sort of deprecated metadata within
the generated Camel xsd? For instance this metadata would be great for
tooling, as I would really like to highlight elements/attributes as being
deprecated within camel routes when inside an IDE; Having this information
in the XSD would really help with that. 

Is this possible to do within an XSD?

Alan



--
View this message in context: http://camel.465427.n5.nabble.com/Difference-between-method-attribute-bean-and-ref-tp5733348p5733359.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Difference between method attribute 'bean' and 'ref'

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah fell free to update the docs

On Tue, May 28, 2013 at 3:26 PM, AlanFoster <al...@alanfoster.me> wrote:
> Thanks for your reply Claus.
>
> Will the documentation for http://camel.apache.org/bean-language.html need
> to be updated to use the 'ref' attribute maybe?
>
> This is from the documentation page above
>
> <route>
>   <from uri="activemq:topic:OrdersTopic"/>
>   <filter>
>     <method bean="myBean" method="isGoldCustomer"/>
>     <to uri="activemq:BigSpendersQueue"/>
>   </filter>
> </route>
>
> Shall I update the page and add a note for this, or is there an existing
> dedicated page for the 'method' dsl where this information is already added?
>
> Also, I wonder if there a way to provide any sort of deprecated metadata
> within the generated Camel xsd? For instance this metadata would be great
> for tooling, as I would really like to highlight elements/attributes as
> being deprecated within camel routes when inside an IDE; Having this
> information in the XSD would really help with that.
>
> Alan
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Difference-between-method-attribute-bean-and-ref-tp5733348p5733357.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Difference between method attribute 'bean' and 'ref'

Posted by AlanFoster <al...@alanfoster.me>.
Thanks for your reply Claus.

Will the documentation for http://camel.apache.org/bean-language.html need
to be updated to use the 'ref' attribute maybe? 

This is from the documentation page above

<route>
  <from uri="activemq:topic:OrdersTopic"/>
  <filter>
    <method bean="myBean" method="isGoldCustomer"/>
    <to uri="activemq:BigSpendersQueue"/>
  </filter>
</route>

Shall I update the page and add a note for this, or is there an existing
dedicated page for the 'method' dsl where this information is already added?

Also, I wonder if there a way to provide any sort of deprecated metadata
within the generated Camel xsd? For instance this metadata would be great
for tooling, as I would really like to highlight elements/attributes as
being deprecated within camel routes when inside an IDE; Having this
information in the XSD would really help with that.

Alan



--
View this message in context: http://camel.465427.n5.nabble.com/Difference-between-method-attribute-bean-and-ref-tp5733348p5733357.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Difference between method attribute 'bean' and 'ref'

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Its the same. bean was the old attribute, which has been deprecated.
You should favor using ref

@XmlRootElement(name = "method")
@XmlAccessorType(XmlAccessType.FIELD)
public class MethodCallExpression extends ExpressionDefinition {
    @XmlAttribute
    @Deprecated
    private String bean;
    @XmlAttribute
    private String ref;


On Tue, May 28, 2013 at 12:41 PM, AlanFoster <al...@alanfoster.me> wrote:
> Hi,
>
> I was just wondering what the differences between the 'ref' and 'bean'
> attribute are within the method XML type.
>
> For example
>
>     <method ref="beanName" method="methodName" />
>
> and
>
>     <method bean="beanName" method="methodName" />
>
> Thanks,
> Alan
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Difference-between-method-attribute-bean-and-ref-tp5733348.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen