On Fri, Mar 14, 2008 at 9:20 AM, Simon Laws <[EMAIL PROTECTED]>
wrote:

> I'm getting.
>
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> javax.xml
> .xpath.XPathExpressionException: javax.xml.transform.TransformerException:
> Extra
>  illegal tokens: 'http://www.osoa.org/xmlns/sca/1.0', ':', 'binding.sca'
>         at org.apache.tuscany.sca.policy.xml.PolicySetProcessor.read
> (PolicySetPr
> ocessor.java:109)
>         at org.apache.tuscany.sca.policy.xml.PolicySetProcessor.read
> (PolicySetPr
> ocessor.java:61)
>         at
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactP
> rocessor.read(ExtensibleStAXArtifactProcessor.java:83)
>         at
> org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor.read(S
> CADefinitionsProcessor.java:90)
>         at
> org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor.read(S
> CADefinitionsProcessor.java:49)
>         at
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactP
> rocessor.read(ExtensibleStAXArtifactProcessor.java:83)
>         at
> org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcesso
> r.read(SCADefinitionsDocumentProcessor.java:120)
>         at
> org.apache.tuscany.sca.assembly.xml.ResolvePolicyTestCase.testResolve
> ConstrainingType(ResolvePolicyTestCase.java:115)
>
> and am assuming it's related to this checkin. Am investigating but in the
> mean time can you check if anything was missed.
>
> Thanks
>
> Simon
>
>
>
> On Fri, Mar 14, 2008 at 3:48 AM, <[EMAIL PROTECTED]> wrote:
>
> > Author: rfeng
> > Date: Thu Mar 13 20:48:47 2008
> > New Revision: 636985
> >
> > URL: http://svn.apache.org/viewvc?rev=636985&view=rev
> > Log:
> > Fix for TUSCANY-2078
> >
> > Modified:
> >
> >  
> > incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
> >
> >  
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
> >
> >  
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
> >
> >  
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
> >
> >  
> > incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
> >
> >  
> > incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
> >
> >  
> > incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
> >
> >  
> > incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
> >
> > Modified:
> > incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=636985&r1=636984&r2=636985&view=diff
> >
> > ==============================================================================
> > ---
> > incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
> > (original)
> > +++
> > incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
> > Thu Mar 13 20:48:47 2008
> > @@ -31,6 +31,9 @@
> >  import javax.xml.stream.XMLStreamException;
> >  import javax.xml.stream.XMLStreamReader;
> >  import javax.xml.stream.XMLStreamWriter;
> > +import javax.xml.xpath.XPath;
> > +import javax.xml.xpath.XPathExpressionException;
> > +import javax.xml.xpath.XPathFactory;
> >
> >  import org.apache.tuscany.sca.assembly.AssemblyFactory;
> >  import org.apache.tuscany.sca.assembly.Binding;
> > @@ -75,7 +78,9 @@
> >  * @version $Rev$ $Date$
> >  */
> >  public class CompositeProcessor extends BaseAssemblyProcessor
> > implements StAXArtifactProcessor<Composite> {
> > -
> > +    // FIXME: to be refactored
> > +    private XPathFactory xPathFactory = XPathFactory.newInstance();
> > +
> >     /**
> >      * Construct a new composite processor
> >      *
> > @@ -235,7 +240,33 @@
> >                             // Read a <component><property>
> >                             componentProperty =
> > assemblyFactory.createComponentProperty();
> >                             property = componentProperty;
> > -                            componentProperty.setSource(getString(reader,
> > SOURCE));
> > +                            String source = getString(reader, SOURCE);
> > +                            if(source!=null) {
> > +                                source = source.trim();
> > +                            }
> > +                            componentProperty.setSource(source);
> > +                            if (source != null) {
> > +                                // $<name>/...
> > +                                if (source.charAt(0) == '$') {
> > +                                    int index = source.indexOf('/');
> > +                                    if (index == -1) {
> > +                                        // Tolerating $prop
> > +                                        source = source + "/";
> > +                                        index = source.length() - 1;
> > +                                    }
> > +                                    source = source.substring(index +
> > 1);
> > +                                    if ("".equals(source)) {
> > +                                        source = ".";
> > +                                    }
> > +                                }
> > +                                XPath xpath = xPathFactory.newXPath();
> > +                                xpath.setNamespaceContext(
> > reader.getNamespaceContext());
> > +                                try {
> > +
> > componentProperty.setSourceXPathExpression(xpath.compile(source));
> > +                                } catch (XPathExpressionException e) {
> > +                                    throw new
> > ContributionReadException(e);
> > +                                }
> > +                            }
> >                             componentProperty.setFile(getString(reader,
> > FILE));
> >                             policyProcessor.readPolicies(property,
> > reader);
> >                             readAbstractProperty(componentProperty,
> > reader);
> > @@ -852,7 +883,7 @@
> >                     component.setImplementation(implementation);
> >                 } catch ( PolicyValidationException e ) {
> >                     throw new
> > ContributionResolveException("PolicyValidation exception when processing
> > implementation of component '"
> > -                                                           +
> > component.getName() + "' due to " + e.getMessage());
> > +                                                           +
> > component.getName() + "' due to " + e.getMessage(), e);
> >                 }
> >
> >             }
> >
> > Modified:
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java?rev=636985&r1=636984&r2=636985&view=diff
> >
> > ==============================================================================
> > ---
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
> > (original)
> > +++
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
> > Thu Mar 13 20:48:47 2008
> > @@ -18,6 +18,8 @@
> >  */
> >  package org.apache.tuscany.sca.assembly;
> >
> > +import javax.xml.xpath.XPathExpression;
> > +
> >  /**
> >  * Represents a configured property of a component.
> >  *
> > @@ -56,6 +58,18 @@
> >      *            composite
> >      */
> >     void setSource(String source);
> > +
> > +    /**
> > +     * Get the XPath expression for the source attribute
> > +     * @return the XPath expression for the source attribute
> > +     */
> > +    XPathExpression getSourceXPathExpression();
> > +
> > +    /**
> > +     * Set the XPath expression for the source attribute
> > +     * @param sourceXPathExpression the XPath expression for the source
> > attribute
> > +     */
> > +    void setSourceXPathExpression(XPathExpression
> > sourceXPathExpression);
> >
> >     /**
> >      * Returns a URI to a file containing the property value.
> >
> > Modified:
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java?rev=636985&r1=636984&r2=636985&view=diff
> >
> > ==============================================================================
> > ---
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
> > (original)
> > +++
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
> > Thu Mar 13 20:48:47 2008
> > @@ -24,10 +24,13 @@
> >  import java.net.URI;
> >  import java.net.URL;
> >  import java.net.URLConnection;
> > +import java.util.Arrays;
> > +import java.util.Collections;
> >  import java.util.Iterator;
> >  import java.util.List;
> >  import java.util.Map;
> >
> > +import javax.xml.XMLConstants;
> >  import javax.xml.namespace.NamespaceContext;
> >  import javax.xml.parsers.DocumentBuilderFactory;
> >  import javax.xml.parsers.ParserConfigurationException;
> > @@ -36,7 +39,6 @@
> >  import javax.xml.transform.TransformerFactory;
> >  import javax.xml.transform.dom.DOMResult;
> >  import javax.xml.transform.sax.SAXSource;
> > -import javax.xml.xpath.XPath;
> >  import javax.xml.xpath.XPathConstants;
> >  import javax.xml.xpath.XPathExpression;
> >  import javax.xml.xpath.XPathExpressionException;
> > @@ -59,18 +61,11 @@
> >     private static final DocumentBuilderFactory DOC_BUILDER_FACTORY =
> > DocumentBuilderFactory.newInstance();
> >     private static final TransformerFactory TRANSFORMER_FACTORY =
> > TransformerFactory.newInstance();
> >
> > -    static private Document evaluate(NamespaceContext nsContext, Node
> > node, String xPathExpression)
> > +    static private Document evaluate(Document node, XPathExpression
> > expression)
> >         throws XPathExpressionException, ParserConfigurationException {
> > -        XPath path = XPATH_FACTORY.newXPath();
> > -
> > -        if (nsContext != null) {
> > -            path.setNamespaceContext(nsContext);
> > -        } else {
> > -            path.setNamespaceContext(new DOMNamespaceContext(node));
> > -        }
> > -
> > -        XPathExpression expression = path.compile(xPathExpression);
> > -        Node result = (Node)expression.evaluate(node,
> > XPathConstants.NODE);
> > +
> > +        Node value = node.getDocumentElement();
> > +        Node result = (Node)expression.evaluate(value,
> > XPathConstants.NODE);
> >         if (result == null) {
> >             return null;
> >         }
> > @@ -139,19 +134,8 @@
> >
> >                     Document compositePropDefValues =
> > (Document)compositeProp.getValue();
> >
> > -                    // Adding /value because the document root is
> > "value"
> > -                    String path = source.substring(index);
> > -                    String xpath = null;
> > -
> > -                    if ("/".equals(path)) {
> > -                        // trailing / is not legal for xpath
> > -                        xpath = "/value";
> > -                    } else {
> > -                        xpath = "/value" + path;
> > -                    }
> > -
> >                     // FIXME: How to deal with namespaces?
> > -                    Document node = evaluate(null,
> > compositePropDefValues, xpath);
> > +                    Document node = evaluate(compositePropDefValues,
> > aProperty.getSourceXPathExpression());
> >
> >                     if (node != null) {
> >                         aProperty.setValue(node);
> > @@ -178,15 +162,42 @@
> >         }
> >
> >         public String getNamespaceURI(String prefix) {
> > -            return node.lookupNamespaceURI(prefix);
> > +            if (prefix == null) {
> > +                throw new IllegalArgumentException("Prefix is null");
> > +            } else if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
> > +                return XMLConstants.XML_NS_URI;
> > +            } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
> > +                return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
> > +            }
> > +            String ns = node.lookupNamespaceURI(prefix);
> > +            return ns == null ? XMLConstants.NULL_NS_URI : ns;
> >         }
> >
> >         public String getPrefix(String namespaceURI) {
> > +            if (namespaceURI == null) {
> > +                throw new IllegalArgumentException("Namespace URI is
> > null");
> > +            } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
> > +                return XMLConstants.XML_NS_PREFIX;
> > +            } else if 
> > (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI))
> > {
> > +                return XMLConstants.XMLNS_ATTRIBUTE;
> > +            }
> >             return node.lookupPrefix(namespaceURI);
> >         }
> >
> >         public Iterator<?> getPrefixes(String namespaceURI) {
> > -            return null;
> > +            // Not implemented
> > +            if (namespaceURI == null) {
> > +                throw new IllegalArgumentException("Namespace URI is
> > null");
> > +            } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
> > +                return Arrays.asList(XMLConstants.XML_NS_PREFIX
> > ).iterator();
> > +            } else if 
> > (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI))
> > {
> > +                return Arrays.asList(XMLConstants.XMLNS_ATTRIBUTE
> > ).iterator();
> > +            }
> > +            String prefix = getPrefix(namespaceURI);
> > +            if (prefix == null) {
> > +                return Collections.emptyList().iterator();
> > +            }
> > +            return Arrays.asList(prefix).iterator();
> >         }
> >
> >     }
> >
> > Modified:
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java?rev=636985&r1=636984&r2=636985&view=diff
> >
> > ==============================================================================
> > ---
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
> > (original)
> > +++
> > incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
> > Thu Mar 13 20:48:47 2008
> > @@ -19,6 +19,8 @@
> >
> >  package org.apache.tuscany.sca.assembly.impl;
> >
> > +import javax.xml.xpath.XPathExpression;
> > +
> >  import org.apache.tuscany.sca.assembly.ComponentProperty;
> >  import org.apache.tuscany.sca.assembly.Property;
> >
> > @@ -31,6 +33,7 @@
> >     private String file;
> >     private Property property;
> >     private String source;
> > +    private XPathExpression sourceXPathExpression;
> >
> >     /**
> >      * Constructs a new component property.
> > @@ -77,6 +80,14 @@
> >
> >     public void setSource(String source) {
> >         this.source = source;
> > +    }
> > +
> > +    public XPathExpression getSourceXPathExpression() {
> > +        return sourceXPathExpression;
> > +    }
> > +
> > +    public void setSourceXPathExpression(XPathExpression
> > sourceXPathExpression) {
> > +        this.sourceXPathExpression = sourceXPathExpression;
> >     }
> >
> >  }
> >
> > Modified:
> > incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java?rev=636985&r1=636984&r2=636985&view=diff
> >
> > ==============================================================================
> > ---
> > incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
> > (original)
> > +++
> > incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
> > Thu Mar 13 20:48:47 2008
> > @@ -32,11 +32,9 @@
> >  import java.util.ArrayList;
> >  import java.util.Collection;
> >  import java.util.Hashtable;
> > -import java.util.Iterator;
> >  import java.util.List;
> >  import java.util.Map;
> >
> > -import javax.xml.namespace.NamespaceContext;
> >  import javax.xml.namespace.QName;
> >  import javax.xml.parsers.DocumentBuilder;
> >  import javax.xml.parsers.DocumentBuilderFactory;
> > @@ -51,11 +49,9 @@
> >  import javax.xml.transform.TransformerFactory;
> >  import javax.xml.transform.dom.DOMSource;
> >  import javax.xml.transform.stream.StreamResult;
> > -import javax.xml.xpath.XPath;
> >  import javax.xml.xpath.XPathConstants;
> >  import javax.xml.xpath.XPathExpression;
> >  import javax.xml.xpath.XPathExpressionException;
> > -import javax.xml.xpath.XPathFactory;
> >
> >  import org.apache.tuscany.sca.assembly.AssemblyFactory;
> >  import org.apache.tuscany.sca.assembly.Composite;
> > @@ -545,18 +541,15 @@
> >
> > XPathExpressionException,
> >
> > TransformerConfigurationException,
> >
> > TransformerException  {
> > -        XPathFactory xpathFactory = XPathFactory.newInstance();
> > -        XPath path = xpathFactory.newXPath();
> > -        path.setNamespaceContext(new DOMNamespaceContext(doc));
> >         int prefixCount = 1;
> >
> >         for ( PolicySet policySet : policySets ) {
> >             if ( policySet.getAppliesTo() != null ) {
> > -                addApplicablePolicySets(policySet, path, doc,
> > prefixCount);
> > +                addApplicablePolicySets(policySet, doc, prefixCount);
> >             }
> >
> >             if ( policySet.getAlwaysAppliesTo() != null ) {
> > -                addAlwaysApplicablePolicySets(policySet, path, doc,
> > prefixCount);
> > +                addAlwaysApplicablePolicySets(policySet, doc,
> > prefixCount);
> >             }
> >         }
> >
> > @@ -569,8 +562,8 @@
> >         return sw.toString().getBytes();
> >     }
> >
> > -    private void addAlwaysApplicablePolicySets(PolicySet policySet,
> > XPath path, Document doc, int prefixCount) throws XPathExpressionException {
> > -        XPathExpression expression = path.compile(
> > policySet.getAlwaysAppliesTo());
> > +    private void addAlwaysApplicablePolicySets(PolicySet policySet,
> > Document doc, int prefixCount) throws XPathExpressionException {
> > +        XPathExpression expression =
> > policySet.getAlwaysAppliesToXPathExpression();
> >         NodeList result = (NodeList)expression.evaluate(doc,
> > XPathConstants.NODESET);
> >
> >         if ( result != null ) {
> > @@ -600,8 +593,8 @@
> >         }
> >     }
> >
> > -    private void addApplicablePolicySets(PolicySet policySet, XPath
> > path, Document doc, int prefixCount) throws XPathExpressionException {
> > -        XPathExpression expression = path.compile(
> > policySet.getAppliesTo());
> > +    private void addApplicablePolicySets(PolicySet policySet, Document
> > doc, int prefixCount) throws XPathExpressionException {
> > +        XPathExpression expression =
> > policySet.getAppliesToXPathExpression();
> >         NodeList result = (NodeList)expression.evaluate(doc,
> > XPathConstants.NODESET);
> >
> >         if ( result != null ) {
> > @@ -683,55 +676,6 @@
> >             element.setAttributeNodeNS(attr);
> >         }
> >         return prefix;
> > -    }
> > -
> > -    private static class DOMNamespaceContext implements
> > NamespaceContext {
> > -        private Node node;
> > -
> > -        /**
> > -         * @param node
> > -         */
> > -        public DOMNamespaceContext(Node node) {
> > -            super();
> > -            this.node = node;
> > -        }
> > -
> > -        public String getNamespaceURI(String prefix) {
> > -            return node.lookupNamespaceURI(prefix);
> > -        }
> > -
> > -        public String getPrefix(String namespaceURI) {
> > -            return node.lookupPrefix(namespaceURI);
> > -        }
> > -
> > -        public Iterator<?> getPrefixes(String namespaceURI) {
> > -            return null;
> > -        }
> > -
> > -    }
> > -
> > -    private static String print(Node node)  {
> > -        if ( node.getNodeType() != 3 ) {
> > -            
> > System.out.println("********************************************************"
> > + node.getNodeType());
> > -            StringWriter sw = new StringWriter();
> > -            Source domSource = new DOMSource(node);
> > -            Result finalResult = new StreamResult(sw);
> > -
> > -            try {
> > -                Transformer t = TransformerFactory.newInstance
> > ().newTransformer();
> > -
> > -                t.setOutputProperty("omit-xml-declaration", "yes");
> > -                //System.out.println(" ***** - " +
> > t.getOutputProperties());
> > -                t.transform(domSource, finalResult);
> > -            } catch ( Exception e ) {
> > -                e.printStackTrace();
> > -             }
> > -            System.out.println(sw.toString());
> > -            System.out.println
> > ("********************************************************");
> > -            return sw.toString();
> > -        } else {
> > -            return null;
> > -        }
> >     }
> >
> >  }
> >
> > Modified:
> > incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java?rev=636985&r1=636984&r2=636985&view=diff
> >
> > ==============================================================================
> > ---
> > incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
> > (original)
> > +++
> > incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
> > Thu Mar 13 20:48:47 2008
> > @@ -33,6 +33,9 @@
> >  import javax.xml.stream.XMLStreamException;
> >  import javax.xml.stream.XMLStreamReader;
> >  import javax.xml.stream.XMLStreamWriter;
> > +import javax.xml.xpath.XPath;
> > +import javax.xml.xpath.XPathExpressionException;
> > +import javax.xml.xpath.XPathFactory;
> >
> >  import org.apache.axiom.om.OMAbstractFactory;
> >  import org.apache.axiom.om.OMElement;
> > @@ -59,6 +62,7 @@
> >
> >     private PolicyFactory policyFactory;
> >     private StAXArtifactProcessor<Object> extensionProcessor;
> > +    private XPathFactory xpathFactory = XPathFactory.newInstance();
> >
> >     public PolicySetProcessor(ModelFactoryExtensionPoint modelFactories)
> > {
> >         this.policyFactory = modelFactories.getFactory(
> > PolicyFactory.class);
> > @@ -91,6 +95,20 @@
> >
> >         policySet.setAppliesTo(appliesTo);
> >         policySet.setAlwaysAppliesTo(alwaysAppliesTo);
> > +
> > +        XPath path = xpathFactory.newXPath();
> > +        path.setNamespaceContext(reader.getNamespaceContext());
> > +        try {
> > +            if (appliesTo != null) {
> > +                policySet.setAppliesToXPathExpression(path.compile
> > (appliesTo));
> > +            }
> > +            if (alwaysAppliesTo != null) {
> > +                policySet.setAlwaysAppliesToXPathExpression(
> > path.compile(alwaysAppliesTo));
> > +            }
> > +        } catch (XPathExpressionException e) {
> > +            throw new ContributionReadException(e);
> > +        }
> > +
> >         readProvidedIntents(policySet, reader);
> >
> >         int event = reader.getEventType();
> >
> > Modified:
> > incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java?rev=636985&r1=636984&r2=636985&view=diff
> >
> > ==============================================================================
> > ---
> > incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
> > (original)
> > +++
> > incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
> > Thu Mar 13 20:48:47 2008
> > @@ -22,6 +22,7 @@
> >  import java.util.Map;
> >
> >  import javax.xml.namespace.QName;
> > +import javax.xml.xpath.XPathExpression;
> >
> >  /**
> >  * Represents a policy set. See the Policy Framework specification for a
> > @@ -49,7 +50,6 @@
> >      * @return
> >      */
> >     //List<Operation> getOperations();
> > -
> >     /**
> >      * Returns the list of
> >      *
> > @@ -64,7 +64,6 @@
> >      */
> >     List<Intent> getProvidedIntents();
> >
> > -
> >     /**
> >      * Returns the list of concrete policies, either WS-Policy policy
> >      * attachments, policy references, or policies expressed in another
> > policy
> > @@ -87,7 +86,7 @@
> >      * @param unresolved whether the model element is unresolved
> >      */
> >     void setUnresolved(boolean unresolved);
> > -
> > +
> >     /**
> >      * Returns the xpath expression that is to be used to evaluate
> >      * if this PolicySet applies to specific attachment point
> > @@ -95,23 +94,21 @@
> >      * @return the xpath expression
> >      */
> >     String getAppliesTo();
> > -
> > +
> >     /**
> >      * Sets the xpath expression that is to be used to evaluate
> >      * if this PolicySet applies to specific attachment point
> >      *
> > -     * @return
> >      */
> >     void setAppliesTo(String xpath);
> > -
> > -
> > +
> >     /**
> >      * Returns the policies / policy attachments provided thro intent
> > maps
> >      *
> >      * @return
> >      */
> > -    Map<Intent, List<Object>>getMappedPolicies();
> > -
> > +    Map<Intent, List<Object>> getMappedPolicies();
> > +
> >     /**
> >      * Gets the xpath expression that is to be used to evaluate
> >      * the SCA Artifacts that this policyset will always apply to
> > @@ -120,13 +117,37 @@
> >      * @return the xpath expression
> >      */
> >     String getAlwaysAppliesTo();
> > -
> > +
> >     /**
> >      * Sets the xpath expression that is to be used to evaluate
> >      * the SCA Artifacts that this policyset will always apply to
> >      * immaterial of an intent declared on the SCA Artifact
> >      *
> > -     * @return
> >      */
> >     void setAlwaysAppliesTo(String xpath);
> > +
> > +    /**
> > +     * Get the XPath expression for the appliesTo attribute
> > +     * @return the XPath expression for the appliesTo attribute
> > +     */
> > +    XPathExpression getAppliesToXPathExpression();
> > +
> > +    /**
> > +     * Set the XPath expression for the appliesTo attribute
> > +     * @param xpathExpression the XPath expression for the appliesTo
> > attribute
> > +     */
> > +    void setAppliesToXPathExpression(XPathExpression xpathExpression);
> > +
> > +    /**
> > +     * Get the XPath expression for the alwaysAppliesTo attribute
> > +     * @return the XPath expression for the alwaysAppliesTo attribute
> > +     */
> > +    XPathExpression getAlwaysAppliesToXPathExpression();
> > +
> > +    /**
> > +     * Set the XPath expression for the alwaysAppliesTo attribute
> > +     * @param xpathExpression the XPath expression for the
> > alwaysAppliesTo attribute
> > +     */
> > +    void setAlwaysAppliesToXPathExpression(XPathExpression
> > xpathExpression);
> > +
> >  }
> >
> > Modified:
> > incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java?rev=636985&r1=636984&r2=636985&view=diff
> >
> > ==============================================================================
> > ---
> > incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
> > (original)
> > +++
> > incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
> > Thu Mar 13 20:48:47 2008
> > @@ -24,6 +24,7 @@
> >  import java.util.Map;
> >
> >  import javax.xml.namespace.QName;
> > +import javax.xml.xpath.XPathExpression;
> >
> >  import org.apache.tuscany.sca.policy.Intent;
> >  import org.apache.tuscany.sca.policy.PolicySet;
> > @@ -46,6 +47,9 @@
> >     private boolean unresolved = true;
> >     private String alwaysAppliesTo;
> >
> > +    private XPathExpression appliesToXPathExpression;
> > +    private XPathExpression alwaysAppliesToXPathExpression;
> > +
> >     public String getAlwaysAppliesTo() {
> >         return alwaysAppliesTo;
> >     }
> > @@ -125,4 +129,21 @@
> >     public String toString() {
> >         return getName().toString();
> >     }
> > +
> > +    public XPathExpression getAppliesToXPathExpression() {
> > +        return appliesToXPathExpression;
> > +    }
> > +
> > +    public void setAppliesToXPathExpression(XPathExpression
> > appliesToXPathExpression) {
> > +        this.appliesToXPathExpression = appliesToXPathExpression;
> > +    }
> > +
> > +    public XPathExpression getAlwaysAppliesToXPathExpression() {
> > +        return alwaysAppliesToXPathExpression;
> > +    }
> > +
> > +    public void setAlwaysAppliesToXPathExpression(XPathExpression
> > alwaysAppliesToXPathExpression) {
> > +        this.alwaysAppliesToXPathExpression =
> > alwaysAppliesToXPathExpression;
> > +    }
> > +
> >  }
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
Just checked in a fix to test-definitions.xml in the assembly-xml test
resources. There was an invalid xpath expression in there. However that file
hasn't changed for a while so I' be interested to know why this hasn't
cropped up before.

Simon

Reply via email to