cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r807773 - in /websites/production/cxf/content: cache/docs.pageCache docs/developing-assertions.html
Date Wed, 07 Mar 2012 17:48:05 GMT
Author: buildbot
Date: Wed Mar  7 17:48:05 2012
New Revision: 807773

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/developing-assertions.html

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

Modified: websites/production/cxf/content/docs/developing-assertions.html
==============================================================================
--- websites/production/cxf/content/docs/developing-assertions.html (original)
+++ websites/production/cxf/content/docs/developing-assertions.html Wed Mar  7 17:48:05 2012
@@ -145,6 +145,11 @@ Apache CXF -- Developing Assertions
 
 <h2><a shape="rect" name="DevelopingAssertions-ImplementingandRegisteringtheAssertionBuilderInterface"></a>Implementing
and Registering the AssertionBuilder Interface</h2>
 
+<p>Assertion Builder class for custom assertion should implement <em>AssertionBuilder&lt;T&gt;</em>
interface. The interface type can be <em>Element</em>, <em>XMLStreamReader</em>
or <em>OMElement</em>. <br clear="none">
+Interface contains two methods: <em>build()</em> and <em>getKnownElements()</em>.
<br clear="none">
+Implementation of <em>build()</em> method should construct Assertion from the
incoming type. It can be <em>PrimitiveAssertion</em> (without attributes or child
elements), NestedPrimitiveAssertion  (without attributes but with nested policy element) and
<em>JaxbAssertion</em> (assertion described by any XML schema).<br clear="none">
+<em>getKnownElements()</em> method must return QNames of assertion elements from
which assertion can be built.</p>
+
 <p>Implementing the build method of the AssertionBuilder interface is straightforward
(in the case of JaxbAssertions you can extend the JaxbAssertionBuilder class, which provides
an appropriate JAXB context and some other useful methods). </p>
 
 <p>The implementation of buildCompatible may need some more consideration if your assertion
represents an element with attributes and/or child elements. </p>
@@ -187,7 +192,7 @@ class MyPolicyAwareInterceptor {
 </pre>
 </div></div>
 
-<p>Sometimes, it may be more convenient to spead the above functionality accross several
interceptors, possibly according to chain (in, in fault, out, outfault). In any case, you
need to also provide a PolicyInterceptorProvider, and declare a corresponding bean. Either
implement one from scratch or use the PolicyInterceptorProviderImpl in the api package and
customise it as follows (assuming that one and the same interceptor is used for all paths):</p>
+<p>Sometimes, it may be more convenient to spead the above functionality accross several
interceptors, possibly according to chain (in, in fault, out, outfault). In any case, you
need to also provide a PolicyInterceptorProvider, and declare a corresponding bean. Either
implement one from scratch or use the PolicyInterceptorProviderImpl in the api package and
customise it as follows (assuming that one and the same interceptor is used for all paths).
The main task of policy interceptor provider is to say which interceptors must be activated
for specified policy assertion:</p>
 <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
 <pre class="code-xml">
 
@@ -231,6 +236,30 @@ class MyPolicyAwareInterceptor {
 
 <p>All beans of type PolicyInterceptorProvider are automatically registered with the
framework's PolicyInterceptorProviderRegistry.</p>
 
+<p>It is also possible to implement policy interceptor provider programmatically from
scratch. It's constructor gives assertions QNames as argument of super constructor and adds
corresponded interceptors using getters:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
+<pre class="code-java">
+<span class="code-keyword">public</span> class AuthorizationInterceptorProvider
<span class="code-keyword">extends</span> AbstractPolicyInterceptorProvider {
+    <span class="code-keyword">private</span> <span class="code-keyword">static</span>
<span class="code-keyword">final</span> <span class="code-object">long</span>
serialVersionUID = -5248428637449096540L;
+    <span class="code-keyword">private</span> <span class="code-keyword">static</span>
<span class="code-keyword">final</span> AuthorizationInInterceptor IN_AUTHZ_INTERCEPTOR
= <span class="code-keyword">new</span> AuthorizationInInterceptor();
+    <span class="code-keyword">private</span> <span class="code-keyword">static</span>
<span class="code-keyword">final</span> AuthorizationInInterceptor OUT_AUTHZ_INTERCEPTOR
= <span class="code-keyword">new</span> AuthorizationOutInterceptor();
+    
+    <span class="code-keyword">private</span> <span class="code-keyword">static</span>
<span class="code-keyword">final</span> Collection&lt;QName&gt; ASSERTION_TYPES;
+    <span class="code-keyword">static</span> {
+        ASSERTION_TYPES = <span class="code-keyword">new</span> ArrayList&lt;QName&gt;();
+        ASSERTION_TYPES.add(AuthorizationConstants.AUTHORIZATION_ASSERTION);
+    }
+
+    <span class="code-keyword">public</span> AuthorizationInterceptorProvider()
{
+        <span class="code-keyword">super</span>(ASSERTION_TYPES);
+        getInInterceptors().add(IN_AUTHZ_INTERCEPTOR);        
+        getOutInterceptors().add(OUT_AUTHZ_INTERCEPTOR);        
+    }
+}
+</pre>
+</div></div>
+
 <h2><a shape="rect" name="DevelopingAssertions-ImplementingaPolicyAwareConduit%2FDestination"></a>Implementing
a Policy-Aware Conduit/Destination</h2>
 
 <h3><a shape="rect" name="DevelopingAssertions-Initialisation"></a>Initialisation</h3>



Mime
View raw message