You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2008/04/05 11:50:33 UTC
svn commit: r645058 - in
/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra:
conversation/spring/ viewController/spring/
Author: imario
Date: Sat Apr 5 02:50:31 2008
New Revision: 645058
URL: http://svn.apache.org/viewvc?rev=645058&view=rev
Log:
ORCHESTRA-20: allow viewController scope to lookup the correct conversation name for the viewController bean. This introduces a binary incompatible change. Should be reviewed if another way is possible/required.
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringSingleConversationScope.java
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/conversation/spring/AbstractSpringOrchestraScope.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java?rev=645058&r1=645057&r2=645058&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java Sat Apr 5 02:50:31 2008
@@ -117,7 +117,7 @@
* proxying for specific beans if desired.
* <p>
* This defaults to true.
- *
+ *
* @since 1.1
*/
public void setAutoProxy(boolean state)
@@ -227,7 +227,7 @@
* There is a separate proxy instance per beandef (shared across all
* instances of that bean). This instance is created when first needed,
* and cached for reuse.
- *
+ *
* @since 1.1
*/
protected Object getProxy(String beanName, ObjectFactory objectFactory)
@@ -299,7 +299,7 @@
*
* @param conversationName
* @param beanName is the key within the conversation of the bean we are interested in.
- *
+ *
* @since 1.1
*/
protected Object getRealBean(String conversationName, String beanName, ObjectFactory objectFactory)
@@ -426,7 +426,7 @@
* <p>
* When a bean <i>instance</i> is created by Spring, it always runs every single BeanPostProcessor
* that has been registered with it.
- *
+ *
* @since 1.1
*/
public void defineBeanPostProcessors(ConfigurableListableBeanFactory cbf) throws BeansException
@@ -464,7 +464,7 @@
* Get the conversation-name for bean instances created using the specified
* bean definition.
*/
- protected String getConversationNameForBean(String beanName)
+ public String getConversationNameForBean(String beanName)
{
if (applicationContext == null)
{
@@ -514,7 +514,7 @@
* <p>
* This is a separate method so that subclasses can determine conversation names via alternate methods.
* In particular, a subclass may want to look for an annotation on the class specified by the definition.
- *
+ *
* @since 1.1
*/
protected String getExplicitConversationName(BeanDefinition beanDef)
@@ -622,9 +622,9 @@
}
/**
- * @since 1.1
+ * @since 1.2
*/
- protected ApplicationContext getApplicationContext()
+ protected ConfigurableApplicationContext getApplicationContext()
{
return applicationContext;
}
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringSingleConversationScope.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringSingleConversationScope.java?rev=645058&r1=645057&r2=645058&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringSingleConversationScope.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringSingleConversationScope.java Sat Apr 5 02:50:31 2008
@@ -37,7 +37,7 @@
// for now. Might be able to implement cleaner with Orchestra 2.
public final static String CONVERSATION_NAME="_oamo_single_conversation"; // NON-NLS
- protected String getConversationNameForBean(String beanName) {
+ public String getConversationNameForBean(String beanName) {
return CONVERSATION_NAME;
}
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=645058&r1=645057&r2=645058&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 Sat Apr 5 02:50:31 2008
@@ -27,6 +27,8 @@
import org.apache.myfaces.orchestra.viewController.DefaultViewControllerManager;
import org.apache.myfaces.orchestra.viewController.ViewControllerManager;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.Scope;
/**
* This hooks into the Spring2.x scope-handling mechanism to provide a dummy scope type
@@ -82,7 +84,7 @@
* The parameter is completely ignored; the conversation-name returned is that associated with the
* controller bean, not the specified bean at all.
*/
- protected String getConversationNameForBean(String beanName)
+ public String getConversationNameForBean(String beanName)
{
ViewControllerManager viewControllerManager = getViewControllerManager();
String viewId = FrameworkAdapter.getCurrentInstance().getCurrentViewId();
@@ -92,13 +94,17 @@
throw new OrchestraException("no view controller name found for view " + viewId);
}
- String conversationName = super.getConversationNameForBean(viewControllerName);
- if (conversationName == null)
+ // Look up the definition with the specified name.
+ BeanDefinition beanDefinition = getApplicationContext().getBeanFactory().getBeanDefinition(viewControllerName);
+ String scope = beanDefinition.getScope();
+
+ Scope registeredScope = getApplicationContext().getBeanFactory().getRegisteredScope(scope);
+ if (registeredScope instanceof AbstractSpringOrchestraScope)
{
- throw new OrchestraException("no view controller definition found for view " + viewId);
+ return ((AbstractSpringOrchestraScope) registeredScope).getConversationNameForBean(viewControllerName);
}
- return conversationName;
+ throw new OrchestraException("bean " + beanName + " not in an Orchestra managed scope.");
}
/**
@@ -113,7 +119,7 @@
{
return (ViewControllerManager)
getApplicationContext().getBean(
- ViewControllerManager.VIEW_CONTROLLER_MANAGER_NAME,
+ ViewControllerManager.VIEW_CONTROLLER_MANAGER_NAME,
ViewControllerManager.class);
}
catch(NoSuchBeanDefinitionException e)