You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by camelvev <ca...@vevang.no> on 2015/03/27 00:06:06 UTC
SortTerm[] in Spring XML
Hello!
This is probably stupidly simple, but: I'd like to use the new SortTerm[]
functionality with IMAP in Camel 2.15.
I'm using spring xml to configure my bean bindings and want to refer to the
sort term (say, SortTerm.SUBJECT) by referring to a binding id in the
endpoint URI like this: sortTerm=#mySortTerm.
In the tests, you do this:
JndiRegistry jndi = super.createRegistry();
jndi.bind("sortAscendingDate", new SortTerm[]{SortTerm.DATE});
How do I create a simple binding to a SortTerm array using Spring XML? I've
tried creating a bean specifically for it, and using <util:list> and <array>
around the SortTerm, using value-type="com.sun.mail.imap.SortTerm" , but I
always get some sort of type conversion error, typically
No type converter available to convert from type: java.lang.String to the
required type: com.sun.mail.imap.SortTerm[] .
So the question is - How can I create a simple array of SortTerms in the
spring registry using Spring XML?
Thanks,
ovvo
--
View this message in context: http://camel.465427.n5.nabble.com/SortTerm-in-Spring-XML-tp5764866.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SortTerm[] in Spring XML
Posted by camelvev <ca...@vevang.no>.
Umm, yes, sorry - that was the wrong piece of code! Brain fart... Here's what
I used for the SortTerm:
public class SubjectSortTermsFactory {
public static SortTerm[] create() {
return new SortTerm[]{SortTerm.SUBJECT};
}
}
<bean id="subjectSortTerm"
class="no.ngt.tech.b2b.vulaparser.util.SubjectSortTermsFactory"
factory-method="create"/>
BR,
Øyvind
--
View this message in context: http://camel.465427.n5.nabble.com/SortTerm-in-Spring-XML-tp5764866p5764908.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SortTerm[] in Spring XML
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Ah thanks. I assume its a SortTerm builder. As the code you show is
about search terms.
Btw for search terms, you can use the search.XXX prefix in the uri to
build that also a bit easier for some simpler cases.
See bottom of page
http://camel.apache.org/mail.html
On Fri, Mar 27, 2015 at 12:40 PM, camelvev <ca...@vevang.no> wrote:
> Hi,
>
> Thanks a lot Claus. In addition, if someone else is wondering about
> this, I managed to solve the issue (with some help from a nice
> colleague) by creating a factoryBean that returns a SortTerm[]:
>
> public class IMAPsearchTermFactory {
>
> public static SearchTerm create() {
>
> SearchTermBuilder builder = new SearchTermBuilder();
> builder.unseen().subject(SearchTermBuilder.Op.or, "Some
> subject").subject(SearchTermBuilder.Op.or, "Some other subject");
> return builder.build();
> }
> }
>
> and then in the XML
>
> <bean id="searchTerm"
> class="no.ngt.tech.b2b.vulaparser.util.IMAPsearchTermFactory"
> factory-method="create"/>
>
> ...which can then be referenced in the URI as #searchTerm.
>
> BR,
> ؘyvind
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/SortTerm-in-Spring-XML-tp5764866p5764904.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Re: SortTerm[] in Spring XML
Posted by camelvev <ca...@vevang.no>.
Hi,
Thanks a lot Claus. In addition, if someone else is wondering about
this, I managed to solve the issue (with some help from a nice
colleague) by creating a factoryBean that returns a SortTerm[]:
public class IMAPsearchTermFactory {
public static SearchTerm create() {
SearchTermBuilder builder = new SearchTermBuilder();
builder.unseen().subject(SearchTermBuilder.Op.or, "Some
subject").subject(SearchTermBuilder.Op.or, "Some other subject");
return builder.build();
}
}
and then in the XML
<bean id="searchTerm"
class="no.ngt.tech.b2b.vulaparser.util.IMAPsearchTermFactory"
factory-method="create"/>
...which can then be referenced in the URI as #searchTerm.
BR,
Øyvind
--
View this message in context: http://camel.465427.n5.nabble.com/SortTerm-in-Spring-XML-tp5764866p5764904.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SortTerm[] in Spring XML
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah we should make this easier so you can do something similar to
what searchTerm can do. I have logged a ticket
https://issues.apache.org/jira/browse/CAMEL-8560
On Fri, Mar 27, 2015 at 12:06 AM, camelvev <ca...@vevang.no> wrote:
> Hello!
>
> This is probably stupidly simple, but: I'd like to use the new SortTerm[]
> functionality with IMAP in Camel 2.15.
>
> I'm using spring xml to configure my bean bindings and want to refer to the
> sort term (say, SortTerm.SUBJECT) by referring to a binding id in the
> endpoint URI like this: sortTerm=#mySortTerm.
>
> In the tests, you do this:
>
> JndiRegistry jndi = super.createRegistry();
> jndi.bind("sortAscendingDate", new SortTerm[]{SortTerm.DATE});
>
> How do I create a simple binding to a SortTerm array using Spring XML? I've
> tried creating a bean specifically for it, and using <util:list> and <array>
> around the SortTerm, using value-type="com.sun.mail.imap.SortTerm" , but I
> always get some sort of type conversion error, typically
>
> No type converter available to convert from type: java.lang.String to the
> required type: com.sun.mail.imap.SortTerm[] .
>
> So the question is - How can I create a simple array of SortTerms in the
> spring registry using Spring XML?
>
> Thanks,
> ovvo
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/SortTerm-in-Spring-XML-tp5764866.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/