ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r801797 - in /ant/sandbox/antlibs/compress/trunk/src: main/org/apache/ant/compress/antlib.xml main/org/apache/ant/compress/resources/ArFileSet.java main/org/apache/ant/compress/resources/ArScanner.java tests/antunit/arfileset-test.xml
Date Thu, 06 Aug 2009 19:56:42 GMT
Author: bodewig
Date: Thu Aug  6 19:56:42 2009
New Revision: 801797

URL: http://svn.apache.org/viewvc?rev=801797&view=rev
Log:
arfileset

Added:
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java
      - copied, changed from r801795, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarFileSet.java
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java
      - copied, changed from r801795, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarScanner.java
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arfileset-test.xml
      - copied, changed from r801795, ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tarfileset-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=801797&r1=801796&r2=801797&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 Thu Aug
 6 19:56:42 2009
@@ -54,4 +54,8 @@
     name="tarfileset"
     classname="org.apache.ant.compress.resources.TarFileSet"
     />
+  <typedef
+    name="arfileset"
+    classname="org.apache.ant.compress.resources.ArFileSet"
+    />
 </antlib>

Copied: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java
(from r801795, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarFileSet.java)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java&p1=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarFileSet.java&r1=801795&r2=801797&rev=801797&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarFileSet.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java
Thu Aug  6 19:56:42 2009
@@ -26,28 +26,24 @@
 import org.apache.tools.ant.types.Reference;
 
 /**
- * A TarFileSet is a FileSet with extra attributes useful in the context of
- * Tar/Jar tasks.
+ * A ArFileSet is a FileSet with extra attributes useful in the context of
+ * Ar/Jar tasks.
  *
- * A TarFileSet extends FileSets with the ability to extract a subset of the
- * entries of a Tar file for inclusion in another Tar file.  It also includes
- * a prefix attribute which is prepended to each entry in the output Tar file.
+ * A ArFileSet extends FileSets with the ability to extract a subset of the
+ * entries of a Ar file for inclusion in another Ar file.  It also includes
+ * a prefix attribute which is prepended to each entry in the output Ar file.
  *
  */
-public class TarFileSet extends ArchiveFileSet {
+public class ArFileSet extends ArchiveFileSet {
 
-    private boolean userNameSet;
-    private boolean groupNameSet;
     private boolean userIdSet;
     private boolean groupIdSet;
 
-    private String userName = "";
-    private String groupName = "";
     private int    uid;
     private int    gid;
 
-    /** Constructor for TarFileSet */
-    public TarFileSet() {
+    /** Constructor for ArFileSet */
+    public ArFileSet() {
         super();
     }
 
@@ -55,63 +51,35 @@
      * Constructor using a fileset arguement.
      * @param fileset the fileset to use
      */
-    protected TarFileSet(FileSet fileset) {
+    protected ArFileSet(FileSet fileset) {
         super(fileset);
     }
 
     /**
-     * Constructor using a tarfileset arguement.
-     * @param fileset the tarfileset to use
+     * Constructor using a arfileset arguement.
+     * @param fileset the arfileset to use
      */
-    protected TarFileSet(TarFileSet fileset) {
+    protected ArFileSet(ArFileSet fileset) {
         super(fileset);
     }
 
     /**
-     * The username for the tar entry
-     * This is not the same as the UID.
-     * @param userName the user name for the tar entry.
-     */
-    public void setUserName(String userName) {
-        checkTarFileSetAttributesAllowed();
-        userNameSet = true;
-        this.userName = userName;
-    }
-
-    /**
-     * @return the user name for the tar entry
-     */
-    public String getUserName() {
-        if (isReference()) {
-            return ((TarFileSet) getCheckedRef()).getUserName();
-        }
-        return userName;
-    }
-
-    /**
-     * @return whether the user name has been explicitly set.
-     */
-    public boolean hasUserNameBeenSet() {
-        return userNameSet;
-    }
-
-    /**
-     * The uid for the tar entry
+     * The uid for the ar entry
      * This is not the same as the User name.
-     * @param uid the id of the user for the tar entry.
+     * @param uid the id of the user for the ar entry.
      */
     public void setUid(int uid) {
-        checkTarFileSetAttributesAllowed();
+        checkArFileSetAttributesAllowed();
         userIdSet = true;
         this.uid = uid;
     }
 
     /**
-     * @return the uid for the tar entry
+     * @return the uid for the ar entry
      */
     public int getUid() {
         if (isReference()) {
-            return ((TarFileSet) getCheckedRef()).getUid();
+            return ((ArFileSet) getCheckedRef()).getUid();
         }
         return uid;
     }
@@ -124,40 +92,12 @@
     }
 
     /**
-     * The groupname for the tar entry; optional, default=""
-     * This is not the same as the GID.
-     * @param groupName the group name string.
-     */
-    public void setGroup(String groupName) {
-        checkTarFileSetAttributesAllowed();
-        groupNameSet = true;
-        this.groupName = groupName;
-    }
-
-    /**
-     * @return the group name string.
-     */
-    public String getGroup() {
-        if (isReference()) {
-            return ((TarFileSet) getCheckedRef()).getGroup();
-        }
-        return groupName;
-    }
-
-    /**
-     * @return whether the group name has been explicitly set.
-     */
-    public boolean hasGroupBeenSet() {
-        return groupNameSet;
-    }
-
-    /**
-     * The GID for the tar entry; optional, default="0"
+     * The GID for the ar entry; optional, default="0"
      * This is not the same as the group name.
      * @param gid the group id.
      */
     public void setGid(int gid) {
-        checkTarFileSetAttributesAllowed();
+        checkArFileSetAttributesAllowed();
         groupIdSet = true;
         this.gid = gid;
     }
@@ -167,7 +107,7 @@
      */
     public int getGid() {
         if (isReference()) {
-            return ((TarFileSet) getCheckedRef()).getGid();
+            return ((ArFileSet) getCheckedRef()).getGid();
         }
         return gid;
     }
@@ -184,7 +124,7 @@
      * @return the created scanner.
      */
     protected ArchiveScanner newArchiveScanner() {
-        TarScanner zs = new TarScanner();
+        ArScanner zs = new ArScanner();
         return zs;
     }
 
@@ -197,14 +137,14 @@
      * @throws BuildException on error
      */
     public void setRefid(Reference r) throws BuildException {
-        if (userNameSet || userIdSet || groupNameSet || groupIdSet) {
+        if (userIdSet || groupIdSet) {
             throw tooManyAttributes();
         }
         super.setRefid(r);
     }
 
     /**
-     * A TarFileset accepts another TarFileSet or a FileSet as reference
+     * A ArFileset accepts another ArFileSet or a FileSet as reference
      * FileSets are often used by the war task for the lib attribute
      * @param p the project to use
      * @return the abstract fileset instance
@@ -212,60 +152,58 @@
     protected AbstractFileSet getRef(Project p) {
         dieOnCircularReference(p);
         Object o = getRefid().getReferencedObject(p);
-        if (o instanceof TarFileSet) {
+        if (o instanceof ArFileSet) {
             return (AbstractFileSet) o;
         } else if (o instanceof FileSet) {
-            TarFileSet zfs = new TarFileSet((FileSet) o);
+            ArFileSet zfs = new ArFileSet((FileSet) o);
             configureFileSet(zfs);
             return zfs;
         } else {
-            String msg = getRefid().getRefId() + " doesn\'t denote a tarfileset or a fileset";
+            String msg = getRefid().getRefId() + " doesn\'t denote a arfileset or a fileset";
             throw new BuildException(msg);
         }
     }
 
     /**
      * Configure a fileset based on this fileset.
-     * If the fileset is a TarFileSet copy in the tarfileset
+     * If the fileset is a ArFileSet copy in the arfileset
      * specific attributes.
      * @param zfs the archive fileset to configure.
      */
     protected void configureFileSet(ArchiveFileSet zfs) {
         super.configureFileSet(zfs);
-        if (zfs instanceof TarFileSet) {
-            TarFileSet tfs = (TarFileSet) zfs;
-            tfs.setUserName(userName);
-            tfs.setGroup(groupName);
+        if (zfs instanceof ArFileSet) {
+            ArFileSet tfs = (ArFileSet) zfs;
             tfs.setUid(uid);
             tfs.setGid(gid);
         }
     }
 
     /**
-     * Return a TarFileSet that has the same properties
+     * Return a ArFileSet that has the same properties
      * as this one.
-     * @return the cloned tarFileSet
+     * @return the cloned arFileSet
      */
     public Object clone() {
         if (isReference()) {
-            return ((TarFileSet) getRef(getProject())).clone();
+            return ((ArFileSet) getRef(getProject())).clone();
         } else {
             return super.clone();
         }
     }
 
     /**
-     * A check attributes for TarFileSet.
+     * A check attributes for ArFileSet.
      * If there is a reference, and
-     * it is a TarFileSet, the tar fileset attributes
+     * it is a ArFileSet, the ar fileset attributes
      * cannot be used.
      */
-    private void checkTarFileSetAttributesAllowed() {
+    private void checkArFileSetAttributesAllowed() {
         if (getProject() == null
             || (isReference()
                 && (getRefid().getReferencedObject(
                         getProject())
-                    instanceof TarFileSet))) {
+                    instanceof ArFileSet))) {
             checkAttributesAllowed();
         }
     }

Copied: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java
(from r801795, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarScanner.java)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java&p1=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarScanner.java&r1=801795&r2=801797&rev=801797&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/TarScanner.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java
Thu Aug  6 19:56:42 2009
@@ -24,21 +24,21 @@
 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;
 
 /**
- * Scans tar archives for resources.
+ * Scans ar archives for resources.
  */
-public class TarScanner extends CommonsCompressArchiveScanner {
+public class ArScanner extends CommonsCompressArchiveScanner {
 
     protected ArchiveInputStream getArchiveStream(InputStream is)
         throws IOException {
-        return new TarArchiveInputStream(is);
+        return new ArArchiveInputStream(is);
     }
 
     protected Resource getResource(Resource archive, String encoding,
                                    ArchiveEntry entry) {
-        return new TarResource(archive, (TarArchiveEntry) entry);
+        return new ArResource(archive, (ArArchiveEntry) entry);
     }
 }
\ No newline at end of file

Copied: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arfileset-test.xml (from r801795,
ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tarfileset-test.xml)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arfileset-test.xml?p2=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arfileset-test.xml&p1=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tarfileset-test.xml&r1=801795&r2=801797&rev=801797&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tarfileset-test.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arfileset-test.xml Thu Aug  6 19:56:42
2009
@@ -22,9 +22,9 @@
 
   <target name="testMissingArchive">
     <mkdir dir="${output}"/>
-    <au:expectfailure expectedMessage="The archive foo.tar doesn't exist">
+    <au:expectfailure expectedMessage="The archive foo.ar doesn't exist">
       <copy todir="${output}">
-        <cmp:tarfileset src="foo.tar"/>
+        <cmp:arfileset src="foo.ar"/>
       </copy>
     </au:expectfailure>
   </target>
@@ -32,7 +32,7 @@
   <target name="testMissingArchiveDoesntMatter">
     <mkdir dir="${output}"/>
     <copy todir="${output}">
-      <cmp:tarfileset src="foo.tar" errorOnMissingArchive="false"/>
+      <cmp:arfileset src="foo.ar" errorOnMissingArchive="false"/>
     </copy>
   </target>
 



Mime
View raw message