You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/02/18 23:11:27 UTC

svn commit: r628885 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/viewController/spring/SpringViewControllerScope.java

Author: skitching
Date: Mon Feb 18 14:11:26 2008
New Revision: 628885

URL: http://svn.apache.org/viewvc?rev=628885&view=rev
Log:
Use only Spring functionality in Spring package (implement the todo)

Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/viewController/spring/SpringViewControllerScope.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/viewController/spring/SpringViewControllerScope.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/viewController/spring/SpringViewControllerScope.java?rev=628885&r1=628884&r2=628885&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/viewController/spring/SpringViewControllerScope.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/viewController/spring/SpringViewControllerScope.java Mon Feb 18 14:11:26 2008
@@ -27,6 +27,7 @@
 import org.apache.myfaces.orchestra.lib.OrchestraException;
 import org.apache.myfaces.orchestra.viewController.DefaultViewControllerManager;
 import org.apache.myfaces.orchestra.viewController.ViewControllerManager;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 
 /**
  * This hooks into the Spring2.x scope-handling mechanism to provide a dummy scope type
@@ -107,15 +108,16 @@
 
     private ViewControllerManager getViewControllerManager(FacesContext context)
 	{
-    	// todo: use Spring here, not JSF resolver. That does mean that ViewControllers defined in the 
-    	// managedBean file rather than the spring-config will no longer be found. But it does properly
-    	// isolate this class from JSF.
-		ViewControllerManager manager = (ViewControllerManager) context.getApplication().getVariableResolver().resolveVariable(context, ViewControllerManager.VIEW_CONTROLLER_MANAGER_NAME);
-		if (manager != null)
-		{
-			return manager;
-		}
-
-		return DEFAULT_VCM;
+    	try
+    	{
+    		return (ViewControllerManager)
+				getApplicationContext().getBean(
+					ViewControllerManager.VIEW_CONTROLLER_MANAGER_NAME, 
+					ViewControllerManager.class);
+    	}
+    	catch(NoSuchBeanDefinitionException e)
+    	{
+    		return DEFAULT_VCM;
+    	}
 	}
 }