diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-20 16:00:09 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-20 16:00:09 +0000 |
commit | 1006c4802c6dadbcc4ffc874044b8a8e7bf0ec2e (patch) | |
tree | 00bbb2cbf0874616964efa45d0a848696bbd61a6 /sca-java-2.x/trunk/modules/interface-wsdl | |
parent | 57169b6adb015ac0e78eabec1219ec24f62c614d (diff) |
TUSCANY-3426 read/write/resolve requires and policySets attributes that appear in interface.java and interface.wsdl elements.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@901251 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
3 files changed, 21 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/interface-wsdl/META-INF/MANIFEST.MF index bd2392b1d4..75ad6812be 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/META-INF/MANIFEST.MF +++ b/sca-java-2.x/trunk/modules/interface-wsdl/META-INF/MANIFEST.MF @@ -21,6 +21,7 @@ Import-Package: javax.wsdl, javax.xml.namespace,
javax.xml.stream,
org.apache.tuscany.sca.assembly;version="2.0.0",
+ org.apache.tuscany.sca.assembly.xml;version="2.0.0",
org.apache.tuscany.sca.common.java.io;version="2.0.0",
org.apache.tuscany.sca.common.xml;version="2.0.0",
org.apache.tuscany.sca.common.xml.stax;version="2.0.0",
diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java index 8c4a986525..f1dd8bfdda 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java @@ -27,6 +27,7 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.xml.PolicySubjectProcessor; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; @@ -38,6 +39,7 @@ import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; @@ -46,6 +48,7 @@ import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject; 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.policy.PolicyFactory; /** * Handles a <interface.wsdl ... /> element in a SCDL file @@ -54,8 +57,9 @@ import org.apache.tuscany.sca.monitor.Problem.Severity; public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfaceContract>, WSDLConstants { private WSDLFactory wsdlFactory; - private InterfaceContractMapper interfaceContractMapper; + private PolicyFactory policyFactory; + private PolicySubjectProcessor policyProcessor; public WSDLInterfaceProcessor(ExtensionPointRegistry registry) { FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class); @@ -63,6 +67,9 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(InterfaceContractMapper.class); this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class); + + this.policyFactory = modelFactories.getFactory(PolicyFactory.class); + this.policyProcessor = new PolicySubjectProcessor(policyFactory); } /** * Report a warning. @@ -195,6 +202,9 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa ((WSDLInterface)wsdlInterfaceContract.getInterface()).getName().toString(), remotable); } + + // Read intents and policy sets + policyProcessor.readPolicies(wsdlInterfaceContract.getInterface(), reader); // Skip to end element while (reader.hasNext()) { @@ -229,6 +239,8 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsdlInterfaceContract.getLocation()); } + policyProcessor.writePolicyAttributes(wsdlInterface, writer); + writer.writeEndElement(); } @@ -259,9 +271,12 @@ public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfa // WSDLInterface to the resolver try { wsdlDefinition.setDefinition(portType.getDefinition()); - wsdlInterface = wsdlFactory.createWSDLInterface(portType.getElement(), wsdlDefinition, resolver, monitor); - wsdlInterface.setWsdlDefinition(wsdlDefinition); - resolver.addModel(wsdlInterface, context); + WSDLInterface newWSDLInterface = wsdlFactory.createWSDLInterface(portType.getElement(), wsdlDefinition, resolver, monitor); + newWSDLInterface.setWsdlDefinition(wsdlDefinition); + newWSDLInterface.getRequiredIntents().addAll(wsdlInterface.getRequiredIntents()); + newWSDLInterface.getPolicySets().addAll(wsdlInterface.getPolicySets()); + resolver.addModel(newWSDLInterface, context); + wsdlInterface = newWSDLInterface; } catch (InvalidInterfaceException e) { ContributionResolveException ce = new ContributionResolveException("Invalid interface when resolving " + portType.toString(), e); diff --git a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite index a71e0a55f8..9d714e8169 100644 --- a/sca-java-2.x/trunk/modules/interface-wsdl/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite +++ b/sca-java-2.x/trunk/modules/interface-wsdl/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite @@ -25,7 +25,7 @@ <service name="CalculatorService" promote="CalculatorServiceComponent"> <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)" - wsdli:wsdlLocation="http://tempuri.org"/> + wsdli:wsdlLocation="http://tempuri.org" requires="calc:intent1" policySets="calc:policySet1"/> </service> <component name="CalculatorServiceComponent"> |