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 2007/12/08 14:05:15 UTC
svn commit: r602459 -
/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
Author: imario
Date: Sat Dec 8 05:05:14 2007
New Revision: 602459
URL: http://svn.apache.org/viewvc?rev=602459&view=rev
Log:
fixed regression regarding viewController scope
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.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=602459&r1=602458&r2=602459&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 Dec 8 05:05:14 2007
@@ -55,9 +55,9 @@
* <p>
* This base class handles item 1 above, and leaves item 2 to a subclass. The
* declaration of interface ConversationFactory needs to be on this class, however,
- * as the createBean method needs to invoke it.
+ * as the createBean method needs to invoke it.
*/
-public abstract class AbstractSpringOrchestraScope implements ConversationFactory,
+public abstract class AbstractSpringOrchestraScope implements ConversationFactory,
Scope, BeanFactoryAware, ApplicationContextAware
{
private final Log log = LogFactory.getLog(AbstractSpringOrchestraScope.class);
@@ -108,7 +108,7 @@
* in the classpath. It also can impact performance in some cases. Where this is a
* problem, this flag can turn autoproxying off. Note that the standard spring
* aop:scoped-proxy bean can then be used on individual beans to re-enable
- * proxying for specific beans if desired.
+ * proxying for specific beans if desired.
* <p>
* This defaults to true.
*/
@@ -151,7 +151,7 @@
* expressions, and in this case the performance impact is not significant
* relative to the overhead of EL. Note that there is one case where this
* proxying is not "transparent" to user code: if a proxied object passes a
- * "this" pointer to a longer-lived object that retains that pointer then
+ * "this" pointer to a longer-lived object that retains that pointer then
* that reference can be "stale", as it points directly to an instance rather
* than to the proxy.
* <p>
@@ -180,10 +180,10 @@
// The user must have included an aop:scoped-proxy within the bean definition,
// and here the proxy is firing to try to get the underlying bean. In this
// case, return a non-proxied instance of the referenced bean.
- try
+ try
{
String originalBeanName = _SpringUtils.getOriginalBeanName(name);
- String conversationName = getConversationNameForBean(name);
+ String conversationName = getConversationNameForBean(name);
return getRealBean(conversationName, originalBeanName, objectFactory);
}
catch(RuntimeException e)
@@ -194,7 +194,7 @@
}
else if (!autoProxy)
{
- String conversationName = getConversationNameForBean(name);
+ String conversationName = getConversationNameForBean(name);
return getRealBean(conversationName, name, objectFactory);
}
else
@@ -210,7 +210,7 @@
/**
* Return a CGLIB-generated proxy class for the beanclass that is
- * specified by the provided beanName.
+ * specified by the provided beanName.
* <p>
* When any method is invoked on this proxy, it invokes method
* getRealBean on this same instance in order to locate a proper
@@ -231,13 +231,11 @@
Object proxy = beanDefinition.getAttribute(ScopedBeanTargetSource.class.getName());
if (proxy == null)
{
- if (log.isDebugEnabled())
+ if (log.isDebugEnabled())
{
log.debug("getProxy: creating proxy for " + beanName);
}
- String conversationName = (String) beanDefinition.getAttribute(BeanDefinitionConversationNameAttrDecorator.CONVERSATION_NAME_ATTRIBUTE);
- if (conversationName == null)
- conversationName = beanName;
+ String conversationName = getConversationNameForBean(beanName);
BeanFactory beanFactory = applicationContext.getBeanFactory();
proxy = _SpringUtils.newProxy(this, conversationName, beanName, objectFactory, beanFactory);
beanDefinition.setAttribute(ScopedBeanTargetSource.class.getName(), proxy);
@@ -257,7 +255,7 @@
{
fa.setRequestAttribute(beanName, proxy);
}
-
+
return proxy;
}
@@ -277,7 +275,7 @@
* is always attached. Note that if the bean definition contains the aop:proxy
* tag (and most do) then the bean that spring creates is already a proxy, ie
* what is returned is a proxy of a proxy.
- *
+ *
* @param conversationName
* @param beanName is the key within the conversation of the bean we are interested in.
*/
@@ -296,7 +294,7 @@
conversation = manager.getConversation(conversationName);
if (conversation == null)
{
- // Start the conversation. This eventually results in a
+ // Start the conversation. This eventually results in a
// callback to the createConversation method on this class.
conversation = manager.startConversation(conversationName, this);
}
@@ -337,7 +335,7 @@
}
conversation.setAttribute(beanName, value);
-
+
if (value instanceof ConversationAware)
{
((ConversationAware) value).setConversation(conversation);
@@ -351,7 +349,7 @@
/**
* Verify that the specified conversation was created by this scope object.
- *
+ *
* @param beanName is just used when generating an error message on failure.
* @param conversation is the conversation to validate.
*/
@@ -396,7 +394,7 @@
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
{
}
-
+
/**
* Register any BeanPostProcessors that are needed by this scope.
* <p>
@@ -408,10 +406,10 @@
*/
public void defineBeanPostProcessors(ConfigurableListableBeanFactory cbf) throws BeansException
{
- if (!cbf.containsSingleton(POST_PROCESSOR_BEAN_NAME))
+ if (!cbf.containsSingleton(POST_PROCESSOR_BEAN_NAME))
{
BeanPostProcessor processor = new OrchestraAdvisorBeanPostProcessor(applicationContext);
-
+
// Adding the bean to the singletons set causes it to be picked up by the standard
// AbstractApplicationContext.RegisterBeanPostProcessors method; that calls
// getBeanNamesForType(BeanPostProcessor.class, ...) which finds stuff in the
@@ -447,8 +445,8 @@
{
throw new IllegalStateException("Null application context");
}
-
- // Look up the definition with the specified name.
+
+ // Look up the definition with the specified name.
BeanDefinition beanDefinition = applicationContext.getBeanFactory().getBeanDefinition(beanName);
if (ScopedProxyFactoryBean.class.getName().equals(beanDefinition.getBeanClassName()))
@@ -468,7 +466,7 @@
//
// This case does not occur when this method is invoked from within this class; the
// spring scope-related callbacks always deal with the beandef that is scoped to
- // this scope - which is the original (though renamed) beandef.
+ // this scope - which is the original (though renamed) beandef.
beanName = _SpringUtils.getModifiedBeanName(beanName);
beanDefinition = applicationContext.getBeanFactory().getBeanDefinition(beanName); // NON-NLS
}
@@ -503,7 +501,7 @@
* Strip off any Spring namespace (eg scopedTarget).
* <p>
* This method will simply strip off anything before the first dot.
- *
+ *
* @deprecated Should not be necessary in user code.
*/
protected String buildBeanName(String name)
@@ -541,7 +539,7 @@
* <p>
* When an aop:scoped-proxy has been used inside the bean, then the "new" definition
* does not have any scope attribute, so orchestra is not invoked for it. However
- * the "renamed" bean does, and so this is called.
+ * the "renamed" bean does, and so this is called.
*/
public void registerDestructionCallback(String name, final Runnable runnable)
{
@@ -593,6 +591,6 @@
}
this.applicationContext = (ConfigurableApplicationContext) applicationContext;
- defineBeanPostProcessors(this.applicationContext.getBeanFactory());
+ defineBeanPostProcessors(this.applicationContext.getBeanFactory());
}
}
Re: svn commit: r602459 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
Posted by Matthias Wessendorf <ma...@apache.org>.
it's all IDEA :-)
On Dec 8, 2007 2:17 PM, Mario Ivankovits <ma...@ops.co.at> wrote:
> Sorry for the whitespace stuff, I thought I reverted them.
>
> This one is the real patch:
> > Author: imario
> > Date: Sat Dec 8 05:05:14 2007
> > New Revision: 602459
> >
> > URL: http://svn.apache.org/viewvc?rev=602459&view=rev
> > Log:
> > fixed regression regarding viewController scope
> >
> > Modified:
> > myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
> > @@ -231,13 +231,11 @@
> > Object proxy = beanDefinition.getAttribute(ScopedBeanTargetSource.class.getName());
> > if (proxy == null)
> > {
> > if (log.isDebugEnabled())
> > {
> > log.debug("getProxy: creating proxy for " + beanName);
> > }
> > - String conversationName = (String) beanDefinition.getAttribute(BeanDefinitionConversationNameAttrDecorator.CONVERSATION_NAME_ATTRIBUTE);
> > - if (conversationName == null)
> > - conversationName = beanName;
> > + String conversationName = getConversationNameForBean(beanName);
> > BeanFactory beanFactory = applicationContext.getBeanFactory();
> > proxy = _SpringUtils.newProxy(this, conversationName, beanName, objectFactory, beanFactory);
> > beanDefinition.setAttribute(ScopedBeanTargetSource.class.getName(), proxy);
> >
>
> Ciao,
> Mario
>
>
--
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org
Re: svn commit: r602459 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
Posted by Mario Ivankovits <ma...@ops.co.at>.
Sorry for the whitespace stuff, I thought I reverted them.
This one is the real patch:
> Author: imario
> Date: Sat Dec 8 05:05:14 2007
> New Revision: 602459
>
> URL: http://svn.apache.org/viewvc?rev=602459&view=rev
> Log:
> fixed regression regarding viewController scope
>
> Modified:
> myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/AbstractSpringOrchestraScope.java
> @@ -231,13 +231,11 @@
> Object proxy = beanDefinition.getAttribute(ScopedBeanTargetSource.class.getName());
> if (proxy == null)
> {
> if (log.isDebugEnabled())
> {
> log.debug("getProxy: creating proxy for " + beanName);
> }
> - String conversationName = (String) beanDefinition.getAttribute(BeanDefinitionConversationNameAttrDecorator.CONVERSATION_NAME_ATTRIBUTE);
> - if (conversationName == null)
> - conversationName = beanName;
> + String conversationName = getConversationNameForBean(beanName);
> BeanFactory beanFactory = applicationContext.getBeanFactory();
> proxy = _SpringUtils.newProxy(this, conversationName, beanName, objectFactory, beanFactory);
> beanDefinition.setAttribute(ScopedBeanTargetSource.class.getName(), proxy);
>
Ciao,
Mario