cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1214425 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/configuration/spring/ rt/core/src/main/java/org/apache/cxf/bus/blueprint/ rt/core/src/main/java/org/apache/cxf/bus/spring/ rt/core/src/main/java/org/apache/cxf/configurati...
Date Wed, 14 Dec 2011 19:48:58 GMT
Author: dkulp
Date: Wed Dec 14 19:48:57 2011
New Revision: 1214425

URL: http://svn.apache.org/viewvc?rev=1214425&view=rev
Log:
Simplify how the bus addtribute is handled on <cxf:bus> to make sure
it's ignored and not resulting in circular graphs

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BusDefinitionParser.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java?rev=1214425&r1=1214424&r2=1214425&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
Wed Dec 14 19:48:57 2011
@@ -102,25 +102,31 @@ public abstract class AbstractBeanDefini
                 bean.addDependsOn(val);
             } else if ("name".equals(name)) {
                 processNameAttribute(element, ctx, bean, val);
+            } else if ("bus".equals(name)) {
+                setBus = processBusAttribute(element, ctx, bean, val);
             } else if (!"id".equals(name) && isAttribute(pre, name)) {
-                if ("bus".equals(name)) {                                     
-                    if (val != null && val.trim().length() > 0) {
-                        if (ctx.getRegistry().containsBeanDefinition(val)) {
-                            bean.addPropertyReference(name, val);
-                        } else {
-                            addBusWiringAttribute(bean, BusWiringType.PROPERTY,
-                                                  val, ctx);
-                        }
-                        setBus = true;                         
-                    }
-                } else {
-                    mapAttribute(bean, element, name, val);
-                }    
+                mapAttribute(bean, element, name, val);
             }
         } 
         return setBus;
     }
 
+    
+    protected boolean processBusAttribute(Element element, ParserContext ctx, 
+                                        BeanDefinitionBuilder bean,
+                                        String val) {
+        if (val != null && val.trim().length() > 0) {
+            if (ctx.getRegistry().containsBeanDefinition(val)) {
+                bean.addPropertyReference("bus", val);
+            } else {
+                addBusWiringAttribute(bean, BusWiringType.PROPERTY,
+                                      val, ctx);
+            }
+            return true;                         
+        }
+        return false;
+    }
+
     protected void processNameAttribute(Element element,
                                         ParserContext ctx,
                                         BeanDefinitionBuilder bean,

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BusDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BusDefinitionParser.java?rev=1214425&r1=1214424&r2=1214425&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BusDefinitionParser.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BusDefinitionParser.java
Wed Dec 14 19:48:57 2011
@@ -46,7 +46,10 @@ public class BusDefinitionParser 
         }
         return cxfBean;
     }
-    
+    protected void processBusAttribute(Element element, ParserContext ctx, 
+                                       MutableBeanMetadata bean, String val) {
+        //nothing
+    }
     protected boolean hasBusProperty() {
         return false;
     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java?rev=1214425&r1=1214424&r2=1214425&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java Wed
Dec 14 19:48:57 2011
@@ -70,12 +70,7 @@ public class BusDefinitionParser extends
             bean.addPropertyValue("id", id);
         }
 
-        String tmp = element.getAttribute("bus");
-        element.removeAttribute("bus");
         super.doParse(element, ctx, bean);
-        if (StringUtils.isEmpty(tmp)) {
-            element.setAttribute("bus", tmp);
-        }
         
         if (ctx.getRegistry().containsBeanDefinition(bus)) {
             BeanDefinition def = ctx.getRegistry().getBeanDefinition(bus);
@@ -93,7 +88,11 @@ public class BusDefinitionParser extends
             bean.addConstructorArgValue(bus);
         }
     }
-    
+    protected boolean processBusAttribute(Element element, ParserContext ctx, 
+                                          BeanDefinitionBuilder bean,
+                                          String val) {
+        return false;
+    }
     private void copyProps(BeanDefinitionBuilder src, BeanDefinition def) {
         for (PropertyValue v : src.getBeanDefinition().getPropertyValues().getPropertyValues())
{
             if (!"bus".equals(v.getName())) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java?rev=1214425&r1=1214424&r2=1214425&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
Wed Dec 14 19:48:57 2011
@@ -160,21 +160,24 @@ public abstract class AbstractBPBeanDefi
                     bean.addDependsOn(val);
                 } else if ("name".equals(name)) {
                     processNameAttribute(element, ctx, bean, val);
+                } else if ("bus".equals(name)) {
+                    processBusAttribute(element, ctx, bean, val);
                 } else if (!"id".equals(name) && isAttribute(pre, name)) {
-                    if ("bus".equals(name)) {
-                        if (this.hasBusProperty()) {
-                            bean.addProperty("bus", getBusRef(ctx, val));
-                        } else {
-                            bean.addArgument(getBusRef(ctx, val), null, 0);
-                        }
-                    } else {
-                        mapAttribute(bean, element, name, val, ctx);
-                    }
+                    mapAttribute(bean, element, name, val, ctx);
                 }
             }
         }
         return setBus;
     }
+    protected void processBusAttribute(Element element, ParserContext ctx, 
+                                       MutableBeanMetadata bean, String val) {
+        if (this.hasBusProperty()) {
+            bean.addProperty("bus", getBusRef(ctx, val));
+        } else {
+            bean.addArgument(getBusRef(ctx, val), null, 0);
+        }
+    }
+
     protected void processNameAttribute(Element element,
                                         ParserContext ctx,
                                         MutableBeanMetadata bean,



Mime
View raw message