diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-20 18:10:27 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-20 18:10:27 +0000 |
commit | d3903111ad61b5621f76bf573484c16f20231df0 (patch) | |
tree | e2008c41c136f317a45b156bec602793c2e6aa42 /java/sca/modules/assembly-xml | |
parent | d32433ef7a2b34bd30285f45724cdd158d596029 (diff) |
Add promoted components to CompositeReference model
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@756696 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly-xml')
-rw-r--r-- | java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index 0a7df27b1f..7a2eba494f 100644 --- a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -297,10 +297,20 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt String promote = reader.getAttributeValue(null, Constants.PROMOTE); if (promote != null) { for (StringTokenizer tokens = new StringTokenizer(promote); tokens.hasMoreTokens();) { + String refName = tokens.nextToken(); + Component promotedComponent = assemblyFactory.createComponent(); + int index = refName.indexOf('/'); + if (index == -1) { + error("Invalid reference name", compositeReference, refName); + } + String promotedComponentName = refName.substring(0, index); + promotedComponent.setName(promotedComponentName); + promotedComponent.setUnresolved(true); + compositeReference.getPromotedComponents().add(promotedComponent); ComponentReference promotedReference = assemblyFactory.createComponentReference(); promotedReference.setUnresolved(true); - promotedReference.setName(tokens.nextToken()); + promotedReference.setName(refName); compositeReference.getPromotedReferences().add(promotedReference); } } |