Revision: 18688
          http://sourceforge.net/p/gate/code/18688
Author:   ian_roberts
Date:     2015-05-14 16:30:56 +0000 (Thu, 14 May 2015)
Log Message:
-----------
Don't treat namespace declarations on a gate:pooled-proxy element as target 
source property setters

Modified Paths:
--------------
    
gate/trunk/src/main/gate/util/spring/xml/PooledProxyBeanDefinitionDecorator.java

Modified: 
gate/trunk/src/main/gate/util/spring/xml/PooledProxyBeanDefinitionDecorator.java
===================================================================
--- 
gate/trunk/src/main/gate/util/spring/xml/PooledProxyBeanDefinitionDecorator.java
    2015-05-14 14:22:27 UTC (rev 18687)
+++ 
gate/trunk/src/main/gate/util/spring/xml/PooledProxyBeanDefinitionDecorator.java
    2015-05-14 16:30:56 UTC (rev 18688)
@@ -15,6 +15,8 @@
  */
 package gate.util.spring.xml;
 
+import javax.xml.XMLConstants;
+
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanDefinitionHolder;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
@@ -62,10 +64,9 @@
  * </p>
  * 
  * <p>
- * <b>NOTE</b> In addition to the <code>spring-aop</code> JAR, you
- * also need the Apache <code>commons-pool</code> JAR and its
- * dependencies available to your application in order to use this
- * class.
+ * <b>NOTE</b> In addition to the <code>spring-aop</code> JAR, you also
+ * need the Apache <code>commons-pool</code> JAR and its dependencies
+ * available to your application in order to use this class.
  * </p>
  */
 public class PooledProxyBeanDefinitionDecorator implements
@@ -73,14 +74,16 @@
 
   public static final String TARGET_PREFIX = "gate.util.spring.pool-target.";
 
-  public static final String TARGET_SOURCE_PREFIX = 
"gate.util.spring.pool-target-source.";
+  public static final String TARGET_SOURCE_PREFIX =
+          "gate.util.spring.pool-target-source.";
 
-  public static final String POOL_FILLER_PREFIX = 
"gate.util.spring.pool-filler.";
+  public static final String POOL_FILLER_PREFIX =
+          "gate.util.spring.pool-filler.";
 
   private static final String PROXY_TARGET_CLASS = "proxy-target-class";
 
   private static final String INITIAL_SIZE = "initial-size";
-  
+
   private static final String TARGET_SOURCE_CLASS = "target-source-class";
 
   @Override
@@ -103,13 +106,14 @@
     RootBeanDefinition targetSourceDefinition = new RootBeanDefinition();
     targetSourceDefinition.setScope(originalScope);
     String targetSourceClassName = null;
-    if(node instanceof Element && 
((Element)node).hasAttribute(TARGET_SOURCE_CLASS)) {
+    if(node instanceof Element
+            && ((Element)node).hasAttribute(TARGET_SOURCE_CLASS)) {
       targetSourceClassName = 
((Element)node).getAttribute(TARGET_SOURCE_CLASS);
     } else {
-      targetSourceClassName = 
"org.springframework.aop.target.CommonsPoolTargetSource";
+      targetSourceClassName =
+              "org.springframework.aop.target.CommonsPoolTargetSource";
     }
-    targetSourceDefinition
-            .setBeanClassName(targetSourceClassName);
+    targetSourceDefinition.setBeanClassName(targetSourceClassName);
     targetSourceDefinition.getPropertyValues().addPropertyValue(
             "targetBeanName", targetBeanName);
     String targetSourceBeanName = TARGET_SOURCE_PREFIX + originalBeanName;
@@ -122,10 +126,13 @@
       NamedNodeMap attrs = ele.getAttributes();
       for(int i = 0; i < attrs.getLength(); i++) {
         Attr att = (Attr)attrs.item(i);
-        if(!PROXY_TARGET_CLASS.equals(att.getLocalName())
+        if(!XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(att.getNamespaceURI())
+                && !XMLConstants.XML_NS_URI.equals(att.getNamespaceURI())
+                && !XMLConstants.XMLNS_ATTRIBUTE.equals(att.getLocalName())
+                && !PROXY_TARGET_CLASS.equals(att.getLocalName())
                 && !INITIAL_SIZE.equals(att.getLocalName())) {
-          String propName = Conventions.attributeNameToPropertyName(att
-                  .getLocalName());
+          String propName =
+                  Conventions.attributeNameToPropertyName(att.getLocalName());
           targetSourceDefinition.getPropertyValues().addPropertyValue(propName,
                   att.getValue());
         }
@@ -145,8 +152,8 @@
     if(node instanceof Element) {
       Element ele = (Element)node;
       if(ele.hasAttribute(PROXY_TARGET_CLASS)) {
-        proxyTargetClass = Boolean
-                .valueOf(ele.getAttribute(PROXY_TARGET_CLASS));
+        proxyTargetClass =
+                Boolean.valueOf(ele.getAttribute(PROXY_TARGET_CLASS));
       }
     }
     proxyDefinition.getPropertyValues().addPropertyValue("proxyTargetClass",
@@ -163,8 +170,8 @@
     // if we have an initial-size attribute, create a pool filler bean
     // to pre-fill the pool to the stated initial size
     if(node instanceof Element && ((Element)node).hasAttribute(INITIAL_SIZE)) {
-      RootBeanDefinition poolFillerDefinition = new RootBeanDefinition(
-              PoolFiller.class);
+      RootBeanDefinition poolFillerDefinition =
+              new RootBeanDefinition(PoolFiller.class);
       String poolFillerBeanName = POOL_FILLER_PREFIX + originalBeanName;
       poolFillerDefinition.getPropertyValues().addPropertyValue("targetSource",
               new RuntimeBeanReference(targetSourceBeanName));
@@ -175,8 +182,7 @@
       String[] proxyDepends = proxyDefinition.getDependsOn();
       if(proxyDepends == null) {
         proxyDepends = new String[1];
-      }
-      else {
+      } else {
         String[] newDepends = new String[proxyDepends.length + 1];
         System.arraycopy(proxyDepends, 0, newDepends, 0, proxyDepends.length);
         proxyDepends = newDepends;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to