camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r849920 - in /websites/production/camel/content: book-in-one-page.html cache/main.pageCache camel-30-ideas.html
Date Fri, 08 Feb 2013 16:26:48 GMT
Author: buildbot
Date: Fri Feb  8 16:26:48 2013
New Revision: 849920

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/book-in-one-page.html
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/camel-30-ideas.html

Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Fri Feb  8 16:26:48 2013
@@ -34328,6 +34328,192 @@ location=<span class="code-quote">"bluep
 <p>Each location is separated by comma.</p>
 
 
+<h4><a shape="rect" name="BookInOnePage-OverridingBlueprintpropertyplaceholdersoutsideCamelContext"></a>Overriding
Blueprint property placeholders outside CamelContext</h4>
+<p><b>Available as of Camel 2.10.4</b></p>
+
+<p>When using Blueprint property placeholder in the Blueprint XML file, you can declare
the properties directly in the XML file as shown below:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-xml"><span class="code-tag"><span class="code-comment">&lt;!--
blueprint property placeholders --&gt;</span></span>
+<span class="code-tag">&lt;cm:property-placeholder persistent-id=<span class="code-quote">"my-placeholders"</span>&gt;</span>
+  <span class="code-tag">&lt;cm:default-properties&gt;</span>
+    <span class="code-tag">&lt;cm:property name=<span class="code-quote">"greeting"</span>
value=<span class="code-quote">"Hello"</span>/&gt;</span>
+    <span class="code-tag">&lt;cm:property name=<span class="code-quote">"destination"</span>
value=<span class="code-quote">"mock:result"</span>/&gt;</span>
+  <span class="code-tag">&lt;/cm:default-properties&gt;</span>
+<span class="code-tag">&lt;/cm:property-placeholder&gt;</span>
+
+<span class="code-tag"><span class="code-comment">&lt;!-- a bean that uses
a blueprint property placeholder --&gt;</span></span>
+<span class="code-tag">&lt;bean id=<span class="code-quote">"myCoolBean"</span>
class=<span class="code-quote">"org.apache.camel.test.blueprint.MyCoolBean"</span>&gt;</span>
+  <span class="code-tag">&lt;property name=<span class="code-quote">"say"</span>
value=<span class="code-quote">"${greeting}"</span>/&gt;</span>
+<span class="code-tag">&lt;/bean&gt;</span>
+
+<span class="code-tag">&lt;camelContext xmlns=<span class="code-quote">"http://camel.apache.org/schema/blueprint"</span>&gt;</span>
+
+  <span class="code-tag">&lt;route&gt;</span>
+    <span class="code-tag">&lt;from uri=<span class="code-quote">"direct:start"</span>/&gt;</span>
+    <span class="code-tag">&lt;bean ref=<span class="code-quote">"myCoolBean"</span>
method=<span class="code-quote">"saySomething"</span>/&gt;</span>
+    <span class="code-tag">&lt;to uri=<span class="code-quote">"{{destination}}"</span>/&gt;</span>
+  <span class="code-tag">&lt;/route&gt;</span>
+
+<span class="code-tag">&lt;/camelContext&gt;</span>
+</pre>
+</div></div>
+
+<p>Notice that we have a &lt;bean&gt; which refers to one of the properties.
And in the Camel route we refer to the other using the {{ }} notation.</p>
+
+<p>Now if you want to override these Blueprint properties from an unit test, you can
do this as shown below:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Override
+<span class="code-keyword">protected</span> <span class="code-object">String</span>
useOverridePropertiesWithConfigAdmin(Dictionary props) {
+    <span class="code-comment">// add the properties we want to override
+</span>    props.put(<span class="code-quote">"greeting"</span>, <span
class="code-quote">"Bye"</span>);
+
+    <span class="code-comment">// <span class="code-keyword">return</span>
the PID of the config-admin we are using in the blueprint xml file
+</span>    <span class="code-keyword">return</span> <span class="code-quote">"my-placeholders"</span>;
+}
+</pre>
+</div></div>
+
+<p>To do this we override and implement the <tt>useOverridePropertiesWithConfigAdmin</tt>
method. We can then put the properties we want to override on the given props parameter. And
the return value <b>must</b> be the persistence-id of the &lt;cm:property-placeholder&gt;
tag, which you define in the blueprint XML file.</p>
+
+<h4><a shape="rect" name="BookInOnePage-Using.cfgor.propertiesfileforBlueprintpropertyplaceholders"></a>Using
.cfg or .properties file for Blueprint property placeholders</h4>
+<p><b>Available as of Camel 2.10.4</b></p>
+
+<p>When using Blueprint property placeholder in the Blueprint XML file, you can declare
the properties in a .properties or .cfg file. If you use Apache ServieMix / Karaf then this
container has a convention that it loads the properties from a file in the etc directory with
the naming etc/pid.cfg, where pid is the persistence-id.</p>
+
+<p>For example in the blueprint XML file we have the persistence-id="stuff", which
mean it will load the configuration file as etc/stuff.cfg.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-xml"><span class="code-tag"><span class="code-comment">&lt;!--
blueprint property placeholders, that will use etc/stuff.cfg as the properties file --&gt;</span></span>
+<span class="code-tag">&lt;cm:property-placeholder persistent-id=<span class="code-quote">"stuff"</span>/&gt;</span>
+
+<span class="code-tag"><span class="code-comment">&lt;!-- a bean that uses
a blueprint property placeholder --&gt;</span></span>
+<span class="code-tag">&lt;bean id=<span class="code-quote">"myCoolBean"</span>
class=<span class="code-quote">"org.apache.camel.test.blueprint.MyCoolBean"</span>&gt;</span>
+  <span class="code-tag">&lt;property name=<span class="code-quote">"say"</span>
value=<span class="code-quote">"${greeting}"</span>/&gt;</span>
+<span class="code-tag">&lt;/bean&gt;</span>
+
+<span class="code-tag">&lt;camelContext xmlns=<span class="code-quote">"http://camel.apache.org/schema/blueprint"</span>&gt;</span>
+
+  <span class="code-tag">&lt;route&gt;</span>
+    <span class="code-tag">&lt;from uri=<span class="code-quote">"direct:start"</span>/&gt;</span>
+    <span class="code-tag">&lt;bean ref=<span class="code-quote">"myCoolBean"</span>
method=<span class="code-quote">"saySomething"</span>/&gt;</span>
+    <span class="code-tag">&lt;to uri=<span class="code-quote">"mock:result"</span>/&gt;</span>
+  <span class="code-tag">&lt;/route&gt;</span>
+
+<span class="code-tag">&lt;/camelContext&gt;</span>
+</pre>
+</div></div>
+
+<p>Now if you want to unit test this blueprint XML file, then you can override the
<tt>loadConfigAdminConfigurationFile</tt> and tell Camel which file to load as
shown below:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">@Override
+<span class="code-keyword">protected</span> <span class="code-object">String</span>[]
loadConfigAdminConfigurationFile() {
+    <span class="code-comment">// <span class="code-object">String</span>[0]
= tell Camel the path of the .cfg file to use <span class="code-keyword">for</span>
OSGi ConfigAdmin in the blueprint XML file
+</span>    <span class="code-comment">// <span class="code-object">String</span>[1]
= tell Camel the persistence-id of the cm:property-placeholder in the blueprint XML file
+</span>    <span class="code-keyword">return</span> <span class="code-keyword">new</span>
<span class="code-object">String</span>[]{<span class="code-quote">"src/test/resources/etc/stuff.cfg"</span>,
<span class="code-quote">"stuff"</span>};
+}
+</pre>
+</div></div>
+
+<p>Notice that this method requires to return a String[] with 2 values. The 1st value
is the path for the configuration file to load.<br clear="none">
+The 2nd value is the persistence-id of the &lt;cm:property-placeholder&gt; tag.</p>
+
+<p>The stuff.cfg file is just a plain properties file with the property placeholders
such as:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+## <span class="code-keyword">this</span> is a comment
+greeting=Bye
+</pre>
+</div></div>
+
+
+<h4><a shape="rect" name="BookInOnePage-Using.cfgfileandoverridingpropertiesforBlueprintpropertyplaceholders"></a>Using
.cfg file and overriding properties for Blueprint property placeholders</h4>
+
+<p>You can do both as well. Here is a complete example. First we have the Blueprint
XML file:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-xml">&lt;blueprint xmlns=<span class="code-quote">"http://www.osgi.org/xmlns/blueprint/v1.0.0"</span>
+           <span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
+           <span class="code-keyword">xmlns:cm</span>=<span class="code-quote">"http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"</span>
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"&gt;
+
+  <span class="code-tag"><span class="code-comment">&lt;!-- blueprint property
placeholders, that will use etc/stuff.cfg as the properties file --&gt;</span></span>
+  <span class="code-tag">&lt;cm:property-placeholder persistent-id=<span class="code-quote">"stuff"</span>/&gt;</span>
+
+  <span class="code-tag"><span class="code-comment">&lt;!-- a bean that uses
a blueprint property placeholder --&gt;</span></span>
+  <span class="code-tag">&lt;bean id=<span class="code-quote">"myCoolBean"</span>
class=<span class="code-quote">"org.apache.camel.test.blueprint.MyCoolBean"</span>&gt;</span>
+    <span class="code-tag">&lt;property name=<span class="code-quote">"say"</span>
value=<span class="code-quote">"${greeting}"</span>/&gt;</span>
+    <span class="code-tag">&lt;property name=<span class="code-quote">"echo"</span>
value=<span class="code-quote">"${echo}"</span>/&gt;</span>
+  <span class="code-tag">&lt;/bean&gt;</span>
+
+  <span class="code-tag">&lt;camelContext xmlns=<span class="code-quote">"http://camel.apache.org/schema/blueprint"</span>&gt;</span>
+
+    <span class="code-tag">&lt;route&gt;</span>
+      <span class="code-tag">&lt;from uri=<span class="code-quote">"direct:start"</span>/&gt;</span>
+      <span class="code-tag">&lt;bean ref=<span class="code-quote">"myCoolBean"</span>
method=<span class="code-quote">"saySomething"</span>/&gt;</span>
+      <span class="code-tag">&lt;to uri=<span class="code-quote">"{{destination}}"</span>/&gt;</span>
+      <span class="code-tag">&lt;bean ref=<span class="code-quote">"myCoolBean"</span>
method=<span class="code-quote">"echoSomething"</span>/&gt;</span>
+      <span class="code-tag">&lt;to uri=<span class="code-quote">"{{destination}}"</span>/&gt;</span>
+    <span class="code-tag">&lt;/route&gt;</span>
+
+  <span class="code-tag">&lt;/camelContext&gt;</span>
+
+<span class="code-tag">&lt;/blueprint&gt;</span>
+</pre>
+</div></div>
+
+<p>And in the unit test class we do as follows:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">/**
+ * This example will load a Blueprint .cfdg file, and also override its property placeholders
from <span class="code-keyword">this</span> unit test
+ * source code directly.
+ */
+<span class="code-keyword">public</span> class ConfigAdminLoadConfigurationFileAndOverrideTest
<span class="code-keyword">extends</span> CamelBlueprintTestSupport {
+
+    @Override
+    <span class="code-keyword">protected</span> <span class="code-object">String</span>
getBlueprintDescriptor() {
+        <span class="code-comment">// which blueprint XML file to use <span class="code-keyword">for</span>
<span class="code-keyword">this</span> test
+</span>        <span class="code-keyword">return</span> <span class="code-quote">"org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml"</span>;
+    }
+
+    @Override
+    <span class="code-keyword">protected</span> <span class="code-object">String</span>[]
loadConfigAdminConfigurationFile() {
+        <span class="code-comment">// which .cfg file to use, and the name of the persistence-id
+</span>        <span class="code-keyword">return</span> <span class="code-keyword">new</span>
<span class="code-object">String</span>[]{<span class="code-quote">"src/test/resources/etc/stuff.cfg"</span>,
<span class="code-quote">"stuff"</span>};
+    }
+
+    @Override
+    <span class="code-keyword">protected</span> <span class="code-object">String</span>
useOverridePropertiesWithConfigAdmin(Dictionary props) <span class="code-keyword">throws</span>
Exception {
+        <span class="code-comment">// override / add extra properties
+</span>        props.put(<span class="code-quote">"destination"</span>,
<span class="code-quote">"mock:extra"</span>);
+
+        <span class="code-comment">// <span class="code-keyword">return</span>
the persistence-id to use
+</span>        <span class="code-keyword">return</span> <span class="code-quote">"stuff"</span>;
+    }
+
+    @Test
+    <span class="code-keyword">public</span> void testConfigAdmin() <span
class="code-keyword">throws</span> Exception {
+        <span class="code-comment">// regular unit test method
+</span>        getMockEndpoint(<span class="code-quote">"mock:extra"</span>).expectedBodiesReceived(<span
class="code-quote">"Bye World"</span>, <span class="code-quote">"Yay Bye WorldYay
Bye World"</span>);
+
+        template.sendBody(<span class="code-quote">"direct:start"</span>, <span
class="code-quote">"World"</span>);
+
+        assertMockEndpointsSatisfied();
+    }
+
+}
+</pre>
+</div></div>
+
+<p>And the <tt>etc/stuff.cfg</tt> configuration file contains</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+greeting=Bye
+echo=Yay
+destination=mock:result
+</pre>
+</div></div>
+
+
 <h3><a shape="rect" name="BookInOnePage-BridgingSpringandCamelpropertyplaceholders"></a>Bridging
Spring and Camel property placeholders</h3>
 <p><b>Available as of Camel 2.10</b></p>
 
@@ -34396,7 +34582,6 @@ This is now possible from Camel 2.10 onw
 
 <p>The <tt>ignoreMissingLocationWithPropertiesComponent</tt> can be used
to instruct Camel to ignore any locations which was not discoverable, for example if you run
the unit test, in an environment that does not have access to the location of the properties.
</p>
 
-
 <h3><a shape="rect" name="BookInOnePage-SeeAlso"></a>See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html" title="Configuring Camel">Configuring
Camel</a></li><li><a shape="rect" href="component.html" title="Component">Component</a></li><li><a
shape="rect" href="endpoint.html" title="Endpoint">Endpoint</a></li><li><a
shape="rect" href="getting-started.html" title="Getting Started">Getting Started</a></li></ul>
 

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/camel-30-ideas.html
==============================================================================
--- websites/production/camel/content/camel-30-ideas.html (original)
+++ websites/production/camel/content/camel-30-ideas.html Fri Feb  8 16:26:48 2013
@@ -181,12 +181,13 @@ AMQ is also using older Jetty, but that 
 <h4><a shape="rect" name="Camel3.0-Ideas-Removenotusedcomponents"></a>Remove
not used components</h4>
 
 <p>We should consider removing</p>
-<ul class="alternate" type="square"><li>camel-bam</li><li>org.apache.camel.view
from came-core</li><li>dot maven generator</li><li>... (there could
be other stuff to remove)</li></ul>
+<ul class="alternate" type="square"><li>camel-bam</li><li>camel-msv</li><li>org.apache.camel.view
from came-core</li><li>dot maven generator</li><li>... (there could
be other stuff to remove)</li></ul>
 
 
 <p>The BAM has not changed in 5 years, and very seldom used by end users. And neither
has the functionality you need. There is much better solutions outside ASF Camel for a BAM
solution.<br clear="none">
 The DOT generator is not up to date and maintained. Also it requires binary generator to
generate a route diagram; we never managed to find a good java library for that.</p>
 
+<p>The MSV component is never/rarely used, and is causing some issues for cutting releases,
due some weird maven issues / download of JARs etc. And the codebase has basically been left
unchanged for 5+ years now.</p>
 
 
 <h3><a shape="rect" name="Camel3.0-Ideas-Oldideas"></a>Old ideas</h3>



Mime
View raw message