deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1730277 - in /deltaspike/site/trunk/content/documentation: core.html jpa.html
Date Sat, 13 Feb 2016 21:36:51 GMT
Author: gpetracek
Date: Sat Feb 13 21:36:51 2016
New Revision: 1730277

URL: http://svn.apache.org/viewvc?rev=1730277&view=rev
Log:
Site checkin for project Apache DeltaSpike Documentation

Modified:
    deltaspike/site/trunk/content/documentation/core.html
    deltaspike/site/trunk/content/documentation/jpa.html

Modified: deltaspike/site/trunk/content/documentation/core.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/core.html?rev=1730277&r1=1730276&r2=1730277&view=diff
==============================================================================
--- deltaspike/site/trunk/content/documentation/core.html (original)
+++ deltaspike/site/trunk/content/documentation/core.html Sat Feb 13 21:36:51 2016
@@ -1655,19 +1655,34 @@ javax.enterprise.inject.spi.Bean instanc
 <h2 id="_deactivatable">Deactivatable</h2>
 <div class="sectionbody">
 <div class="paragraph">
-<p>DeltaSpike allows you to deactivate its own Extensions. You just need to
-implement your <a href="spi.html#_classdeactivator">ClassDeactivator</a>.</p>
+<p>DeltaSpike allows you to deactivate its own pre-configured parts (like Extensions,
event-broadcasters,&#8230;&#8203;).
+Therefore DeltaSpike offers <code>org.apache.deltaspike.core.spi.activation.ClassDeactivator</code>
and
+<code>org.apache.deltaspike.core.spi.activation.Deactivatable</code>.</p>
 </div>
 <div class="paragraph">
-<p>The ClassDeactivator should be resolved by any ConfigSource using the
+<p>A <code>ClassDeactivator</code> allows to specify deactivated classes
(if they implement <code>Deactivatable</code>)
+which can&#8217;t be deactivated/customized via std. CDI mechanisms
+(like the veto-method or alternative/specialized CDI-beans).
+This might be the case e.g. for CDI Extensions because CDI mechanisms are not available at
startup time.</p>
+</div>
+<div class="paragraph">
+<p>Use it mainly to deactivate specific parts <strong>explicitly</strong>
(blacklist approach),
+if there is an issue with such parts (and waiting for the next release isn&#8217;t an
option).</p>
+</div>
+<div class="paragraph">
+<p>You just need to implement your <a href="spi.html#_classdeactivator">ClassDeactivator</a>.</p>
+</div>
+<div class="paragraph">
+<p>The <code>ClassDeactivator</code> 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>
+example, if we need to provide our own version of the SecurityExtension,
+we can disable the SecurityExtension provided by DeltaSpike with the following <code>ClassDeactivator</code>:</p>
 </div>
 <div class="listingblock">
+<div class="title">Disable a specific extension</div>
 <div class="content">
 <pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span>
<span class="type">class</span> <span class="class">CustomClassDeactivator</span>
<span class="directive">implements</span> ClassDeactivator
 {
-
     <span class="directive">private</span> <span class="directive">static</span>
<span class="directive">final</span> <span class="type">long</span>
serialVersionUID = <span class="integer">1L</span>;
 
     <span class="annotation">@Override</span>
@@ -1691,6 +1706,53 @@ other <a href="configuration.html#_confi
 <pre>org.apache.deltaspike.core.spi.activation.ClassDeactivator=org.test.CustomClassDeactivator</pre>
 </div>
 </div>
+<div class="paragraph">
+<p>SecurityExtension still gets started, because it isn&#8217;t possible to veto
it, however, it isn&#8217;t processing beans (once deactivated)
+and therefore it&#8217;s e.g. possible to extend and customize the default implementation
provided by DeltaSpike.</p>
+</div>
+<div class="paragraph">
+<p>The following listing shows how to enable only a minimal set of extensions.
+Technically that&#8217;s possible, however, it isn&#8217;t suggested to use such
an approach,
+because you might disable mechanisms need later on (in your project).</p>
+</div>
+<div class="listingblock">
+<div class="title">Possible but not suggested</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span>
<span class="type">class</span> <span class="class">WhitelistFilter</span>
<span class="directive">implements</span> ClassDeactivator
+{
+    <span class="directive">private</span> <span class="predefined-type">List</span>&lt;<span
class="predefined-type">Class</span>&lt;?&gt;&gt; limitedExtensions =
+      <span class="keyword">new</span> <span class="predefined-type">ArrayList</span>&lt;<span
class="predefined-type">Class</span>&lt;?&gt;&gt;()
+    {{
+        add(ConfigurationExtension.class);
+        add(PartialBeanBindingExtension.class);
+        add(RepositoryExtension.class);
+    }};
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="predefined-type">Boolean</span>
isActivated(
+      <span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span>
Deactivatable&gt; deactivatableClass)
+    {
+        <span class="keyword">return</span> !Extension.class.isAssignableFrom(deactivatableClass)
||
+            limitedExtensions.contains(deactivatableClass);
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Instead it&#8217;s better to disable the part you really like to deactivate
(see <code>CustomClassDeactivator</code>).</p>
+</div>
+<div class="sect2">
+<h3 id="_deactivate_deactivatable_classes_via_config">Deactivate Deactivatable-Classes
via Config</h3>
+<div class="paragraph">
+<p>The default implementation of <code>ClassDeactivator</code> allows to
deactivate classes by adding config-entries to one of your config-sources (like <code>META-INF\apache-deltaspike.properties</code>).
+The following example shows how it would look like e.g. in case of the SecurityExtension:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>deactivate.org.apache.deltaspike.security.impl.extension.SecurityExtension=true</pre>
+</div>
+</div>
+</div>
 </div>
 </div>
 <div class="sect1">
@@ -1945,7 +2007,11 @@ objects, the last object in the array wi
 <li><a href="#_creating_a_custom_cdi_scope">Creating a Custom CDI Scope</a></li>
 </ul>
 </li>
-<li><a href="#_deactivatable">Deactivatable</a></li>
+<li><a href="#_deactivatable">Deactivatable</a>
+<ul class="sectlevel2">
+<li><a href="#_deactivate_deactivatable_classes_via_config">Deactivate Deactivatable-Classes
via Config</a></li>
+</ul>
+</li>
 <li><a href="#_utilities">Utilities</a>
 <ul class="sectlevel2">
 <li><a href="#_annotationutils">AnnotationUtils</a></li>

Modified: deltaspike/site/trunk/content/documentation/jpa.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/jpa.html?rev=1730277&r1=1730276&r2=1730277&view=diff
==============================================================================
--- deltaspike/site/trunk/content/documentation/jpa.html (original)
+++ deltaspike/site/trunk/content/documentation/jpa.html Sat Feb 13 21:36:51 2016
@@ -510,7 +510,11 @@ the example above.</p>
 </div>
 </div>
 <div class="paragraph">
-<p>Obtaining an EntityManager from an EntityManagerFactory is just a matter of calling
<code>emfA.createEntityManager()</code>.</p>
+<p>Obtaining an EntityManager from an EntityManagerFactory is just a matter of calling
<code>emfA.createEntityManager()</code>.
+DeltaSpike provides a built-in producer for <code>@PersistenceUnitName</code>
qualified EntityManagerFactories.
+This producer also looks up  a property files with the name <code>persistence-{persistenceunit
name}.properties</code> via the DeltaSpike <code>PropertyLoader</code>.
+For the example above this would be <code>persistence-puA.properties</code>.
+The properties in this file will be passed 1:1 to <code>Persistence#createEntityManagerFactory(properties)</code>
by the built-in producer method.</p>
 </div>
 </div>
 <div class="sect3">



Mime
View raw message