FileDocCategorySizeDatePackage
Attrib.javaAPI DocApache Ant 1.705777Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs.optional.windows

Attrib

public class Attrib extends org.apache.tools.ant.taskdefs.ExecuteOn
Attrib equivalent for Win32 environments. Note: Attrib parameters /S and /D are not handled.
since
Ant 1.6

Fields Summary
private static final String
ATTR_READONLY
private static final String
ATTR_ARCHIVE
private static final String
ATTR_SYSTEM
private static final String
ATTR_HIDDEN
private static final String
SET
private static final String
UNSET
private boolean
haveAttr
Constructors Summary
public Attrib()
Constructor for Attrib.


        
      
        super.setExecutable("attrib");
        super.setParallel(false);
    
Methods Summary
private voidaddArg(boolean sign, java.lang.String attribute)

        createArg().setValue(getSignString(sign) + attribute);
        haveAttr = true;
    
protected voidcheckConfiguration()
Check the attributes.

        if (!haveAttr()) {
            throw new BuildException("Missing attribute parameter",
                                     getLocation());
        }
        super.checkConfiguration();
    
private static java.lang.StringgetSignString(boolean attr)

        return (attr ? SET : UNSET);
    
private booleanhaveAttr()

        return haveAttr;
    
protected booleanisValidOs()
Check if the os is valid. Always include windows

return
true if the os is valid.

        return Os.isFamily("windows") && super.isValidOs();
    
public voidsetAddsourcefile(boolean b)
Add source file. This is not allowed, and it always throws a BuildException.

param
b ignored
ant.attribute
ignore="true"

        throw new BuildException(getTaskType()
            + " doesn\'t support the addsourcefile attribute", getLocation());
    
public voidsetArchive(boolean value)
Set the Archive file attribute.

param
value a boolean value

        addArg(value, ATTR_ARCHIVE);
    
public voidsetCommand(java.lang.String e)
Set the executable. This is not allowed, and it always throws a BuildException.

param
e ignored
ant.attribute
ignore="true"

        throw new BuildException(getTaskType()
            + " doesn\'t support the command attribute", getLocation());
    
public voidsetExecutable(java.lang.String e)
Set the executable. This is not allowed, and it always throws a BuildException.

param
e ignored
ant.attribute
ignore="true"

        throw new BuildException(getTaskType()
            + " doesn\'t support the executable attribute", getLocation());
    
public voidsetFile(java.io.File src)
A file to be attribed.

param
src a file

        FileSet fs = new FileSet();
        fs.setFile(src);
        addFileset(fs);
    
public voidsetHidden(boolean value)
Set the Hidden file attribute.

param
value a boolean value

        addArg(value, ATTR_HIDDEN);
    
public voidsetMaxParallel(int max)
Set max parallel. This is not allowed, and it always throws a BuildException.

param
max ignored
ant.attribute
ignore="true"

        throw new BuildException(getTaskType()
                                 + " doesn\'t support the maxparallel attribute",
                                 getLocation());
    
public voidsetParallel(boolean parallel)
Set parallel. This is not allowed, and it always throws a BuildException.

param
parallel ignored
ant.attribute
ignore="true"

        throw new BuildException(getTaskType()
                                 + " doesn\'t support the parallel attribute",
                                 getLocation());
    
public voidsetReadonly(boolean value)
Set the ReadOnly file attribute.

param
value a boolean value

        addArg(value, ATTR_READONLY);
    
public voidsetSkipEmptyFilesets(boolean skip)
Set skip empty file sets. This is not allowed, and it always throws a BuildException.

param
skip ignored
ant.attribute
ignore="true"

        throw new BuildException(getTaskType() + " doesn\'t support the "
                                 + "skipemptyfileset attribute",
                                 getLocation());
    
public voidsetSystem(boolean value)
Set the System file attribute.

param
value a boolean value

        addArg(value, ATTR_SYSTEM);