deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r912359 - in /websites/staging/deltaspike/trunk/content: ./ core.html spi.html
Date Thu, 12 Jun 2014 17:20:40 GMT
Author: buildbot
Date: Thu Jun 12 17:20:39 2014
New Revision: 912359

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/core.html
    websites/staging/deltaspike/trunk/content/spi.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Jun 12 17:20:39 2014
@@ -1 +1 @@
-1602186
+1602236

Modified: websites/staging/deltaspike/trunk/content/core.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/core.html (original)
+++ websites/staging/deltaspike/trunk/content/core.html Thu Jun 12 17:20:39 2014
@@ -140,6 +140,7 @@ Notice:    Licensed to the Apache Softwa
 </ul>
 </li>
 <li><a href="#scopes">Scopes</a></li>
+<li><a href="#deactivatable">Deactivatable</a></li>
 </ul>
 </li>
 <li><a href="#core-utils">Core - Utils</a><ul>
@@ -346,7 +347,7 @@ For such cases a custom ExpressionInterp
 <h2 id="literals">Literals</h2>
 <p>Literals allow the instantiation of annotations by extending the abstract class
'javax.enterprise.util.AnnotationLiteral'</p>
 <p><strong>Example</strong></p>
-<div class="codehilite"><pre><span class="kd">public</span> <span
class="kd">abstract</span> <span class="kd">class</span> <span class="nc">PayByQualifier</span>

+<div class="codehilite"><pre><span class="kd">public</span> <span
class="kd">abstract</span> <span class="kd">class</span> <span class="nc">PayByQualifier</span>
        <span class="kd">extends</span> <span class="n">AnnotationLiteral</span><span
class="o">&lt;</span><span class="n">PayBy</span><span class="o">&gt;</span>
        <span class="kd">implements</span> <span class="n">PayBy</span>
<span class="o">{}</span>
 
@@ -825,6 +826,32 @@ object to give flow control to the handl
 that exception chain, unless it's explicitly marked as unmuted via the
 <code>unmute()</code> method on <code>ExceptionEvent</code>.</p>
 <h2 id="scopes">Scopes</h2>
+<h2 id="deactivatable">Deactivatable</h2>
+<p>DeltaSpike allows you to deactivate its own Extensions. You just need to implement
your <a href="spi.html#classdeactivator">ClassDeactivator</a>.</p>
+<p>The ClassDeactivator should be resolved by any ConfigSource using the key <code>org.apache.deltaspike.core.spi.activation.ClassDeactivator</code>.
For example, we can disable SecurityExtension having the following class:</p>
+<div class="codehilite"><pre><span class="kd">public</span> <span
class="kd">class</span> <span class="nc">CustomClassDeactivator</span>
<span class="kd">implements</span> <span class="n">ClassDeactivator</span>
+<span class="o">{</span>
+
+    <span class="kd">private</span> <span class="kd">static</span>
<span class="kd">final</span> <span class="kt">long</span> <span
class="n">serialVersionUID</span> <span class="o">=</span> <span class="mi">1L</span><span
class="o">;</span>
+
+    <span class="nd">@Override</span>
+    <span class="kd">public</span> <span class="n">Boolean</span>
<span class="nf">isActivated</span><span class="o">(</span><span
class="n">Class</span><span class="o">&lt;?</span> <span class="kd">extends</span>
<span class="n">Deactivatable</span><span class="o">&gt;</span>
<span class="n">targetClass</span><span class="o">)</span>
+    <span class="o">{</span>
+        <span class="k">if</span> <span class="o">(</span><span
class="n">targetClass</span><span class="o">.</span><span class="na">equals</span><span
class="o">(</span><span class="n">SecurityExtension</span><span class="o">.</span><span
class="na">class</span><span class="o">))</span>
+        <span class="o">{</span>
+            <span class="k">return</span> <span class="n">Boolean</span><span
class="o">.</span><span class="na">FALSE</span><span class="o">;</span>
+        <span class="o">}</span>
+        <span class="k">return</span> <span class="kc">null</span><span
class="o">;</span> <span class="c1">//no result for the given class</span>
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>now, we can use the file /META-INF/apache-deltaspike.properties (or any other <a
href="configuration.html#configsources-provided-by-default">ConfigSource</a>) with
the following key/value:</p>
+<div class="codehilite"><pre><span class="n">org</span><span class="p">.</span><span
class="n">apache</span><span class="p">.</span><span class="n">deltaspike</span><span
class="p">.</span><span class="n">core</span><span class="p">.</span><span
class="n">spi</span><span class="p">.</span><span class="n">activation</span><span
class="p">.</span><span class="n">ClassDeactivator</span><span class="p">=</span><span
class="n">org</span><span class="p">.</span><span class="n">test</span><span
class="p">.</span><span class="n">CustomClassDeactivator</span>
+</pre></div>
+
+
 <h1 id="core-utils">Core - Utils</h1>
 <p>DeltaSpike provides many utility-classes (no constructor / static methods) that
can be useful for your project.</p>
 <p>Below you can find an information about these classes.</p>

Modified: websites/staging/deltaspike/trunk/content/spi.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/spi.html (original)
+++ websites/staging/deltaspike/trunk/content/spi.html Thu Jun 12 17:20:39 2014
@@ -108,7 +108,7 @@ DeltaSpike itself doesn't deactivate an 
 <h2 id="classdeactivator">ClassDeactivator</h2>
 <p>A class-deactivator allows to specify deactivated classes.</p>
 <div class="codehilite"><pre><span class="c1">//This class needs to be
configured via one of the supported config sources!</span>
-<span class="n">public</span> <span class="k">class</span> <span
class="n">CustomClassDeactivator</span> <span class="k">extends</span>
<span class="n">ClassDeactivator</span>
+<span class="n">public</span> <span class="k">class</span> <span
class="n">CustomClassDeactivator</span> <span class="n">implements</span>
<span class="n">ClassDeactivator</span>
 <span class="p">{</span>
     <span class="p">@</span><span class="n">Override</span>
     <span class="n">public</span> <span class="n">Boolean</span>
<span class="n">isActivated</span><span class="p">(</span><span
class="n">Class</span><span class="o">&lt;?</span> <span class="k">extends</span>
<span class="n">Deactivatable</span><span class="o">&gt;</span>
<span class="n">targetClass</span><span class="p">)</span>



Mime
View raw message