Author: buildbot
Date: Wed Nov 26 21:18:15 2014
New Revision: 930656

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/camel-and-scr.html

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

Modified: websites/production/camel/content/camel-and-scr.html
==============================================================================
--- websites/production/camel/content/camel-and-scr.html (original)
+++ websites/production/camel/content/camel-and-scr.html Wed Nov 26 21:18:15 
2014
@@ -85,14 +85,14 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 
id="CamelandSCR-WorkingwithCamelusingSCR">Working with Camel using 
SCR</h2><p><span style="font-size: 14.0px;line-height: 1.4285715;">SCR stands 
for Service Component Runtime and is an implementation of OSGi Declarative 
Services specification (TODO: add a link to spec here). SCR enables any plain 
old Java object to expose and use OSGi services with no boilerplate 
code.</span></p><p>OSGi framework knows your object by looking at SCR 
descriptor files in your bundle which are typically generated from annotations 
in your code by a plugin such as org.apache.felix:maven-scr-plugin (<a 
shape="rect" class="external-link" 
href="https://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin.html";>https://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin.html</a>).</p><p>Running
 Camel in an SCR bundle is a great alternative for Spring DM and Blueprint 
based solutions having significantly fewer lines of code betw
 een you and the OSGi framework. Using SCR your bundle can remain completely in 
Java world; there is no need to edit XML or properties files. This offers you 
full control over everything and means your IDE of choice knows exactly what is 
going on in your project.</p><h3 id="CamelandSCR-CamelSCRsupport">Camel SCR 
support</h3><p><strong>Available as of Camel 2.15.0</strong></p><p><span 
style="line-height: 1.4285715;"><code>org.apache.camel/camel-scr</code> bundle 
provides a base class, <code>AbstractCamelRunner</code>, which manages a Camel 
context for you and a helper class, <code>ScrHelper</code>, for using your SCR 
properties in unit tests. Camel-scr feature for Apache Karaf&#160;</span><span 
style="line-height: 1.4285715;">defines all features and bundles required for 
running Camel in SCR 
bundles.</span></p><p><code>AbstractCamelRunner</code>&#160;class ties 
CamelContext's lifecycle to Service Component's lifecycle and handles 
configuration with help of Camel's PropertiesComponent.
  All you have to do to make a Service Component out of your java class is to 
extend it from <code>AbstractCamelRunner</code>&#160;and add the following 
<code>org.apache.felix.scr.annotations</code> on class level:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Required 
annotations</b></div><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 
id="CamelandSCR-WorkingwithCamelandSCR">Working with Camel and SCR</h2><p><span 
style="font-size: 14.0px;line-height: 1.4285715;">SCR stands for Service 
Component Runtime and is an implementation of OSGi Declarative Services 
specification. SCR enables any plain old Java object to expose and use OSGi 
services with no boilerplate code.</span></p><p>OSGi framework knows your 
object by looking at SCR descriptor files in its bundle which are typically 
generated from Java annotations by a plugin such as <code><a shape="rect" 
class="external-link" 
href="https://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin.html";>org.apache.felix:maven-scr-plugin</a></code>.</p><p>Running
 Camel in an SCR bundle is a great alternative for Spring DM and Blueprint 
based solutions having significantly fewer lines of code between you and the 
OSGi framework. Using SCR your bundle can remain completely in Java world; 
there is no need to edit XML 
 or properties files. This offers you full control over everything and means 
your IDE of choice knows exactly what is going on in your project.</p><h3 
id="CamelandSCR-CamelSCRsupport">Camel SCR support</h3><p><strong>Available as 
of Camel 2.15.0</strong></p><p><span style="line-height: 
1.4285715;"><code>org.apache.camel/camel-scr</code> bundle provides a base 
class, <code>AbstractCamelRunner</code>, which manages a Camel context for you 
and a helper class, <code>ScrHelper</code>, for using your SCR properties in 
unit tests. Camel-scr feature for Apache Karaf&#160;</span><span 
style="line-height: 1.4285715;">defines all features and bundles required for 
running Camel in SCR 
bundles.</span></p><p><code>AbstractCamelRunner</code>&#160;class ties 
CamelContext's lifecycle to Service Component's lifecycle and handles 
configuration with help of Camel's PropertiesComponent. All you have to do to 
make a Service Component out of your java class is to extend it from 
<code>AbstractCamelRunner</c
 ode>&#160;and add the following <code>org.apache.felix.scr.annotations</code> 
on class level:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Required annotations</b></div><div class="codeContent panelContent 
pdl">
 <script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[@Component
 @References({
     @Reference(name = &quot;camelComponent&quot;,referenceInterface = 
ComponentResolver.class,
         cardinality = ReferenceCardinality.MANDATORY_MULTIPLE, policy = 
ReferencePolicy.DYNAMIC,
         policyOption = ReferencePolicyOption.GREEDY, bind = 
&quot;gotCamelComponent&quot;, unbind = &quot;lostCamelComponent&quot;)
 })]]></script>
-</div></div><p>Then implement <code>getRouteBuilders()</code> method which 
returns the Camel routes you want to run. And finally provide the default 
configuration with:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Configuration in annotations</b></div><div class="codeContent 
panelContent pdl">
+</div></div><p>Then implement <code>getRouteBuilders()</code> method which 
returns the Camel routes you want to run:</p><p>&#160;</p><p>And finally 
provide the default configuration with:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>Configuration in annotations</b></div><div 
class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[@Properties({
    @Property(name = &quot;camelContextId&quot;, value = &quot;my-test&quot;),
    @Property(name = &quot;active&quot;, value = &quot;true&quot;),
@@ -290,12 +290,12 @@ public class CamelScrExampleTest {
 </div></div><p>Now, let's take a look at the interesting bits one by 
one.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Using 
property prefixing</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[        // Set property prefix for unit 
testing
         System.setProperty(CamelScrExample.PROPERTY_PREFIX, 
&quot;unit&quot;);]]></script>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Getting 
test configuration from annotations</b></div><div class="codeContent 
panelContent pdl">
+</div></div><p>This allows you to override parts of the configuration by 
prefixing properties with "unit.". For example, <code>unit.from</code> 
overrides <code>from</code> for the unit test.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>Getting test configuration from 
annotations</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[        integration.prepare(null, 
ScrHelper.getScrProperties(integration.getClass().getName()));]]></script>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Mock 
components that are not available for test</b></div><div class="codeContent 
panelContent pdl">
+</div></div><p>Here we configure the Service Component in test with the same 
properties that would be used in OSGi environment.</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>Mocking components for test</b></div><div 
class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[        // Fake a component for test
         // context.addComponent(&quot;amq&quot;, new 
MockComponent());]]></script>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Adjusting routes for test</b></div><div class="codeContent 
panelContent pdl">
+</div></div><p>Components that are not available in test can be mocked like 
this to allow the route to start.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>Adjusting routes for test</b></div><div 
class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[        // Adjust routes
         List&lt;RouteDefinition&gt; routes = context.getRouteDefinitions();
 
@@ -308,13 +308,13 @@ public class CamelScrExampleTest {
                 mockEndpoints(&quot;log:*&quot;);
             }
         });]]></script>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Starting the routes</b></div><div class="codeContent panelContent pdl">
+</div></div><p>Camel's AdviceWith feature allows route to be modified for 
test.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Starting the routes</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[        // Start the integration
         integration.run();]]></script>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Sending 
a test message</b></div><div class="codeContent panelContent pdl">
+</div></div><p>Here we start the Service Component and along with it the 
routes.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Sending 
a test message</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[        // Send the test message
         context.createProducerTemplate().sendBody(&quot;direct:start&quot;, 
&quot;hello&quot;);]]></script>
-</div></div></div>
+</div></div><p>Here we send a message to a route in test.</p></div>
         </td>
         <td valign="top">
           <div class="navigation">


Reply via email to