Author: buildbot
Date: Tue Nov 25 20:19:25 2014
New Revision: 930484
Log:
Production update by buildbot for camel
Added:
websites/production/camel/content/camel-and-scr.html
Modified:
websites/production/camel/content/cache/main.pageCache
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Added: websites/production/camel/content/camel-and-scr.html
==============================================================================
--- websites/production/camel/content/camel-and-scr.html (added)
+++ websites/production/camel/content/camel-and-scr.html Tue Nov 25 20:19:25
2014
@@ -0,0 +1,170 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<head>
+ <link href="//camel.apache.org/styles/site.css" rel="stylesheet"
type="text/css">
+ <link href="//camel.apache.org/styles/type-settings.css" rel="stylesheet"
type="text/css">
+ <script src="//camel.apache.org/styles/prototype.js"
type="text/javascript"></script>
+ <script src="//camel.apache.org/styles/rico.js"
type="text/javascript"></script>
+ <script src="//camel.apache.org/styles/site.js"
type="text/javascript"></script>
+
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
+
+ <style type="text/css">
+ .maincontent { overflow:hidden; }
+ </style>
+ <!--[if IE]>
+ <style type="text/css">
+ .maincontent { width:100%; }
+ </style>
+ <![endif]-->
+
+
+ <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css'
rel='stylesheet' type='text/css' />
+ <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css'
rel='stylesheet' type='text/css' />
+ <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js'
type='text/javascript'></script>
+ <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
+
+ <script type="text/javascript">
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
+
+ <title>
+ Apache Camel: Camel and SCR
+ </title>
+</head>
+<body>
+<div class="white_box">
+<div class="header">
+ <div class="header_l">
+ <div class="header_r">
+ </div>
+ </div>
+</div>
+<div class="content">
+ <div class="content_l">
+ <div class="content_r">
+ <div>
+ <!-- Banner -->
+<div id="banner-content"><div id="asf_logo">
+ <div id="activemq_logo" style="height:108px; background:transparent
url(banner.data/apache-camel-7.png) no-repeat scroll left top;">
+ <a shape="rect" style="float:left;
width:310px;display:block;text-indent:-5000px;text-decoration:none;line-height:140px;
margin-top:20px; margin-left:18px;" href="http://camel.apache.org/">Camel</a>
+ <a shape="rect" style="float:right;
width:180px;display:block;text-indent:-5000px;text-decoration:none;line-height:80px;
margin-top:45px; margin-right:10px;" href="http://www.apache.org">Apache</a>
+ </div>
+</div></div>
+ <!-- Banner -->
+ <div class="top_red_bar">
+ <div id="site-breadcrumbs">
+ <!-- Breadcrumbs -->
+<a href="index.html">Apache Camel</a> > <a
href="documentation.html">Documentation</a> > <a
href="user-guide.html">User Guide</a> > <a
href="camel-and-scr.html">Camel and SCR</a>
+ </div>
+ <!-- Quicklinks -->
+<div id="site-quicklinks"><p><a shape="rect" href="download.html">Download</a>
| <a shape="rect" href="javadoc.html">JavaDoc</a> | <a shape="rect"
href="source.html">Source</a> | <a shape="rect"
href="discussion-forums.html">Forums</a> | <a shape="rect"
href="support.html">Support</a></p></div>
+ <!-- Quicklinks -->
+ </div>
+
+ <table border="0">
+ <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 </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> 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> 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="codeContent
panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[@Component
+@References({
+ @Reference(name = "camelComponent",referenceInterface =
ComponentResolver.class,
+ cardinality = ReferenceCardinality.MANDATORY_MULTIPLE, policy =
ReferencePolicy.DYNAMIC,
+ policyOption = ReferencePolicyOption.GREEDY, bind =
"gotCamelComponent", unbind = "lostCamelComponent")
+})]]></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="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[@Properties({
+ @Property(name = "camelContextId", value = "my-test"),
+ @Property(name = "active", value = "true"),
+ @Property(name = "...", value = "..."),
+ ...
+})]]></script>
+</div></div><p>That's all. And if you used <code>camel-archetype-scr</code> to
generate a project all this is already taken care
of.</p><p><code>CamelContextId</code> and
<code>active</code> properties control the CamelContext's name (defaults
to "camel-runner-default") and whether it will be started or not (defaults to
"false"), respectively. In addition to these you can add and use as many
properties as you like. Camel's PropertiesComponent handles recursive
properties and prefixing with fallback without
problem.</p><p><code>AbstractCamelRunner</code> will make these properties
available to your RouteBuilders through Camel's PropertiesComponent and it will
also inject these values into your Service Component's and RouteBuilder's
fields when their names match. The fields can be declared with any visibility
level, and many types are supported (String, int, boolean, URL, ...).</p><h4
id="CamelandSCR-AbstractCamelRunner'slifecycleinSCR">AbstractCamelRunner's
lifecycle i
n SCR</h4><ol><li>When component's configuration policy and mandatory
references are satisfied SCR calls <code>activate()</code>. This creates and
sets up a CamelContext through the following call chain:
<code>activate()</code> → <code><em>prepare</em>()</code> → <code>createCamelContext()</code>
→ <code>setupPropertiesComponent()</code>
→ <code>configure()</code>
→ <code>setupCamelContext()</code>. Finally, the context is
scheduled to start after a delay defined in
<code>AbstractCamelRunner.START_DELAY</code> with
<code>runWithDelay()</code>.</li><li><span style="line-height: 1.4285715;">When
Camel components (<code>ComponentResolver</code> services, to be exact) are
registered in OSGi, SCR calls </span><code>gotCamelComponent</code><span
style="line-height: 1.4285715;"><code>()</code> which reschedules/delays the
CamelContext start further by the same
</span><code>AbstractCamelRunner.START_DELAY</code><span styl
e="line-height: 1.4285715;">. This in effect makes CamelContext wait until all
Camel components are loaded or there is a sufficient gap between them. The same
logic will tell a failed-to-start CamelContext to try again whenever we add
more Camel components.</span></li><li><span style="line-height:
1.4285715;">When Camel components are unregistered SCR calls
</span><code>lostCamelComponent</code><span style="line-height:
1.4285715;"><code>()</code>. This call does nothing.</span></li><li><span
style="line-height: 1.4285715;">When one of the requirements that caused the
call to </span><code>activate</code><span style="line-height:
1.4285715;"><code>()</code> is lost SCR will call
</span><code>deactivate</code><span style="line-height:
1.4285715;"><code>()</code>. This will shutdown the
CamelContext.</span></li></ol><p>In (non-OSGi) unit tests you should use
<code>prepare()</code> → <code>run()</code>
→ <code>stop()</code> instead of <code>activate()</code> →
; <code>deactivate()</code> for more fine-grained control. Also, this
allows us to avoid possible SCR specific operations in tests.</p><h4
id="CamelandSCR-ExampleCamelSCRbundle">Example Camel SCR bundle</h4><p>The
easiest way to create an Camel SCR bundle is to use camel-archetype-scr Maven
archetype.</p><p><code>mvn archetype:generate
-Dfilter=org.apache.camel.archetypes:camel-archetype-scr</code></p><p>Choose
archetype:<br clear="none">1: local ->
org.apache.camel.archetypes:camel-archetype-scr (Creates a new Camel SCR bundle
project for Karaf)<br clear="none">Choose a number or apply filter (format:
[groupId:]artifactId, case sensitive contains): : 1<br clear="none">Define
value for property 'groupId': : my.example<br clear="none">[INFO] Using
property: groupId = my.example<br clear="none">Define value for property
'artifactId': : my-test<br clear="none">Define value for property 'version':
1.0-SNAPSHOT: :<br clear="none">Define value for property 'package':
my.example: :
<br clear="none">[INFO] Using property: archetypeArtifactId =
camel-archetype-scr<br clear="none">[INFO] Using property: archetypeGroupId =
org.apache.camel.archetypes<br clear="none">[INFO] Using property:
archetypeVersion = 2.15-SNAPSHOT<br clear="none">Define value for property
'className': : MyTest<br clear="none">Confirm properties configuration:<br
clear="none">groupId: my.example<br clear="none">artifactId: my-test<br
clear="none">version: 1.0-SNAPSHOT<br clear="none">package: my.example<br
clear="none">archetypeArtifactId: camel-archetype-scr<br
clear="none">archetypeGroupId: org.apache.camel.archetypes<br
clear="none">archetypeVersion: 2.15-SNAPSHOT<br clear="none">className:
MyTest<br clear="none"> Y: :</p><p>All done! Check ReadMe.txt in the generated
project folder for the next steps.</p><p>To deploy a Camel SCR bundle project
in Apache Karaf:</p><p>On Karaf command line:</p><p># Add Camel feature
repository<br clear="none">features:chooseurl camel 2.15-SNAPSHOT</p><p>#
Install camel-scr feature<br clear="none">features:install camel-scr</p><p>#
Install commons-lang, used in the example route to validate parameters<br
clear="none"> osgi:install mvn:commons-lang/commons-lang/2.6</p><p># Install
and start your bundle<br clear="none"> osgi:install -s
mvn:your.company/your-bundle/version</p><p># See how it's running<br
clear="none">log:tail -n 10</p><p>Press ctrl-c to stop watching the
log.</p></div>
+ </td>
+ <td valign="top">
+ <div class="navigation">
+ <div class="navigation_top">
+ <!-- NavigationBar -->
+<div class="navigation_bottom" id="navigation_bottom"><h3
id="Navigation-Overview"><a shape="rect"
href="overview.html">Overview</a></h3><ul class="alternate"><li><a shape="rect"
href="index.html">Home</a></li><li><a shape="rect"
href="download.html">Download</a></li><li><a shape="rect"
href="getting-started.html">Getting Started</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li></ul><h3 id="Navigation-Documentation"><a
shape="rect" href="documentation.html">Documentation</a></h3><ul
class="alternate"><li><a shape="rect" href="user-guide.html">User
Guide</a></li><li><a shape="rect" href="manual.html">Manual</a></li><li><a
shape="rect" href="books.html">Books</a></li><li><a shape="rect"
href="tutorials.html">Tutorials</a></li><li><a shape="rect"
href="examples.html">Examples</a></li><li><a shape="rect"
href="cookbook.html">Cookbook</a></li><li><a shape="rect"
href="architecture.html">Architecture</a></li><li><a shape="rect"
href="enterprise-integration-patterns.html">Enterprise
Integration Patterns</a></li><li><a shape="rect"
href="dsl.html">DSL</a></li><li><a shape="rect"
href="components.html">Components</a></li><li><a shape="rect"
href="data-format.html">Data Format</a></li><li><a shape="rect"
href="languages.html">Languages</a></li><li><a shape="rect"
href="security.html">Security</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse">
+ <div>
+ <input type="hidden" name="cx" value="007878419884033443453:m5nhvy4hmyq">
+ <input type="hidden" name="ie" value="UTF-8">
+ <input type="text" name="q" size="21">
+ <input type="submit" name="sa" value="Search">
+ </div>
+</form>
+<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script><h3
id="Navigation-Community"><a shape="rect"
href="community.html">Community</a></h3><ul class="alternate"><li><a
shape="rect" href="support.html">Support</a></li><li><a shape="rect"
href="contributing.html">Contributing</a></li><li><a shape="rect"
href="discussion-forums.html">Discussion Forums</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
href="user-stories.html">User Stories</a></li><li><a shape="rect"
href="news.html">News</a></li><li><a shape="rect"
href="articles.html">Articles</a></li><li><a shape="rect"
href="site.html">Site</a></li><li><a shape="rect"
href="team.html">Team</a></li><li><a shape="rect" class="external-link"
href="http://camel-extra.googlecode.com/" rel="nofollow">Camel
Extra</a></li></ul><h3 id="Navigation-Developers"><a shape="rect"
href="developers.html">Developers</a></h3><ul class="alternate"
><li><a shape="rect" href="developers.html">Developer Guide</a></li><li><a
>shape="rect" href="source.html">Source</a></li><li><a shape="rect"
>href="building.html">Building</a></li><li><a shape="rect"
>href="javadoc.html">JavaDoc</a></li><li><a shape="rect"
>href="irc-room.html">IRC Room</a></li></ul><h3
>id="Navigation-ApacheSoftwareFoundation">Apache Software Foundation</h3><ul
>class="alternate"><li><a shape="rect" class="external-link"
>href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
>class="external-link"
>href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
> shape="rect" class="external-link"
>href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
>shape="rect" class="external-link"
>href="http://www.apache.org/security/">Security</a></li></ul></div>
+ <!-- NavigationBar -->
+ </div>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+
+ <div class="bottom_red_bar"></div>
+ </div>
+ </div>
+ </div>
+</div>
+<div class="black_box">
+<div class="footer">
+ <div class="footer_l">
+ <div class="footer_r">
+ <div>
+ <a href="$base/privacy-policy.html">Privacy Policy</a> -
+ (<a
href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=48792691">edit
page</a>)
+ (<a
href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=48792691&showComments=true&showCommentArea=true#addcomment">add
comment</a>)
+ </div>
+ </div>
+ </div>
+</div>
+</div>
+</div>
+<div class="design_attribution">
+© 2004-2014 The Apache Software Foundation.
+<br>
+Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel
project logo are trademarks of The Apache Software Foundation. All other marks
mentioned may be trademarks or registered trademarks of their respective owners.
+<br>
+<a href="http://hiramchirino.com">Graphic Design By Hiram</a>
+</div>
+
+<!-- Camel committers that would like access to the Analytics, send a note to
[email protected] -->
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-25976253-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript';
ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
+
+</body>
+</html>
+
+