Return-Path: Delivered-To: apmail-incubator-abdera-commits-archive@locus.apache.org Received: (qmail 3341 invoked from network); 7 Feb 2008 23:41:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Feb 2008 23:41:10 -0000 Received: (qmail 92892 invoked by uid 500); 7 Feb 2008 23:41:03 -0000 Delivered-To: apmail-incubator-abdera-commits-archive@incubator.apache.org Received: (qmail 92859 invoked by uid 500); 7 Feb 2008 23:41:03 -0000 Mailing-List: contact abdera-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: abdera-dev@incubator.apache.org Delivered-To: mailing list abdera-commits@incubator.apache.org Received: (qmail 92841 invoked by uid 99); 7 Feb 2008 23:41:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Feb 2008 15:41:03 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Feb 2008 23:40:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1DC8F1A9832; Thu, 7 Feb 2008 15:40:40 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r619687 - in /incubator/abdera/java/trunk: build/ spring/src/main/java/org/apache/abdera/spring/ spring/src/main/resources/META-INF/schemas/ spring/src/test/java/org/apache/abdera/spring/ spring/src/test/resources/org/apache/abdera/spring/ Date: Thu, 07 Feb 2008 23:40:39 -0000 To: abdera-commits@incubator.apache.org From: jmsnell@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080207234040.1DC8F1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jmsnell Date: Thu Feb 7 15:40:35 2008 New Revision: 619687 URL: http://svn.apache.org/viewvc?rev=619687&view=rev Log: Per https://issues.apache.org/jira/browse/ABDERA-105.. "spring provider definition parser doesn't load more than one filter" Modified: incubator/abdera/java/trunk/build/build.xml incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/DefaultProviderDefinitionParser.java incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ProviderDefinitionParserTest.java incubator/abdera/java/trunk/spring/src/test/resources/org/apache/abdera/spring/beans.xml Modified: incubator/abdera/java/trunk/build/build.xml URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/build/build.xml?rev=619687&r1=619686&r2=619687&view=diff ============================================================================== --- incubator/abdera/java/trunk/build/build.xml (original) +++ incubator/abdera/java/trunk/build/build.xml Thu Feb 7 15:40:35 2008 @@ -416,6 +416,17 @@ + + + Running Spring Tests... + + + + + + + + Modified: incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/DefaultProviderDefinitionParser.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/DefaultProviderDefinitionParser.java?rev=619687&r1=619686&r2=619687&view=diff ============================================================================== --- incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/DefaultProviderDefinitionParser.java (original) +++ incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/DefaultProviderDefinitionParser.java Thu Feb 7 15:40:35 2008 @@ -18,8 +18,13 @@ */ package org.apache.abdera.spring; +import java.util.List; + import org.apache.abdera.protocol.server.Provider; +import org.springframework.beans.MutablePropertyValues; +import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.BeanDefinitionStoreException; +import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.ManagedList; @@ -41,6 +46,7 @@ } @Override + @SuppressWarnings("unchecked") protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element element, String name) { if (name.equals("workspaceManager")) { setFirstChildAsProperty(element, ctx, bean, "workspaceManager"); @@ -48,16 +54,26 @@ setFirstChildAsProperty(element, ctx, bean, "targetResolver"); } else if (name.equals("subjectResolver")) { setFirstChildAsProperty(element, ctx, bean, name); - } else if (name.equals("filter")) { - ManagedList filters = new ManagedList(); + } else if (name.equals("filter")) { + MutablePropertyValues values = bean.getBeanDefinition().getPropertyValues(); + PropertyValue pv = values.getPropertyValue("filters"); + List filters = pv != null?(List) pv.getValue():new ManagedList(); NodeList nodes = element.getChildNodes(); - for (int i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); - if (n.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) { - Element childElement = (Element)n; - Object child = ctx.getDelegate().parsePropertySubElement(childElement, bean.getRawBeanDefinition()); - filters.add(child); - } + Object child = null; + if (element.hasAttribute("ref")) { + child = new RuntimeBeanReference(element.getAttribute("ref")); + ((RuntimeBeanReference)child).setSource(ctx.extractSource(element)); + } else if (nodes != null) { + for (int i = 0; i < nodes.getLength(); i++) { + Node n = nodes.item(i); + if (n.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) { + Element childElement = (Element)n; + child = ctx.getDelegate().parsePropertySubElement(childElement, bean.getRawBeanDefinition()); + } + } + } + if (child != null) { + filters.add(child); } bean.addPropertyValue("filters", filters); } else if (name.equals("workspace")) { Modified: incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd?rev=619687&r1=619686&r2=619687&view=diff ============================================================================== --- incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd (original) +++ incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd Thu Feb 7 15:40:35 2008 @@ -83,8 +83,9 @@ + - + Modified: incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ProviderDefinitionParserTest.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ProviderDefinitionParserTest.java?rev=619687&r1=619686&r2=619687&view=diff ============================================================================== --- incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ProviderDefinitionParserTest.java (original) +++ incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ProviderDefinitionParserTest.java Thu Feb 7 15:40:35 2008 @@ -54,8 +54,7 @@ Collection collections = w.getCollections(null); assertEquals(2, collections.size()); - assertEquals(1, p.getFilters(null).length); //Parameter isn't used - + assertEquals(2, p.getFilters(null).length); //Parameter isn't used } @Override Modified: incubator/abdera/java/trunk/spring/src/test/resources/org/apache/abdera/spring/beans.xml URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/test/resources/org/apache/abdera/spring/beans.xml?rev=619687&r1=619686&r2=619687&view=diff ============================================================================== --- incubator/abdera/java/trunk/spring/src/test/resources/org/apache/abdera/spring/beans.xml (original) +++ incubator/abdera/java/trunk/spring/src/test/resources/org/apache/abdera/spring/beans.xml Thu Feb 7 15:40:35 2008 @@ -25,8 +25,10 @@ - + + +