FileDocCategorySizeDatePackage
TarFileSet.javaAPI DocApache Ant 1.707562Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.types

TarFileSet

public class TarFileSet extends ArchiveFileSet
A TarFileSet is a FileSet with extra attributes useful in the context of Tar/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.

Fields Summary
private boolean
userNameSet
private boolean
groupNameSet
private boolean
userIdSet
private boolean
groupIdSet
private String
userName
private String
groupName
private int
uid
private int
gid
Constructors Summary
public TarFileSet()
Constructor for TarFileSet


        
      
        super();
    
protected TarFileSet(FileSet fileset)
Constructor using a fileset arguement.

param
fileset the fileset to use

        super(fileset);
    
protected TarFileSet(TarFileSet fileset)
Constructor using a tarfileset arguement.

param
fileset the tarfileset to use

        super(fileset);
    
Methods Summary
private voidcheckTarFileSetAttributesAllowed()
A check attributes for TarFileSet. If there is a reference, and it is a TarFileSet, the tar fileset attributes cannot be used.

        if (getProject() == null
            || (isReference()
                && (getRefid().getReferencedObject(
                        getProject())
                    instanceof TarFileSet))) {
            checkAttributesAllowed();
        }
    
public java.lang.Objectclone()
Return a TarFileSet that has the same properties as this one.

return
the cloned tarFileSet

        if (isReference()) {
            return ((TarFileSet) getRef(getProject())).clone();
        } else {
            return super.clone();
        }
    
protected voidconfigureFileSet(ArchiveFileSet zfs)
Configure a fileset based on this fileset. If the fileset is a TarFileSet copy in the tarfileset specific attributes.

param
zfs the archive fileset to configure.

        super.configureFileSet(zfs);
        if (zfs instanceof TarFileSet) {
            TarFileSet tfs = (TarFileSet) zfs;
            tfs.setUserName(userName);
            tfs.setGroup(groupName);
            tfs.setUid(uid);
            tfs.setGid(gid);
        }
    
public intgetGid()

return
the group identifier.

        if (isReference()) {
            return ((TarFileSet) getCheckedRef()).getGid();
        }
        return gid;
    
public java.lang.StringgetGroup()

return
the group name string.

        if (isReference()) {
            return ((TarFileSet) getCheckedRef()).getGroup();
        }
        return groupName;
    
protected AbstractFileSetgetRef(org.apache.tools.ant.Project p)
A TarFileset accepts another TarFileSet 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

        dieOnCircularReference(p);
        Object o = getRefid().getReferencedObject(p);
        if (o instanceof TarFileSet) {
            return (AbstractFileSet) o;
        } else if (o instanceof FileSet) {
            TarFileSet zfs = new TarFileSet((FileSet) o);
            configureFileSet(zfs);
            return zfs;
        } else {
            String msg = getRefid().getRefId() + " doesn\'t denote a tarfileset or a fileset";
            throw new BuildException(msg);
        }
    
public intgetUid()

return
the uid for the tar entry

        if (isReference()) {
            return ((TarFileSet) getCheckedRef()).getUid();
        }
        return uid;
    
public java.lang.StringgetUserName()

return
the user name for the tar entry

        if (isReference()) {
            return ((TarFileSet) getCheckedRef()).getUserName();
        }
        return userName;
    
public booleanhasGroupBeenSet()

return
whether the group name has been explicitly set.

        return groupNameSet;
    
public booleanhasGroupIdBeenSet()

return
whether the group id has been explicitly set.

        return groupIdSet;
    
public booleanhasUserIdBeenSet()

return
whether the user id has been explicitly set.

        return userIdSet;
    
public booleanhasUserNameBeenSet()

return
whether the user name has been explicitly set.

        return userNameSet;
    
protected ArchiveScannernewArchiveScanner()
Create a new scanner.

return
the created scanner.

        TarScanner zs = new TarScanner();
        return zs;
    
public voidsetGid(int gid)
The GID for the tar entry; optional, default="0" This is not the same as the group name.

param
gid the group id.

        checkTarFileSetAttributesAllowed();
        groupIdSet = true;
        this.gid = gid;
    
public voidsetGroup(java.lang.String groupName)
The groupname for the tar entry; optional, default="" This is not the same as the GID.

param
groupName the group name string.

        checkTarFileSetAttributesAllowed();
        groupNameSet = true;
        this.groupName = groupName;
    
public voidsetRefid(Reference r)
Makes this instance in effect a reference to another instance.

You must not set another attribute or nest elements inside this element if you make it a reference.

param
r the Reference to use.
throws
BuildException on error

        if (userNameSet || userIdSet || groupNameSet || groupIdSet) {
            throw tooManyAttributes();
        }
        super.setRefid(r);
    
public voidsetUid(int uid)
The uid for the tar entry This is not the same as the User name.

param
uid the id of the user for the tar entry.

        checkTarFileSetAttributesAllowed();
        userIdSet = true;
        this.uid = uid;
    
public voidsetUserName(java.lang.String userName)
The username for the tar entry This is not the same as the UID.

param
userName the user name for the tar entry.

        checkTarFileSetAttributesAllowed();
        userNameSet = true;
        this.userName = userName;