|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 - 3 - 4 - 5 - 6 | Next > |
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererGrabbing name from dataFormat type works fine.
But when I use it on loadBalancer type, it throws a null pointer exception. loadBalanceDefinition.getLoadBalancerType().getClass().getAnnotation(XmlRootElement.class) throws the exception.
|
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererOn Sat, Jul 4, 2009 at 8:16 AM, alloyer<alloyer@...> wrote:
> > Grabbing name from dataFormat type works fine. > But when I use it on loadBalancer type, it throws a null pointer exception. > > > loadBalanceDefinition.getLoadBalancerType().getClass().getAnnotation(XmlRootElement.class) > throws the exception. > I think its because you use ref to lookup the definition in the registry. Then when Camel builds the runtime route it will lookup the real load balancer and use it. So if getLoadBalancerType returns null then try checking getRef and see if you can lookup this bean in the registry What does the route DSL looks like? > > JIRA jira@... wrote: >> >> >> [ >> https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52687#action_52687 >> ] >> >> Jonathan Anstey commented on CAMEL-1392: >> ---------------------------------------- >> >> Also, instead of duplicating the dataformat types (and loadbalancer types >> too), you should be able to grab the short names through the JAXB >> metadata. Like so >> >> {code} >> dataFormat.getClass().getAnnotation(XmlRootElement.class).name() >> {code} >> >>> groovy renderer >>> --------------- >>> >>> Key: CAMEL-1392 >>> URL: https://issues.apache.org/activemq/browse/CAMEL-1392 >>> Project: Apache Camel >>> Issue Type: Sub-task >>> Reporter: James Strachan >>> Assignee: Xueqiang Mi >>> Attachments: camel-web-20090629.patch, camel-web-20090703.patch >>> >>> >> >> >> -- >> This message is automatically generated by JIRA. >> - >> You can reply to this email to add a comment to the issue online. >> >> >> > > -- > View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24331647.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererThe getLoadBalancerType don't return null but the getAnnotation().
The getLoadBalancerType return a LoadBalancerDefinition instance, which I think should be a RandomLoadBalancerdefinition one. The dsl is: from("direct:start").loadBalance().random().to("mock:x", "mock:y", "mock:z")
|
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererHi
I loaded the RandomLoadBalanceTest unit test from camel-core and put a break point at assertMockEndpointsSatisfied(); And then inspected the CameContext and its getRouteDefinitions(). See attached picture from the debugger, shows the object graph and the types it has a runtime. Maybe you need a getLoadBalancer() without a parameter. But try with getLoadBalancer(null) in the class LoadBalancerDefinition as it should have been created. Notice its the load balancer definition with R that can return the specific type. On Sat, Jul 4, 2009 at 11:07 AM, alloyer<alloyer@...> wrote: > > The getLoadBalancerType don't return null but the getAnnotation(). > The getLoadBalancerType return a LoadBalancerDefinition instance, which I > think should be a > RandomLoadBalancerdefinition one. > > The dsl is: from("direct:start").loadBalance().random().to("mock:x", > "mock:y", "mock:z") > > > Claus Ibsen-2 wrote: >> >> On Sat, Jul 4, 2009 at 8:16 AM, alloyer<alloyer@...> wrote: >>> >>> Grabbing name from dataFormat type works fine. >>> But when I use it on loadBalancer type, it throws a null pointer >>> exception. >>> >>> >>> loadBalanceDefinition.getLoadBalancerType().getClass().getAnnotation(XmlRootElement.class) >>> throws the exception. >>> >> >> I think its because you use ref to lookup the definition in the registry. >> Then when Camel builds the runtime route it will lookup the real load >> balancer and use it. >> >> So if getLoadBalancerType returns null then try checking getRef and >> see if you can lookup this bean in the registry >> >> >> >> What does the route DSL looks like? >> >>> >>> JIRA jira@... wrote: >>>> >>>> >>>> [ >>>> https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52687#action_52687 >>>> ] >>>> >>>> Jonathan Anstey commented on CAMEL-1392: >>>> ---------------------------------------- >>>> >>>> Also, instead of duplicating the dataformat types (and loadbalancer >>>> types >>>> too), you should be able to grab the short names through the JAXB >>>> metadata. Like so >>>> >>>> {code} >>>> dataFormat.getClass().getAnnotation(XmlRootElement.class).name() >>>> {code} >>>> >>>>> groovy renderer >>>>> --------------- >>>>> >>>>> Key: CAMEL-1392 >>>>> URL: >>>>> https://issues.apache.org/activemq/browse/CAMEL-1392 >>>>> Project: Apache Camel >>>>> Issue Type: Sub-task >>>>> Reporter: James Strachan >>>>> Assignee: Xueqiang Mi >>>>> Attachments: camel-web-20090629.patch, camel-web-20090703.patch >>>>> >>>>> >>>> >>>> >>>> -- >>>> This message is automatically generated by JIRA. >>>> - >>>> You can reply to this email to add a comment to the issue online. >>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24331647.html >>> Sent from the Camel Development mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24332317.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererHi
I have created a basic unit test that navigates the unit test and emits the route in Java DSL. Its very basic but demonstrates how its possible. You can take a look and see how I can determine the load balancer type. http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java?revision=791092&pathrev=791092 I do wonder if we should by default change the toString() in the xxxDefinition to be more Java DSL like so its easier to read the route. On Sat, Jul 4, 2009 at 11:32 AM, Claus Ibsen<claus.ibsen@...> wrote: > Hi > > I loaded the RandomLoadBalanceTest unit test from camel-core and put a > break point at > assertMockEndpointsSatisfied(); > > And then inspected the CameContext and its getRouteDefinitions(). > See attached picture from the debugger, shows the object graph and the > types it has a runtime. > > Maybe you need a getLoadBalancer() without a parameter. But try with > getLoadBalancer(null) in the class LoadBalancerDefinition as it should > have been created. Notice its the load balancer definition with R that > can return the specific type. > > > > On Sat, Jul 4, 2009 at 11:07 AM, alloyer<alloyer@...> wrote: >> >> The getLoadBalancerType don't return null but the getAnnotation(). >> The getLoadBalancerType return a LoadBalancerDefinition instance, which I >> think should be a >> RandomLoadBalancerdefinition one. >> >> The dsl is: from("direct:start").loadBalance().random().to("mock:x", >> "mock:y", "mock:z") >> >> >> Claus Ibsen-2 wrote: >>> >>> On Sat, Jul 4, 2009 at 8:16 AM, alloyer<alloyer@...> wrote: >>>> >>>> Grabbing name from dataFormat type works fine. >>>> But when I use it on loadBalancer type, it throws a null pointer >>>> exception. >>>> >>>> >>>> loadBalanceDefinition.getLoadBalancerType().getClass().getAnnotation(XmlRootElement.class) >>>> throws the exception. >>>> >>> >>> I think its because you use ref to lookup the definition in the registry. >>> Then when Camel builds the runtime route it will lookup the real load >>> balancer and use it. >>> >>> So if getLoadBalancerType returns null then try checking getRef and >>> see if you can lookup this bean in the registry >>> >>> >>> >>> What does the route DSL looks like? >>> >>>> >>>> JIRA jira@... wrote: >>>>> >>>>> >>>>> [ >>>>> https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52687#action_52687 >>>>> ] >>>>> >>>>> Jonathan Anstey commented on CAMEL-1392: >>>>> ---------------------------------------- >>>>> >>>>> Also, instead of duplicating the dataformat types (and loadbalancer >>>>> types >>>>> too), you should be able to grab the short names through the JAXB >>>>> metadata. Like so >>>>> >>>>> {code} >>>>> dataFormat.getClass().getAnnotation(XmlRootElement.class).name() >>>>> {code} >>>>> >>>>>> groovy renderer >>>>>> --------------- >>>>>> >>>>>> Key: CAMEL-1392 >>>>>> URL: >>>>>> https://issues.apache.org/activemq/browse/CAMEL-1392 >>>>>> Project: Apache Camel >>>>>> Issue Type: Sub-task >>>>>> Reporter: James Strachan >>>>>> Assignee: Xueqiang Mi >>>>>> Attachments: camel-web-20090629.patch, camel-web-20090703.patch >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> This message is automatically generated by JIRA. >>>>> - >>>>> You can reply to this email to add a comment to the issue online. >>>>> >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24331647.html >>>> Sent from the Camel Development mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >>> >> >> -- >> View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24332317.html >> Sent from the Camel Development mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererYeah. This method to invoke "getLoadBalancer()" may be the only valid now.
Thanks
|
|
|
[jira] Updated: (CAMEL-1392) groovy renderer[ https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xueqiang Mi updated CAMEL-1392: ------------------------------- Attachment: camel-web-20090705.patch Fixed the test bug and add some dsl support. > groovy renderer > --------------- > > Key: CAMEL-1392 > URL: https://issues.apache.org/activemq/browse/CAMEL-1392 > Project: Apache Camel > Issue Type: Sub-task > Reporter: James Strachan > Assignee: Xueqiang Mi > Attachments: camel-web-20090629.patch, camel-web-20090703.patch, camel-web-20090705.patch > > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
Re: [jira] Created: (CAMEL-1392) groovy rendererWhen renderring
loadBalance().failover(IOException.class) resequence(body()) ,need a getExceptions() for FailOverLoadBalancer and a getExceptionList() for ResequenceDefinition.
|
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererThere are one problem to define the assertions in test cases since sometimes we are not sure of an input sentence. For example:
1)"to("mock:a","mock:b") and "to("mock:a").to("mock:b") have the same route definition 2) Sometimes we can't use a ".end()" for the choice sentence. But when renderring, the ".end()" is a required part. Do you have some ideas to deal with it?
|
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererOn Mon, Jul 6, 2009 at 1:20 PM, alloyer<alloyer@...> wrote:
> > There are one problem to define the assertions in test cases since sometimes > we are not sure of an input sentence. For example: > 1)"to("mock:a","mock:b") and "to("mock:a").to("mock:b") have the same route > definition Yeah this is not possible to know how the original route as defined, its the same model when Camel builds the model. I suggest to use the .to(mock:a).to(mock:b) as its more readable and most used. > 2) Sometimes we can't use a ".end()" for the choice sentence. But when > renderring, the ".end()" is a required part. > Do you have some ideas to deal with it? the end() is needed where there is more after the choice block. For example: from A choice() when() to B when() to C otherwise() to D end() to X from A choice() when() to B when() to C end() to X But if the choice is the last then the end is optional / not needed. from A choice() when() to B when() to C otherwise() to D But I would assume for starters it would be easiest to always include it > > JIRA jira@... wrote: >> >> >> [ >> https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52686#action_52686 >> ] >> >> Jonathan Anstey commented on CAMEL-1392: >> ---------------------------------------- >> >> Quickly trying this new code drop out before leaving for the day :) In the >> GroovyRendererTest I noticed pretty much all routes defined in the >> supported list get rendered like >> "from("direct:start",).to("mock:result")". Example output: >> >> {code} >> dsl: from("direct:start").unmarshal().serialization().to("mock:result") >> after rendered: >> import org.apache.camel.language.groovy.GroovyRouteBuilder; >> class GroovyRoute extends GroovyRouteBuilder { >> void configure() { >> from("direct:start",).to("mock:result") >> } >> } >> {code} >> >> Not sure if this is a bug in the renderer or the test case. Care to fix >> that up? >> >> Also unit tests typically contain assertions on the output of a piece of >> code to make sure its operating correctly. In your case the test should be >> asserting that the output of the renderer is correct. Currently we have to >> verify this by looking at the output. >> >>> groovy renderer >>> --------------- >>> >>> Key: CAMEL-1392 >>> URL: https://issues.apache.org/activemq/browse/CAMEL-1392 >>> Project: Apache Camel >>> Issue Type: Sub-task >>> Reporter: James Strachan >>> Assignee: Xueqiang Mi >>> Attachments: camel-web-20090629.patch, camel-web-20090703.patch >>> >>> >> >> >> -- >> This message is automatically generated by JIRA. >> - >> You can reply to this email to add a comment to the issue online. >> >> >> > > -- > View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24353726.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: [jira] Created: (CAMEL-1392) groovy rendererLoad balancer is not a top priority DSL to get working 100% in groovy
DSL at this time. If you have other DSL to port then please take a look at them instead. For instance the Content Based Router (choice) is top priority. On Mon, Jul 6, 2009 at 1:05 PM, alloyer<alloyer@...> wrote: > > When renderring > loadBalance().failover(IOException.class) > resequence(body()) > ,need a getExceptions() for FailOverLoadBalancer and a getExceptionList() > for ResequenceDefinition. > > > JIRA jira@... wrote: >> >> groovy renderer >> --------------- >> >> Key: CAMEL-1392 >> URL: https://issues.apache.org/activemq/browse/CAMEL-1392 >> Project: Apache Camel >> Issue Type: Sub-task >> Reporter: James Strachan >> >> >> >> >> -- >> This message is automatically generated by JIRA. >> - >> You can reply to this email to add a comment to the issue online. >> >> >> > > -- > View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24353532.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererOn Mon, Jul 6, 2009 at 9:37 AM, Claus Ibsen <claus.ibsen@...> wrote:
> On Mon, Jul 6, 2009 at 1:20 PM, alloyer<alloyer@...> wrote: > > > > There are one problem to define the assertions in test cases since > sometimes > > we are not sure of an input sentence. For example: > > 1)"to("mock:a","mock:b") and "to("mock:a").to("mock:b") have the same > route > > definition > Yeah this is not possible to know how the original route as defined, > its the same model when Camel builds the model. > > I suggest to use the .to(mock:a).to(mock:b) as its more readable and most > used. +1 > > > > > > > 2) Sometimes we can't use a ".end()" for the choice sentence. But when > > renderring, the ".end()" is a required part. > > Do you have some ideas to deal with it? > > the end() is needed where there is more after the choice block. > > For example: > > from A > choice() > when() to B > when() to C > otherwise() to D > end() > to X > > from A > choice() > when() to B > when() to C > end() > to X > > But if the choice is the last then the end is optional / not needed. > > from A > choice() > when() to B > when() to C > otherwise() to D > > But I would assume for starters it would be easiest to always include it Also, sounds good. +1 This Groovy renderer is really a best effort kinda thing. i.e. its going to be pretty hard to render arbitrary Groovy code. I think a good set of documentation for this will be a necessity. I've created CAMEL-1804 to track this so we don't forget. > > > > > > > JIRA jira@... wrote: > >> > >> > >> [ > >> > https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52686#action_52686 > >> ] > >> > >> Jonathan Anstey commented on CAMEL-1392: > >> ---------------------------------------- > >> > >> Quickly trying this new code drop out before leaving for the day :) In > the > >> GroovyRendererTest I noticed pretty much all routes defined in the > >> supported list get rendered like > >> "from("direct:start",).to("mock:result")". Example output: > >> > >> {code} > >> dsl: from("direct:start").unmarshal().serialization().to("mock:result") > >> after rendered: > >> import org.apache.camel.language.groovy.GroovyRouteBuilder; > >> class GroovyRoute extends GroovyRouteBuilder { > >> void configure() { > >> from("direct:start",).to("mock:result") > >> } > >> } > >> {code} > >> > >> Not sure if this is a bug in the renderer or the test case. Care to fix > >> that up? > >> > >> Also unit tests typically contain assertions on the output of a piece of > >> code to make sure its operating correctly. In your case the test should > be > >> asserting that the output of the renderer is correct. Currently we have > to > >> verify this by looking at the output. > >> > >>> groovy renderer > >>> --------------- > >>> > >>> Key: CAMEL-1392 > >>> URL: > https://issues.apache.org/activemq/browse/CAMEL-1392 > >>> Project: Apache Camel > >>> Issue Type: Sub-task > >>> Reporter: James Strachan > >>> Assignee: Xueqiang Mi > >>> Attachments: camel-web-20090629.patch, camel-web-20090703.patch > >>> > >>> > >> > >> > >> -- > >> This message is automatically generated by JIRA. > >> - > >> You can reply to this email to add a comment to the issue online. > >> > >> > >> > > > > -- > > View this message in context: > http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24353726.html > > Sent from the Camel Development mailing list archive at Nabble.com. > > > > > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > -- Cheers, Jon http://janstey.blogspot.com/ |
|
|
Re: [jira] Created: (CAMEL-1392) groovy rendererall right. I am going to create a page to list which DSL have been supported these days.
Now the main problem I encountered is to deal with the invoking of a registered bean or creating object (such as a MyAggregationStrategy instance) when editing route in Groovy. Do you think it is a top priority work? Or I should let current DSL support more robust firstly?
|
|
|
Re: [jira] Created: (CAMEL-1392) groovy rendererAfter some discuss with Janstey, I know the web editor is working for changing the existing route, not for router development. The duty of creating bean may be dropped on groovy editor.
|
|
|
Re: [jira] Commented: (CAMEL-1392) groovy renderergroovyRenderer now needs a lot of work on string processing and can't deal with some complicated expressions. If the xxxDefinition provides a toString() method which presents a DSL-style string, the rendering work will be much easier. If it is determined, I will do this work.
|
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererOn Tue, Jul 7, 2009 at 9:57 AM, alloyer<alloyer@...> wrote:
> > groovyRenderer now need a lot of work on string processing and can't deal > with some complicated expressions. If the xxxDefinition classes provide a > toString() method which presents a DSL-style string, the rendering work will > be much easier. If it is determined, I will do this work. Hi Could you post a sample of this problem / issue. Its much easier to understand and discuss with a sample to make the problem more clearer for us. > > Claus Ibsen-2 wrote: >> >> >> I do wonder if we should by default change the toString() in the >> xxxDefinition to be more Java DSL like so its easier to read the >> route. >> >> >> On Sat, Jul 4, 2009 at 11:32 AM, Claus Ibsen<claus.ibsen@...> wrote: >>> Hi >>> >>> I loaded the RandomLoadBalanceTest unit test from camel-core and put a >>> break point at >>> assertMockEndpointsSatisfied(); >>> >>> And then inspected the CameContext and its getRouteDefinitions(). >>> See attached picture from the debugger, shows the object graph and the >>> types it has a runtime. >>> >>> Maybe you need a getLoadBalancer() without a parameter. But try with >>> getLoadBalancer(null) in the class LoadBalancerDefinition as it should >>> have been created. Notice its the load balancer definition with R that >>> can return the specific type. >>> >>> >>> >>> On Sat, Jul 4, 2009 at 11:07 AM, alloyer<alloyer@...> wrote: >>>> >>>> The getLoadBalancerType don't return null but the getAnnotation(). >>>> The getLoadBalancerType return a LoadBalancerDefinition instance, which >>>> I >>>> think should be a >>>> RandomLoadBalancerdefinition one. >>>> >>>> The dsl is: from("direct:start").loadBalance().random().to("mock:x", >>>> "mock:y", "mock:z") >>>> >>>> >>>> Claus Ibsen-2 wrote: >>>>> >>>>> On Sat, Jul 4, 2009 at 8:16 AM, alloyer<alloyer@...> wrote: >>>>>> >>>>>> Grabbing name from dataFormat type works fine. >>>>>> But when I use it on loadBalancer type, it throws a null pointer >>>>>> exception. >>>>>> >>>>>> >>>>>> loadBalanceDefinition.getLoadBalancerType().getClass().getAnnotation(XmlRootElement.class) >>>>>> throws the exception. >>>>>> >>>>> >>>>> I think its because you use ref to lookup the definition in the >>>>> registry. >>>>> Then when Camel builds the runtime route it will lookup the real load >>>>> balancer and use it. >>>>> >>>>> So if getLoadBalancerType returns null then try checking getRef and >>>>> see if you can lookup this bean in the registry >>>>> >>>>> >>>>> >>>>> What does the route DSL looks like? >>>>> >>>>>> >>>>>> JIRA jira@... wrote: >>>>>>> >>>>>>> >>>>>>> [ >>>>>>> https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52687#action_52687 >>>>>>> ] >>>>>>> >>>>>>> Jonathan Anstey commented on CAMEL-1392: >>>>>>> ---------------------------------------- >>>>>>> >>>>>>> Also, instead of duplicating the dataformat types (and loadbalancer >>>>>>> types >>>>>>> too), you should be able to grab the short names through the JAXB >>>>>>> metadata. Like so >>>>>>> >>>>>>> {code} >>>>>>> dataFormat.getClass().getAnnotation(XmlRootElement.class).name() >>>>>>> {code} >>>>>>> >>>>>>>> groovy renderer >>>>>>>> --------------- >>>>>>>> >>>>>>>> Key: CAMEL-1392 >>>>>>>> URL: >>>>>>>> https://issues.apache.org/activemq/browse/CAMEL-1392 >>>>>>>> Project: Apache Camel >>>>>>>> Issue Type: Sub-task >>>>>>>> Reporter: James Strachan >>>>>>>> Assignee: Xueqiang Mi >>>>>>>> Attachments: camel-web-20090629.patch, >>>>>>>> camel-web-20090703.patch >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> This message is automatically generated by JIRA. >>>>>>> - >>>>>>> You can reply to this email to add a comment to the issue online. >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24331647.html >>>>>> Sent from the Camel Development mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Claus Ibsen >>>>> Apache Camel Committer >>>>> >>>>> Open Source Integration: http://fusesource.com >>>>> Blog: http://davsclaus.blogspot.com/ >>>>> Twitter: http://twitter.com/davsclaus >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24332317.html >>>> Sent from the Camel Development mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24368755.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendereryep, a sample is as follows:
when rendering such a DSL: from("direct:start").filter(header("foo").isEqualTo("bar")).to("mock:result") the "from" and "to" are easy to handle, but the "filter" definition maintains a {header(foo) == bar} predicate for (header("foo").isEqualTo("bar")). So I have to generate the expected (header("foo").isEqualTo("bar")) by converting {header(foo) == bar}, the method is shown below: {code} // pre is grabbed by using the toString of the predicate pre = pre.replaceAll("\\(", "(\"").replaceAll("\\)", "\")"); String rightExp = pre.substring(pre.indexOf(" ") + 1); if (rightExp.startsWith("==")) { pre = pre.replaceFirst("\\ == ", ".isEqualTo(\""); pre += ")"; } else if (rightExp.startsWith("is not null")) { pre = pre.replaceFirst("\\ is not null", ".isNotNull()"); } buffer.append("(").append(pre).append(")"); {code} In this sample, the filter uses a predicate as parameter, and it also can use a xpath or other expression as its parameter, so in the filter processing part, I have to judge several conditions: {code} if (expression.getPredicate() != null) { PredicateRenderer.renderPredicate(buffer, expression.getPredicate()); } else if (expression.getLanguage() != null) { buffer.append("().").append(expression.getLanguage()) .append("(\"").append(expression.getExpression().toString()).append("\")"); } {code}
|
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererHi,
xxxDefinition classes has the toString() method, which is useful for tracing the message. I don't know if it can help your Groovy rendering. Willem alloyer wrote: > groovyRenderer now need a lot of work on string processing and can't deal > with some complicated expressions. If the xxxDefinition classes provide a > toString() method which presents a DSL-style string, the rendering work will > be much easier. If it is determined, I will do this work. > > Claus Ibsen-2 wrote: >> >> I do wonder if we should by default change the toString() in the >> xxxDefinition to be more Java DSL like so its easier to read the >> route. >> >> >> On Sat, Jul 4, 2009 at 11:32 AM, Claus Ibsen<claus.ibsen@...> wrote: >>> Hi >>> >>> I loaded the RandomLoadBalanceTest unit test from camel-core and put a >>> break point at >>> assertMockEndpointsSatisfied(); >>> >>> And then inspected the CameContext and its getRouteDefinitions(). >>> See attached picture from the debugger, shows the object graph and the >>> types it has a runtime. >>> >>> Maybe you need a getLoadBalancer() without a parameter. But try with >>> getLoadBalancer(null) in the class LoadBalancerDefinition as it should >>> have been created. Notice its the load balancer definition with R that >>> can return the specific type. >>> >>> >>> >>> On Sat, Jul 4, 2009 at 11:07 AM, alloyer<alloyer@...> wrote: >>>> The getLoadBalancerType don't return null but the getAnnotation(). >>>> The getLoadBalancerType return a LoadBalancerDefinition instance, which >>>> I >>>> think should be a >>>> RandomLoadBalancerdefinition one. >>>> >>>> The dsl is: from("direct:start").loadBalance().random().to("mock:x", >>>> "mock:y", "mock:z") >>>> >>>> >>>> Claus Ibsen-2 wrote: >>>>> On Sat, Jul 4, 2009 at 8:16 AM, alloyer<alloyer@...> wrote: >>>>>> Grabbing name from dataFormat type works fine. >>>>>> But when I use it on loadBalancer type, it throws a null pointer >>>>>> exception. >>>>>> >>>>>> >>>>>> loadBalanceDefinition.getLoadBalancerType().getClass().getAnnotation(XmlRootElement.class) >>>>>> throws the exception. >>>>>> >>>>> I think its because you use ref to lookup the definition in the >>>>> registry. >>>>> Then when Camel builds the runtime route it will lookup the real load >>>>> balancer and use it. >>>>> >>>>> So if getLoadBalancerType returns null then try checking getRef and >>>>> see if you can lookup this bean in the registry >>>>> >>>>> >>>>> >>>>> What does the route DSL looks like? >>>>> >>>>>> JIRA jira@... wrote: >>>>>>> >>>>>>> [ >>>>>>> https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52687#action_52687 >>>>>>> ] >>>>>>> >>>>>>> Jonathan Anstey commented on CAMEL-1392: >>>>>>> ---------------------------------------- >>>>>>> >>>>>>> Also, instead of duplicating the dataformat types (and loadbalancer >>>>>>> types >>>>>>> too), you should be able to grab the short names through the JAXB >>>>>>> metadata. Like so >>>>>>> >>>>>>> {code} >>>>>>> dataFormat.getClass().getAnnotation(XmlRootElement.class).name() >>>>>>> {code} >>>>>>> >>>>>>>> groovy renderer >>>>>>>> --------------- >>>>>>>> >>>>>>>> Key: CAMEL-1392 >>>>>>>> URL: >>>>>>>> https://issues.apache.org/activemq/browse/CAMEL-1392 >>>>>>>> Project: Apache Camel >>>>>>>> Issue Type: Sub-task >>>>>>>> Reporter: James Strachan >>>>>>>> Assignee: Xueqiang Mi >>>>>>>> Attachments: camel-web-20090629.patch, >>>>>>>> camel-web-20090703.patch >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> This message is automatically generated by JIRA. >>>>>>> - >>>>>>> You can reply to this email to add a comment to the issue online. >>>>>>> >>>>>>> >>>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24331647.html >>>>>> Sent from the Camel Development mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Claus Ibsen >>>>> Apache Camel Committer >>>>> >>>>> Open Source Integration: http://fusesource.com >>>>> Blog: http://davsclaus.blogspot.com/ >>>>> Twitter: http://twitter.com/davsclaus >>>>> >>>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24332317.html >>>> Sent from the Camel Development mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > |
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendereryeah, I am now using the toString() method to render the route on some
xxxDefinitions, but I am still not sure whether the renderer can deal with a sufficient complicated expression through this method. I am a little worried about the renderer's handling with some incidental interminable DSL.
|
|
|
Re: [jira] Commented: (CAMEL-1392) groovy rendererSo yeah, rendering languages that we input as a String (i.e. XPath, EL,
etc.) is easy since we have the language text available. The toString operations on PredicateBuilders on the other hand don't return exactly what was used to create them. Like you mentioned, header("foo").isEqualTo("bar") returns header(foo) == bar, which is not very helpful to you. So, you could provide a patch to the toString methods for the PredicateBuilders so that they return something like header("foo").isEqualTo("bar") instead of header(foo) == bar. Though this is not as nice looking for the tracing feature IMO. What do others think of this change? On Tue, Jul 7, 2009 at 8:52 AM, alloyer <alloyer@...> wrote: > > yeah, I am now using the toString() method to render the route on some > xxxDefinitions, but I am still not sure whether the renderer can deal with > a sufficient complicated expression through this method. I am a little > worried > about the renderer's handling with some incidental interminable DSL. > > > willem.jiang wrote: > > > > Hi, > > > > xxxDefinition classes has the toString() method, which is useful for > > tracing the message. > > > > I don't know if it can help your Groovy rendering. > > > > Willem > > > > alloyer wrote: > >> groovyRenderer now need a lot of work on string processing and can't > deal > >> with some complicated expressions. If the xxxDefinition classes provide > a > >> toString() method which presents a DSL-style string, the rendering work > >> will > >> be much easier. If it is determined, I will do this work. > >> > >> Claus Ibsen-2 wrote: > >>> > >>> I do wonder if we should by default change the toString() in the > >>> xxxDefinition to be more Java DSL like so its easier to read the > >>> route. > >>> > >>> > >>> On Sat, Jul 4, 2009 at 11:32 AM, Claus Ibsen<claus.ibsen@...> > >>> wrote: > >>>> Hi > >>>> > >>>> I loaded the RandomLoadBalanceTest unit test from camel-core and put a > >>>> break point at > >>>> assertMockEndpointsSatisfied(); > >>>> > >>>> And then inspected the CameContext and its getRouteDefinitions(). > >>>> See attached picture from the debugger, shows the object graph and the > >>>> types it has a runtime. > >>>> > >>>> Maybe you need a getLoadBalancer() without a parameter. But try with > >>>> getLoadBalancer(null) in the class LoadBalancerDefinition as it should > >>>> have been created. Notice its the load balancer definition with R that > >>>> can return the specific type. > >>>> > >>>> > >>>> > >>>> On Sat, Jul 4, 2009 at 11:07 AM, alloyer<alloyer@...> wrote: > >>>>> The getLoadBalancerType don't return null but the getAnnotation(). > >>>>> The getLoadBalancerType return a LoadBalancerDefinition instance, > >>>>> which > >>>>> I > >>>>> think should be a > >>>>> RandomLoadBalancerdefinition one. > >>>>> > >>>>> The dsl is: from("direct:start").loadBalance().random().to("mock:x", > >>>>> "mock:y", "mock:z") > >>>>> > >>>>> > >>>>> Claus Ibsen-2 wrote: > >>>>>> On Sat, Jul 4, 2009 at 8:16 AM, alloyer<alloyer@...> wrote: > >>>>>>> Grabbing name from dataFormat type works fine. > >>>>>>> But when I use it on loadBalancer type, it throws a null pointer > >>>>>>> exception. > >>>>>>> > >>>>>>> > >>>>>>> > loadBalanceDefinition.getLoadBalancerType().getClass().getAnnotation(XmlRootElement.class) > >>>>>>> throws the exception. > >>>>>>> > >>>>>> I think its because you use ref to lookup the definition in the > >>>>>> registry. > >>>>>> Then when Camel builds the runtime route it will lookup the real > load > >>>>>> balancer and use it. > >>>>>> > >>>>>> So if getLoadBalancerType returns null then try checking getRef and > >>>>>> see if you can lookup this bean in the registry > >>>>>> > >>>>>> > >>>>>> > >>>>>> What does the route DSL looks like? > >>>>>> > >>>>>>> JIRA jira@... wrote: > >>>>>>>> > >>>>>>>> [ > >>>>>>>> > https://issues.apache.org/activemq/browse/CAMEL-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52687#action_52687 > >>>>>>>> ] > >>>>>>>> > >>>>>>>> Jonathan Anstey commented on CAMEL-1392: > >>>>>>>> ---------------------------------------- > >>>>>>>> > >>>>>>>> Also, instead of duplicating the dataformat types (and > loadbalancer > >>>>>>>> types > >>>>>>>> too), you should be able to grab the short names through the JAXB > >>>>>>>> metadata. Like so > >>>>>>>> > >>>>>>>> {code} > >>>>>>>> dataFormat.getClass().getAnnotation(XmlRootElement.class).name() > >>>>>>>> {code} > >>>>>>>> > >>>>>>>>> groovy renderer > >>>>>>>>> --------------- > >>>>>>>>> > >>>>>>>>> Key: CAMEL-1392 > >>>>>>>>> URL: > >>>>>>>>> https://issues.apache.org/activemq/browse/CAMEL-1392 > >>>>>>>>> Project: Apache Camel > >>>>>>>>> Issue Type: Sub-task > >>>>>>>>> Reporter: James Strachan > >>>>>>>>> Assignee: Xueqiang Mi > >>>>>>>>> Attachments: camel-web-20090629.patch, > >>>>>>>>> camel-web-20090703.patch > >>>>>>>>> > >>>>>>>>> > >>>>>>>> > >>>>>>>> -- > >>>>>>>> This message is automatically generated by JIRA. > >>>>>>>> - > >>>>>>>> You can reply to this email to add a comment to the issue online. > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>> -- > >>>>>>> View this message in context: > >>>>>>> > http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24331647.html > >>>>>>> Sent from the Camel Development mailing list archive at Nabble.com. > >>>>>>> > >>>>>>> > >>>>>> > >>>>>> > >>>>>> -- > >>>>>> Claus Ibsen > >>>>>> Apache Camel Committer > >>>>>> > >>>>>> Open Source Integration: http://fusesource.com > >>>>>> Blog: http://davsclaus.blogspot.com/ > >>>>>> Twitter: http://twitter.com/davsclaus > >>>>>> > >>>>>> > >>>>> -- > >>>>> View this message in context: > >>>>> > http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24332317.html > >>>>> Sent from the Camel Development mailing list archive at Nabble.com. > >>>>> > >>>>> > >>>> > >>>> > >>>> -- > >>>> Claus Ibsen > >>>> Apache Camel Committer > >>>> > >>>> Open Source Integration: http://fusesource.com > >>>> Blog: http://davsclaus.blogspot.com/ > >>>> Twitter: http://twitter.com/davsclaus > >>>> > >>> > >>> > >>> -- > >>> Claus Ibsen > >>> Apache Camel Committer > >>> > >>> Open Source Integration: http://fusesource.com > >>> Blog: http://davsclaus.blogspot.com/ > >>> Twitter: http://twitter.com/davsclaus > >>> > >>> > >> > > > > > > > > -- > View this message in context: > http://www.nabble.com/-jira--Created%3A-%28CAMEL-1392%29-groovy-renderer-tp22220288p24371507.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Cheers, Jon http://janstey.blogspot.com/ |
| < Prev | 1 - 2 - 3 - 4 - 5 - 6 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |