geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r823070 - in /geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany: EmbeddedRuntimeGBean.java TuscanyModuleBuilderExtension.java
Date Thu, 08 Oct 2009 06:55:58 GMT
Author: vamsic007
Date: Thu Oct  8 06:55:58 2009
New Revision: 823070

URL: http://svn.apache.org/viewvc?rev=823070&view=rev
Log:
Eliminate the use of temporary jar with SCA artifacts to compute the model from WAR and EJB
JARs during deployment.

Modified:
    geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java
    geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java

Modified: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java?rev=823070&r1=823069&r2=823070&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java
(original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java
Thu Oct  8 06:55:58 2009
@@ -86,7 +86,8 @@
         ModelResolverImpl modelResolver = new ModelResolverImpl(classLoader);
         
         // Add contribution
-        contribution = eScaDomain.getContributionService().contribute(contributionRoot, new
URL(contributionRoot), modelResolver, false);
+        //contribution = eScaDomain.getContributionService().contribute(contributionRoot,
new URL(contributionRoot), modelResolver, false);
+        contribution = eScaDomain.getContributionService().contribute(contributionRoot, new
URL(contributionRoot), false);
 
         // Collect the composites
         List<Composite> composites = new ArrayList<Composite>();

Modified: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java?rev=823070&r1=823069&r2=823070&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
(original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
Thu Oct  8 06:55:58 2009
@@ -20,6 +20,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.net.URL;
@@ -243,7 +244,17 @@
             IOUtil.close(jarOut);
         }
         
-        data.setAttribute("jarFileName", "META-INF/"+(module.isStandAlone() ? "" : module.getName()+"/")+"application-composite.jar");
+        //data.setAttribute("jarFileName", "META-INF/"+(module.isStandAlone() ? "" : module.getName()+"/")+"application-composite.jar");
+        // Copy the module file to META-INF
+        File tempModuleFile = new File(module.getModuleFile().getName());
+        File tempModuleFileSave = new File(earContext.getBaseDir(), "META-INF/"+tempModuleFile.getName());
+        try {
+            IOUtil.copyFile(tempModuleFile, tempModuleFileSave);
+        } catch (IOException e) {
+            throw new DeploymentException(e);
+        }
+        data.setAttribute("jarFileName", "META-INF/"+tempModuleFile.getName());
+        
         try {
             earContext.addGBean(data);
         } catch (GBeanAlreadyExistsException e) {
@@ -267,7 +278,17 @@
         String thisComponentName = null;
         ModelResolverImpl modelResolver = new ModelResolverImpl(cl);
         try {
-            Contribution contribution = getEmbeddedSCADomain().getContributionService().contribute(appCompositeJarFile.toURL().toString(),
appCompositeJarFile.toURL(), modelResolver, false);
+            Contribution contribution = null;
+            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(cl);
+                //Contribution contribution = getEmbeddedSCADomain().getContributionService().contribute(appCompositeJarFile.toURL().toString(),
appCompositeJarFile.toURL(), modelResolver, false);
+                contribution = getEmbeddedSCADomain().getContributionService().contribute(tempModuleFileSave.toURL().toString(),
tempModuleFileSave.toURL(), false);
+            } catch(Throwable t) {
+                t.printStackTrace();
+            } finally {
+                Thread.currentThread().setContextClassLoader(oldCl);
+            }
             for(Artifact artifact : contribution.getArtifacts()) {
                 if(thisComponentName != null) {
                     break;
@@ -465,7 +486,9 @@
             IOUtil.close(jarOut);
         }
         
-        data.setAttribute("jarFileName", "META-INF/"+(module.isStandAlone() ? "" : module.getName()+"/")+"application-composite.jar");
+        // Do not use the hack.  Point to ejb.jar file.
+        //data.setAttribute("jarFileName", "META-INF/"+(module.isStandAlone() ? "" : module.getName()+"/")+"application-composite.jar");
+        data.setAttribute("jarFileName", "ejb.jar");
         try {
             earContext.addGBean(data);
         } catch (GBeanAlreadyExistsException e) {
@@ -475,8 +498,19 @@
         // Find the various components
         Map<String, String> ejb2component = new HashMap<String, String>();
         ModelResolverImpl modelResolver = new ModelResolverImpl(cl);
+        appCompositeJarFile = ejbJarFile;
         try {
-            Contribution contribution = getEmbeddedSCADomain().getContributionService().contribute(appCompositeJarFile.toURL().toString(),
appCompositeJarFile.toURL(), modelResolver, false);
+            Contribution contribution = null;
+            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(cl);
+                //contribution = getEmbeddedSCADomain().getContributionService().contribute(appCompositeJarFile.toURL().toString(),
appCompositeJarFile.toURL(), modelResolver, false);
+                contribution = getEmbeddedSCADomain().getContributionService().contribute(appCompositeJarFile.toURL().toString(),
appCompositeJarFile.toURL(), false);
+            } catch(Throwable t) {
+                t.printStackTrace();
+            } finally {
+                Thread.currentThread().setContextClassLoader(oldCl);
+            }
             for(Artifact artifact : contribution.getArtifacts()) {
                 if (artifact.getModel() instanceof Composite) {
                     for(Component component : ((Composite)artifact.getModel()).getComponents())
{



Mime
View raw message