cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Schneider (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache CXF > CXF configuration ideas
Date Tue, 10 Dec 2013 09:46:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/15/_/styles/combined.css?spaceKey=CXF&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/CXF/CXF+configuration+ideas">CXF
configuration ideas</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~christian%2Bschneider">Christian
Schneider</a>
    </h4>
        <br/>
                         <h4>Changes (4)</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>h4. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>{code:language=java|title=Feature definition} <br>@Named(&quot;MyFeature&quot;)
<br>public class MyFeature extends AbstractFeature { <br>... <br>} <br>{code}
<br> <br>Endpoint with inlined injections <br> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">{code:language=java|title=Endpoint}<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{code}</span></span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{code:language=java|title=Proxy}{code}
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">@WebService
<br>public class MyServiceImpl implements MyService { <br>  @Inject MyRessource
res1; // Inject arbitrary user ressources <br> <br>  @Inject @Named(&quot;MyFeature&quot;)
Feature feature1; // Inject named feature <br>  @Inject List&lt;Feature&gt;
features; // Inject all features known to this context <br>... <br>} <br>{code}
<br> <br>We might also support some kind of Endpoint description classes to separate
endpoint definition from the actual implementation. Not sure how to wire this with CDI. Any
ideas? <br> <br> <br>For the proxy I am not sure which is the best annotation
based approach. One idea is to have one or more factories for producers. <br> <br>{code:language=java|title=Annotation
based Proxy definitions} <br>public class MyServiceProducer { <br> <br>
 @Produce MyService createMyService() { <br>     return new JAXWSProxyFactory(&quot;http://myserver:8080/myService&quot;);
<br> <br>  } <br> <br>  @Produce @MyMarker // CDI Qualifiers to distinguish
services of the same interface type <br>  MyService createMyService() { <br> 
} <br>} <br>{code} <br> <br>{code:language=java|title=XML based proxy
definition} <br> <br>{code} <br> <br>{code:language=java|title=Annotation
based JAXRS Endpoint definition} <br> <br>{code} <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="CXFconfigurationideas-Environment"></a>Environment</h2>

<p>CXF is intended to work in a wide range of containers / frameworks:</p>
<ul>
	<li>Plain Java</li>
	<li>Spring XML and annotation based</li>
	<li>Blueprint</li>
	<li>JavaEE (CDI)</li>
</ul>


<p>It for each of the important cases it should be as easy and natural to configure
CXF for the developer.</p>


<h2><a name="CXFconfigurationideas-Problemdescription"></a>Problem description</h2>

<p>Currently CXF provides a lot of integration points with frameworks as well as CXF
proprietary ways of configuration.</p>

<p>Out current approach has several drawbacks:</p>
<ul>
	<li>Integration with some frameworks creates problems with other frameworks. For example
the aries blueprint namespaces make it impossible to use gemini blueprint</li>
	<li>CXF configuration is often quite unnatural for users of the respective frameworks.
For example if you define a Feature using the service loader approach you cannot inject resources
into it</li>
	<li>Using other framework is often difficult as we do not have nice plain java ways
to setup e.g. endpoints</li>
	<li>CXF defines special annotations. These are processed in a CXF proprietary way that
does not allow to mix these with annotations of the user framework of choice</li>
</ul>


<h2><a name="CXFconfigurationideas-Idea"></a>Idea</h2>

<p>The general idea is to step back and keep injection out of CXF as much as possible
and instead rely more on the frameworks to do this job. This should make CXF much more embedable
and less complex. We still can have some glue code for the frameworks but at as few points
as possible.</p>

<p>A good example for this is camel which defines a registry concept that is implemented
differently for each framework. In spring it relies on the spring context in blueprint on
the blueprint context, in OSGi on services. The camel registry is not perfect but a good step
in the right direction.</p>

<p>In the following checpters we should look into the respective frameworks and discuss
how CXF integration should work ideally.</p>

<h2><a name="CXFconfigurationideas-Spring"></a>Spring</h2>


<h3><a name="CXFconfigurationideas-XML"></a>XML</h3>


<h3><a name="CXFconfigurationideas-Annotationbased"></a>Annotation based</h3>


<h2><a name="CXFconfigurationideas-Blueprint"></a>Blueprint</h2>


<h2><a name="CXFconfigurationideas-CDI"></a>CDI</h2>


<h4><a name="CXFconfigurationideas-"></a></h4>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Feature definition</b></div><div
class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
@Named("MyFeature")
public class MyFeature extends AbstractFeature {
...
}
</pre>
</div></div>

<p>Endpoint with inlined injections</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Endpoint</b></div><div class="codeContent
panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
@WebService
public class MyServiceImpl implements MyService {
  @Inject MyRessource res1; // Inject arbitrary user ressources

  @Inject @Named("MyFeature") Feature feature1; // Inject named feature
  @Inject List&lt;Feature&gt; features; // Inject all features known to this context
...
}
</pre>
</div></div>

<p>We might also support some kind of Endpoint description classes to separate endpoint
definition from the actual implementation. Not sure how to wire this with CDI. Any ideas?</p>


<p>For the proxy I am not sure which is the best annotation based approach. One idea
is to have one or more factories for producers.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Annotation based Proxy definitions</b></div><div
class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
public class MyServiceProducer {

  @Produce MyService createMyService() {
     return new JAXWSProxyFactory("http://myserver:8080/myService");
     
  }

  @Produce @MyMarker // CDI Qualifiers to distinguish services of the same interface type
  MyService createMyService() {
  }
}
</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>XML based proxy definition</b></div><div
class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">

</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Annotation based JAXRS Endpoint definition</b></div><div
class="codeContent panelContent">
<pre class="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">

</pre>
</div></div>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CXF">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CXF/CXF+configuration+ideas">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=36274231&revisedVersion=3&originalVersion=2">View
Changes</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message