summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/interface-wsdl-xml
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-01-29 01:05:27 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-01-29 01:05:27 +0000
commitb76ea9bf0a7983a05c25efa4b24c3911f132aca4 (patch)
tree114384d2760cf01a8ab9bd733960d228e8820c03 /branches/sca-java-1.x/modules/interface-wsdl-xml
parent52cae7f873d9c547d756d8c2da11e6bcd0e9aba0 (diff)
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
Diffstat (limited to 'branches/sca-java-1.x/modules/interface-wsdl-xml')
-rw-r--r--branches/sca-java-1.x/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java37
1 files changed, 36 insertions, 1 deletions
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<WSDLInterfaceContract>, WSDLConstants {
private WSDLFactory wsdlFactory;
+ private ExtensionFactory extensionFactory;
+ private StAXAttributeProcessor<Object> 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<WSDLInterfa
if (wsdlCallbackInterface != null)
wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
}
+
+ // 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()) &&
+ (! 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<WSDLInterfa
writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsdlInterfaceContract.getLocation());
}
+ // Write extended attributes
+ for(Extension extension : wsdlInterfaceContract.getAttributeExtensions()) {
+ if(extension.isAttribute()) {
+ extensionAttributeProcessor.write(extension, writer);
+ }
+ }
+
writer.writeEndElement();
}