knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [knox] branch master updated: KNOX-1826 - Replace zip4j with ShrinkWrap
Date Thu, 14 Mar 2019 17:52:45 GMT
This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 5fb4491  KNOX-1826 - Replace zip4j with ShrinkWrap
5fb4491 is described below

commit 5fb449118bbcddccea0750dd7a97e66f53f32c60
Author: Kevin Risden <krisden@apache.org>
AuthorDate: Thu Mar 14 11:59:03 2019 -0400

    KNOX-1826 - Replace zip4j with ShrinkWrap
    
    Signed-off-by: Kevin Risden <krisden@apache.org>
---
 gateway-server/pom.xml                                     |  4 ----
 .../main/java/org/apache/knox/gateway/GatewayServer.java   | 14 +++++++-------
 pom.xml                                                    |  7 -------
 3 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/gateway-server/pom.xml b/gateway-server/pom.xml
index ca6c410..b451d69 100644
--- a/gateway-server/pom.xml
+++ b/gateway-server/pom.xml
@@ -231,10 +231,6 @@
         </dependency>
         
         <dependency>
-            <groupId>net.lingala.zip4j</groupId>
-            <artifactId>zip4j</artifactId>
-        </dependency>
-        <dependency>
             <groupId>joda-time</groupId>
             <artifactId>joda-time</artifactId>
         </dependency>
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
index 1578d50..f0b8365 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
@@ -17,8 +17,6 @@
  */
 package org.apache.knox.gateway;
 
-import net.lingala.zip4j.core.ZipFile;
-import net.lingala.zip4j.exception.ZipException;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.io.FileUtils;
@@ -71,8 +69,10 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.eclipse.jetty.webapp.Configuration;
 import org.eclipse.jetty.webapp.WebAppContext;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
 import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -749,12 +749,12 @@ public class GatewayServer {
     return context;
   }
 
-  private static void explodeWar( File source, File target ) throws IOException, ZipException
{
+  private static void explodeWar( File source, File target ) throws IOException {
     if( source.isDirectory() ) {
       FileUtils.copyDirectory( source, target );
     } else {
-      ZipFile zip = new ZipFile( source );
-      zip.extractAll( target.getAbsolutePath() );
+      WebArchive webArchive = ShrinkWrap.createFromZipFile(WebArchive.class, source);
+      webArchive.as(ExplodedExporter.class).exportExploded(target);
     }
   }
 
@@ -791,7 +791,7 @@ public class GatewayServer {
     }
   }
 
-  private synchronized void internalDeployApplications( Topology topology, File topoDir )
throws IOException, ZipException, ParserConfigurationException, TransformerException, SAXException
{
+  private synchronized void internalDeployApplications( Topology topology, File topoDir )
throws IOException, ParserConfigurationException, TransformerException, SAXException {
     if( topology != null ) {
       Collection<Application> applications = topology.getApplications();
       if( applications != null ) {
@@ -809,7 +809,7 @@ public class GatewayServer {
     }
   }
 
-  private synchronized void internalDeployApplication( File topoDir, Application application,
String url ) throws IOException, ZipException, TransformerException, SAXException, ParserConfigurationException
{
+  private synchronized void internalDeployApplication( File topoDir, Application application,
String url ) throws IOException, TransformerException, SAXException, ParserConfigurationException
{
     File appsDir = new File( config.getGatewayApplicationsDir() );
     File appDir = new File( appsDir, application.getName() );
     File[] implFiles = appDir.listFiles( new RegexFilenameFilter( "app|app\\..*" ) );
diff --git a/pom.xml b/pom.xml
index a5f725e..dfe00a0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -228,7 +228,6 @@
         <velocity.version>1.7</velocity.version>
         <xmltool.version>3.3</xmltool.version>
         <xml-matchers.version>0.10</xml-matchers.version>
-        <zip4j.version>1.3.2</zip4j.version>
         <zookeeper.version>3.4.13</zookeeper.version>
     </properties>
 
@@ -1725,12 +1724,6 @@
                 <artifactId>bcprov-jdk15on</artifactId>
                 <version>${bcprov-jdk15on.version}</version>
             </dependency>
-            
-            <dependency>
-                <groupId>net.lingala.zip4j</groupId>
-                <artifactId>zip4j</artifactId>
-                <version>${zip4j.version}</version>
-            </dependency>
 
             <dependency>
                 <groupId>org.ow2.asm</groupId>


Mime
View raw message