geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From de...@apache.org
Subject svn commit: r997666 - /geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
Date Thu, 16 Sep 2010 09:58:54 GMT
Author: delos
Date: Thu Sep 16 09:58:53 2010
New Revision: 997666

URL: http://svn.apache.org/viewvc?rev=997666&view=rev
Log:
GERONIMO-5568 it's problem of exporting plugin. Now, all deployed artifact has been in format
of car package, so update original code to read from a package instead of a directory

Modified:
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?rev=997666&r1=997665&r2=997666&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
Thu Sep 16 09:58:53 2010
@@ -24,12 +24,15 @@ import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.SortedSet;
+import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 import java.util.zip.ZipOutputStream;
 
 import javax.management.ObjectName;
@@ -276,21 +279,39 @@ public class RepositoryConfigurationStor
     }
 
     private void writeToZip(File dir, ZipOutputStream out, String prefix, byte[] buf) throws
IOException {
-        File[] all = dir.listFiles();
-        if (all.length == 0) {
-            // it is an empty directory
-            ZipEntry entry = new ZipEntry(prefix);
-            out.putNextEntry(entry);
-        }
-        for (File file : all) {
-            if (file.isDirectory()) {
-                writeToZip(file, out, prefix + file.getName() + "/", buf);
-            } else {
-                ZipEntry entry = new ZipEntry(prefix + file.getName());
-                out.putNextEntry(entry);
-                writeToZipStream(file, out, buf);
-            }
-        }
+    	if (dir.isDirectory()) {
+	        File[] all = dir.listFiles();
+	        if (all.length == 0) {
+	            // it is an empty directory
+	            ZipEntry entry = new ZipEntry(prefix);
+	            out.putNextEntry(entry);
+	        }
+	        for (File file : all) {
+	            if (file.isDirectory()) {
+	                writeToZip(file, out, prefix + file.getName() + "/", buf);
+	            } else {
+	                ZipEntry entry = new ZipEntry(prefix + file.getName());
+	                out.putNextEntry(entry);
+	                writeToZipStream(file, out, buf);
+	            }
+	        }
+    	}else{
+    		 ZipFile input = new ZipFile(dir);
+             Enumeration en = input.entries();
+             byte[] buffer = new byte[4096];
+             int count;
+             while (en.hasMoreElements()) {
+                 ZipEntry entry = (ZipEntry) en.nextElement();
+                 out.putNextEntry(entry);
+                 InputStream in = input.getInputStream(entry);
+                     while ((count = in.read(buf)) > -1) {
+                         out.write(buf, 0, count);
+                 }
+                 in.close();
+                 out.closeEntry();                 
+             }             
+             input.close();
+    	}
     }
 
     private void writeToZipStream(File file, OutputStream out, byte[] buf) throws IOException
{



Mime
View raw message