summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-04-22 13:48:18 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-04-22 13:48:18 +0000
commit27bfc6f1e7b6353157e6a2390b8ee77ceb75f9da (patch)
tree1ff3416e330402b40cde2aec99fc316d7e1bdab3
parent4dc93e96be8c9f825795485fb8bd1903131530bd (diff)
Update to introspect external ear archives
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@767522 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.java27
1 files changed, 23 insertions, 4 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 9f133a5a13..e8be60f671 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
@@ -20,6 +20,7 @@ package org.apache.tuscany.sca.implementation.jee.xml;
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import java.io.File;
import java.net.URI;
import javax.xml.namespace.QName;
@@ -32,19 +33,21 @@ import org.apache.tuscany.sca.assembly.ComponentType;
import org.apache.tuscany.sca.assembly.xml.Constants;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
+import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
import org.apache.tuscany.sca.contribution.jee.JavaEEExtension;
+import org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector;
import org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension;
import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
import org.apache.tuscany.sca.contribution.jee.impl.EjbModuleInfoImpl;
-import org.apache.tuscany.sca.contribution.jee.impl.WebModuleInfoImpl;
import org.apache.tuscany.sca.contribution.jee.impl.JavaEEApplicationInfoImpl;
+import org.apache.tuscany.sca.contribution.jee.impl.WebModuleInfoImpl;
import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.implementation.jee.JEEImplementation;
import org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -57,13 +60,17 @@ import org.apache.tuscany.sca.monitor.Monitor;
public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JEEImplementation> {
private static final QName IMPLEMENTATION_JEE = new QName(Constants.SCA10_NS, "implementation.jee");
+ private ExtensionPointRegistry extensionPoints;
private AssemblyFactory assemblyFactory;
private JEEImplementationFactory implementationFactory;
private JavaEEExtension jeeExtension;
private JavaEEOptionalExtension jeeOptionalExtension;
private Monitor monitor;
+
- public JEEImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
+ public JEEImplementationProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
+ this.extensionPoints = extensionPoints;
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
this.implementationFactory = modelFactories.getFactory(JEEImplementationFactory.class);
this.jeeExtension = modelFactories.getFactory(JavaEEExtension.class);
@@ -110,6 +117,7 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
// Resolve the component type
String uri = implementation.getURI();
String archive = implementation.getArchive();
+ boolean unresolvedEar = false;;
if (uri != null) {
Object moduleInfo = null;
if(uri.equals("")) {
@@ -150,7 +158,8 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
} else if(uri.endsWith(".ear")) {
JavaEEApplicationInfo appInfo = new JavaEEApplicationInfoImpl();
appInfo.setUri(URI.create(archive));
- appInfo = resolver.resolveModel(JavaEEApplicationInfo.class, appInfo);
+ JavaEEApplicationInfo resolved = resolver.resolveModel(JavaEEApplicationInfo.class, appInfo);
+ unresolvedEar = resolved == appInfo;
moduleInfo = appInfo;
}
@@ -174,6 +183,16 @@ public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implem
}
// TODO: check for ejb-jar composite
} else if(moduleInfo instanceof JavaEEApplicationInfo) {
+ if (unresolvedEar) {
+ JavaEEIntrospector jeeIntrospector = extensionPoints.getExtensionPoint(JavaEEIntrospector.class);
+ try {
+ File f = new File(((JavaEEApplicationInfo)moduleInfo).getUri().toString());
+ moduleInfo = jeeIntrospector.introspectJeeArchive(f.toURI().toURL());
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+ }
+
if(jeeExtension != null) {
ComponentType ct = jeeExtension.createImplementationJeeComponentType((JavaEEApplicationInfo)moduleInfo);
implementation.getServices().addAll(ct.getServices());