summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5.1/modules/workspace-impl/src/main
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-07-26 20:36:02 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-07-26 20:36:02 +0000
commit3ab88505030fccad43563207ae97226f652ce206 (patch)
treec59a07369fd597e34537aac59421726e84375fc4 /branches/sca-java-1.5.1/modules/workspace-impl/src/main
parent9c0d7eda738c8523490cfe3d0d5f94078d1f6613 (diff)
Fix TUSCANY-3171 (domain manager does not load definitions.xml files)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@797987 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java59
1 files changed, 58 insertions, 1 deletions
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
index f81b386420..4aa619aa3f 100644
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
+++ b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
@@ -50,9 +50,13 @@ import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.workspace.scanner.impl.DirectoryContributionScanner;
import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner;
@@ -71,6 +75,8 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
private StAXArtifactProcessor<Object> extensionProcessor;
private UtilityExtensionPoint utilities;
private Monitor monitor = null;
+ private ModelResolver policyDefinitionsResolver = null;
+ private List<SCADefinitions> policyDefinitions = null;
public ContributionContentProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
this.extensionPoints = extensionPoints;
@@ -89,6 +95,13 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
}
+ public ContributionContentProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor,
+ ModelResolver policyDefinitionsResolver, List<SCADefinitions> policyDefinitions) {
+ this(extensionPoints, monitor);
+ this.policyDefinitionsResolver = policyDefinitionsResolver;
+ this.policyDefinitions = policyDefinitions;
+ }
+
/*
public ContributionContentProcessor(ModelFactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers,
URLArtifactProcessor<Object> artifactProcessor, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
@@ -116,7 +129,12 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
Contribution contribution = contributionFactory.createContribution();
contribution.setURI(contributionURI.toString());
contribution.setLocation(contributionURL.toString());
- ModelResolver modelResolver = new ExtensibleModelResolver(contribution, extensionPoints);
+ ModelResolver modelResolver;
+ if (policyDefinitionsResolver != null) {
+ modelResolver = new ExtensibleModelResolver(contribution, extensionPoints, modelResolvers, modelFactories, policyDefinitionsResolver);
+ } else {
+ modelResolver = new ExtensibleModelResolver(contribution, extensionPoints);
+ }
contribution.setModelResolver(modelResolver);
contribution.setUnresolved(true);
@@ -150,6 +168,11 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
// Add the loaded model to the model resolver
modelResolver.addModel(model);
+ // Add policy definitions to the list of policy definitions
+ if (policyDefinitionsResolver != null) {
+ addPolicyDefinitions(model);
+ }
+
// Merge contribution metadata into the contribution model
if (model instanceof ContributionMetadata) {
contributionMetadata = true;
@@ -245,4 +268,38 @@ public class ContributionContentProcessor implements URLArtifactProcessor<Contri
}
}
}
+
+ /**
+ * The following code was copied from ContributionServiceImpl to fix TUSCANY-3171
+ *
+ * @param model
+ */
+ private void addPolicyDefinitions(Object model) {
+
+ // Add policy definitions to the list of policy definitions
+ if (model instanceof SCADefinitions) {
+ policyDefinitions.add((SCADefinitions)model);
+
+ SCADefinitions definitions = (SCADefinitions)model;
+ for (Intent intent : definitions.getPolicyIntents() ) {
+ policyDefinitionsResolver.addModel(intent);
+ }
+
+ for (PolicySet policySet : definitions.getPolicySets() ) {
+ policyDefinitionsResolver.addModel(policySet);
+ }
+
+ for (IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
+ policyDefinitionsResolver.addModel(attachPointType);
+ }
+
+ for (IntentAttachPointType attachPointType : definitions.getImplementationTypes() ) {
+ policyDefinitionsResolver.addModel(attachPointType);
+ }
+ for (Object binding : definitions.getBindings() ) {
+ policyDefinitionsResolver.addModel(binding);
+ }
+ }
+ }
+
}