ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r801274 - in /ant/sandbox/antlibs/compress/trunk/src: main/org/apache/ant/compress/antlib.xml main/org/apache/ant/compress/resources/ArResource.java tests/antunit/arentry-test.xml
Date Wed, 05 Aug 2009 15:51:09 GMT
Author: bodewig
Date: Wed Aug  5 15:51:09 2009
New Revision: 801274

URL: http://svn.apache.org/viewvc?rev=801274&view=rev
Log:
ArEntry resource

Added:
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArResource.java
      - copied, changed from r801271, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarResource.java
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arentry-test.xml
      - copied, changed from r801271, ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tarentry-test.xml
Modified:
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml?rev=801274&r1=801273&r2=801274&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml Wed Aug
 5 15:51:09 2009
@@ -37,4 +37,8 @@
     name="tarentry"
     classname="org.apache.ant.compress.resources.TarResource"
     />
+  <typedef
+    name="arentry"
+    classname="org.apache.ant.compress.resources.ArResource"
+    />
 </antlib>

Copied: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArResource.java
(from r801271, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarResource.java)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArResource.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArResource.java&p1=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarResource.java&r1=801271&r2=801274&rev=801274&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarResource.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArResource.java
Wed Aug  5 15:51:09 2009
@@ -25,81 +25,59 @@
 import org.apache.tools.ant.types.Resource;
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.ArchiveInputStream;
-import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
-import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
+import org.apache.commons.compress.archivers.ar.ArArchiveEntry;
+import org.apache.commons.compress.archivers.ar.ArArchiveInputStream;
 
 /**
- * A Resource representation of an entry in a tar archive.
+ * A Resource representation of an entry in a ar archive.
  */
-public class TarResource extends CommonsCompressArchiveResource {
+public class ArResource extends CommonsCompressArchiveResource {
 
-    private String userName = "";
-    private String groupName = "";
     private int    uid;
     private int    gid;
 
     /**
      * Default constructor.
      */
-    public TarResource() {
+    public ArResource() {
     }
 
     /**
-     * Construct a TarResource representing the specified
+     * Construct a ArResource representing the specified
      * entry in the specified archive.
      * @param a the archive as File.
-     * @param e the TarEntry.
+     * @param e the ArEntry.
      */
-    public TarResource(File a, TarArchiveEntry e) {
+    public ArResource(File a, ArArchiveEntry e) {
         super(a, e);
     }
 
     /**
-     * Construct a TarResource representing the specified
+     * Construct a ArResource representing the specified
      * entry in the specified archive.
      * @param a the archive as Resource.
-     * @param e the TarEntry.
+     * @param e the ArEntry.
      */
-    public TarResource(Resource a, TarArchiveEntry e) {
+    public ArResource(Resource a, ArArchiveEntry e) {
         super(a, e);
     }
 
     /**
-     * @return the user name for the tar entry
-     */
-    public String getUserName() {
-        if (isReference()) {
-            return ((TarResource) getCheckedRef()).getUserName();
-        }
-        return userName;
-    }
-
-    /**
-     * @return the group name for the tar entry
-     */
-    public String getGroup() {
-        if (isReference()) {
-            return ((TarResource) getCheckedRef()).getGroup();
-        }
-        return groupName;
-    }
-
-    /**
-     * @return the uid for the tar entry
+     * @return the uid for the ar entry
      */
     public int getUid() {
         if (isReference()) {
-            return ((TarResource) getCheckedRef()).getUid();
+            return ((ArResource) getCheckedRef()).getUid();
         }
         return uid;
     }
 
     /**
-     * @return the uid for the tar entry
+     * @return the uid for the ar entry
      */
     public int getGid() {
         if (isReference()) {
-            return ((TarResource) getCheckedRef()).getGid();
+            return ((ArResource) getCheckedRef()).getGid();
         }
         return uid;
     }
@@ -107,28 +85,26 @@
     protected void setEntry(ArchiveEntry e) {
         super.setEntry(e);
         if (e != null) {
-            TarArchiveEntry te = (TarArchiveEntry) e;
-            userName = te.getUserName();
-            groupName = te.getGroupName();
-            uid = te.getUserId();
-            gid = te.getGroupId();
+            ArArchiveEntry ae = (ArArchiveEntry) e;
+            uid = ae.getUserId();
+            gid = ae.getGroupId();
         }
     }
 
     protected ArchiveInputStream getArchiveStream(InputStream is)
         throws IOException {
-        return new TarArchiveInputStream(is);
+        return new ArArchiveInputStream(is);
     }
 
     protected Date getLastModified(ArchiveEntry entry) {
-        return ((TarArchiveEntry) entry).getModTime();
+        return new Date(((ArArchiveEntry) entry).getLastModified() * 1000);
     }
 
     protected int getMode(ArchiveEntry e) {
-        return ((TarArchiveEntry) e).getMode();
+        return ((ArArchiveEntry) e).getMode();
     }
 
     protected String getArchiveType() {
-        return "tar";
+        return "ar";
     }
 }

Copied: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arentry-test.xml (from r801271,
ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tarentry-test.xml)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arentry-test.xml?p2=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arentry-test.xml&p1=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tarentry-test.xml&r1=801271&r2=801274&rev=801274&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tarentry-test.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arentry-test.xml Wed Aug  5 15:51:09
2009
@@ -23,14 +23,13 @@
 
   <target name="setUp">
     <mkdir dir="${output}"/>
-    <mkdir dir="${input}"/>
   </target>
 
-  <target name="testTarSource" depends="setUp">
+  <target name="testArSource" depends="setUp">
     <copy todir="${output}">
-      <cmp:tarentry name="asf-logo.gif">
-        <file file="../resources/asf-logo.gif.tar"/>
-      </cmp:tarentry>
+      <cmp:arentry name="asf-logo.gif">
+        <file file="../resources/asf-logo.gif.ar"/>
+      </cmp:arentry>
     </copy>
     <au:assertFilesMatch
        actual="${output}/asf-logo.gif"
@@ -38,19 +37,4 @@
        />
   </target>
 
-  <target name="testUncompressSource" depends="setUp">
-    <gzip destfile="${input}/asf-logo.gif.tar.gz"
-          src="../resources/asf-logo.gif.tar"/>
-    <copy todir="${output}">
-      <cmp:tarentry name="asf-logo.gif">
-        <gzipresource>
-          <file file="${input}/asf-logo.gif.tar.gz"/>
-        </gzipresource>
-      </cmp:tarentry>
-    </copy>
-    <au:assertFilesMatch
-       actual="${output}/asf-logo.gif"
-       expected="../resources/asf-logo.gif"
-       />
-  </target>
 </project>



Mime
View raw message