You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2009/02/13 15:53:42 UTC

svn commit: r744134 - /servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java

Author: gnodet
Date: Fri Feb 13 14:53:41 2009
New Revision: 744134

URL: http://svn.apache.org/viewvc?rev=744134&view=rev
Log:
SMX4NMR-85: Improve JBI->OSGi transformation speed

Modified:
    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java

Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java?rev=744134&r1=744133&r2=744134&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java Fri Feb 13 14:53:41 2009
@@ -20,6 +20,8 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.InputStream;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarInputStream;
@@ -85,13 +87,18 @@
         m.getMainAttributes().putValue("Bundle-Version", version);
         m.getMainAttributes().putValue("DynamicImport-Package", "javax.*,org.xml.*,org.w3c.*");
 
-		JarInputStream jis = new JarInputStream(new FileInputStream(jbiArtifact));
-		JarOutputStream jos = new JarOutputStream(new FileOutputStream(osgiBundle), m);
+		JarInputStream jis = new JarInputStream(new BufferedInputStream(new FileInputStream(jbiArtifact)));
+		JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(osgiBundle)), m);
+        jos.setMethod(JarOutputStream.STORED);
 
 		JarEntry entry = jis.getNextJarEntry();
 		while (entry != null) {
             if (!"META-INF/MANIFEST.MF".equals(entry.getName())) {
-                jos.putNextEntry(entry);
+                JarEntry newEntry = new JarEntry(entry.getName());
+                newEntry.setSize(entry.getSize());
+                newEntry.setCompressedSize(entry.getSize());
+                newEntry.setCrc(entry.getCrc());
+                jos.putNextEntry(newEntry);
                 FileUtil.copyInputStream(jis, jos);
                 jos.closeEntry();
             }