summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-03-10 10:10:58 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-03-10 10:10:58 +0000
commit1303bb654471a586be4049978daba5a8fe221d71 (patch)
treea47e003108e2498ecbf770ea8f15f9f85fa1fe41
parent5b3b3cf5da7c994092c1eb44fef2e142d1e744f1 (diff)
TUSCANY-242 add URI specific processing wherever we read an anyURI attribute
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@921279 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/itest/jms/src/main/resources/external/client.composite2
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java14
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java7
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java5
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java5
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java5
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java2
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java16
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java5
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java7
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java5
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java2
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java65
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java2
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java5
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java5
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java2
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java5
-rw-r--r--sca-java-1.x/branches/sca-java-1.5.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java7
19 files changed, 123 insertions, 43 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/itest/jms/src/main/resources/external/client.composite b/sca-java-1.x/branches/sca-java-1.5.2/itest/jms/src/main/resources/external/client.composite
index 7a0013be4d..50bfe1a30e 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/itest/jms/src/main/resources/external/client.composite
+++ b/sca-java-1.x/branches/sca-java-1.5.2/itest/jms/src/main/resources/external/client.composite
@@ -28,7 +28,7 @@
<reference name="serviceA" promote="HelloWorldClient/serviceA">
<interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
<binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
- <destination name="DestQueueA"/>
+ <destination name=" DestQueueA "/>
<response>
<destination name="RespQueueA"/>
</response>
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
index f34adbc581..36ef0e0d02 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
@@ -180,7 +180,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
// Read a <composite>
composite = assemblyFactory.createComposite();
- composite.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
+ composite.setName(new QName(getURIString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
if(!isSet(reader, TARGET_NAMESPACE)){
// spec says that a composite must have a namespace
@@ -227,7 +227,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
contract = compositeService;
compositeService.setName(getString(reader, NAME));
- String promoted = getString(reader, PROMOTE);
+ String promoted = getURIString(reader, PROMOTE);
if (promoted != null) {
String promotedComponentName;
String promotedServiceName;
@@ -283,7 +283,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
compositeReference.setName(getString(reader, NAME));
readMultiplicity(compositeReference, reader);
readTargets(compositeReference, reader);
- String promote = reader.getAttributeValue(null, Constants.PROMOTE);
+ String promote = getString(reader, Constants.PROMOTE);
if (promote != null) {
for (StringTokenizer tokens = new StringTokenizer(promote); tokens.hasMoreTokens();) {
ComponentReference promotedReference =
@@ -337,7 +337,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
//throw ce;
}
}
- componentProperty.setFile(getString(reader, FILE));
+ componentProperty.setFile(getURIString(reader, FILE));
//handle extension attributes
this.readExtendedAttributes(reader, componentProperty);
@@ -380,7 +380,7 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
component.setAutowire(getBoolean(reader, AUTOWIRE));
}
if (isSet(reader, URI)) {
- component.setURI(getString(reader, URI));
+ component.setURI(getURIString(reader, URI));
}
//handle extension attributes
@@ -396,12 +396,12 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt
wire = assemblyFactory.createWire();
ComponentReference source = assemblyFactory.createComponentReference();
source.setUnresolved(true);
- source.setName(getString(reader, SOURCE));
+ source.setName(getURIString(reader, SOURCE));
wire.setSource(source);
ComponentService target = assemblyFactory.createComponentService();
target.setUnresolved(true);
- target.setName(getString(reader, TARGET));
+ target.setName(getURIString(reader, TARGET));
wire.setTarget(target);
//handle extension attributes
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
index 467ed37638..1c5c5f8233 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
@@ -144,7 +144,12 @@ public class DefaultBeanModelProcessor<T> extends BaseAssemblyProcessor implemen
String attributeName = reader.getAttributeLocalName(i);
Method setter = setterMethods.get(attributeName);
if (setter != null) {
- String value = reader.getAttributeValue(i);
+ String value = null;
+ if (attributeName.equals("uri")){
+ value = getURIString(reader, "uri");
+ } else {
+ value = reader.getAttributeValue(i);
+ }
setter.invoke(model, value);
}
}
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java
index 0bb38d3682..a837e95294 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java
@@ -28,6 +28,7 @@ import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
import org.apache.tuscany.sca.binding.corba.CorbaBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -38,7 +39,7 @@ import org.apache.tuscany.sca.policy.PolicyFactory;
/**
* @version $Rev$ $Date$
*/
-public class CorbaBindingProcessor implements StAXArtifactProcessor<CorbaBinding> {
+public class CorbaBindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<CorbaBinding> {
private PolicyFactory policyFactory;
private PolicyAttachPointProcessor policyProcessor;
@@ -76,7 +77,7 @@ public class CorbaBindingProcessor implements StAXArtifactProcessor<CorbaBinding
}
// Read binding URI
- String uri = reader.getAttributeValue(null, "uri");
+ String uri = getURIString(reader, "uri");
if (uri != null) {
binding.setURI(uri);
}
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java
index 305cd2a742..78ad84ee56 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java
@@ -31,6 +31,7 @@ import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
import org.apache.tuscany.sca.binding.ejb.EJBBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXAttributeProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
@@ -68,7 +69,7 @@ import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
*
* @version $Rev$ $Date$
*/
-public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBindingImpl> {
+public class EJBBindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<EJBBindingImpl> {
private PolicyFactory policyFactory;
private ExtensionFactory extensionFactory;
private PolicyAttachPointProcessor policyProcessor;
@@ -132,7 +133,7 @@ public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBindingImpl
}
// Read binding URI
- String uri = reader.getAttributeValue(null, EJBBinding.URI);
+ String uri = getURIString(reader, EJBBinding.URI);
if (uri != null) {
ejbBinding.setURI(uri);
}
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java
index dea035559b..8928c8772f 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java
@@ -26,6 +26,7 @@ import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sca.binding.gdata.GdataBinding;
import org.apache.tuscany.sca.binding.gdata.GdataBindingFactory;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -37,7 +38,7 @@ import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
*
* @version $Rev$ $Date$
*/
-public class GdataBindingProcessor implements StAXArtifactProcessor<GdataBinding> {
+public class GdataBindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<GdataBinding> {
private QName BINDING_GDATA = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.gdata");
@@ -64,7 +65,7 @@ public class GdataBindingProcessor implements StAXArtifactProcessor<GdataBinding
gdataBinding.setName(name);
}
- String uri = reader.getAttributeValue(null, "uri");
+ String uri = getURIString(reader, "uri");
if (uri != null) {
gdataBinding.setURI(uri);
}
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
index cb35d0f104..0904a78c88 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
@@ -102,7 +102,7 @@ public class HTTPBindingProcessor extends BaseStAXArtifactProcessor implements S
httpBinding.setName(name);
}
- String uri = getString(reader, URI);
+ String uri = getURIString(reader, URI);
if (uri != null) {
httpBinding.setURI(uri);
}
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
index 49875d84d0..f9256c106c 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
@@ -219,13 +219,13 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
}
// Read initial context factory
- String initialContextFactory = reader.getAttributeValue(null, "initialContextFactory");
+ String initialContextFactory = getURIString(reader, "initialContextFactory");
if (initialContextFactory != null && initialContextFactory.length() > 0) {
jmsBinding.setInitialContextFactoryName(initialContextFactory);
}
// Read JNDI URL
- String jndiURL = reader.getAttributeValue(null, "jndiURL");
+ String jndiURL = getURIString(reader, "jndiURL");
if (jndiURL != null && jndiURL.length() > 0) {
jmsBinding.setJndiURL(jndiURL);
}
@@ -407,7 +407,7 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
}
private void parseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
+ String name = getURIString(reader, "name");
if (name != null && name.length() > 0) {
jmsBinding.setDestinationName(name);
}
@@ -433,7 +433,7 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
}
private void parseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
+ String name = getURIString(reader, "name");
if (name != null && name.length() > 0) {
jmsBinding.setConnectionFactoryName(name);
} else {
@@ -443,7 +443,7 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
}
private void parseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
+ String name = getURIString(reader, "name");
if (name != null && name.length() > 0) {
jmsBinding.setActivationSpecName(name);
} else {
@@ -453,7 +453,7 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
}
private void parseResponseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
+ String name = getURIString(reader, "name");
if (name != null && name.length() > 0) {
jmsBinding.setResponseDestinationName(name);
}
@@ -479,7 +479,7 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
}
private void parseResponseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
+ String name = getURIString(reader, "name");
if (name != null && name.length() > 0) {
jmsBinding.setResponseConnectionFactoryName(name);
} else {
@@ -489,7 +489,7 @@ public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements St
}
private void parseResponseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
+ String name = getURIString(reader, "name");
if (name != null && name.length() > 0) {
jmsBinding.setResponseActivationSpecName(name);
} else {
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
index 034aaf0339..9c5bc2ad2b 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
@@ -33,6 +33,7 @@ import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
@@ -51,7 +52,7 @@ import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
* @version $Rev$ $Date$
*/
-public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, Constants{
+public class SCABindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SCABinding>, Constants{
private SCABindingFactory scaBindingFactory;
private ExtensionFactory extensionFactory;
@@ -106,7 +107,7 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C
}
// Read binding URI
- String uri = reader.getAttributeValue(null, URI);
+ String uri = getURIString(reader, URI);
if (uri != null) {
scaBinding.setURI(uri);
}
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
index a3dfcc3c5b..12995f19de 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
@@ -47,6 +47,7 @@ import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXAttributeProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
@@ -77,7 +78,7 @@ import com.ibm.wsdl.OperationImpl;
*
* @version $Rev$ $Date$
*/
-public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServiceBinding>, WebServiceConstants {
+public class WebServiceBindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WebServiceBinding>, WebServiceConstants {
private ExtensionPointRegistry extensionPoints;
private WSDLFactory wsdlFactory;
@@ -172,7 +173,7 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
}
// Read URI
- String uri = reader.getAttributeValue(null, URI);
+ String uri = getURIString(reader, URI);
if (uri != null) {
wsBinding.setURI(uri);
}
@@ -180,7 +181,7 @@ public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServ
// Read a qname in the form:
// namespace#wsdl.???(name)
Boolean wsdlElementIsBinding = null;
- String wsdlElement = reader.getAttributeValue(null, WSDL_ELEMENT);
+ String wsdlElement = getURIString(reader, WSDL_ELEMENT);
if (wsdlElement != null) {
int index = wsdlElement.indexOf('#');
if (index == -1) {
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
index d18977714c..12cff100ff 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
@@ -30,6 +30,7 @@ import javax.xml.stream.XMLStreamWriter;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.java.JavaImport;
import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -45,7 +46,7 @@ import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
*
* @version $Rev$ $Date$
*/
-public class JavaImportProcessor implements StAXArtifactProcessor<JavaImport> {
+public class JavaImportProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JavaImport> {
private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
private static final QName IMPORT_JAVA = new QName(SCA10_NS, "import.java");
@@ -121,7 +122,7 @@ public class JavaImportProcessor implements StAXArtifactProcessor<JavaImport> {
} else
javaImport.setPackage(packageName);
- String location = reader.getAttributeValue(null, LOCATION);
+ String location = getURIString(reader, LOCATION);
javaImport.setLocation(location);
}
break;
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
index ab7c76114a..7afc7d48d2 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
@@ -133,7 +133,7 @@ public class NamespaceImportProcessor extends BaseStAXArtifactProcessor implemen
namespaceImport.setNamespace(ns);
}
- String location = reader.getAttributeValue(null, LOCATION);
+ String location = getURIString(reader, LOCATION);
if (location != null) {
namespaceImport.setLocation(location);
}
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
index a451316883..023c678617 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
@@ -123,6 +123,71 @@ public abstract class BaseStAXArtifactProcessor {
protected String getString(XMLStreamReader reader, String name) {
return reader.getAttributeValue(null, name);
}
+
+ /**
+ * TUSCANY-242
+ *
+ * Returns the URI value of an attribute as a string and first applies the
+ * URI whitespace processing as defined in section 4.3.6 of XML Schema Part2: Datatypes
+ * [http://www.w3.org/TR/xmlschema-2/#rf-facets]. anyURI is defined with the following
+ * XSD:
+ * <xs:simpleType name="anyURI" id="anyURI">
+ * <xs:restriction base="xs:anySimpleType">
+ * <xs:whiteSpace value="collapse" fixed="true" id="anyURI.whiteSpace"/>
+ * </xs:restriction>
+ * </xs:simpleType>
+ *
+ * The <xs:whiteSpace value="collapse"/> constraining facet is defined as follows
+ *
+ * replace
+ * All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced with #x20 (space)
+ * collapse
+ * After the processing implied by replace, contiguous sequences of #x20's are collapsed to a single #x20,
+ * and leading and trailing #x20's are removed
+ *
+ * It seems that the StAX parser does apply this rule so we do it here.
+ *
+ * @param reader
+ * @param name
+ * @return
+ */
+ public static String getURIString(XMLStreamReader reader, String name) {
+ // get the basic string value
+ String uri = reader.getAttributeValue(null, name);
+
+ // apply the "collapse" rule
+ if (uri != null){
+ // turn tabs, line feeds and carriage returns into spaces
+ uri = uri.replace('\t', ' ');
+ uri = uri.replace('\n', ' ');
+ uri = uri.replace('\r', ' ');
+
+ // remote leading and trailing spaces. Other whitespace
+ // has already been converted to spaces above
+ uri = uri.trim();
+
+ // collapse any contiguous spaces into a single space
+ StringBuilder sb= new StringBuilder(uri.length());
+ boolean spaceFound= false;
+ for(int i=0; i< uri.length(); ++i){
+ char c= uri.charAt(i);
+ if(c == ' '){
+ if(!spaceFound){
+ sb.append(c);
+ spaceFound = true;
+ } else {
+ // collapse the space by ignoring it
+ }
+ }else{
+ sb.append(c);
+ spaceFound= false;
+ }
+ }
+ uri = sb.toString();
+ }
+
+ return uri;
+ }
/**
* Test if an attribute is explicitly set
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
index 0bea894854..8768d0b964 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
@@ -97,7 +97,7 @@ public class SCADefinitionsProcessor extends BaseStAXArtifactProcessor implement
name = reader.getName();
if ( SCA_DEFINITIONS_QNAME.equals(name)) {
definitions = new SCADefinitionsImpl();
- targetNamespace = reader.getAttributeValue(null, TARGET_NAMESPACE);
+ targetNamespace = getURIString(reader, TARGET_NAMESPACE);
definitions.setTargetNamespace(targetNamespace);
} else {
Object extension = extensionProcessor.read(reader);
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
index a8d399b11e..d7a8c542b7 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
@@ -32,6 +32,7 @@ import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.contribution.Artifact;
import org.apache.tuscany.sca.contribution.ContributionFactory;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -50,7 +51,7 @@ import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
*
* @version $Rev$ $Date$
*/
-public class ResourceImplementationProcessor implements StAXArtifactProcessor<ResourceImplementation> {
+public class ResourceImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<ResourceImplementation> {
private static final QName IMPLEMENTATION_RESOURCE = new QName(Constants.SCA10_TUSCANY_NS, "implementation.resource");
private ContributionFactory contributionFactory;
@@ -109,7 +110,7 @@ public class ResourceImplementationProcessor implements StAXArtifactProcessor<Re
ResourceImplementation implementation = null;
// Read the location attribute specifying the location of the resources
- String location = reader.getAttributeValue(null, "location");
+ String location = getURIString(reader, "location");
if (location != null) {
implementation = implementationFactory.createResourceImplementation();
implementation.setLocation(location);
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
index 29dc0a38a1..0567d12845 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
@@ -32,6 +32,7 @@ import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -54,7 +55,7 @@ import org.apache.tuscany.sca.policy.PolicyFactory;
*
* @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
*/
-public class SpringImplementationProcessor implements StAXArtifactProcessor<SpringImplementation> {
+public class SpringImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SpringImplementation> {
private static final String LOCATION = "location";
private static final String IMPLEMENTATION_SPRING = "implementation.spring";
@@ -139,7 +140,7 @@ public class SpringImplementationProcessor implements StAXArtifactProcessor<Spri
SpringImplementation springImplementation = null;
// Read the location attribute for the spring implementation
- String springLocation = reader.getAttributeValue(null, LOCATION);
+ String springLocation = getURIString(reader, LOCATION);
if (springLocation != null) {
springImplementation = new SpringImplementation();
springImplementation.setLocation(springLocation);
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
index c0087e97fe..23b188fc96 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
@@ -110,7 +110,7 @@ public class WidgetImplementationProcessor extends BaseStAXArtifactProcessor imp
WidgetImplementation implementation = null;
// Read the location attribute specifying the location of the resources
- String location = reader.getAttributeValue(null, "location");
+ String location = getURIString(reader, "location");
if (location != null) {
implementation = implementationFactory.createWidgetImplementation();
implementation.setLocation(location);
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java
index 12c478daea..854c760a54 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java
@@ -30,6 +30,7 @@ import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.contribution.Artifact;
import org.apache.tuscany.sca.contribution.ContributionFactory;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -47,7 +48,7 @@ import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
* Processor for the XQuery implementation type artifact
* @version $Rev$ $Date$
*/
-public class XQueryImplementationProcessor implements StAXArtifactProcessor<XQueryImplementation> {
+public class XQueryImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<XQueryImplementation> {
private static final String LOCATION = "location";
private static final String IMPLEMENTATION_XQUERY = "implementation.xquery";
@@ -94,7 +95,7 @@ public class XQueryImplementationProcessor implements StAXArtifactProcessor<XQue
XQueryImplementation xqueryImplementation = null;
/* Read the location attribute for the XQuery implementation */
- String xqueryLocation = reader.getAttributeValue(null, LOCATION);
+ String xqueryLocation = getURIString(reader, LOCATION);
if (xqueryLocation != null) {
xqueryImplementation = XQueryImplementationFactory.INSTANCE.createXQueryImplementation();
xqueryImplementation.setLocation(xqueryLocation);
diff --git a/sca-java-1.x/branches/sca-java-1.5.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/sca-java-1.x/branches/sca-java-1.5.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
index a7244ce13c..9fed67dd0e 100644
--- a/sca-java-1.x/branches/sca-java-1.5.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.5.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
@@ -32,6 +32,7 @@ import org.apache.tuscany.sca.assembly.Extension;
import org.apache.tuscany.sca.assembly.ExtensionFactory;
import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
@@ -57,7 +58,7 @@ import com.ibm.wsdl.OperationImpl;
*
* @version $Rev$ $Date$
*/
-public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfaceContract>, WSDLConstants {
+public class WSDLInterfaceProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WSDLInterfaceContract>, WSDLConstants {
private WSDLFactory wsdlFactory;
private ExtensionFactory extensionFactory;
@@ -152,14 +153,14 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa
String location = reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION);
wsdlInterfaceContract.setLocation(location);
- String uri = reader.getAttributeValue(null, INTERFACE);
+ String uri = getURIString(reader, INTERFACE);
if (uri != null) {
WSDLInterface wsdlInterface = createWSDLInterface(uri);
if (wsdlInterface != null)
wsdlInterfaceContract.setInterface(wsdlInterface);
}
- uri = reader.getAttributeValue(null, CALLBACK_INTERFACE);
+ uri = getURIString(reader, CALLBACK_INTERFACE);
if (uri != null) {
WSDLInterface wsdlCallbackInterface = createWSDLInterface(uri);
if (wsdlCallbackInterface != null)