camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Camel > Unsupported Groovy DSL Features on Web Console
Date Thu, 03 Sep 2009 14:37:01 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="">Unsupported
Groovy DSL Features on Web Console</a></h2>
    <h4>Page  <b>added</b> by             <a href="">Xueqiang
    <div class="notificationGreySide">
         <h2><a name="UnsupportedGroovyDSLFeaturesonWebConsole-UnsupportedGroovyDSLFeaturesonWebConsole"></a>Unsupported
Groovy DSL Features on Web Console</h2>

<p>Most of the DSL features have been supported on <a href="/confluence/display/CAMEL/Web+Console"
title="Web Console">Web Console</a>, so you can view and edit in an easy way. However,
<a href="/confluence/display/CAMEL/Web+Console" title="Web Console">Web Console</a>
doesn't support all the features that you can get from an IDE. Here will list and explain
the unsupported features, including the reason for giving up them, alternative solutions or
some suggestion for those who indeed need to extend them.</p>

<h3><a name="UnsupportedGroovyDSLFeaturesonWebConsole-UnsupportedFeaturesList"></a>Unsupported
Features List</h3>

<h4><a name="UnsupportedGroovyDSLFeaturesonWebConsole-creatingnewclasses"></a>creating
new classes</h4>

<p>When writing a route in Java DSL, we often create new classes. For example, we may
create a processor as follows:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"direct:start"</span>).process(<span class="code-keyword">new</span>
Processor() {
     <span class="code-keyword">public</span> void process(Exchange exchange)
          Message in = exchange.getIn();
          in.setBody(in.getBody(<span class="code-object">String</span>.class)
+ <span class="code-quote">" World!"</span>);
}).to(<span class="code-quote">"mock:result"</span>);
<p>Here an anonymous inner class is created to process the message. But this feature
is not supported on <a href="/confluence/display/CAMEL/Web+Console" title="Web Console">Web
Console</a> since it use a groovy class loader to parse the route content and you should
use groovy grammar to build the processor. <br/>
Using a bundle of anonymous inner classes may cause you to lost the route definition after
creating them because <a href="/confluence/display/CAMEL/Web+Console" title="Web Console">Web
Console</a> can't render them in the view/edit operations.</p>

	<li>happen to: aggregate, bean, process, etc.</li>
	<li>alternative solution: you should build the processors externally, register them
on <a href="/confluence/pages/createpage.action?spaceKey=CAMEL&amp;title=Camel+Context&amp;linkCreation=true&amp;fromPageId=2853162"
class="createlink">Camel Context</a> and then you can use them by using beanRef or
processRef DSL. For such an example, you should refer <a href="/confluence/display/CAMEL/Content+Based+Routing+on+Camel"
title="Content Based Routing on Camel">Content Based Routing on Camel</a>.</li>

<h4><a name="UnsupportedGroovyDSLFeaturesonWebConsole-invokingunimportedclassse"></a>invoking
un-imported classse </h4>

<p>This feature also appears frequently. In the try...catch DSL or onException DSL,
we may use some external or custom exception classes. But current groovy renderer doesn't
process the import packages, so if you should manually add the import lines each time you
edit it.</p>

	<li>happen to: doTry...doCatch(...doFinally), onException, throwException, etc.</li>
	<li>improving suggestion: let groovy renderer add the import packages automatically,
but I am afraid it can't process them at all times.</li>

<h4><a name="UnsupportedGroovyDSLFeaturesonWebConsole-otherfeatures"></a>other

<p>Some expression and predicate have complex and refractory toString method, so the
ExpressionRenderer and PredicateRenderer class written a little hard.</p>

    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message