diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-17 12:51:22 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-17 12:51:22 +0000 |
commit | a206102be754cca89c3aa8b386f635521aa56bde (patch) | |
tree | 20f11f9fbe63dfd70d526d66d98ab3b1f7979e32 /sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca | |
parent | 5dd0b6ca59173e1011eed91af21df729be1081df (diff) |
TUSCANY-3958 - serialize endpoint intents/policy sets across the registry for matching purposes. In this change they are stashed in the component element on write and then retrieved back into the endpoint model on read.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1185135 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca')
-rw-r--r-- | sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java index 9f323a5507..153734ddc5 100644 --- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java +++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java @@ -19,6 +19,9 @@ package org.apache.tuscany.sca.assembly.xml; +import java.util.ArrayList; +import java.util.List; + import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; @@ -41,6 +44,7 @@ import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor; 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.policy.PolicySet; /** * @@ -87,6 +91,10 @@ public class EndpointProcessor extends BaseAssemblyProcessor implements StAXArti endpoint.setComponent(component); endpoint.setService(service); endpoint.setBinding(binding); + + // retrieve the stash of intents and policy sets from the component + endpoint.getRequiredIntents().addAll(component.getRequiredIntents()); + endpoint.getPolicySets().addAll(component.getPolicySets()); } return endpoint; } @@ -108,6 +116,14 @@ public class EndpointProcessor extends BaseAssemblyProcessor implements StAXArti composite.getComponents().add(component); component.getReferences().clear(); component.getServices().clear(); + + // stash endpoint intents and policy sets on the component so that they are all + // in one place + component.getRequiredIntents().clear(); + component.getRequiredIntents().addAll(endpoint.getRequiredIntents()); + component.getPolicySets().clear(); + component.getPolicySets().addAll(endpoint.getPolicySets()); + if (endpoint.getService() != null) { ComponentService service = (ComponentService)endpoint.getService().clone(); component.getServices().add(service); @@ -143,5 +159,11 @@ public class EndpointProcessor extends BaseAssemblyProcessor implements StAXArti } public void resolve(Endpoint model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException { + // the only thing we'll resolve here is the policy model as the endpoint + // matching algorithm needs to look inside the policy model + + for (PolicySet policySet : model.getPolicySets()){ + extensionProcessor.resolve(policySet, resolver, context); + } } } |