Commit b08a843a authored by Sven Bunge's avatar Sven Bunge

Remove pack200 compression from the buildsystem and the decompression from the...

Remove pack200 compression from the buildsystem and the decompression from the ServerStarter and PluginManager

Add pack200task.jar again

Add pack200task.jar again
parent 2e1110b9
......@@ -21,12 +21,10 @@
package org.jivesoftware.openfire.container;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
......@@ -49,8 +47,6 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.zip.ZipFile;
import org.dom4j.Attribute;
......@@ -1134,64 +1130,11 @@ public class PluginManager {
}
zipFile.close();
// The lib directory of the plugin may contain Pack200 versions of the JAR
// file. If so, unpack them.
unpackArchives(new File(dir, "lib"));
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
}
/**
* Converts any pack files in a directory into standard JAR files. Each
* pack file will be deleted after being converted to a JAR. If no
* pack files are found, this method does nothing.
*
* @param libDir the directory containing pack files.
*/
private void unpackArchives(File libDir) {
// Get a list of all packed files in the lib directory.
File [] packedFiles = libDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".pack");
}
});
if (packedFiles == null) {
// Do nothing since no .pack files were found
return;
}
// Unpack each.
for (File packedFile : packedFiles) {
try {
String jarName = packedFile.getName().substring(0,
packedFile.getName().length() - ".pack".length());
// Delete JAR file with same name if it exists (could be due to upgrade
// from old Openfire release).
File jarFile = new File(libDir, jarName);
if (jarFile.exists()) {
jarFile.delete();
}
InputStream in = new BufferedInputStream(new FileInputStream(packedFile));
JarOutputStream out = new JarOutputStream(new BufferedOutputStream(
new FileOutputStream(new File(libDir, jarName))));
Pack200.Unpacker unpacker = Pack200.newUnpacker();
// Call the unpacker
unpacker.unpack(in, out);
in.close();
out.close();
packedFile.delete();
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
}
}
}
/**
......
......@@ -20,11 +20,9 @@
package org.jivesoftware.openfire.starter;
import java.io.*;
import java.util.jar.Pack200;
import java.util.jar.JarOutputStream;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.Log;
import java.io.File;
/**
* Starts the core XMPP server. A bootstrap class that configures classloaders
* to ensure easy, dynamic server startup.
......@@ -86,9 +84,6 @@ public class ServerStarter {
libDir = new File(DEFAULT_LIB_DIR);
}
// Unpack any pack files.
unpackArchives(libDir, true);
String adminLibDirString = System.getProperty("openfireHome");
if (adminLibDirString == null) {
adminLibDirString = DEFAULT_ADMIN_LIB_DIR;
......@@ -97,10 +92,7 @@ public class ServerStarter {
adminLibDirString = adminLibDirString+"/plugins/admin/webapp/WEB-INF/lib";
}
File adminLibDir = new File(adminLibDirString);
if (adminLibDir.exists()) {
unpackArchives(adminLibDir, false);
}
else {
if (!adminLibDir.exists()) {
Log.warn("Admin Lib Directory " + adminLibDirString +
" does not exist. Web admin console may not work.");
}
......@@ -132,64 +124,4 @@ public class ServerStarter {
}
return parent;
}
/**
* Converts any pack files in a directory into standard JAR files. Each
* pack file will be deleted after being converted to a JAR. If no
* pack files are found, this method does nothing.
*
* @param libDir the directory containing pack files.
* @param printStatus true if status ellipses should be printed when unpacking.
*/
private void unpackArchives(File libDir, boolean printStatus) {
// Get a list of all packed files in the lib directory.
File [] packedFiles = libDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".pack");
}
});
if (packedFiles == null) {
// Do nothing since no .pack files were found
return;
}
// Unpack each.
boolean unpacked = false;
for (File packedFile : packedFiles) {
try {
String jarName = packedFile.getName().substring(0,
packedFile.getName().length() - ".pack".length());
// Delete JAR file with same name if it exists (could be due to upgrade
// from old Openfire release).
File jarFile = new File(libDir, jarName);
if (jarFile.exists()) {
jarFile.delete();
}
InputStream in = new BufferedInputStream(new FileInputStream(packedFile));
JarOutputStream out = new JarOutputStream(new BufferedOutputStream(
new FileOutputStream(new File(libDir, jarName))));
Pack200.Unpacker unpacker = Pack200.newUnpacker();
// Print something so the user knows something is happening.
if (printStatus) {
System.out.print(".");
}
// Call the unpacker
unpacker.unpack(in, out);
in.close();
out.close();
packedFile.delete();
unpacked = true;
}
catch (Exception e) {
e.printStackTrace();
}
}
// Print newline if unpacking happened.
if (unpacked && printStatus) {
System.out.println();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment