deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject deltaspike git commit: DELTASPIKE-776 check usage of deltaspike-jsf-module-impl-ee6 with jsf v2.2+
Date Mon, 10 Nov 2014 08:45:15 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 7e4825269 -> 8138f1bb4


DELTASPIKE-776 check usage of deltaspike-jsf-module-impl-ee6 with jsf v2.2+


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/8138f1bb
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/8138f1bb
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/8138f1bb

Branch: refs/heads/master
Commit: 8138f1bb4413ec17e8c1ff43fc28a0d488275f38
Parents: 7e48252
Author: gpetracek <gpetracek@apache.org>
Authored: Mon Nov 10 09:39:12 2014 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Mon Nov 10 09:39:12 2014 +0100

----------------------------------------------------------------------
 .../request/DeltaSpikeLifecycleFactoryWrapper.java   | 15 ++++++++++++---
 .../NavigationHandlerAwareApplication.java           | 12 +++++++++++-
 .../apache/deltaspike/jsf/impl/util/JsfUtils.java    | 11 +++++++++++
 3 files changed, 34 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8138f1bb/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleFactoryWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleFactoryWrapper.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleFactoryWrapper.java
index e415ba2..87a6c4e 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleFactoryWrapper.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleFactoryWrapper.java
@@ -24,6 +24,7 @@ import org.apache.deltaspike.core.util.ClassDeactivationUtils;
 import org.apache.deltaspike.core.util.ClassUtils;
 import org.apache.deltaspike.core.util.ExceptionUtils;
 import org.apache.deltaspike.jsf.api.config.JsfModuleConfig;
+import org.apache.deltaspike.jsf.impl.util.JsfUtils;
 
 import javax.faces.lifecycle.Lifecycle;
 import javax.faces.lifecycle.LifecycleFactory;
@@ -46,8 +47,16 @@ public class DeltaSpikeLifecycleFactoryWrapper extends LifecycleFactory
implemen
     {
         this.wrapped = wrapped;
         this.deactivated = !ClassDeactivationUtils.isActivated(getClass());
-        this.jsfVersionWithClientWindowDetected =
-                ClassUtils.tryToLoadClassForName(JsfModuleConfig.CLIENT_WINDOW_CLASS_NAME)
!= null;
+        boolean jsfVersionWithClientWindowDetected =
+            ClassUtils.tryToLoadClassForName(JsfModuleConfig.CLIENT_WINDOW_CLASS_NAME) !=
null;
+
+        if (jsfVersionWithClientWindowDetected && ClassUtils.tryToLoadClassForName(
+            "org.apache.deltaspike.jsf.impl.listener.request.JsfClientWindowAwareLifecycleWrapper")
== null)
+        {
+            jsfVersionWithClientWindowDetected = false;
+            JsfUtils.logWrongModuleUsage(getClass().getName());
+        }
+        this.jsfVersionWithClientWindowDetected = jsfVersionWithClientWindowDetected;
     }
 
     @Override
@@ -72,7 +81,7 @@ public class DeltaSpikeLifecycleFactoryWrapper extends LifecycleFactory
implemen
                     "org.apache.deltaspike.jsf.impl.listener.request.JsfClientWindowAwareLifecycleWrapper");
             try
             {
-                return lifecycleWrapperClass.getConstructor(new Class[] { Lifecycle.class
})
+                return (Lifecycle) lifecycleWrapperClass.getConstructor(new Class[] { Lifecycle.class
})
                         .newInstance(new DeltaSpikeLifecycleWrapper(result));
             }
             catch (Exception e)

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8138f1bb/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
index 54783a8..6393914 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/navigation/NavigationHandlerAwareApplication.java
@@ -21,6 +21,7 @@ package org.apache.deltaspike.jsf.impl.navigation;
 import org.apache.deltaspike.core.spi.activation.Deactivatable;
 import org.apache.deltaspike.core.util.ClassUtils;
 import org.apache.deltaspike.core.util.ExceptionUtils;
+import org.apache.deltaspike.jsf.impl.util.JsfUtils;
 
 import javax.faces.application.Application;
 import javax.faces.application.ApplicationWrapper;
@@ -83,7 +84,16 @@ public class NavigationHandlerAwareApplication extends ApplicationWrapper
implem
             navigationHandlerWrapperClass =
                 ClassUtils.tryToLoadClassForName(
                     "org.apache.deltaspike.jsf.impl.navigation.DeltaSpikeNavigationHandlerWrapper");
-            manualNavigationHandlerWrapperMode = false;
+
+            if (navigationHandlerWrapperClass != null)
+            {
+                manualNavigationHandlerWrapperMode = false;
+            }
+            else
+            {
+                JsfUtils.logWrongModuleUsage(NavigationHandlerAwareApplication.class.getName());
+                manualNavigationHandlerWrapperMode = true;
+            }
         }
         else
         {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8138f1bb/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
index 8e0686f..1bf2ff0 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/util/JsfUtils.java
@@ -42,6 +42,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 public abstract class JsfUtils
 {
@@ -362,4 +364,13 @@ public abstract class JsfUtils
         return ClassUtils.tryToLoadClassForName("javax.faces.view.ViewScoped") != null &&
!"false".equalsIgnoreCase(
             ConfigResolver.getPropertyValue("deltaspike.scope.view.delegate", Boolean.TRUE.toString()));
     }
+
+    public static void logWrongModuleUsage(String name)
+    {
+        Logger.getLogger(name).log(
+            Level.WARNING, "You are using the JSF module for JSF 2.0/2.1 with JSF 2.2+ which
" +
+                "might cause issues in your application in different areas. Please upgrade
" +
+                    "org.apache.deltaspike.modules:deltaspike-jsf-module-impl-ee6 to " +
+                        "org.apache.deltaspike.modules:deltaspike-jsf-module-impl");
+    }
 }


Mime
View raw message