diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-21 14:59:30 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-05-21 14:59:30 +0000 |
commit | 56dd4b8312aa2a708f0d9b3609094515e511bc02 (patch) | |
tree | 7e431117f69484425bc83af4e2abe630e8893a84 /branches | |
parent | f254177a44d527690a901fe865b0561cc27b5f7f (diff) |
TUSCANY-3041- policySets & intents not resolved on implementation.jee, applied patch from vamsi
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@777142 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
5 files changed, 22 insertions, 5 deletions
diff --git a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java index 1a63f52d3e..4d16dbf35d 100644 --- a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java +++ b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java @@ -27,7 +27,7 @@ import org.apache.tuscany.sca.implementation.jee.JEEImplementation; * * @version $Rev$ $Date$ */ -class JEEImplementationImpl extends ImplementationImpl implements JEEImplementation { +public class JEEImplementationImpl extends ImplementationImpl implements JEEImplementation { private String archive; diff --git a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java index 99616318ea..072394df75 100644 --- a/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java +++ b/branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java @@ -31,6 +31,7 @@ import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.ComponentType; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.xml.Constants; +import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.jee.ModelObject; import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo; @@ -52,6 +53,7 @@ import org.apache.tuscany.sca.contribution.service.ContributionWriteException; import org.apache.tuscany.sca.implementation.jee.JEEImplementation; import org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory; import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.policy.PolicyFactory; /** * Implements a StAX artifact processor for JEE implementations. @@ -62,17 +64,21 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem private static final QName IMPLEMENTATION_JEE = new QName(Constants.SCA10_NS, "implementation.jee"); private AssemblyFactory assemblyFactory; + private PolicyFactory policyFactory; private JEEImplementationFactory implementationFactory; private JavaEEExtension jeeExtension; private JavaEEOptionalExtension jeeOptionalExtension; private Monitor monitor; + private PolicyAttachPointProcessor policyProcessor; public JEEImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + this.policyFactory = modelFactories.getFactory(PolicyFactory.class); this.implementationFactory = modelFactories.getFactory(JEEImplementationFactory.class); this.jeeExtension = modelFactories.getFactory(JavaEEExtension.class); this.jeeOptionalExtension = modelFactories.getFactory(JavaEEOptionalExtension.class); this.monitor = monitor; + this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); } public QName getArtifactType() { @@ -100,6 +106,9 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem implementation.setURI(archive); } + // Read policies + policyProcessor.readPolicies(implementation, reader); + // Skip to end element while (reader.hasNext()) { if (reader.next() == END_ELEMENT && IMPLEMENTATION_JEE.equals(reader.getName())) { @@ -266,9 +275,11 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem public void write(JEEImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { // Write <implementation.jee> + policyProcessor.writePolicyPrefixes(implementation, writer); writeStart(writer, IMPLEMENTATION_JEE.getNamespaceURI(), IMPLEMENTATION_JEE.getLocalPart(), new XAttr("archive", implementation.getArchive())); + policyProcessor.writePolicyAttributes(implementation, writer); writeEnd(writer); } } diff --git a/branches/sca-java-1.x/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/ReadTestCase.java b/branches/sca-java-1.x/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/ReadTestCase.java index 221d077a33..471ce480a0 100644 --- a/branches/sca-java-1.x/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/ReadTestCase.java +++ b/branches/sca-java-1.x/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/ReadTestCase.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.implementation.jee.xml; import java.io.InputStream; +import javax.xml.namespace.QName; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; @@ -38,9 +39,10 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.implementation.jee.JEEImplementation; +import org.apache.tuscany.sca.implementation.jee.impl.JEEImplementationImpl; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; +import org.apache.tuscany.sca.policy.PolicySet; /** * Test reading JEE implementations. @@ -76,8 +78,11 @@ public class ReadTestCase extends TestCase { assertNotNull(composite); compositeBuilder.build(composite); + JEEImplementationImpl implementation = (JEEImplementationImpl) composite.getComponents().get(0).getImplementation(); - assertTrue(((JEEImplementation) composite.getComponents().get(0).getImplementation()).getArchive().equals("myarchive.ear")); + assertTrue(implementation.getArchive().equals("myarchive.ear")); + PolicySet policySet = implementation.getPolicySets().get(0); + assertEquals(new QName("http://sample/test-policy", "allowRole1"), policySet.getName()); } } diff --git a/branches/sca-java-1.x/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/WriteTestCase.java b/branches/sca-java-1.x/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/WriteTestCase.java index 78849cd22f..1ec1e928d2 100644 --- a/branches/sca-java-1.x/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/WriteTestCase.java +++ b/branches/sca-java-1.x/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/WriteTestCase.java @@ -62,7 +62,7 @@ public class WriteTestCase extends TestCase { staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos)); assertTrue(bos.toString().contains("archive=\"myarchive.ear\"")); - + assertTrue(bos.toString().contains("allowRole1")); } } diff --git a/branches/sca-java-1.x/modules/implementation-jee/src/test/resources/org/apache/tuscany/sca/implementation/jee/xml/TestJEE.composite b/branches/sca-java-1.x/modules/implementation-jee/src/test/resources/org/apache/tuscany/sca/implementation/jee/xml/TestJEE.composite index ac85b888c4..edd694a5e2 100644 --- a/branches/sca-java-1.x/modules/implementation-jee/src/test/resources/org/apache/tuscany/sca/implementation/jee/xml/TestJEE.composite +++ b/branches/sca-java-1.x/modules/implementation-jee/src/test/resources/org/apache/tuscany/sca/implementation/jee/xml/TestJEE.composite @@ -23,9 +23,10 @@ <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://sample/jee" xmlns:sc="http://sample/composite" + xmlns:test="http://sample/test-policy" name="TestJEE"> <component name="TestJEE"> - <implementation.jee archive="myarchive.ear"/> + <implementation.jee archive="myarchive.ear" policySets="test:allowRole1"/> </component> </composite> |