myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r954635 - in /myfaces/extensions/cdi/trunk: core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/ jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ jee-modules/jsf-module/impl/s...
Date Mon, 14 Jun 2010 20:40:59 GMT
Author: gpetracek
Date: Mon Jun 14 20:40:59 2010
New Revision: 954635

URL: http://svn.apache.org/viewvc?rev=954635&view=rev
Log:
EXTCDI-6 initial draft

Added:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java
      - copied, changed from r954597, myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameter.java
Removed:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameter.java
Modified:
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/ConfigProducer.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/config/DefaultCodiWebConfig.java

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/ConfigProducer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/ConfigProducer.java?rev=954635&r1=954634&r2=954635&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/ConfigProducer.java
(original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/ConfigProducer.java
Mon Jun 14 20:40:59 2010
@@ -94,6 +94,24 @@ public class ConfigProducer
         };
     }
 
+    private void createConfigFilter(BeanManager beanManager)
+    {
+        Set<? extends Bean> deactivatedConfigBeans = beanManager.getBeans(DeactivatedCodiConfig.class);
+
+        configFilter = new HashSet<Class<? extends CodiConfig>>(deactivatedConfigBeans.size());
+
+        CreationalContext<DeactivatedCodiConfig> creationalContext;
+        Class<? extends CodiConfig>[] filteredCodiConfigClasses;
+        for(Bean<DeactivatedCodiConfig> deactivatedConfigBean : deactivatedConfigBeans)
+        {
+            creationalContext = beanManager.createCreationalContext(deactivatedConfigBean);
+
+            filteredCodiConfigClasses = deactivatedConfigBean.create(creationalContext).getDeactivatedConfigs();
+
+            configFilter.addAll(Arrays.asList(filteredCodiConfigClasses));
+        }
+    }
+
     private void createConfig(BeanManager beanManager)
     {
         Set<? extends Bean> configBeans = beanManager.getBeans(CodiConfig.class);
@@ -114,22 +132,4 @@ public class ConfigProducer
             }
         }
     }
-
-    private void createConfigFilter(BeanManager beanManager)
-    {
-        Set<? extends Bean> deactivatedConfigBeans = beanManager.getBeans(DeactivatedCodiConfig.class);
-
-        configFilter = new HashSet<Class<? extends CodiConfig>>(deactivatedConfigBeans.size());
-
-        CreationalContext<DeactivatedCodiConfig> creationalContext;
-        Class<? extends CodiConfig>[] filteredCodiConfigClasses;
-        for(Bean<DeactivatedCodiConfig> deactivatedConfigBean : deactivatedConfigBeans)
-        {
-            creationalContext = beanManager.createCreationalContext(deactivatedConfigBean);
-
-            filteredCodiConfigClasses = deactivatedConfigBean.create(creationalContext).getDeactivatedConfigs();
-
-            configFilter.addAll(Arrays.asList(filteredCodiConfigClasses));
-        }
-    }
 }

Copied: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java
(from r954597, myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameter.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java?p2=myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java&p1=myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameter.java&r1=954597&r2=954635&rev=954635&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/WebXmlParameter.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java
Mon Jun 14 20:40:59 2010
@@ -23,7 +23,9 @@ import org.apache.myfaces.extensions.cdi
 /**
  * @author Gerhard Petracek
  */
-public interface WebXmlParameter
+public interface ConfigParameter
 {
     static final String TRANSACTION_TOKEN_ENABLED = CoreCodiConfigParameter.BASE_NAME + "TRANSACTION_TOKEN_ENABLED";
+
+    static final Boolean TRANSACTION_TOKEN_ENABLED_DEFAULT = Boolean.FALSE;
 }

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/config/DefaultCodiWebConfig.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/config/DefaultCodiWebConfig.java?rev=954635&r1=954634&r2=954635&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/config/DefaultCodiWebConfig.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/config/DefaultCodiWebConfig.java
Mon Jun 14 20:40:59 2010
@@ -19,13 +19,13 @@
 package org.apache.myfaces.extensions.cdi.javaee.jsf.impl.config;
 
 import org.apache.myfaces.extensions.cdi.javaee.jsf.api.config.CodiWebConfig12;
-import static org.apache.myfaces.extensions.cdi.javaee.jsf.api.WebXmlParameter.TRANSACTION_TOKEN_ENABLED;
+import static org.apache.myfaces.extensions.cdi.javaee.jsf.api.ConfigParameter.TRANSACTION_TOKEN_ENABLED;
+import static org.apache.myfaces.extensions.cdi.javaee.jsf.api.ConfigParameter.TRANSACTION_TOKEN_ENABLED_DEFAULT;
 import org.apache.myfaces.extensions.cdi.core.api.config.Config;
 
 import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.Produces;
 import javax.inject.Named;
-import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.faces.context.FacesContext;
 
@@ -35,19 +35,46 @@ import javax.faces.context.FacesContext;
 @Singleton
 public class DefaultCodiWebConfig extends CodiWebConfig12
 {
-    protected DefaultCodiWebConfig()
+    private Boolean configInitialized;
+
+    @Produces
+    @Named
+    @Dependent
+    @Config(CodiWebConfig12.class)
+    public Boolean transactionTokenEnabled()
+    {
+        return isTransactionTokenEnabled();
+    }
+
+    public boolean isTransactionTokenEnabled()
     {
+        lazyInit();
+        return getAttribute(TRANSACTION_TOKEN_ENABLED, Boolean.class);
     }
 
-    @Inject
-    public DefaultCodiWebConfig(FacesContext facesContext)
+    private void lazyInit()
     {
+        if(configInitialized == null)
+        {
+            init(FacesContext.getCurrentInstance());
+        }
+    }
+
+    private synchronized void init(FacesContext facesContext)
+    {
+        if(configInitialized != null || facesContext == null)
+        {
+            return;
+        }
+
+        configInitialized = true;
+
         initTransactionTokenEnabled(facesContext);
     }
 
     private void initTransactionTokenEnabled(FacesContext facesContext)
     {
-        boolean transactionTokenEnabled = false;
+        boolean transactionTokenEnabled = TRANSACTION_TOKEN_ENABLED_DEFAULT;
 
         if("true".equalsIgnoreCase(facesContext.getExternalContext().getInitParameter(TRANSACTION_TOKEN_ENABLED)))
         {
@@ -56,18 +83,4 @@ public class DefaultCodiWebConfig extend
 
         setAttribute(TRANSACTION_TOKEN_ENABLED, transactionTokenEnabled);
     }
-
-    @Produces
-    @Named
-    @Dependent
-    @Config(CodiWebConfig12.class)
-    public Boolean transactionTokenEnabled()
-    {
-        return isTransactionTokenEnabled();
-    }
-
-    public boolean isTransactionTokenEnabled()
-    {
-        return getAttribute(TRANSACTION_TOKEN_ENABLED, Boolean.class);
-    }
 }



Mime
View raw message