camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > ComponentConfiguration
Date Tue, 23 Apr 2013 10:00:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/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="https://cwiki.apache.org/confluence/display/CAMEL/ComponentConfiguration">ComponentConfiguration</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~jstrachan">James
Strachan</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h2. ComponentConfiguration API <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">The</span>
<span class="diff-added-words"style="background-color: #dfd;">As of *Camel 2.12* there
is a</span> new ComponentConfiguration API provides a mechanism for tools (command line,
IDE, web based) to introspect the available Camel components and introspect what configuration
parameters are available on the components to create new endpoints, edit existing endpoints
or create URIs for endpoints (if the aim is to allow UI editting of Camel routes for example).
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>To get an idea for the
kinds of things you can do with the ComponentConfiguration API [check out the test case|https://github.com/apache/camel/blob/trunk/camel-core/src/test/java/org/apache/camel/impl/ComponentConfigurationTest.java#L69].
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="ComponentConfiguration-ComponentConfigurationAPI"></a>ComponentConfiguration
API</h2>

<p>As of <b>Camel 2.12</b> there is a new ComponentConfiguration API provides
a mechanism for tools (command line, IDE, web based) to introspect the available Camel components
and introspect what configuration parameters are available on the components to create new
endpoints, edit existing endpoints or create URIs for endpoints (if the aim is to allow UI
editting of Camel routes for example).</p>

<p>To get an idea for the kinds of things you can do with the ComponentConfiguration
API <a href="https://github.com/apache/camel/blob/trunk/camel-core/src/test/java/org/apache/camel/impl/ComponentConfigurationTest.java#L69"
class="external-link" rel="nofollow">check out the test case</a>.</p>

<p>For example given a Component object you can create a new configuration; then introspect
the available properties...</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
Component component = camelContext.getComponent(<span class="code-quote">"seda"</span>);
ComponentConfiguration configuration = component.createComponentConfiguration();

<span class="code-comment">// now lets introspect the available parameters...
</span>SortedMap&lt;<span class="code-object">String</span>, ParameterConfiguration&gt;
parameterMap = configuration.getParameterConfigurationMap();

<span class="code-comment">// or lets look up a named parameter
</span>ParameterConfiguration config = configuration.getParameterConfiguration(<span
class="code-quote">"foo"</span>);


<span class="code-comment">// lets get or set the parameter values...
</span>configuration.setParameter(<span class="code-quote">"concurrentConsumers"</span>,
5);
configuration.setParameter(<span class="code-quote">"size"</span>, 1000);

<span class="code-comment">// or lets set the base URI and parameters from a URI string
</span>configuration.setUriString(<span class="code-quote">"foo?concurrentConsumers=5&amp;size=1000"</span>);


<span class="code-comment">// now lets convert the configuration to a URI string
</span><span class="code-object">String</span> uriString = configuration.getUriString();

<span class="code-comment">// now lets convert the configuration to an Endpoint
</span>Endpoint newEndpoint = configuration.createEndpoint();
</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/ComponentConfiguration">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=31819233&revisedVersion=3&originalVersion=2">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/ComponentConfiguration?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message