You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2008/12/09 16:31:43 UTC

svn commit: r724758 - /geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java

Author: vamsic007
Date: Tue Dec  9 07:31:43 2008
New Revision: 724758

URL: http://svn.apache.org/viewvc?rev=724758&view=rev
Log:
Support componentType side file for web apps.

Modified:
    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/TuscanyModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java?rev=724758&r1=724757&r2=724758&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 Tue Dec  9 07:31:43 2008
@@ -135,21 +135,34 @@
         data.setReferencePattern("Repository", new AbstractNameQuery(Repository.class.getName()));
 
         // FIXME: Eliminate this hack.
-        // HACK: Create a JAR file with the web.composite file and place it as META-INF/application-composite.jar
-        // to deploy to the SCA domain
+        // HACK: Create a JAR file with web.composite and web.componentType files
+        // place it as META-INF/application-composite.jar to deploy to the SCA domain
         File webCompositeFile = new File(earContext.getBaseDir(), "WEB-INF/web.composite");
+        File webComponentTypeFile = new File(earContext.getBaseDir(), "WEB-INF/web.componentType");
         File appCompositeJarFile = new File(earContext.getBaseDir(), "META-INF/application-composite.jar");
         JarOutputStream jarOut = null;
         FileInputStream fin = null;
         try {
-            fin = new FileInputStream(webCompositeFile);
             jarOut = new JarOutputStream(new FileOutputStream(appCompositeJarFile));
-            jarOut.putNextEntry(new ZipEntry("web.composite"));
-            int b;
-            while((b = fin.read()) != -1) {
-                jarOut.write(b);
+            if(webCompositeFile.exists()) {
+                fin = new FileInputStream(webCompositeFile);
+                jarOut.putNextEntry(new ZipEntry("web.composite"));
+                int b;
+                while((b = fin.read()) != -1) {
+                    jarOut.write(b);
+                }
+                jarOut.closeEntry();
+                IOUtil.close(fin);
+            }
+            if(webComponentTypeFile.exists()) {
+                fin = new FileInputStream(webComponentTypeFile);
+                jarOut.putNextEntry(new ZipEntry("web.componentType"));
+                int b;
+                while((b = fin.read()) != -1) {
+                    jarOut.write(b);
+                }
+                jarOut.closeEntry();
             }
-            jarOut.closeEntry();
         } catch (Exception e) {
             throw new DeploymentException(e);
         } finally {