diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-21 12:16:20 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-21 12:16:20 +0000 |
commit | e91618601f3fb9a52e2e264825410b62268eb6d7 (patch) | |
tree | b3ddbe2d83cf731b2080b0bbcce9333552428934 /branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache | |
parent | f265fa28ac8115c5ae664a62a0c8f110343d955f (diff) |
TUSCANY-3347 make the name of the implementation.jee composite unique
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@827983 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache')
-rw-r--r-- | branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java | 21 |
1 files changed, 19 insertions, 2 deletions
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 9059d2da26..83b56cf990 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 @@ -106,8 +106,6 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem JEEImplementation implementation = implementationFactory.createJEEImplementation(); implementation.setUnresolved(true); - implementation.setName(IMPLEMENTATION_JEE); - // Read the archive attribute String archive = getString(reader, "archive"); if (archive != null) { @@ -116,6 +114,25 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem // Set the URI of the component type implementation.setURI(archive); } + + // the resulting implementation (composite) will be cached by the CompositeModelResolver + // based on it's name so we need to derive a unique name for this implementation based + // on the name of the archive that it represents + String path = URI.create(archive).getPath(); + String localName = "impl-jee-current-dir-archive"; + if (path != null){ + int s = path.lastIndexOf('/'); + if (s > -1){ + localName = path.substring(s + 1); + } else { + if (path.length() > 0 && !path.equals(".")){ + localName = path; + } + } + } + + QName name = new QName(Constants.SCA10_TUSCANY_NS, localName); + implementation.setName(name); // Read policies policyProcessor.readPolicies(implementation, reader); |