diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-15 17:57:26 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-15 17:57:26 +0000 |
commit | 56ae68a329e4333c753e4cb5df7cd49e550ddc43 (patch) | |
tree | 78b06364b4578d4a2cf7c5787b58f9e992a59ee8 /branches/sca-java-1.3.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java | |
parent | db0b393ee18e88e7f4b97d901828afdd7669a551 (diff) |
TUSCANY-2463 - Merging attribute extension support from trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@695565 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.3.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java')
-rw-r--r-- | branches/sca-java-1.3.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/branches/sca-java-1.3.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/branches/sca-java-1.3.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java index ae33a4da16..06b208540a 100644 --- a/branches/sca-java-1.3.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java +++ b/branches/sca-java-1.3.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java @@ -49,6 +49,7 @@ import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.ConfiguredOperation; import org.apache.tuscany.sca.assembly.ConstrainingType; import org.apache.tuscany.sca.assembly.Contract; +import org.apache.tuscany.sca.assembly.Extensible; import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.assembly.OperationsConfigurator; @@ -58,9 +59,11 @@ import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; import org.apache.tuscany.sca.contribution.ContributionFactory; 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; 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.interfacedef.InterfaceContract; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.Problem; @@ -832,6 +835,45 @@ abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implement } } + /** + * + * @param reader + * @param elementName + * @param estensibleElement + * @param extensionAttributeProcessor + * @throws ContributionReadException + * @throws XMLStreamException + */ + protected void readExtendedAttributes(XMLStreamReader reader, QName elementName, Extensible estensibleElement, StAXAttributeProcessor extensionAttributeProcessor) throws ContributionReadException, XMLStreamException { + for (int a = 0; a < reader.getAttributeCount(); a++) { + QName attributeName = reader.getAttributeName(a); + if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) { + if( ! elementName.getNamespaceURI().equals(attributeName.getNamespaceURI()) ) { + String attributeExtension = (String) extensionAttributeProcessor.read(attributeName, reader); + estensibleElement.getExtensions().add(attributeExtension); + } + } + } + } + + + /** + * + * @param attributeModel + * @param writer + * @param extensibleElement + * @param extensionAttributeProcessor + * @throws ContributionWriteException + * @throws XMLStreamException + */ + protected void writeExtendedAttributes(XMLStreamWriter writer, Extensible extensibleElement, StAXAttributeProcessor extensionAttributeProcessor) throws ContributionWriteException, XMLStreamException { + for(Object o : extensibleElement.getExtensions()) { + //FIXME How to identify it's a extended attribute ? + if(o instanceof String) { + extensionAttributeProcessor.write(o, writer); + } + } + } /*protected void validatePolicySets(PolicySetAttachPoint policySetAttachPoint) throws ContributionResolveException { |