Splitter as JavaBean
Hello. How can I write a class-spliiter ? and how can i use this class in my spring config ? I use camel 1.5 (because it's stable release). Thanks Evgeny -- View this message in context: http://www.nabble.com/Splitter-as-JavaBean-tp22034573s22882p22034573.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JavaBean as Splitter
Hi I created a sample at the wiki page: http://cwiki.apache.org/confluence/display/CAMEL/Splitter On Mon, Feb 16, 2009 at 11:23 AM, Claus Ibsen claus.ib...@gmail.com wrote: Hi On Mon, Feb 16, 2009 at 11:11 AM, pevgen pev...@km.ru wrote: Hello. How can I write a class-spliiter ? and how can i use this class in my spring config ? I use camel 1.5 (because it's stable release). Just create a POJO that has a method that returns something the can be iterateable, eg. return each splitted part. Eg a List, Iterator And then you can use the methodCall expression to configure the splitter to know that it should call a method on your POJO You POJO can be defined in spring XML in plain spring bean style. Behind the covers the splitter expects an Expression that it evaluated to get the something that can be iteratable I guess we could use a sample of that on the wiki page: http://camel.apache.org/splitter.html Thanks Evgeny -- View this message in context: http://www.nabble.com/JavaBean-as-Splitter-tp22034573s22882p22034573.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/
Re: JavaBean as Splitter
Hi On Mon, Feb 16, 2009 at 11:11 AM, pevgen pev...@km.ru wrote: Hello. How can I write a class-spliiter ? and how can i use this class in my spring config ? I use camel 1.5 (because it's stable release). Just create a POJO that has a method that returns something the can be iterateable, eg. return each splitted part. Eg a List, Iterator And then you can use the methodCall expression to configure the splitter to know that it should call a method on your POJO You POJO can be defined in spring XML in plain spring bean style. Behind the covers the splitter expects an Expression that it evaluated to get the something that can be iteratable I guess we could use a sample of that on the wiki page: http://camel.apache.org/splitter.html Thanks Evgeny -- View this message in context: http://www.nabble.com/JavaBean-as-Splitter-tp22034573s22882p22034573.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/
Re: Camel as an OSGi service on a JOnAS 5.1.0-M3 Application Server
Hi Willem, i'll check your work as soon as i can :), and test it, thx. However, i'm not sure i'll be able to do it before the 1.6.0 release. I also saw the CAMEL-1345 report on JIRA. A way to make things become easier for the users could be to provide a Camel service when its bundle is installed and started on an OSGi gateway. It's the way i did, using iPOJO http://felix.apache.org/site/apache-felix-ipojo.html as the OSGi service manager. Cheers, Guillaume Willem Jiang a écrit : Hi Guillaume, I did some works[1] about moving the OSGI stuff from camel-core to OSGI. Current Camel 1.6 and Camel 2.0-snapshot don't check the getBundle method from the classloader to verify if the camel context is deploied in an OSGI envrionment. Please feel free to try them out. BTW, current we are voting the camel 1.6, you can get it from here[2] [1]http://issues.apache.org/activemq/browse/CAMEL-1043 [2]http://people.apache.org/~hadrian/apache-camel-1.6.0-RC1/maven2/ Willem Guillaume Renault wrote: Hello all, it is time for me to inform the Camel users that i did some work on Camel/OSGi/JOnAS. The goal was to provide a Camel OSGi service on the JOnAS 5 Application Server. I first noticed that Camel provides bundles of its modules (thanks all for this). However, an issue remains when we use Camel on OSGi. In the camel-core, when Camel try to find the converters (and more generally, when Camel try to deal with bundles), it needs to get the list of bundles on the OSGi gateway. this is done this way : class : org.apache.camel.util.ResolverUtil ... org.osgi.framework.Bundle bundle = (org.osgi.framework.Bundle) mth.invoke(loader); org.osgi.framework.Bundle[] bundles = bundle.getBundleContext().getBundles(); ... where mth is a Method object and loader a ClassLoader. This is not a common way to access the bundle list (so the bundleContext), as the classloader doesn't own such a method by default. It must be done the way it is in your case because of the websphere integration, but in a common environment, Camel needs to access this list through the BundleContext, which is known when the bundle is deployed on the gateway. Then i did some overload of the core to correctly get the bundles' list, as it is impossible for Camel to know that we are in an OSGi environment if the getBundle method is not available on a classloader. Once this was done, it was quite simple to provide a Camel service on an OSGi gateway using iPOJO (http://felix.apache.org/site/ipojo-concepts-overview.html). Be aware that my work was done for integration on a JOnAS Application Server (it is the reason of the classes' names), but it can perfectly work on a standalone OSGi gateway without JOnAS (JOnAS 5 uses Felix by default). You can checkout the sources here svn://svn.forge.objectweb.org/svnroot/jonas/sandbox/camel-jonas5. Feel free to make comments, and if you're in need for such a service in Camel, i will be glad to include my work in the project, either as an example, or all other ways you would like to. Two examples are also provided in my project, one deeling with JMS (using the JORAM implementation) and an other one using CXF. I still need to set up some tests to validate my work in a unitary test way. BTW, i use from the version 1.5.0 of Camel. Feel free to comment this e-mail, and react on the subject. Also don't hesitate to directly contact me. Regards, Guillaume PS : I'm using the Registry component made by S. Ali Tokmen, who made Camel work on a JOnAS 4.10.3 version. This component allow to define logical names to access endpoints when we define the camel routes. Those names are binded to the real technical name. -- Guillaume Renault - BULL Service BULL - Architect of an Open World Email : guillaume.rena...@bull.net Tel : +334 76 29 71 09 Office : B1-295 Web : http://jasmine.ow2.org web : http://jonas.ow2.org (\ _ /) (='.'=) ()-() -- Guillaume Renault - BULL Service BULL - Architect of an Open World Email : guillaume.rena...@bull.net Tel : +334 76 29 71 09 Office : B1-295 Web : http://jasmine.ow2.org web : http://jonas.ow2.org (\ _ /) (='.'=) ()-()
Re: Camel as an OSGi service on a JOnAS 5.1.0-M3 Application Server
Hi all, I just provided a test to my Camel service, in a simple OSGi gateway out of a JOnAS environment. You can check it, it may give some ideas. Here svn://svn.forge.objectweb.org/svnroot/jonas/sandbox/camel-jonas5 are the sources to checkout. Guillaume Guillaume Renault a écrit : Hi Willem, i'll check your work as soon as i can :), and test it, thx. However, i'm not sure i'll be able to do it before the 1.6.0 release. I also saw the CAMEL-1345 report on JIRA. A way to make things become easier for the users could be to provide a Camel service when its bundle is installed and started on an OSGi gateway. It's the way i did, using iPOJO http://felix.apache.org/site/apache-felix-ipojo.html as the OSGi service manager. Cheers, Guillaume Willem Jiang a écrit : Hi Guillaume, I did some works[1] about moving the OSGI stuff from camel-core to OSGI. Current Camel 1.6 and Camel 2.0-snapshot don't check the getBundle method from the classloader to verify if the camel context is deploied in an OSGI envrionment. Please feel free to try them out. BTW, current we are voting the camel 1.6, you can get it from here[2] [1]http://issues.apache.org/activemq/browse/CAMEL-1043 [2]http://people.apache.org/~hadrian/apache-camel-1.6.0-RC1/maven2/ Willem Guillaume Renault wrote: Hello all, it is time for me to inform the Camel users that i did some work on Camel/OSGi/JOnAS. The goal was to provide a Camel OSGi service on the JOnAS 5 Application Server. I first noticed that Camel provides bundles of its modules (thanks all for this). However, an issue remains when we use Camel on OSGi. In the camel-core, when Camel try to find the converters (and more generally, when Camel try to deal with bundles), it needs to get the list of bundles on the OSGi gateway. this is done this way : class : org.apache.camel.util.ResolverUtil ... org.osgi.framework.Bundle bundle = (org.osgi.framework.Bundle) mth.invoke(loader); org.osgi.framework.Bundle[] bundles = bundle.getBundleContext().getBundles(); ... where mth is a Method object and loader a ClassLoader. This is not a common way to access the bundle list (so the bundleContext), as the classloader doesn't own such a method by default. It must be done the way it is in your case because of the websphere integration, but in a common environment, Camel needs to access this list through the BundleContext, which is known when the bundle is deployed on the gateway. Then i did some overload of the core to correctly get the bundles' list, as it is impossible for Camel to know that we are in an OSGi environment if the getBundle method is not available on a classloader. Once this was done, it was quite simple to provide a Camel service on an OSGi gateway using iPOJO (http://felix.apache.org/site/ipojo-concepts-overview.html). Be aware that my work was done for integration on a JOnAS Application Server (it is the reason of the classes' names), but it can perfectly work on a standalone OSGi gateway without JOnAS (JOnAS 5 uses Felix by default). You can checkout the sources here svn://svn.forge.objectweb.org/svnroot/jonas/sandbox/camel-jonas5. Feel free to make comments, and if you're in need for such a service in Camel, i will be glad to include my work in the project, either as an example, or all other ways you would like to. Two examples are also provided in my project, one deeling with JMS (using the JORAM implementation) and an other one using CXF. I still need to set up some tests to validate my work in a unitary test way. BTW, i use from the version 1.5.0 of Camel. Feel free to comment this e-mail, and react on the subject. Also don't hesitate to directly contact me. Regards, Guillaume PS : I'm using the Registry component made by S. Ali Tokmen, who made Camel work on a JOnAS 4.10.3 version. This component allow to define logical names to access endpoints when we define the camel routes. Those names are binded to the real technical name. -- Guillaume Renault - BULL Service BULL - Architect of an Open World Email : guillaume.rena...@bull.net Tel : +334 76 29 71 09 Office : B1-295 Web : http://jasmine.ow2.org web : http://jonas.ow2.org (\ _ /) (='.'=) ()-() -- Guillaume Renault - BULL Service BULL - Architect of an Open World Email : guillaume.rena...@bull.net Tel : +334 76 29 71 09 Office : B1-295 Web : http://jasmine.ow2.org web : http://jonas.ow2.org (\ _ /) (='.'=) ()-() -- Guillaume Renault - BULL Service BULL - Architect of an Open World Email : guillaume.rena...@bull.net Tel : +334 76 29 71 09 Office : B1-295 Web : http://jasmine.ow2.org web : http://jonas.ow2.org (\ _ /) (='.'=) ()-()
Re: Testing using Camel Test or Spring Testing or Guice
I did a quick fix for it . Please check the latest CAMEL 2.0-SNAPSHOT for it :) Willem On Sun, Feb 15, 2009 at 4:24 PM, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Feb 13, 2009 at 11:52 PM, nojonojo n0...@yahoo.com wrote: Let me clarify - I chose a poor message to respond to. It's not appearing in the standalone snapshot downloads (not related to the maven repository). Hi Thanks for reporting. I have created a ticket: https://issues.apache.org/activemq/browse/CAMEL-1342 nojonojo wrote: Camel-test isn't appearing in the 2.0 snapshots. Nolan willem.jiang wrote: Hi Since Camel-2.0 is not released yet, you can dowload the snapshot from here [1]. Please add this repository into your pom.xml, and set the camel version to be 2.0-SNAPSHOT. repositories repository idapache.snapshot/id nameApache Software Foundation Snapshot Repository/name urlhttp://people.apache.org/repo/m2-snapshot-repository/url snapshots enabledtrue/enabled /snapshots releases enabledfalse/enabled /releases /repository ... /repositories [1]the http://people.apache.org/repo/m2-snapshot-repository Willem Drone42 wrote: Thanks for the guide. However maven cant find camel-test in the repository. Browsing the content of the repository I can find camel-itest. Is this the same? Or where do I find camel-test? James.Strachan wrote: We've been through a few iterations of testing during the lifetime of the Camel project; we started with ContextTestSupport which was quite handy; Mock endpoints camel along, then the Camel binding and injection annotations came... http://activemq.apache.org/camel/bean-integration.html together with Spring Test came along along with which made testing much simpler and more powerful http://activemq.apache.org/camel/spring-testing.html then came Guice support not requiring any XML http://activemq.apache.org/camel/guice.html and finally support for Spring Java Config to allow folks to use Spring without any XML http://cwiki.apache.org/CAMEL/spring-java-config.html However not everyone uses Spring or Guice for Dependency Injection; sometimes folks use straight Java code. So then Camel Test has recently come along as an option... http://cwiki.apache.org/CAMEL/camel-test.html This might now all seem confusing! So I've tried to create a testing page describing how they are all now pretty similar; whether using Camel Test, Spring Testing with XML or Java Config or Guice... http://cwiki.apache.org/CAMEL/testing.html Any feedback/thoughts welcome! -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/ -- View this message in context: http://www.nabble.com/Testing-using-Camel-Test-or-Spring-Testing-or-Guice-tp20811429s22882p22006406.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/
Re: How to negate a Predicate?
Hi I will add a sample to the predicate wiki page http://camel.apache.org/predicate.html But there is a hikup with the apache server right now, so here is part of the source code for an unit test: import static org.apache.camel.builder.PredicateBuilder.not; ... protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { // START SNIPPET: e1 from(direct:start) .choice() .when(not(header(username).regex(goofy|pluto))).to(mock:people) .otherwise().to(mock:animals) .end(); // END SNIPPET: e1 } }; } On Tue, Feb 17, 2009 at 5:01 AM, Trevv 4...@safe-mail.net wrote: Most of my uses of .when are like the first snippet below, very easy to read. But I have a few uses of .when which need to negate the Predicate, and in those places I'm using code like the second snippet below. It works well, and there are no compiler warnings, but it is NOT easy to read. How should I make this code easier to read? // take the first branch, if the regex DOES match... choice(). when(header(foo). regex(cheese|whey)) // take the first branch, if the regex DOES NOT match... choice(). when(PredicateBuilder. not(Builder. MinaExchangeheader(foo). regex(cheese|whey))) -- View this message in context: http://www.nabble.com/How-to-negate-a-Predicate--tp22049751s22882p22049751.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/