summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/branches')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/main/resources/external/client.composite76
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java65
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.1/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.6.1/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.6.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java467
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.1/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.6.1/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.6.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java7
19 files changed, 391 insertions, 311 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/main/resources/external/client.composite b/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/main/resources/external/client.composite
index 7a0013be4d..c07c7df37c 100644
--- a/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/main/resources/external/client.composite
+++ b/sca-java-1.x/branches/sca-java-1.6.1/itest/jms/src/main/resources/external/client.composite
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- -->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- name="ExternalClientComposite">
-
- <component name="HelloWorldClient">
- <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
- <reference name="serviceA" />
- </component>
-
- <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"/>
- <response>
- <destination name="RespQueueA"/>
- </response>
- </binding.jms>
- </reference>
-
-</composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ExternalClientComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <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 "/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.6.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
index cdd5c0d992..03c0db87f3 100644
--- a/sca-java-1.x/branches/sca-java-1.6.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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.6.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
index 1d941e2a4f..67c50e9392 100644
--- a/sca-java-1.x/branches/sca-java-1.6.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
@@ -1,234 +1,235 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-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.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.spring.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+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;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
+import org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * SpringArtifactProcessor is responsible for processing the XML of an <implementation.spring.../>
- * element in an SCA SCDL file.
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class SpringImplementationProcessor implements StAXArtifactProcessor<SpringImplementation> {
-
- private static final String LOCATION = "location";
- private static final String IMPLEMENTATION_SPRING = "implementation.spring";
- private static final QName IMPLEMENTATION_SPRING_QNAME = new QName(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
- private static final String MSG_LOCATION_MISSING = "Reading implementation.spring - location attribute missing";
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
- private PolicyFactory policyFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private Monitor monitor;
-
- private ModelFactoryExtensionPoint factories;
-
- public SpringImplementationProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
- this.factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
- this.javaFactory = factories.getFactory(JavaInterfaceFactory.class);
- this.policyFactory = factories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /*
- * Read the XML and parse out the attributes.
- *
- * <implementation.spring.../> has a single required attribute:
- * "location" - which is the target URI of of an archive file or a directory that contains the Spring
- * application context files.
- * If the resource identified by the location attribute is an archive file, then the file
- * META-INF/MANIFEST.MF is read from the archive.
- * If the location URI identifies a directory, then META-INF/MANIFEST.MF must exist
- * underneath that directory.
- * If the manifest file contains a header "Spring-Context" of the format:
- * Spring-Context ::= path ( ';' path )*
- *
- * Where path is a relative path with respect to the location URI, then the set of paths
- * specified in the header identify the context configuration files.
- * If there is no MANIFEST.MF file or no Spring-Context header within that file,
- * then the default behaviour is to build an application context using all the *.xml files
- * in the METAINF/spring directory.
- */
- public SpringImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Create the Spring implementation
- SpringImplementation springImplementation = null;
-
- // Read the location attribute for the spring implementation
- String springLocation = reader.getAttributeValue(null, LOCATION);
- if (springLocation != null) {
- springImplementation = new SpringImplementation();
- springImplementation.setLocation(springLocation);
- springImplementation.setUnresolved(true);
- processComponentType(springImplementation);
- } else {
- error("LocationAttributeMissing", reader);
- //throw new ContributionReadException(MSG_LOCATION_MISSING);
- }
-
- // Read policies
- policyProcessor.readPolicies(springImplementation, reader);
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_SPRING_QNAME.equals(reader.getName())) {
- break;
- }
- } // end while
-
- return springImplementation;
- } // end read
-
- /*
- * Handles the component type for the Spring implementation
- * @param springImplementation - a Spring implementation. The component type information
- * is created for this implementation
- *
- */
- private void processComponentType(SpringImplementation springImplementation) {
-
- // Create a ComponentType and mark it unresolved
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setUnresolved(true);
- springImplementation.setComponentType(componentType);
- } // end processComponentType
-
- /*
- * Write out the XML representation of the Spring implementation
- * <implementation.spring location="..." />
- */
- public void write(SpringImplementation springImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <implementation.spring>
- writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
- policyProcessor.writePolicyAttributes(springImplementation, writer);
-
- if (springImplementation.getLocation() != null) {
- writer.writeAttribute(LOCATION, springImplementation.getLocation());
- }
-
- writer.writeEndElement();
-
- } // end write
-
- /**
- * Resolves the Spring implementation - loads the Spring application-context XML and
- * derives the spring implementation componentType from it
- */
- public void resolve(SpringImplementation springImplementation, ModelResolver resolver)
- throws ContributionResolveException {
-
- if (springImplementation == null)
- return;
-
- /* Load the Spring component type by reading the Spring application context */
- SpringXMLComponentTypeLoader springLoader =
- new SpringXMLComponentTypeLoader(factories, assemblyFactory, javaFactory, policyFactory);
- try {
- // Load the Spring Implementation information from its application context file...
- springLoader.load(springImplementation, resolver);
- } catch (ContributionReadException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- throw ce;
- }
-
- ComponentType ct = springImplementation.getComponentType();
- if (ct.isUnresolved()) {
- // If the introspection fails to resolve, try to find a side file...
- ComponentType componentType = resolver.resolveModel(ComponentType.class, ct);
- if (componentType.isUnresolved()) {
- error("UnableToResolveComponentType", resolver);
- //throw new ContributionResolveException("SpringArtifactProcessor: unable to resolve componentType for Spring component");
- } else {
- springImplementation.setComponentType(componentType);
- springImplementation.setUnresolved(false);
- }
-
- } // end if
-
- } // end method resolve
-
- public QName getArtifactType() {
- return IMPLEMENTATION_SPRING_QNAME;
- }
-
- public Class<SpringImplementation> getModelType() {
- return SpringImplementation.class;
- }
-
-} // end class SpringArtifactProcessor
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * SpringArtifactProcessor is responsible for processing the XML of an <implementation.spring.../>
+ * element in an SCA SCDL file.
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SpringImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SpringImplementation> {
+
+ private static final String LOCATION = "location";
+ private static final String IMPLEMENTATION_SPRING = "implementation.spring";
+ private static final QName IMPLEMENTATION_SPRING_QNAME = new QName(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
+ private static final String MSG_LOCATION_MISSING = "Reading implementation.spring - location attribute missing";
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+ private Monitor monitor;
+
+ private ModelFactoryExtensionPoint factories;
+
+ public SpringImplementationProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
+ this.factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ this.javaFactory = factories.getFactory(JavaInterfaceFactory.class);
+ this.policyFactory = factories.getFactory(PolicyFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.monitor = monitor;
+ }
+
+ /**
+ * Report a exception.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Exception ex) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, ex);
+ monitor.problem(problem);
+ }
+ }
+
+ /**
+ * Report a error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void error(String message, Object model, Object... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
+ /*
+ * Read the XML and parse out the attributes.
+ *
+ * <implementation.spring.../> has a single required attribute:
+ * "location" - which is the target URI of of an archive file or a directory that contains the Spring
+ * application context files.
+ * If the resource identified by the location attribute is an archive file, then the file
+ * META-INF/MANIFEST.MF is read from the archive.
+ * If the location URI identifies a directory, then META-INF/MANIFEST.MF must exist
+ * underneath that directory.
+ * If the manifest file contains a header "Spring-Context" of the format:
+ * Spring-Context ::= path ( ';' path )*
+ *
+ * Where path is a relative path with respect to the location URI, then the set of paths
+ * specified in the header identify the context configuration files.
+ * If there is no MANIFEST.MF file or no Spring-Context header within that file,
+ * then the default behaviour is to build an application context using all the *.xml files
+ * in the METAINF/spring directory.
+ */
+ public SpringImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Create the Spring implementation
+ SpringImplementation springImplementation = null;
+
+ // Read the location attribute for the spring implementation
+ String springLocation = getURIString(reader, LOCATION);
+ if (springLocation != null) {
+ springImplementation = new SpringImplementation();
+ springImplementation.setLocation(springLocation);
+ springImplementation.setUnresolved(true);
+ processComponentType(springImplementation);
+ } else {
+ error("LocationAttributeMissing", reader);
+ //throw new ContributionReadException(MSG_LOCATION_MISSING);
+ }
+
+ // Read policies
+ policyProcessor.readPolicies(springImplementation, reader);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_SPRING_QNAME.equals(reader.getName())) {
+ break;
+ }
+ } // end while
+
+ return springImplementation;
+ } // end read
+
+ /*
+ * Handles the component type for the Spring implementation
+ * @param springImplementation - a Spring implementation. The component type information
+ * is created for this implementation
+ *
+ */
+ private void processComponentType(SpringImplementation springImplementation) {
+
+ // Create a ComponentType and mark it unresolved
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ springImplementation.setComponentType(componentType);
+ } // end processComponentType
+
+ /*
+ * Write out the XML representation of the Spring implementation
+ * <implementation.spring location="..." />
+ */
+ public void write(SpringImplementation springImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.spring>
+ writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
+ policyProcessor.writePolicyAttributes(springImplementation, writer);
+
+ if (springImplementation.getLocation() != null) {
+ writer.writeAttribute(LOCATION, springImplementation.getLocation());
+ }
+
+ writer.writeEndElement();
+
+ } // end write
+
+ /**
+ * Resolves the Spring implementation - loads the Spring application-context XML and
+ * derives the spring implementation componentType from it
+ */
+ public void resolve(SpringImplementation springImplementation, ModelResolver resolver)
+ throws ContributionResolveException {
+
+ if (springImplementation == null)
+ return;
+
+ /* Load the Spring component type by reading the Spring application context */
+ SpringXMLComponentTypeLoader springLoader =
+ new SpringXMLComponentTypeLoader(factories, assemblyFactory, javaFactory, policyFactory);
+ try {
+ // Load the Spring Implementation information from its application context file...
+ springLoader.load(springImplementation, resolver);
+ } catch (ContributionReadException e) {
+ ContributionResolveException ce = new ContributionResolveException(e);
+ error("ContributionResolveException", resolver, ce);
+ throw ce;
+ }
+
+ ComponentType ct = springImplementation.getComponentType();
+ if (ct.isUnresolved()) {
+ // If the introspection fails to resolve, try to find a side file...
+ ComponentType componentType = resolver.resolveModel(ComponentType.class, ct);
+ if (componentType.isUnresolved()) {
+ error("UnableToResolveComponentType", resolver);
+ //throw new ContributionResolveException("SpringArtifactProcessor: unable to resolve componentType for Spring component");
+ } else {
+ springImplementation.setComponentType(componentType);
+ springImplementation.setUnresolved(false);
+ }
+
+ } // end if
+
+ } // end method resolve
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_SPRING_QNAME;
+ }
+
+ public Class<SpringImplementation> getModelType() {
+ return SpringImplementation.class;
+ }
+
+} // end class SpringArtifactProcessor
diff --git a/sca-java-1.x/branches/sca-java-1.6.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/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.6.1/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.6.1/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.6.1/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.6.1/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)