Author: buildbot Date: Wed Feb 1 21:20:51 2017 New Revision: 1006058 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/book-component-appendix.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/properties.html websites/production/camel/content/using-propertyplaceholder.html Modified: websites/production/camel/content/book-component-appendix.html ============================================================================== --- websites/production/camel/content/book-component-appendix.html (original) +++ websites/production/camel/content/book-component-appendix.html Wed Feb 1 21:20:51 2017 @@ -621,8 +621,8 @@ cometds://localhost:8443/service/mychann <div class="confluence-information-macro-body"> <p>When using CXF in streaming modes (see DataFormat option), then also read about <a shape="rect" href="stream-caching.html">Stream caching</a>.</p> </div> -</div><p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/**/ div.rbtoc1485973067488 {padding: 0px;} div.rbtoc1485973067488 ul {list-style: disc;margin-left: 0px;} div.rbtoc1485973067488 li {margin-left: 0px;padding-left: 0px;} /**/</style> - </p><div class="toc-macro rbtoc1485973067488"> +</div><p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/**/ div.rbtoc1485983924092 {padding: 0px;} div.rbtoc1485983924092 ul {list-style: disc;margin-left: 0px;} div.rbtoc1485983924092 li {margin-left: 0px;padding-left: 0px;} /**/</style> + </p><div class="toc-macro rbtoc1485983924092"> <ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-CXFComponent">CXF Component</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-URIformat">URI format</a></li><li><a shape="rect" href="#BookComponentAppendix-Options">Options</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookComponentAppendix-Thedescriptionsofthedataformats">The descriptions of the dataformats</a> @@ -4611,12 +4611,10 @@ cometds://localhost:8443/service/mychann </div> </div> <div> - <p> </p> <p>From<strong> Camel 2.19.0</strong>: you can set which location can be discarded if missing by setting  <strong><code>optional=true</code></strong>, (<strong><code>false</code></strong> by default).</p> <p>Example:</p> </div> <div> - <p> </p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">pc.setLocations(&quot;com/mycompany/override.properties;optional=true,com/mycompany/defaults.properties&quot;);</script> @@ -4772,7 +4770,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;blueprint xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0&quot; xsi:schemaLocation=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt; &lt;!-- OSGI blueprint property placeholder --&gt; &lt;cm:property-placeholder id=&quot;myblueprint.placeholder&quot; persistent-id=&quot;camel.blueprint&quot;&gt; &lt;!-- list some properties as needed --&gt; &lt;cm:default-properties&gt; &lt;cm:property name=&quot;result&quot; value=&quot;mock:result&quot;/&gt; &lt;/cm:default-properties&gt; &lt;/cm:property-placeholder&gt; &lt;camelContext xmlns=&quot;http://came l.apache.org/schema/blueprint&quot;&gt; &lt;!-- in the route we can use {{ }} placeholders which will lookup in blueprint as Camel will auto detect the OSGi blueprint property placeholder and use it --&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;mock:foo&quot;/&gt; &lt;to uri=&quot;{{result}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; &lt;/blueprint&gt;</script> </div> - </div><p><span style="line-height: 1.42857;"><br clear="none"></span></p><p><span style="line-height: 1.42857;">By default Camel detects and uses OSGi blueprint property placeholder service. You can disable this by setting the attribute </span><strong><code style="line-height: 1.42857;">useBlueprintPropertyResolver</code></strong><span style="line-height: 1.42857;"> to false on the </span><strong><code style="line-height: 1.42857;"><camelContext></code></strong><span style="line-height: 1.42857;"> definition.</span></p> + </div><p><span style="line-height: 1.42857;">By default Camel detects and uses OSGi blueprint property placeholder service. You can disable this by setting the attribute </span><strong><code style="line-height: 1.42857;">useBlueprintPropertyResolver</code></strong><span style="line-height: 1.42857;"> to false on the </span><strong><code style="line-height: 1.42857;"><camelContext></code></strong><span style="line-height: 1.42857;"> definition.</span></p> <div class="confluence-information-macro confluence-information-macro-information"> <p class="title">About placeholder syntaxes</p> <span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span> @@ -4784,7 +4782,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;blueprint xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0&quot; xsi:schemaLocation=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt; &lt;!-- OSGI blueprint property placeholder --&gt; &lt;cm:property-placeholder id=&quot;myblueprint.placeholder&quot; persistent-id=&quot;camel.blueprint&quot;&gt; &lt;!-- list some properties as needed --&gt; &lt;cm:default-properties&gt; &lt;cm:property name=&quot;prefix.result&quot; value=&quot;mock:result&quot;/&gt; &lt;/cm:default-properties&gt; &lt;/cm:property-placeholder&gt; &lt;camelContext xmlns=&quot;http ://camel.apache.org/schema/blueprint&quot;&gt; &lt;!-- using Camel properties component and refer to the blueprint property placeholder by its id --&gt; &lt;propertyPlaceholder id=&quot;properties&quot; location=&quot;blueprint:myblueprint.placeholder&quot; prefixToken=&quot;[[&quot; suffixToken=&quot;]]&quot; propertyPrefix=&quot;prefix.&quot;/&gt; &lt;!-- in the route we can use {{ }} placeholders which will lookup in blueprint --&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;mock:foo&quot;/&gt; &lt;to uri=&quot;[[result]]&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; &lt;/blueprint&gt;</script> </div> - </div><p> </p><p>Notice how we use the <strong><code>blueprint</code></strong> scheme to refer to the OSGi blueprint placeholder by its id. This allows you to mix and match, for example you can also have additional schemes in the location. For example to load a file from the classpath you can do:</p> + </div><p>Notice how we use the <strong><code>blueprint</code></strong> scheme to refer to the OSGi blueprint placeholder by its id. This allows you to mix and match, for example you can also have additional schemes in the location. For example to load a file from the classpath you can do:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">location=&quot;blueprint:myblueprint.placeholder,classpath:myproperties.properties&quot; </script> @@ -4794,22 +4792,22 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;!-- blueprint property placeholders --&gt; &lt;cm:property-placeholder persistent-id=&quot;my-placeholders&quot; update-strategy=&quot;reload&quot;&gt; &lt;cm:default-properties&gt; &lt;cm:property name=&quot;greeting&quot; value=&quot;Hello&quot;/&gt; &lt;cm:property name=&quot;destination&quot; value=&quot;mock:result&quot;/&gt; &lt;/cm:default-properties&gt; &lt;/cm:property-placeholder&gt; &lt;!-- a bean that uses a blueprint property placeholder --&gt; &lt;bean id=&quot;myCoolBean&quot; class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt; &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt; &lt;/bean&gt; &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;& gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt; &lt;to uri=&quot;{{destination}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; </script> </div> - </div> <p>Notice that we have a <strong><code><bean></code></strong> which refers to one of the properties. And in the Camel route we refer to the other using the <strong><code>{{ }}</code></strong> notation.</p><p>Now if you want to override these Blueprint properties from an unit test, you can do this as shown below: + </div>Notice that we have a <strong><code><bean></code></strong> which refers to one of the properties. And in the Camel route we refer to the other using the <strong><code>{{ }}</code></strong> notation.<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 pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"> @Override protected String useOverridePropertiesWithConfigAdmin(Dictionary props) { // add the properties we want to override props.put(&quot;greeting&quot;, &quot;Bye&quot;); // return the PID of the config-admin we are using in the blueprint xml file return &quot;my-placeholders&quot;; } </script> </div> - </div> <p>To do this we override and implement the <strong><code>useOverridePropertiesWithConfigAdmin</code></strong> method. We can then put the properties we want to override on the given props parameter. And the return value <em>must</em> be the persistence-id of the <strong><code><cm:property-placeholder></code></strong> tag, which you define in the blueprint XML file.</p><h4 id="BookComponentAppendix-Usinga.cfgor.propertiesFileforBlueprintPropertyPlaceholders">Using a <code>.cfg</code> or <code>.properties</code> File for Blueprint Property Placeholders</h4><p><strong>Available as of Camel 2.10.4</strong></p><p>When using Blueprint property placeholder in the Blueprint XML file, you can declare the properties in a .properties or <strong><code>.cfg</code></strong> file. If you use Apache ServiceMix/Karaf then this container has a convention that it loads the properties from a file in the etc directory with the naming <strong><code>etc/pid.cfg</code></ strong>, where <strong><code>pid</code></strong> is the persistence-id.</p><p>For example in the blueprint XML file we have the <strong><code>persistence-id="stuff"</code></strong>, which mean it will load the configuration file as <strong><code>etc/stuff.cfg</code></strong>. + </div>To do this we override and implement the <strong><code>useOverridePropertiesWithConfigAdmin</code></strong> method. We can then put the properties we want to override on the given props parameter. And the return value <em>must</em> be the persistence-id of the <strong><code><cm:property-placeholder></code></strong> tag, which you define in the blueprint XML file.<h4 id="BookComponentAppendix-Usinga.cfgor.propertiesFileForBlueprintPropertyPlaceholders">Using a <code>.cfg</code> or <code>.properties</code> File For Blueprint Property Placeholders</h4><p><strong>Available as of Camel 2.10.4</strong></p><p>When using Blueprint property placeholder in the Blueprint XML file, you can declare the properties in a .properties or <strong><code>.cfg</code></strong> file. If you use Apache ServiceMix/Karaf then this container has a convention that it loads the properties from a file in the etc directory with the naming <strong><code>etc/pid.cfg</code></strong>, wher e <strong><code>pid</code></strong> is the persistence-id.</p><p>For example in the blueprint XML file we have the <strong><code>persistence-id="stuff"</code></strong>, which mean it will load the configuration file as <strong><code>etc/stuff.cfg</code></strong>. </p><div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file --&gt; &lt;cm:property-placeholder persistent-id=&quot;stuff&quot; update-strategy=&quot;reload&quot;/&gt; &lt;!-- a bean that uses a blueprint property placeholder --&gt; &lt;bean id=&quot;myCoolBean&quot; class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt; &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt; &lt;/bean&gt; &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt; &lt;to uri=&quot;mock:result&quot;/&gt; &lt;/route&gt; &lt;/came lContext&gt; </script> </div> - </div> <p>Now if you want to unit test this blueprint XML file, then you can override the <strong><code>loadConfigAdminConfigurationFile</code></strong> and tell Camel which file to load as shown below: - </p><div class="code panel pdl" style="border-width: 1px;"> + </div>Now if you want to unit test this blueprint XML file, then you can override the <strong><code>loadConfigAdminConfigurationFile</code></strong> and tell Camel which file to load as shown below: + <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"> @Override protected String[] loadConfigAdminConfigurationFile() { // String[0] = tell Camel the path of the .cfg file to use for OSGi ConfigAdmin in the blueprint XML file // String[1] = tell Camel the persistence-id of the cm:property-placeholder in the blueprint XML file return new String[]{&quot;src/test/resources/etc/stuff.cfg&quot;, &quot;stuff&quot;}; } </script> </div> - </div> <p>Notice that this method requires to return a <strong><code>String[]</code></strong> with 2 values. The 1st value is the path for the configuration file to load. The second value is the persistence-id of the <strong><code><cm:property-placeholder></code></strong> tag.</p><p>The <strong><code>stuff.cfg</code></strong> file is just a plain properties file with the property placeholders such as:</p> + </div>Notice that this method requires to return a <strong><code>String[]</code></strong> with 2 values. The 1st value is the path for the configuration file to load. The second value is the persistence-id of the <strong><code><cm:property-placeholder></code></strong> tag.<p>The <strong><code>stuff.cfg</code></strong> file is just a plain properties file with the property placeholders such as:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">## this is a comment greeting=Bye </script> @@ -4819,12 +4817,12 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;blueprint xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0&quot; xsi:schemaLocation=&quot; http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt; &lt;!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file --&gt; &lt;cm:property-placeholder persistent-id=&quot;stuff&quot; update-strategy=&quot;reload&quot;&gt; &lt;cm:default-properties&gt; &lt;cm:property name=&quot;greeting&quot; value=&quot;Hello&quot; /&gt; &lt;cm:property name=&quot;echo&quot; value=&quot;Hey&quot; /&gt; &lt;cm:property name=&quot;destination&quot; value=&quot;mock:original&quot; /&gt; &lt;/cm:default-properties&gt; &lt;/cm:property-placeholder&gt; &lt;!-- a bean that uses a blueprint property placeholder --&gt; &lt;bean id=&quot;myCoolBean&quot; class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt; &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt; &lt;property name=&quot;echo&quot; value=&quot;${echo}&quot;/&gt; &lt;/bean&gt; &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt; &lt;to uri=&quot;{{destination}}&quot;/&gt; & ;lt;bean ref=&quot;myCoolBean&quot; method=&quot;echoSomething&quot;/&gt; &lt;to uri=&quot;{{destination}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; &lt;/blueprint&gt; </script> </div> - </div> <p>And in the unit test class we do as follows: - </p><div class="code panel pdl" style="border-width: 1px;"> + </div>And in the unit test class we do as follows: + <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"> /** * This example will load a Blueprint .cfg file (which will initialize configadmin), and also override its property * placeholders from this unit test source code directly (the change will reload blueprint container). */ public class ConfigAdminLoadConfigurationFileAndOverrideTest extends CamelBlueprintTestSupport { @Override protected String getBlueprintDescriptor() { // which blueprint XML file to use for this test return &quot;org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml&quot;; } @Override protected String[] loadConfigAdminConfigurationFile() { // which .cfg file to use, and the name of the persistence-id return new String[]{&quot;src/test/resources/etc/stuff.cfg&quot;, &quot;stuff&quot;}; } @Override protected String useOverridePropertiesWithConfigAdmin(Dictionary props) throws Exception { // override / add extra properties props.put(&quot;d estination&quot;, &quot;mock:extra&quot;); // return the persistence-id to use return &quot;stuff&quot;; } @Test public void testConfigAdmin() throws Exception { // mock:original comes from &lt;cm:default-properties&gt;/&lt;cm:property name=&quot;destination&quot; value=&quot;mock:original&quot; /&gt; getMockEndpoint(&quot;mock:original&quot;).setExpectedMessageCount(0); // mock:result comes from loadConfigAdminConfigurationFile() getMockEndpoint(&quot;mock:result&quot;).setExpectedMessageCount(0); // mock:extra comes from useOverridePropertiesWithConfigAdmin() getMockEndpoint(&quot;mock:extra&quot;).expectedBodiesReceived(&quot;Bye World&quot;, &quot;Yay Bye WorldYay Bye World&quot;); template.sendBody(&quot;direct:start&quot;, &quot;World&quot;); assertMockEndpointsSatisfied(); } } </script> </div> - </div> <p>And the <strong><code>etc/stuff.cfg</code></strong> configuration file contains:</p> + </div>And the <strong><code>etc/stuff.cfg</code></strong> configuration file contains: <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">greeting=Bye echo=Yay destination=mock:result </script> @@ -4837,7 +4835,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;!-- bridge spring property placeholder with Camel --&gt; &lt;!-- you must NOT use the &lt;context:property-placeholder at the same time, only this bridge bean --&gt; &lt;bean id=&quot;bridgePropertyPlaceholder&quot; class=&quot;org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer&quot;&gt; &lt;property name=&quot;location&quot; value=&quot;classpath:org/apache/camel/component/properties/cheese.properties&quot;/&gt; &lt;/bean&gt; </script> </div> - </div> <p>You <strong>must not</strong> use the spring <strong><code><context:property-placeholder></code></strong> namespace at the same time; this is not possible.</p><p>After declaring this bean, you can define property placeholders using both the Spring style, and the Camel style within the <strong><code><camelContext></code></strong> tag as shown below: + </div>You <strong>must not</strong> use the spring <strong><code><context:property-placeholder></code></strong> namespace at the same time; this is not possible.<p>After declaring this bean, you can define property placeholders using both the Spring style, and the Camel style within the <strong><code><camelContext></code></strong> tag as shown below: </p><div class="code panel pdl" style="border-width: 1px;"> <div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"> <b>Using bridge property placeholders</b> @@ -4845,7 +4843,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;!-- a bean that uses Spring property placeholder --&gt; &lt;!-- the ${hi} is a spring property placeholder --&gt; &lt;bean id=&quot;hello&quot; class=&quot;org.apache.camel.component.properties.HelloBean&quot;&gt; &lt;property name=&quot;greeting&quot; value=&quot;${hi}&quot;/&gt; &lt;/bean&gt; &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt; &lt;!-- in this route we use Camels property placeholder {{ }} style --&gt; &lt;route&gt; &lt;from uri=&quot;direct:{{cool.bar}}&quot;/&gt; &lt;bean ref=&quot;hello&quot;/&gt; &lt;to uri=&quot;{{cool.end}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; </script> </div> - </div> <p>Notice how the hello bean is using pure Spring property placeholders using the <strong><code>${}</code></strong> notation. And in the Camel routes we use the Camel placeholder notation with <strong><code>{{ }}</code></strong>.</p><h4 id="BookComponentAppendix-ClashingSpringPropertyPlaceholderswithCamelsLanguage">Clashing Spring Property Placeholders with Camels <a shape="rect" href="simple.html">Simple</a> Language</h4><p>Take notice when using Spring bridging placeholder then the spring <strong><code>${}</code></strong> syntax clashes with the <a shape="rect" href="simple.html">Simple</a> in Camel, and therefore take care.</p><p>Example:</p> + </div>Notice how the hello bean is using pure Spring property placeholders using the <strong><code>${}</code></strong> notation. And in the Camel routes we use the Camel placeholder notation with <strong><code>{{ }}</code></strong>.<h4 id="BookComponentAppendix-ClashingSpringPropertyPlaceholderswithCamelsLanguage">Clashing Spring Property Placeholders with Camels <a shape="rect" href="simple.html">Simple</a> Language</h4><p>Take notice when using Spring bridging placeholder then the spring <strong><code>${}</code></strong> syntax clashes with the <a shape="rect" href="simple.html">Simple</a> in Camel, and therefore take care.</p><p>Example:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;setHeader headerName=&quot;Exchange.FILE_NAME&quot;&gt; &lt;simple&gt;{{file.rootdir}}/${in.header.CamelFileName}&lt;/simple&gt; &lt;/setHeader&gt; </script> @@ -4864,7 +4862,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"> // override this method to provide our custom properties we use in this unit test @Override protected Properties useOverridePropertiesWithPropertiesComponent() { Properties extra = new Properties(); extra.put(&quot;destination&quot;, &quot;mock:extra&quot;); extra.put(&quot;greeting&quot;, &quot;Bye&quot;); return extra; } </script> </div> - </div> <p>This can be done from any of the Camel Test kits, such as <strong><code>camel-test</code></strong>, <strong><code>camel-test-spring</code></strong> and <strong><code>camel-test-blueprint</code></strong>.</p><p>The <strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong> 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 id="BookComponentAppendix-Using@PropertyInject">Using <code>@PropertyInject</code></h3><p><strong>Available as of Camel 2.12</strong></p><p>Camel allows to inject property placeholders in POJOs using the <strong><code>@PropertyInject</code></strong> annotation which can be set on fields and setter methods. For example you can use that with <strong><code>RouteBuilder</code></strong> classes, such as shown below:</p> + </div>This can be done from any of the Camel Test kits, such as <strong><code>camel-test</code></strong>, <strong><code>camel-test-spring</code></strong> and <strong><code>camel-test-blueprint</code></strong>.<p>The <strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong> 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 id="BookComponentAppendix-Using@PropertyInject">Using <code>@PropertyInject</code></h3><p><strong>Available as of Camel 2.12</strong></p><p>Camel allows to inject property placeholders in POJOs using the <strong><code>@PropertyInject</code></strong> annotation which can be set on fields and setter methods. For example you can use that with <strong><code>RouteBuilder</code></strong> classes, such as shown below:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">public class MyRouteBuilder extends RouteBuilder { @PropertyInject(&quot;hello&quot;) private String greeting; @Override public void configure() throws Exception { from(&quot;direct:start&quot;) .transform().constant(greeting) .to(&quot;{{result}}&quot;); } } </script> @@ -4890,18 +4888,18 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;{{env:SOMENAME:log:foo}}&quot;/&gt; &lt;to uri=&quot;{{sys:MyJvmPropertyName:log:bar}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt;</script> </div> - </div><p> </p><p>The service function is for looking up a service which is defined using OS environment variables using the service naming idiom, to refer to a service location using <strong><code>hostname : port</code></strong></p> + </div><p>The service function is for looking up a service which is defined using OS environment variables using the service naming idiom, to refer to a service location using <strong><code>hostname : port</code></strong></p> <ul><li><em><code>NAME</code></em><strong><code>_SERVICE_HOST</code></strong></li><li><em><code>NAME</code></em><strong><code>_SERVICE_PORT</code></strong></li></ul><p>in other words the service uses <strong><code>_SERVICE_HOST</code></strong> and <strong><code>_SERVICE_PORT</code></strong> as prefix. So if the service is named <strong><code>FOO</code></strong>, then the OS environment variables should be set as</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">export $FOO_SERVICE_HOST=myserver export $FOO_SERVICE_PORT=8888</script> </div> - </div><p> </p><p>For example if the <strong><code>FOO</code></strong> service a remote HTTP service, then we can refer to the service in the Camel endpoint URI, and use the <a shape="rect" href="http.html">HTTP</a> component to make the HTTP call:</p> + </div><p>For example if the <strong><code>FOO</code></strong> service a remote HTTP service, then we can refer to the service in the Camel endpoint URI, and use the <a shape="rect" href="http.html">HTTP</a> component to make the HTTP call:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;http://{{service:FOO}}/myapp&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt;</script> </div> - </div><p> </p><p>And we can use default values if the service has not been defined, for example to call a service on localhost, maybe for unit testing etc:</p> + </div><p>And we can use default values if the service has not been defined, for example to call a service on localhost, maybe for unit testing etc:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;http://{{service:FOO:localhost:8080}}/myapp&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt;</script> 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 Wed Feb 1 21:20:51 2017 @@ -3930,11 +3930,11 @@ The tutorial has been designed in two pa While not actual tutorials you might find working through the source of the various <a shape="rect" href="examples.html">Examples</a> useful.</li></ul> <h2 id="BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</h2><p> </p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Thanks</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This tutorial was kindly donated to Apache Camel by Martin Gilday.</p></div></div><h2 id="BookInOnePage-Preface">Preface</h2><p>This tutorial aims to guide the reader through the stages of creating a project which uses Camel to facilitate the routing of messages from a JMS queue to a <a shape="rect" class="external-link" href="http://www.springramework.org" rel="nofollow">Spring</a> service. The route works in a synchronous fashion returning a response to the client.</p><p><style type="text/css">/*<![CDATA[*/ -div.rbtoc1485973100154 {padding: 0px;} -div.rbtoc1485973100154 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1485973100154 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1485983947663 {padding: 0px;} +div.rbtoc1485983947663 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1485983947663 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style></p><div class="toc-macro rbtoc1485973100154"> +/*]]>*/</style></p><div class="toc-macro rbtoc1485983947663"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</a></li><li><a shape="rect" href="#BookInOnePage-Preface">Preface</a></li><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" href="#BookInOnePage-About">About</a></li><li><a shape="rect" href="#BookInOnePage-CreatetheCamelProject">Create the Camel Project</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-UpdatethePOMwithDependencies">Update the POM with Dependencies</a></li></ul> </li><li><a shape="rect" href="#BookInOnePage-WritingtheServer">Writing the Server</a> @@ -6049,11 +6049,11 @@ So we completed the last piece in the pi <p>This example has been removed from <strong>Camel 2.9</strong> onwards. Apache Axis 1.4 is a very old and unsupported framework. We encourage users to use <a shape="rect" href="cxf.html">CXF</a> instead of Axis.</p></div></div> <style type="text/css">/*<![CDATA[*/ -div.rbtoc1485973100892 {padding: 0px;} -div.rbtoc1485973100892 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1485973100892 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1485983948107 {padding: 0px;} +div.rbtoc1485983948107 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1485983948107 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style><div class="toc-macro rbtoc1485973100892"> +/*]]>*/</style><div class="toc-macro rbtoc1485983948107"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialusingAxis1.4withApacheCamel">Tutorial using Axis 1.4 with Apache Camel</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" href="#BookInOnePage-Introduction">Introduction</a></li><li><a shape="rect" href="#BookInOnePage-SettinguptheprojecttorunAxis">Setting up the project to run Axis</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Maven2">Maven 2</a></li><li><a shape="rect" href="#BookInOnePage-wsdl">wsdl</a></li><li><a shape="rect" href="#BookInOnePage-ConfiguringAxis">Configuring Axis</a></li><li><a shape="rect" href="#BookInOnePage-RunningtheExample">Running the Example</a></li></ul> @@ -14234,8 +14234,8 @@ cometds://localhost:8443/service/mychann <div class="confluence-information-macro-body"> <p>When using CXF in streaming modes (see DataFormat option), then also read about <a shape="rect" href="stream-caching.html">Stream caching</a>.</p> </div> -</div><p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/**/ div.rbtoc1485973123869 {padding: 0px;} div.rbtoc1485973123869 ul {list-style: disc;margin-left: 0px;} div.rbtoc1485973123869 li {margin-left: 0px;padding-left: 0px;} /**/</style> - </p><div class="toc-macro rbtoc1485973123869"> +</div><p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/**/ div.rbtoc1485983970754 {padding: 0px;} div.rbtoc1485983970754 ul {list-style: disc;margin-left: 0px;} div.rbtoc1485983970754 li {margin-left: 0px;padding-left: 0px;} /**/</style> + </p><div class="toc-macro rbtoc1485983970754"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-CXFComponent">CXF Component</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-URIformat">URI format</a></li><li><a shape="rect" href="#BookInOnePage-Options">Options</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Thedescriptionsofthedataformats">The descriptions of the dataformats</a> @@ -18224,12 +18224,10 @@ cometds://localhost:8443/service/mychann </div> </div> <div> - <p> </p> <p>From<strong> Camel 2.19.0</strong>: you can set which location can be discarded if missing by setting  <strong><code>optional=true</code></strong>, (<strong><code>false</code></strong> by default).</p> <p>Example:</p> </div> <div> - <p> </p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">pc.setLocations(&quot;com/mycompany/override.properties;optional=true,com/mycompany/defaults.properties&quot;);</script> @@ -18385,7 +18383,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;blueprint xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0&quot; xsi:schemaLocation=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt; &lt;!-- OSGI blueprint property placeholder --&gt; &lt;cm:property-placeholder id=&quot;myblueprint.placeholder&quot; persistent-id=&quot;camel.blueprint&quot;&gt; &lt;!-- list some properties as needed --&gt; &lt;cm:default-properties&gt; &lt;cm:property name=&quot;result&quot; value=&quot;mock:result&quot;/&gt; &lt;/cm:default-properties&gt; &lt;/cm:property-placeholder&gt; &lt;camelContext xmlns=&quot;http://came l.apache.org/schema/blueprint&quot;&gt; &lt;!-- in the route we can use {{ }} placeholders which will lookup in blueprint as Camel will auto detect the OSGi blueprint property placeholder and use it --&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;mock:foo&quot;/&gt; &lt;to uri=&quot;{{result}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; &lt;/blueprint&gt;</script> </div> - </div><p><span style="line-height: 1.42857;"><br clear="none"></span></p><p><span style="line-height: 1.42857;">By default Camel detects and uses OSGi blueprint property placeholder service. You can disable this by setting the attribute </span><strong><code style="line-height: 1.42857;">useBlueprintPropertyResolver</code></strong><span style="line-height: 1.42857;"> to false on the </span><strong><code style="line-height: 1.42857;"><camelContext></code></strong><span style="line-height: 1.42857;"> definition.</span></p> + </div><p><span style="line-height: 1.42857;">By default Camel detects and uses OSGi blueprint property placeholder service. You can disable this by setting the attribute </span><strong><code style="line-height: 1.42857;">useBlueprintPropertyResolver</code></strong><span style="line-height: 1.42857;"> to false on the </span><strong><code style="line-height: 1.42857;"><camelContext></code></strong><span style="line-height: 1.42857;"> definition.</span></p> <div class="confluence-information-macro confluence-information-macro-information"> <p class="title">About placeholder syntaxes</p> <span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span> @@ -18397,7 +18395,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;blueprint xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0&quot; xsi:schemaLocation=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt; &lt;!-- OSGI blueprint property placeholder --&gt; &lt;cm:property-placeholder id=&quot;myblueprint.placeholder&quot; persistent-id=&quot;camel.blueprint&quot;&gt; &lt;!-- list some properties as needed --&gt; &lt;cm:default-properties&gt; &lt;cm:property name=&quot;prefix.result&quot; value=&quot;mock:result&quot;/&gt; &lt;/cm:default-properties&gt; &lt;/cm:property-placeholder&gt; &lt;camelContext xmlns=&quot;http ://camel.apache.org/schema/blueprint&quot;&gt; &lt;!-- using Camel properties component and refer to the blueprint property placeholder by its id --&gt; &lt;propertyPlaceholder id=&quot;properties&quot; location=&quot;blueprint:myblueprint.placeholder&quot; prefixToken=&quot;[[&quot; suffixToken=&quot;]]&quot; propertyPrefix=&quot;prefix.&quot;/&gt; &lt;!-- in the route we can use {{ }} placeholders which will lookup in blueprint --&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;mock:foo&quot;/&gt; &lt;to uri=&quot;[[result]]&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; &lt;/blueprint&gt;</script> </div> - </div><p> </p><p>Notice how we use the <strong><code>blueprint</code></strong> scheme to refer to the OSGi blueprint placeholder by its id. This allows you to mix and match, for example you can also have additional schemes in the location. For example to load a file from the classpath you can do:</p> + </div><p>Notice how we use the <strong><code>blueprint</code></strong> scheme to refer to the OSGi blueprint placeholder by its id. This allows you to mix and match, for example you can also have additional schemes in the location. For example to load a file from the classpath you can do:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">location=&quot;blueprint:myblueprint.placeholder,classpath:myproperties.properties&quot; </script> @@ -18407,22 +18405,22 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;!-- blueprint property placeholders --&gt; &lt;cm:property-placeholder persistent-id=&quot;my-placeholders&quot; update-strategy=&quot;reload&quot;&gt; &lt;cm:default-properties&gt; &lt;cm:property name=&quot;greeting&quot; value=&quot;Hello&quot;/&gt; &lt;cm:property name=&quot;destination&quot; value=&quot;mock:result&quot;/&gt; &lt;/cm:default-properties&gt; &lt;/cm:property-placeholder&gt; &lt;!-- a bean that uses a blueprint property placeholder --&gt; &lt;bean id=&quot;myCoolBean&quot; class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt; &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt; &lt;/bean&gt; &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;& gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt; &lt;to uri=&quot;{{destination}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; </script> </div> - </div> <p>Notice that we have a <strong><code><bean></code></strong> which refers to one of the properties. And in the Camel route we refer to the other using the <strong><code>{{ }}</code></strong> notation.</p><p>Now if you want to override these Blueprint properties from an unit test, you can do this as shown below: + </div>Notice that we have a <strong><code><bean></code></strong> which refers to one of the properties. And in the Camel route we refer to the other using the <strong><code>{{ }}</code></strong> notation.<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 pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"> @Override protected String useOverridePropertiesWithConfigAdmin(Dictionary props) { // add the properties we want to override props.put(&quot;greeting&quot;, &quot;Bye&quot;); // return the PID of the config-admin we are using in the blueprint xml file return &quot;my-placeholders&quot;; } </script> </div> - </div> <p>To do this we override and implement the <strong><code>useOverridePropertiesWithConfigAdmin</code></strong> method. We can then put the properties we want to override on the given props parameter. And the return value <em>must</em> be the persistence-id of the <strong><code><cm:property-placeholder></code></strong> tag, which you define in the blueprint XML file.</p><h4 id="BookInOnePage-Usinga.cfgor.propertiesFileforBlueprintPropertyPlaceholders">Using a <code>.cfg</code> or <code>.properties</code> File for Blueprint Property Placeholders</h4><p><strong>Available as of Camel 2.10.4</strong></p><p>When using Blueprint property placeholder in the Blueprint XML file, you can declare the properties in a .properties or <strong><code>.cfg</code></strong> file. If you use Apache ServiceMix/Karaf then this container has a convention that it loads the properties from a file in the etc directory with the naming <strong><code>etc/pid.cfg</code></strong>, where <strong><code>pid</code></strong> is the persistence-id.</p><p>For example in the blueprint XML file we have the <strong><code>persistence-id="stuff"</code></strong>, which mean it will load the configuration file as <strong><code>etc/stuff.cfg</code></strong>. + </div>To do this we override and implement the <strong><code>useOverridePropertiesWithConfigAdmin</code></strong> method. We can then put the properties we want to override on the given props parameter. And the return value <em>must</em> be the persistence-id of the <strong><code><cm:property-placeholder></code></strong> tag, which you define in the blueprint XML file.<h4 id="BookInOnePage-Usinga.cfgor.propertiesFileForBlueprintPropertyPlaceholders">Using a <code>.cfg</code> or <code>.properties</code> File For Blueprint Property Placeholders</h4><p><strong>Available as of Camel 2.10.4</strong></p><p>When using Blueprint property placeholder in the Blueprint XML file, you can declare the properties in a .properties or <strong><code>.cfg</code></strong> file. If you use Apache ServiceMix/Karaf then this container has a convention that it loads the properties from a file in the etc directory with the naming <strong><code>etc/pid.cfg</code></strong>, where < strong><code>pid</code></strong> is the persistence-id.</p><p>For example in the blueprint XML file we have the <strong><code>persistence-id="stuff"</code></strong>, which mean it will load the configuration file as <strong><code>etc/stuff.cfg</code></strong>. </p><div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file --&gt; &lt;cm:property-placeholder persistent-id=&quot;stuff&quot; update-strategy=&quot;reload&quot;/&gt; &lt;!-- a bean that uses a blueprint property placeholder --&gt; &lt;bean id=&quot;myCoolBean&quot; class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt; &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt; &lt;/bean&gt; &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt; &lt;to uri=&quot;mock:result&quot;/&gt; &lt;/route&gt; &lt;/came lContext&gt; </script> </div> - </div> <p>Now if you want to unit test this blueprint XML file, then you can override the <strong><code>loadConfigAdminConfigurationFile</code></strong> and tell Camel which file to load as shown below: - </p><div class="code panel pdl" style="border-width: 1px;"> + </div>Now if you want to unit test this blueprint XML file, then you can override the <strong><code>loadConfigAdminConfigurationFile</code></strong> and tell Camel which file to load as shown below: + <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"> @Override protected String[] loadConfigAdminConfigurationFile() { // String[0] = tell Camel the path of the .cfg file to use for OSGi ConfigAdmin in the blueprint XML file // String[1] = tell Camel the persistence-id of the cm:property-placeholder in the blueprint XML file return new String[]{&quot;src/test/resources/etc/stuff.cfg&quot;, &quot;stuff&quot;}; } </script> </div> - </div> <p>Notice that this method requires to return a <strong><code>String[]</code></strong> with 2 values. The 1st value is the path for the configuration file to load. The second value is the persistence-id of the <strong><code><cm:property-placeholder></code></strong> tag.</p><p>The <strong><code>stuff.cfg</code></strong> file is just a plain properties file with the property placeholders such as:</p> + </div>Notice that this method requires to return a <strong><code>String[]</code></strong> with 2 values. The 1st value is the path for the configuration file to load. The second value is the persistence-id of the <strong><code><cm:property-placeholder></code></strong> tag.<p>The <strong><code>stuff.cfg</code></strong> file is just a plain properties file with the property placeholders such as:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">## this is a comment greeting=Bye </script> @@ -18432,12 +18430,12 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;blueprint xmlns=&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:cm=&quot;http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0&quot; xsi:schemaLocation=&quot; http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;&gt; &lt;!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file --&gt; &lt;cm:property-placeholder persistent-id=&quot;stuff&quot; update-strategy=&quot;reload&quot;&gt; &lt;cm:default-properties&gt; &lt;cm:property name=&quot;greeting&quot; value=&quot;Hello&quot; /&gt; &lt;cm:property name=&quot;echo&quot; value=&quot;Hey&quot; /&gt; &lt;cm:property name=&quot;destination&quot; value=&quot;mock:original&quot; /&gt; &lt;/cm:default-properties&gt; &lt;/cm:property-placeholder&gt; &lt;!-- a bean that uses a blueprint property placeholder --&gt; &lt;bean id=&quot;myCoolBean&quot; class=&quot;org.apache.camel.test.blueprint.MyCoolBean&quot;&gt; &lt;property name=&quot;say&quot; value=&quot;${greeting}&quot;/&gt; &lt;property name=&quot;echo&quot; value=&quot;${echo}&quot;/&gt; &lt;/bean&gt; &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;bean ref=&quot;myCoolBean&quot; method=&quot;saySomething&quot;/&gt; &lt;to uri=&quot;{{destination}}&quot;/&gt; & ;lt;bean ref=&quot;myCoolBean&quot; method=&quot;echoSomething&quot;/&gt; &lt;to uri=&quot;{{destination}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; &lt;/blueprint&gt; </script> </div> - </div> <p>And in the unit test class we do as follows: - </p><div class="code panel pdl" style="border-width: 1px;"> + </div>And in the unit test class we do as follows: + <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"> /** * This example will load a Blueprint .cfg file (which will initialize configadmin), and also override its property * placeholders from this unit test source code directly (the change will reload blueprint container). */ public class ConfigAdminLoadConfigurationFileAndOverrideTest extends CamelBlueprintTestSupport { @Override protected String getBlueprintDescriptor() { // which blueprint XML file to use for this test return &quot;org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml&quot;; } @Override protected String[] loadConfigAdminConfigurationFile() { // which .cfg file to use, and the name of the persistence-id return new String[]{&quot;src/test/resources/etc/stuff.cfg&quot;, &quot;stuff&quot;}; } @Override protected String useOverridePropertiesWithConfigAdmin(Dictionary props) throws Exception { // override / add extra properties props.put(&quot;d estination&quot;, &quot;mock:extra&quot;); // return the persistence-id to use return &quot;stuff&quot;; } @Test public void testConfigAdmin() throws Exception { // mock:original comes from &lt;cm:default-properties&gt;/&lt;cm:property name=&quot;destination&quot; value=&quot;mock:original&quot; /&gt; getMockEndpoint(&quot;mock:original&quot;).setExpectedMessageCount(0); // mock:result comes from loadConfigAdminConfigurationFile() getMockEndpoint(&quot;mock:result&quot;).setExpectedMessageCount(0); // mock:extra comes from useOverridePropertiesWithConfigAdmin() getMockEndpoint(&quot;mock:extra&quot;).expectedBodiesReceived(&quot;Bye World&quot;, &quot;Yay Bye WorldYay Bye World&quot;); template.sendBody(&quot;direct:start&quot;, &quot;World&quot;); assertMockEndpointsSatisfied(); } } </script> </div> - </div> <p>And the <strong><code>etc/stuff.cfg</code></strong> configuration file contains:</p> + </div>And the <strong><code>etc/stuff.cfg</code></strong> configuration file contains: <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">greeting=Bye echo=Yay destination=mock:result </script> @@ -18450,7 +18448,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;!-- bridge spring property placeholder with Camel --&gt; &lt;!-- you must NOT use the &lt;context:property-placeholder at the same time, only this bridge bean --&gt; &lt;bean id=&quot;bridgePropertyPlaceholder&quot; class=&quot;org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer&quot;&gt; &lt;property name=&quot;location&quot; value=&quot;classpath:org/apache/camel/component/properties/cheese.properties&quot;/&gt; &lt;/bean&gt; </script> </div> - </div> <p>You <strong>must not</strong> use the spring <strong><code><context:property-placeholder></code></strong> namespace at the same time; this is not possible.</p><p>After declaring this bean, you can define property placeholders using both the Spring style, and the Camel style within the <strong><code><camelContext></code></strong> tag as shown below: + </div>You <strong>must not</strong> use the spring <strong><code><context:property-placeholder></code></strong> namespace at the same time; this is not possible.<p>After declaring this bean, you can define property placeholders using both the Spring style, and the Camel style within the <strong><code><camelContext></code></strong> tag as shown below: </p><div class="code panel pdl" style="border-width: 1px;"> <div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"> <b>Using bridge property placeholders</b> @@ -18458,7 +18456,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"> &lt;!-- a bean that uses Spring property placeholder --&gt; &lt;!-- the ${hi} is a spring property placeholder --&gt; &lt;bean id=&quot;hello&quot; class=&quot;org.apache.camel.component.properties.HelloBean&quot;&gt; &lt;property name=&quot;greeting&quot; value=&quot;${hi}&quot;/&gt; &lt;/bean&gt; &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt; &lt;!-- in this route we use Camels property placeholder {{ }} style --&gt; &lt;route&gt; &lt;from uri=&quot;direct:{{cool.bar}}&quot;/&gt; &lt;bean ref=&quot;hello&quot;/&gt; &lt;to uri=&quot;{{cool.end}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt; </script> </div> - </div> <p>Notice how the hello bean is using pure Spring property placeholders using the <strong><code>${}</code></strong> notation. And in the Camel routes we use the Camel placeholder notation with <strong><code>{{ }}</code></strong>.</p><h4 id="BookInOnePage-ClashingSpringPropertyPlaceholderswithCamelsLanguage">Clashing Spring Property Placeholders with Camels <a shape="rect" href="simple.html">Simple</a> Language</h4><p>Take notice when using Spring bridging placeholder then the spring <strong><code>${}</code></strong> syntax clashes with the <a shape="rect" href="simple.html">Simple</a> in Camel, and therefore take care.</p><p>Example:</p> + </div>Notice how the hello bean is using pure Spring property placeholders using the <strong><code>${}</code></strong> notation. And in the Camel routes we use the Camel placeholder notation with <strong><code>{{ }}</code></strong>.<h4 id="BookInOnePage-ClashingSpringPropertyPlaceholderswithCamelsLanguage">Clashing Spring Property Placeholders with Camels <a shape="rect" href="simple.html">Simple</a> Language</h4><p>Take notice when using Spring bridging placeholder then the spring <strong><code>${}</code></strong> syntax clashes with the <a shape="rect" href="simple.html">Simple</a> in Camel, and therefore take care.</p><p>Example:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;setHeader headerName=&quot;Exchange.FILE_NAME&quot;&gt; &lt;simple&gt;{{file.rootdir}}/${in.header.CamelFileName}&lt;/simple&gt; &lt;/setHeader&gt; </script> @@ -18477,7 +18475,7 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"> // override this method to provide our custom properties we use in this unit test @Override protected Properties useOverridePropertiesWithPropertiesComponent() { Properties extra = new Properties(); extra.put(&quot;destination&quot;, &quot;mock:extra&quot;); extra.put(&quot;greeting&quot;, &quot;Bye&quot;); return extra; } </script> </div> - </div> <p>This can be done from any of the Camel Test kits, such as <strong><code>camel-test</code></strong>, <strong><code>camel-test-spring</code></strong> and <strong><code>camel-test-blueprint</code></strong>.</p><p>The <strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong> 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 id="BookInOnePage-Using@PropertyInject">Using <code>@PropertyInject</code></h3><p><strong>Available as of Camel 2.12</strong></p><p>Camel allows to inject property placeholders in POJOs using the <strong><code>@PropertyInject</code></strong> annotation which can be set on fields and setter methods. For example you can use that with <strong><code>RouteBuilder</code></strong> classes, such as shown below:</p> + </div>This can be done from any of the Camel Test kits, such as <strong><code>camel-test</code></strong>, <strong><code>camel-test-spring</code></strong> and <strong><code>camel-test-blueprint</code></strong>.<p>The <strong><code>ignoreMissingLocationWithPropertiesComponent</code></strong> 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 id="BookInOnePage-Using@PropertyInject">Using <code>@PropertyInject</code></h3><p><strong>Available as of Camel 2.12</strong></p><p>Camel allows to inject property placeholders in POJOs using the <strong><code>@PropertyInject</code></strong> annotation which can be set on fields and setter methods. For example you can use that with <strong><code>RouteBuilder</code></strong> classes, such as shown below:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">public class MyRouteBuilder extends RouteBuilder { @PropertyInject(&quot;hello&quot;) private String greeting; @Override public void configure() throws Exception { from(&quot;direct:start&quot;) .transform().constant(greeting) .to(&quot;{{result}}&quot;); } } </script> @@ -18503,18 +18501,18 @@ cometds://localhost:8443/service/mychann <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;{{env:SOMENAME:log:foo}}&quot;/&gt; &lt;to uri=&quot;{{sys:MyJvmPropertyName:log:bar}}&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt;</script> </div> - </div><p> </p><p>The service function is for looking up a service which is defined using OS environment variables using the service naming idiom, to refer to a service location using <strong><code>hostname : port</code></strong></p> + </div><p>The service function is for looking up a service which is defined using OS environment variables using the service naming idiom, to refer to a service location using <strong><code>hostname : port</code></strong></p> <ul><li><em><code>NAME</code></em><strong><code>_SERVICE_HOST</code></strong></li><li><em><code>NAME</code></em><strong><code>_SERVICE_PORT</code></strong></li></ul><p>in other words the service uses <strong><code>_SERVICE_HOST</code></strong> and <strong><code>_SERVICE_PORT</code></strong> as prefix. So if the service is named <strong><code>FOO</code></strong>, then the OS environment variables should be set as</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter">export $FOO_SERVICE_HOST=myserver export $FOO_SERVICE_PORT=8888</script> </div> - </div><p> </p><p>For example if the <strong><code>FOO</code></strong> service a remote HTTP service, then we can refer to the service in the Camel endpoint URI, and use the <a shape="rect" href="http.html">HTTP</a> component to make the HTTP call:</p> + </div><p>For example if the <strong><code>FOO</code></strong> service a remote HTTP service, then we can refer to the service in the Camel endpoint URI, and use the <a shape="rect" href="http.html">HTTP</a> component to make the HTTP call:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;http://{{service:FOO}}/myapp&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt;</script> </div> - </div><p> </p><p>And we can use default values if the service has not been defined, for example to call a service on localhost, maybe for unit testing etc:</p> + </div><p>And we can use default values if the service has not been defined, for example to call a service on localhost, maybe for unit testing etc:</p> <div class="code panel pdl" style="border-width: 1px;"> <div class="codeContent panelContent pdl"> <script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter">&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/blueprint&quot;&gt; &lt;route&gt; &lt;from uri=&quot;direct:start&quot;/&gt; &lt;to uri=&quot;http://{{service:FOO:localhost:8080}}/myapp&quot;/&gt; &lt;/route&gt; &lt;/camelContext&gt;</script> Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available.