From b76ea9bf0a7983a05c25efa4b24c3911f132aca4 Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 29 Jan 2009 01:05:27 +0000 Subject: Adding support for extended attributes to wsdl interface git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@738692 13f79535-47bb-0310-9956-ffa450edef68 --- .../wsdl/xml/WSDLInterfaceProcessor.java | 37 +++++++++++++++++++++- .../interfacedef/wsdl/WSDLInterfaceContract.java | 3 +- .../wsdl/impl/WSDLInterfaceContractImpl.java | 17 ++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) (limited to 'branches') diff --git a/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java index be80606343..11cff6658f 100644 --- a/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java +++ b/branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java @@ -27,10 +27,13 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.Extension; +import org.apache.tuscany.sca.assembly.ExtensionFactory; import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; import org.apache.tuscany.sca.assembly.xml.Constants; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; 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; @@ -53,10 +56,17 @@ import org.apache.tuscany.sca.monitor.Problem.Severity; public class WSDLInterfaceProcessor implements StAXArtifactProcessor, WSDLConstants { private WSDLFactory wsdlFactory; + private ExtensionFactory extensionFactory; + private StAXAttributeProcessor extensionAttributeProcessor; private Monitor monitor; - public WSDLInterfaceProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { + public WSDLInterfaceProcessor(ModelFactoryExtensionPoint modelFactories, + StAXArtifactProcessor extensionProcessor, + StAXAttributeProcessor extensionAttributeProcessor, + Monitor monitor) { this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class); + this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class); + this.extensionAttributeProcessor = extensionAttributeProcessor; this.monitor = monitor; } @@ -151,6 +161,24 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor 0) { + if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) && + (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) { + Object attributeValue = extensionAttributeProcessor.read(attributeName, reader); + Extension attributeExtension; + if (attributeValue instanceof Extension) { + attributeExtension = (Extension) attributeValue; + } else { + attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true); + } + wsdlInterfaceContract.getAttributeExtensions().add(attributeExtension); + } + } + } // Skip to end element while (reader.hasNext()) { @@ -185,6 +213,13 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor extensions = new ArrayList(); + private List attributeExtensions = new ArrayList(); + protected WSDLInterfaceContractImpl() { } @@ -39,6 +46,16 @@ public class WSDLInterfaceContractImpl extends InterfaceContractImpl implements public void setLocation(String location) { this.location = location; } + + + public List getExtensions() { + return extensions; + } + + public List getAttributeExtensions() { + return attributeExtensions; + } + @Override public WSDLInterfaceContractImpl clone() throws CloneNotSupportedException { -- cgit v1.2.3