deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rafab...@apache.org
Subject svn commit: r1602236 - in /deltaspike/site/trunk/content: core.mdtext spi.mdtext
Date Thu, 12 Jun 2014 17:20:33 GMT
Author: rafabene
Date: Thu Jun 12 17:20:33 2014
New Revision: 1602236

URL: http://svn.apache.org/r1602236
Log:
DELTASPIKE-634 - Add documentation for Deactivatable on core

Modified:
    deltaspike/site/trunk/content/core.mdtext
    deltaspike/site/trunk/content/spi.mdtext

Modified: deltaspike/site/trunk/content/core.mdtext
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/core.mdtext?rev=1602236&r1=1602235&r2=1602236&view=diff
==============================================================================
--- deltaspike/site/trunk/content/core.mdtext (original)
+++ deltaspike/site/trunk/content/core.mdtext Thu Jun 12 17:20:33 2014
@@ -261,12 +261,12 @@ Literals allow the instantiation of anno
 **Example**
 
     :::java
-    public abstract class PayByQualifier 
+    public abstract class PayByQualifier
            extends AnnotationLiteral<PayBy>
            implements PayBy {}
- 
+
      PayBy paybyCheque = new PayByQualifier() { public PaymentMethod value() { return CHEQUE;
} };
-     
+
 DeltaSpike provides many annotation literals that you can use - e.g.:
 
 - AlternativeLiteral
@@ -386,7 +386,7 @@ You can use `#argument(String)` to pass 
         }
         //...
     }
-    
+
 Besides the static config via `@MessageContextConfig#messageSource`, you can also specify
the message sources dynamically.
 
     :::java
@@ -408,8 +408,8 @@ Besides the static config via `@MessageC
 
     //content (as usual) in message bundle files:
     hello=Hello %s from %s
-    
-         
+
+
 
 ### Customizing the message context
 
@@ -420,7 +420,7 @@ A message-resolver is responsible for cr
 In case of a message-key, the message-resolver has to transform it to the message-text by
looking it up in a message source like a resource-bundle.
 
 **Configuration of a message-resolver**
-    
+
 Besides the static config via `@MessageContextConfig#messageResolver`, you can use it dynamically
via passing a custom message-resolver instance to the current messageContext:
 
     :::java
@@ -430,7 +430,7 @@ Besides the static config via `@MessageC
     //...
 
     Message message = this.messageContext.messageResolver(new CustomMessageResolver()).message();
-    
+
 The result of a `MessageResolver` is the message-text. The text might contain placeholders
which are processed by a `MessageInterpolator`
 
 #### MessageInterpolator
@@ -447,7 +447,7 @@ Besides the static config via `@MessageC
 
     //...
     Message message = this.messageContext.messageInterpolator(new CustomMessageInterpolator()).message();
-    
+
 
 #### LocaleResolver
 
@@ -463,7 +463,7 @@ Besides the static config via `@MessageC
 
     //...
     Message message = this.messageContext.localeResolver(new CustomLocaleResolver()).message();
-    
+
 ## Injecting Resources
 
 DeltaSpike has simple APIs for performing basic resource loading and property file reading.
@@ -814,6 +814,36 @@ that exception chain, unless it's explic
 
 ## Scopes
 
+## Deactivatable
+
+DeltaSpike allows you to deactivate its own Extensions. You just need to implement your [ClassDeactivator](spi.html#classdeactivator).
+
+The ClassDeactivator should be resolved by any ConfigSource using the key `org.apache.deltaspike.core.spi.activation.ClassDeactivator`.
For example, we can disable SecurityExtension having the following class:
+
+    :::java
+    public class CustomClassDeactivator implements ClassDeactivator
+    {
+
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public Boolean isActivated(Class<? extends Deactivatable> targetClass)
+        {
+            if (targetClass.equals(SecurityExtension.class))
+            {
+                return Boolean.FALSE;
+            }
+            return null; //no result for the given class
+        }
+    }
+
+
+now, we can use the file /META-INF/apache-deltaspike.properties (or any other [ConfigSource](configuration.html#configsources-provided-by-default))
with the following key/value:
+
+    org.apache.deltaspike.core.spi.activation.ClassDeactivator=org.test.CustomClassDeactivator
+
+
+
 # Core - Utils
 
 DeltaSpike provides many utility-classes (no constructor / static methods) that can be useful
for your project.
@@ -842,7 +872,7 @@ Helper methods for `ClassDeactivator`
 
 To add a custom `ClassDeactivator` add `org.apache.deltaspike.core.spi.activation.ClassDeactivator=my.CustomClassDeactivator`
to `META-INF\apache-deltaspike.properties`.
 Or configure it via a custom `ConfigSource`.
- 
+
 ## ExceptionUtils
 
 Helper methods to deal with Exceptions
@@ -857,14 +887,14 @@ Helper methods for Property files
  - `#resolvePropertyFiles` - Allows to lookup for resource bundle files.
  - `#loadProperties` - Load a Properties file from the given URL.
  - `#getResourceBundle` - Return the ResourceBundle for the current default Locale.
- 
+
 ## ProxyUtils
 
 Helper for CDI proxies
 
  - `#getUnproxiedClass` - Return class of the real implementation.
  - `#isProxiedClass` - Analyses if the given class is a generated proxy class.
- 
+
 ## StringUtils
 
 A collection of utilities for working with Strings.

Modified: deltaspike/site/trunk/content/spi.mdtext
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/spi.mdtext?rev=1602236&r1=1602235&r2=1602236&view=diff
==============================================================================
--- deltaspike/site/trunk/content/spi.mdtext (original)
+++ deltaspike/site/trunk/content/spi.mdtext Thu Jun 12 17:20:33 2014
@@ -41,7 +41,7 @@ DeltaSpike itself doesn't deactivate an 
 A class-deactivator allows to specify deactivated classes.
    
     //This class needs to be configured via one of the supported config sources!
-    public class CustomClassDeactivator extends ClassDeactivator
+    public class CustomClassDeactivator implements ClassDeactivator
     {
         @Override
         public Boolean isActivated(Class<? extends Deactivatable> targetClass)



Mime
View raw message