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-java/src | |
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 'sca-java-2.x/trunk/modules/interface-java/src')
2 files changed, 18 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java b/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java index 5faa8dfa03..f3ced5c3e5 100644 --- a/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java +++ b/sca-java-2.x/trunk/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java @@ -32,6 +32,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; @@ -39,6 +40,7 @@ import org.apache.tuscany.sca.contribution.processor.ProcessorContext; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.resolver.ClassReference; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; @@ -47,6 +49,7 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; 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; import org.oasisopen.sca.annotation.AllowsPassByReference; import org.oasisopen.sca.annotation.Callback; import org.oasisopen.sca.annotation.ComponentName; @@ -68,10 +71,17 @@ import org.oasisopen.sca.annotation.Service; */ public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfaceContract>, JavaConstants { private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912"; - private JavaInterfaceFactory javaFactory; + private JavaInterfaceFactory javaFactory; + private ExtensionPointRegistry extensionPoints; + private PolicyFactory policyFactory; + private PolicySubjectProcessor policyProcessor; - public JavaInterfaceProcessor(FactoryExtensionPoint modelFactories) { + public JavaInterfaceProcessor(ExtensionPointRegistry extensionPoints) { + this.extensionPoints = extensionPoints; + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); + this.policyFactory = modelFactories.getFactory(PolicyFactory.class); + this.policyProcessor = new PolicySubjectProcessor(policyFactory); this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); } @@ -142,8 +152,10 @@ public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfa if (remotable != null) { javaInterfaceContract.getInterface().setRemotable(Boolean.parseBoolean(remotable)); } - + // Read intents and policy sets + policyProcessor.readPolicies(javaInterfaceContract.getInterface(), reader); + // Skip to end element while (reader.hasNext()) { if (reader.next() == END_ELEMENT && INTERFACE_JAVA_QNAME.equals(reader.getName())) { @@ -168,6 +180,8 @@ public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfa writer.writeAttribute(CALLBACK_INTERFACE, javaCallbackInterface.getName()); } + policyProcessor.writePolicyAttributes(javaInterface, writer); + writer.writeEndElement(); } diff --git a/sca-java-2.x/trunk/modules/interface-java/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite b/sca-java-2.x/trunk/modules/interface-java/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite index 927847c1c9..e5455dc970 100644 --- a/sca-java-2.x/trunk/modules/interface-java/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite +++ b/sca-java-2.x/trunk/modules/interface-java/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite @@ -23,7 +23,7 @@ name="Calculator"> <service name="CalculatorService" promote="CalculatorServiceComponent"> - <interface.java interface="calculator.CalculatorService"/> + <interface.java interface="calculator.CalculatorService" requires="calc:intent1" policySets="calc:policySet1" /> </service> <component name="CalculatorServiceComponent"> |