ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r801799 - in /ant/sandbox/antlibs/compress/trunk/src: main/org/apache/ant/compress/antlib.xml main/org/apache/ant/compress/resources/CpioFileSet.java main/org/apache/ant/compress/resources/CpioScanner.java tests/antunit/cpiofileset-test.xml
Date Thu, 06 Aug 2009 20:02:06 GMT
Author: bodewig
Date: Thu Aug  6 20:02:06 2009
New Revision: 801799

URL: http://svn.apache.org/viewvc?rev=801799&view=rev
Log:
cpiofileset

Added:
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioFileSet.java
      - copied, changed from r801797, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioScanner.java
      - copied, changed from r801797, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpiofileset-test.xml
      - copied, changed from r801797, ant/sandbox/antlibs/compress/trunk/src/tests/antunit/arfileset-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=801799&r1=801798&r2=801799&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 20:02:06 2009
@@ -58,4 +58,8 @@
     name="arfileset"
     classname="org.apache.ant.compress.resources.ArFileSet"
     />
+  <typedef
+    name="cpiofileset"
+    classname="org.apache.ant.compress.resources.CpioFileSet"
+    />
 </antlib>

Copied: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioFileSet.java
(from r801797, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioFileSet.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioFileSet.java&p1=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java&r1=801797&r2=801799&rev=801799&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArFileSet.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioFileSet.java
Thu Aug  6 20:02:06 2009
@@ -26,15 +26,15 @@
 import org.apache.tools.ant.types.Reference;
 
 /**
- * A ArFileSet is a FileSet with extra attributes useful in the context of
- * Ar/Jar tasks.
+ * A CpioFileSet is a FileSet with extra attributes useful in the context of
+ * Cpio/Jar tasks.
  *
- * 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.
+ * A CpioFileSet extends FileSets with the ability to extract a subset of the
+ * entries of a Cpio file for inclusion in another Cpio file.  It also includes
+ * a prefix attribute which is prepended to each entry in the output Cpio file.
  *
  */
-public class ArFileSet extends ArchiveFileSet {
+public class CpioFileSet extends ArchiveFileSet {
 
     private boolean userIdSet;
     private boolean groupIdSet;
@@ -42,8 +42,8 @@
     private int    uid;
     private int    gid;
 
-    /** Constructor for ArFileSet */
-    public ArFileSet() {
+    /** Constructor for CpioFileSet */
+    public CpioFileSet() {
         super();
     }
 
@@ -51,35 +51,35 @@
      * Constructor using a fileset arguement.
      * @param fileset the fileset to use
      */
-    protected ArFileSet(FileSet fileset) {
+    protected CpioFileSet(FileSet fileset) {
         super(fileset);
     }
 
     /**
-     * Constructor using a arfileset arguement.
-     * @param fileset the arfileset to use
+     * Constructor using a cpiofileset arguement.
+     * @param fileset the cpiofileset to use
      */
-    protected ArFileSet(ArFileSet fileset) {
+    protected CpioFileSet(CpioFileSet fileset) {
         super(fileset);
     }
 
     /**
-     * The uid for the ar entry
+     * The uid for the cpio entry
      * This is not the same as the User name.
-     * @param uid the id of the user for the ar entry.
+     * @param uid the id of the user for the cpio entry.
      */
     public void setUid(int uid) {
-        checkArFileSetAttributesAllowed();
+        checkCpioFileSetAttributesAllowed();
         userIdSet = true;
         this.uid = uid;
     }
 
     /**
-     * @return the uid for the ar entry
+     * @return the uid for the cpio entry
      */
     public int getUid() {
         if (isReference()) {
-            return ((ArFileSet) getCheckedRef()).getUid();
+            return ((CpioFileSet) getCheckedRef()).getUid();
         }
         return uid;
     }
@@ -92,12 +92,12 @@
     }
 
     /**
-     * The GID for the ar entry; optional, default="0"
+     * The GID for the cpio entry; optional, default="0"
      * This is not the same as the group name.
      * @param gid the group id.
      */
     public void setGid(int gid) {
-        checkArFileSetAttributesAllowed();
+        checkCpioFileSetAttributesAllowed();
         groupIdSet = true;
         this.gid = gid;
     }
@@ -107,7 +107,7 @@
      */
     public int getGid() {
         if (isReference()) {
-            return ((ArFileSet) getCheckedRef()).getGid();
+            return ((CpioFileSet) getCheckedRef()).getGid();
         }
         return gid;
     }
@@ -124,7 +124,7 @@
      * @return the created scanner.
      */
     protected ArchiveScanner newArchiveScanner() {
-        ArScanner zs = new ArScanner();
+        CpioScanner zs = new CpioScanner();
         return zs;
     }
 
@@ -144,7 +144,7 @@
     }
 
     /**
-     * A ArFileset accepts another ArFileSet or a FileSet as reference
+     * A CpioFileset accepts another CpioFileSet 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
@@ -152,58 +152,58 @@
     protected AbstractFileSet getRef(Project p) {
         dieOnCircularReference(p);
         Object o = getRefid().getReferencedObject(p);
-        if (o instanceof ArFileSet) {
+        if (o instanceof CpioFileSet) {
             return (AbstractFileSet) o;
         } else if (o instanceof FileSet) {
-            ArFileSet zfs = new ArFileSet((FileSet) o);
+            CpioFileSet zfs = new CpioFileSet((FileSet) o);
             configureFileSet(zfs);
             return zfs;
         } else {
-            String msg = getRefid().getRefId() + " doesn\'t denote a arfileset or a fileset";
+            String msg = getRefid().getRefId() + " doesn\'t denote a cpiofileset or a fileset";
             throw new BuildException(msg);
         }
     }
 
     /**
      * Configure a fileset based on this fileset.
-     * If the fileset is a ArFileSet copy in the arfileset
+     * If the fileset is a CpioFileSet copy in the cpiofileset
      * specific attributes.
      * @param zfs the archive fileset to configure.
      */
     protected void configureFileSet(ArchiveFileSet zfs) {
         super.configureFileSet(zfs);
-        if (zfs instanceof ArFileSet) {
-            ArFileSet tfs = (ArFileSet) zfs;
+        if (zfs instanceof CpioFileSet) {
+            CpioFileSet tfs = (CpioFileSet) zfs;
             tfs.setUid(uid);
             tfs.setGid(gid);
         }
     }
 
     /**
-     * Return a ArFileSet that has the same properties
+     * Return a CpioFileSet that has the same properties
      * as this one.
-     * @return the cloned arFileSet
+     * @return the cloned cpioFileSet
      */
     public Object clone() {
         if (isReference()) {
-            return ((ArFileSet) getRef(getProject())).clone();
+            return ((CpioFileSet) getRef(getProject())).clone();
         } else {
             return super.clone();
         }
     }
 
     /**
-     * A check attributes for ArFileSet.
+     * A check attributes for CpioFileSet.
      * If there is a reference, and
-     * it is a ArFileSet, the ar fileset attributes
+     * it is a CpioFileSet, the cpio fileset attributes
      * cannot be used.
      */
-    private void checkArFileSetAttributesAllowed() {
+    private void checkCpioFileSetAttributesAllowed() {
         if (getProject() == null
             || (isReference()
                 && (getRefid().getReferencedObject(
                         getProject())
-                    instanceof ArFileSet))) {
+                    instanceof CpioFileSet))) {
             checkAttributesAllowed();
         }
     }

Copied: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioScanner.java
(from r801797, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java)
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioScanner.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioScanner.java&p1=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java&r1=801797&r2=801799&rev=801799&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/ArScanner.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/resources/CpioScanner.java
Thu Aug  6 20:02:06 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.ar.ArArchiveEntry;
-import org.apache.commons.compress.archivers.ar.ArArchiveInputStream;
+import org.apache.commons.compress.archivers.cpio.CpioArchiveEntry;
+import org.apache.commons.compress.archivers.cpio.CpioArchiveInputStream;
 
 /**
- * Scans ar archives for resources.
+ * Scans cpio archives for resources.
  */
-public class ArScanner extends CommonsCompressArchiveScanner {
+public class CpioScanner extends CommonsCompressArchiveScanner {
 
     protected ArchiveInputStream getArchiveStream(InputStream is)
         throws IOException {
-        return new ArArchiveInputStream(is);
+        return new CpioArchiveInputStream(is);
     }
 
     protected Resource getResource(Resource archive, String encoding,
                                    ArchiveEntry entry) {
-        return new ArResource(archive, (ArArchiveEntry) entry);
+        return new CpioResource(archive, (CpioArchiveEntry) entry);
     }
 }
\ No newline at end of file

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



Mime
View raw message