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
This commit is contained in:
parent
f265fa28ac
commit
e91618601f
3 changed files with 21 additions and 4 deletions
|
@ -29,7 +29,7 @@
|
|||
</component>
|
||||
|
||||
<component name="HelloworldServiceComponent">
|
||||
<implementation.jee archive="itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear"/>
|
||||
<implementation.jee archive="./itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear"/>
|
||||
<reference name="JavaReference" target="HelloworldTargetComponent"/>
|
||||
</component>
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class TestExternalEarModelResolver implements ModelResolver {
|
|||
URL earLocation = null;
|
||||
if ( uri.toString().equals("itest-contribution-jee-samples-13-ear-nonenhanced.ear")){
|
||||
earLocation = new File("../contribution-jee-samples/ear-nonenhanced/target/itest-contribution-jee-samples-13-ear-nonenhanced.ear").toURL();
|
||||
} else if ( uri.toString().equals("itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear")){
|
||||
} else if ( uri.toString().equals("./itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear")){
|
||||
earLocation = new File("../contribution-jee-samples/ear-appcomp-contrib-implicit/target/itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear").toURL();
|
||||
} else if ( uri.toString().equals("itest-contribution-jee-samples-30-ear-appcomp-contrib-implicit-war-appcomp.ear")){
|
||||
earLocation = new File("../contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/target/itest-contribution-jee-samples-30-ear-appcomp-contrib-implicit-war-appcomp.ear").toURL();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue