diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-02 22:45:54 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-02 22:45:54 +0000 |
commit | 6b614afbc3f08ded00a70bf9cf976d9bad12b4a7 (patch) | |
tree | 410ae74a08c76bae0e4b868c6e56bcbd2140e717 /branches/sca-java-1.x/modules/binding-sca-xml/src | |
parent | 5dc6635594ad4a6f08ecf61ac30b82333a418686 (diff) |
Merge from 1.5.1:
1) Fix for TUSCANY-3238
2) Remove calls to XMLStreamWriter.setPrefix() as writeNamespace() invokes it internally (TUSCANY-3212)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@810726 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-sca-xml/src')
-rw-r--r-- | branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java b/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java index 8c82ef2378..034aaf0339 100644 --- a/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java +++ b/branches/sca-java-1.x/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.binding.sca.xml; @@ -52,21 +52,21 @@ import org.apache.tuscany.sca.policy.PolicySetAttachPoint; */ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, Constants{ - + private SCABindingFactory scaBindingFactory; private ExtensionFactory extensionFactory; private PolicyFactory policyFactory; private IntentAttachPointTypeFactory intentAttachPointTypeFactory; - private PolicyAttachPointProcessor policyProcessor; + private PolicyAttachPointProcessor policyProcessor; private StAXAttributeProcessor<Object> extensionAttributeProcessor; - + private Monitor monitor; protected static final String BINDING_SCA = "binding.sca"; protected static final QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA); - public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories, + public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor extensionProcessor, StAXAttributeProcessor extensionAttributeProcessor, Monitor monitor) { @@ -74,9 +74,9 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class); this.policyFactory = modelFactories.getFactory(PolicyFactory.class); this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - + this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); - this.extensionAttributeProcessor = extensionAttributeProcessor; + this.extensionAttributeProcessor = extensionAttributeProcessor; this.monitor = monitor; } @@ -95,10 +95,10 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C bindingType.setName(getArtifactType()); bindingType.setUnresolved(true); ((PolicySetAttachPoint)scaBinding).setType(bindingType); - + // Read policies policyProcessor.readPolicies(scaBinding, reader); - + // Read binding name String name = reader.getAttributeValue(null, NAME); if (name != null) { @@ -110,12 +110,12 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C if (uri != null) { scaBinding.setURI(uri); } - + // Handle extended attributes for (int a = 0; a < reader.getAttributeCount(); a++) { QName attributeName = reader.getAttributeName(a); if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) { - if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && + if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) { Object attributeValue = extensionAttributeProcessor.read(attributeName, reader); Extension attributeExtension; @@ -127,7 +127,7 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C scaBinding.getAttributeExtensions().add(attributeExtension); } } - } + } // Skip to end element while (reader.hasNext()) { @@ -137,15 +137,14 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C } return scaBinding; } - + public void resolve(SCABinding model, ModelResolver resolver) throws ContributionResolveException { policyProcessor.resolvePolicies(model, resolver); - } + } public void write(SCABinding scaBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { // Write <binding.sca> - policyProcessor.writePolicyPrefixes(scaBinding, writer); writer.writeStartElement(Constants.SCA10_NS, BINDING_SCA); policyProcessor.writePolicyAttributes(scaBinding, writer); @@ -153,20 +152,20 @@ public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, C if (scaBinding.getName() != null) { writer.writeAttribute(NAME, scaBinding.getName()); } - + // Write binding URI if (scaBinding.getURI() != null) { writer.writeAttribute(URI, scaBinding.getURI()); } - + // Write extended attributes for(Extension extension : scaBinding.getAttributeExtensions()) { if(extension.isAttribute()) { extensionAttributeProcessor.write(extension, writer); } - } - + } + writer.writeEndElement(); } - + } |