FileDocCategorySizeDatePackage
AttrFile.javaAPI DocGlassfish v2 API3682Fri May 04 22:24:36 BST 2007com.sun.enterprise.config.serverbeans.validation

AttrFile

public class AttrFile extends AttrType
Class which contains Meta data for all types of attributes which is present in Validation Descriptor XML File Sample type="address" /> type="integer" range="low,high" /> type="string" max-length="length" />
author
Srinivas Krishnan
version
2.0

Fields Summary
boolean
checkExists
Constructors Summary
public AttrFile(String name, String type, boolean optional)

        super(name,type, optional);
        checkExists = false;
    
Methods Summary
public voidsetCheckExists(boolean flag)

        checkExists = flag;
    
public voidvalidate(java.lang.Object o, ValidationContext valCtx)

        super.validate(o, valCtx); // call to common validator first
	if(o == null || o.equals(""))
		return;
        if(checkExists || StaticTest.fileCheck) {
            File f = new File((String)o);
            if(!f.exists()) 
               valCtx.result.failed(valCtx.smh.getLocalString(getClass().getName() + ".fileNotExists",
                                            "Attribute({0}={1}) : {2} : Does not exists", new Object[] {valCtx.attrName, o, o}));
            else if(!f.canRead()) 
               valCtx.result.failed(valCtx.smh.getLocalString(getClass().getName() + ".filecannotRead",
                                            "Attribute({0}={1}) : {2} : Does not have read permission", new Object[] {valCtx.attrName, o, o}));
        }