From fe84c69d568e201386f3e8fbc78c0cb750a40f45 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 3 Sep 2008 16:54:38 +0000 Subject: Initial basic support for web.composite, see TUSCANY-2581 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@691684 13f79535-47bb-0310-9956-ffa450edef68 --- .../service/impl/ContributionServiceImpl.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'java/sca') diff --git a/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java b/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java index a91f620ad2..7b8b12ca9d 100644 --- a/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java +++ b/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java @@ -409,12 +409,48 @@ public class ContributionServiceImpl implements ContributionService { } } + processApplicationComposite(contribution); + // store the contribution on the registry this.contributionRepository.addContribution(contribution); return contribution; } + /** + * Process any application composite (eg see 5.1.3 of SCA JEE spec) + * TODO: see TUSCANY-2581 + */ + private void processApplicationComposite(Contribution contribution) { + + Composite composite = findComposite("web-inf/web.composite", contribution); + if (composite != null) { + if (!contribution.getDeployables().contains(composite)) { + contribution.getDeployables().add(createDeploymentComposite(composite)); + } + } + } + + /** + * Create a deployment composite for the composite + * See line 247 section 5.1.3 of SCA JEE spec + */ + private Composite createDeploymentComposite(Composite composite) { + // TODO: for now just use as-is + return composite; + } + + private Composite findComposite(String name, Contribution contribution) { + for (Artifact artifact : contribution.getArtifacts()) { + if (artifact.getModel() instanceof Composite) { + if (name.equalsIgnoreCase(artifact.getURI())) { + return (Composite)artifact.getModel(); + } + } + } + return null; + } + /** * This utility method process each artifact and delegates to proper * artifactProcessor to read the model and generate the in-memory representation -- cgit v1.2.3