camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Pluggable Class Resolvers
Date Wed, 05 May 2010 08:45:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/Pluggable+Class+Resolvers">Pluggable
Class Resolvers</a></h2>
    <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>See more at [camel-jboss]
for a class resolver which works with JBoss and how to use it. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>h3. Using Camel with Eclipse RCP <br> <br>See more at [camel-eclipse]
for a class resolver which works with Eclipse RCP and how to use it. <br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="PluggableClassResolvers-PluggableClassResolvers"></a>Pluggable
Class Resolvers</h2>
<p><b>Available since Camel 2.0</b></p>

<p>Camel provides pluggable class resolvers allowing third party platforms and contains
to provide their own resolvers in case the default ones does not work on their platform. For
example we provide a <tt>WebSpherePackageScanClassResolver</tt> out of the box
in Camel to integration Camel with IBM WebSphere.</p>

<p>Platform providers should look in the <tt>org.apache.camel.spi</tt> package
for the following pluggble resolvers:</p>
<ul class="alternate" type="square">
	<li><tt>PackageScanClassResolver</tt></li>
	<li><tt>ClassResolver</tt></li>
	<li><tt>FactoryFinderResolver</tt></li>
</ul>


<p>In <b>camel-osgi</b> we provide OSGi aware class resolver allowing Camel
to run in any OSGi container.</p>

<h3><a name="PluggableClassResolvers-Configurationofacustomclassresolver"></a>Configuration
of a custom class resolver</h3>
<p>To instruct Camel to use your own custom class resolver you set the resolver on the
<tt>CamelContext</tt> using the appropriate setters.</p>

<h4><a name="PluggableClassResolvers-EasyconfigurationinSpringXML"></a>Easy
configuration in Spring XML</h4>
<p>We have provided easy configuration in Spring XML as you just need to declare a spring
bean with your custom resolver and Camel will pick it up automatically.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
  <span class="code-tag">&lt;bean id=<span class="code-quote">"jbossresolver"</span>
class=<span class="code-quote">"com.mycompany.jboss.JBossPackageScanClassResolver"</span>/&gt;</span>

  <span class="code-tag">&lt;camelContext id=<span class="code-quote">"camel"</span>
xmlns=<span class="code-quote">"http://camel.apache.org/schema/spring"</span>&gt;</span>
    <span class="code-tag">&lt;route&gt;</span>
      <span class="code-tag">&lt;from uri=<span class="code-quote">"seda:start"</span>/&gt;</span>
      <span class="code-tag">&lt;to uri=<span class="code-quote">"mock:result"</span>/&gt;</span>
    <span class="code-tag">&lt;/route&gt;</span>
  <span class="code-tag">&lt;/camelContext&gt;</span>
</pre>
</div></div>

<p>In the sample above the CamelContext will automatic detect the <tt>jbossresolver</tt>
bean and use it instead of its default one.</p>

<h3><a name="PluggableClassResolvers-FactoryFinderResolver"></a>FactoryFinderResolver</h3>
<p>FactoryFinderResolver is used to get an instance of <tt>FactoryFinder</tt>
that is used for lookup of resource files in the classpath in the <tt>META-INF/services</tt>.
It is used internally by Camel to look in .jars for Camel components. For instance to look
for the <tt>file</tt> component Camel will use the <tt>FactoryFinder</tt>
to look the the file named <tt>file</tt> in <tt>META-INF/services/org/apache/camel/component</tt>.
The <tt>CamelContext</tt> have methods to inject a custom <tt>FactoryFinderResolver</tt>.</p>

<h4><a name="PluggableClassResolvers-EasyconfigurationinSpringXML"></a>Easy
configuration in Spring XML</h4>
<p>We have provided easy configuration in Spring XML as you just need to declare a spring
bean with your custom factory finder resolver and Camel will pick it up automatically.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
  <span class="code-tag">&lt;bean id=<span class="code-quote">"jbossFactoryFinderResolver"</span>
class=<span class="code-quote">"com.mycompany.jboss.JBossFactoryFinderResolver"</span>/&gt;</span>

  <span class="code-tag">&lt;camelContext id=<span class="code-quote">"camel"</span>
xmlns=<span class="code-quote">"http://camel.apache.org/schema/spring"</span>&gt;</span>
    <span class="code-tag">&lt;route&gt;</span>
      <span class="code-tag">&lt;from uri=<span class="code-quote">"seda:start"</span>/&gt;</span>
      <span class="code-tag">&lt;to uri=<span class="code-quote">"mock:result"</span>/&gt;</span>
    <span class="code-tag">&lt;/route&gt;</span>
  <span class="code-tag">&lt;/camelContext&gt;</span>
</pre>
</div></div>

<h3><a name="PluggableClassResolvers-UsingCamelwithJBoss"></a>Using Camel
with JBoss</h3>

<p>See more at <a href="/confluence/display/CAMEL/camel-jboss" title="camel-jboss">camel&#45;jboss</a>
for a class resolver which works with JBoss and how to use it.</p>

<h3><a name="PluggableClassResolvers-UsingCamelwithEclipseRCP"></a>Using
Camel with Eclipse RCP</h3>

<p>See more at <a href="/confluence/pages/createpage.action?spaceKey=CAMEL&amp;title=camel-eclipse&amp;linkCreation=true&amp;fromPageId=111620"
class="createlink">camel&#45;eclipse</a> for a class resolver which works with
Eclipse RCP and how to use it.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="http://cwiki.apache.org/confluence/display/CAMEL/Pluggable+Class+Resolvers">View
Online</a>
        |
        <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=111620&revisedVersion=6&originalVersion=5">View
Changes</a>
                |
        <a href="http://cwiki.apache.org/confluence/display/CAMEL/Pluggable+Class+Resolvers?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message