diff options
author | vamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68> | 2009-04-03 19:58:00 +0000 |
---|---|---|
committer | vamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68> | 2009-04-03 19:58:00 +0000 |
commit | 1b65e2849649af8daae15ef79595db99463ea51c (patch) | |
tree | b3f27dd33fd728b3da7df3569abf2b15bb24656b | |
parent | 03f9ba97daad54b9a31208134450573a9c0e59e4 (diff) |
TUSCANY-2956 Java EE Archive introspection
o implementation.jee to handle archive value ""
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@761772 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | branches/sca-java-1.x/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java | 62 |
1 files changed, 48 insertions, 14 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 d832f904d1..9f133a5a13 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 @@ -111,41 +111,75 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem String uri = implementation.getURI(); String archive = implementation.getArchive(); if (uri != null) { - if(uri.endsWith(".war")) { + Object moduleInfo = null; + if(uri.equals("")) { + if(moduleInfo == null) { + WebModuleInfo unresolved = new WebModuleInfoImpl(); + unresolved.setUri(URI.create(archive)); + WebModuleInfo resolved = resolver.resolveModel(WebModuleInfo.class, unresolved); + if(unresolved != resolved) { + moduleInfo = resolved; + } + } + if(moduleInfo == null) { + EjbModuleInfo unresolved = new EjbModuleInfoImpl(); + unresolved.setUri(URI.create(archive)); + EjbModuleInfo resolved = resolver.resolveModel(EjbModuleInfo.class, unresolved); + if(unresolved != resolved) { + moduleInfo = resolved; + } + } + if(moduleInfo == null) { + JavaEEApplicationInfo unresolved = new JavaEEApplicationInfoImpl(); + unresolved.setUri(URI.create(archive)); + JavaEEApplicationInfo resolved = resolver.resolveModel(JavaEEApplicationInfo.class, unresolved); + if(unresolved != resolved) { + moduleInfo = resolved; + } + } + } else if(uri.endsWith(".war")) { WebModuleInfo webModuleInfo = new WebModuleInfoImpl(); webModuleInfo.setUri(URI.create(archive)); webModuleInfo = resolver.resolveModel(WebModuleInfo.class, webModuleInfo); + moduleInfo = webModuleInfo; + } else if(uri.endsWith(".jar")) { + EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl(); + ejbModuleInfo.setUri(URI.create(archive)); + ejbModuleInfo = resolver.resolveModel(EjbModuleInfo.class, ejbModuleInfo); + moduleInfo = ejbModuleInfo; + } else if(uri.endsWith(".ear")) { + JavaEEApplicationInfo appInfo = new JavaEEApplicationInfoImpl(); + appInfo.setUri(URI.create(archive)); + appInfo = resolver.resolveModel(JavaEEApplicationInfo.class, appInfo); + moduleInfo = appInfo; + } + + if(moduleInfo instanceof WebModuleInfo) { if(jeeOptionalExtension != null) { - ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType(webModuleInfo); + ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType((WebModuleInfo)moduleInfo); implementation.getReferences().addAll(ct.getReferences()); implementation.getProperties().addAll(ct.getProperties()); } // TODO: check for web composite - } else if(uri.endsWith(".jar")) { - EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl(); - ejbModuleInfo.setUri(URI.create(archive)); - ejbModuleInfo = resolver.resolveModel(EjbModuleInfo.class, ejbModuleInfo); + } else if(moduleInfo instanceof EjbModuleInfo) { if(jeeExtension != null) { - ComponentType ct = jeeExtension.createImplementationJeeComponentType(ejbModuleInfo); + ComponentType ct = jeeExtension.createImplementationJeeComponentType((EjbModuleInfo)moduleInfo); implementation.getServices().addAll(ct.getServices()); } if(jeeOptionalExtension != null) { - ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType(ejbModuleInfo); + ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType((EjbModuleInfo)moduleInfo); implementation.getServices().addAll(ct.getServices()); implementation.getReferences().addAll(ct.getReferences()); implementation.getProperties().addAll(ct.getProperties()); } // TODO: check for ejb-jar composite - } else if(uri.endsWith(".ear")) { - JavaEEApplicationInfo appInfo = new JavaEEApplicationInfoImpl(); - appInfo.setUri(URI.create(archive)); - appInfo = resolver.resolveModel(JavaEEApplicationInfo.class, appInfo); + } else if(moduleInfo instanceof JavaEEApplicationInfo) { if(jeeExtension != null) { - ComponentType ct = jeeExtension.createImplementationJeeComponentType(appInfo); + ComponentType ct = jeeExtension.createImplementationJeeComponentType((JavaEEApplicationInfo)moduleInfo); implementation.getServices().addAll(ct.getServices()); } if(jeeOptionalExtension != null) { - ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType(appInfo); + ComponentType ct = jeeOptionalExtension.createImplementationJeeComponentType((JavaEEApplicationInfo)moduleInfo); implementation.getServices().addAll(ct.getServices()); implementation.getReferences().addAll(ct.getReferences()); implementation.getProperties().addAll(ct.getProperties()); |