ExamplesThis page has some examples of using ISDirValidator. Basic exampleThis is the one example to see the use of ISDirValidator using the Antīs tasks. <taskdef name="isdirectory" classname="com.inigoserrano.isdirvalidator.ISDirectory"/> <taskdef name="isfile" classname="com.inigoserrano.isdirvalidator.ISFile"/> <taskdef name="isfilepattern" classname="com.inigoserrano.isdirvalidator.ISFilePattern"/> <isdirectory dir="folder" /> <isdirectory dir="..\ISDirCheck\"> <isfile file="build.xml" required="Y" /> <isfile file="Definition.txt" required="N" /> <isfilePattern filePattern="[az]*.txt" /> <isfilePattern filePattern=".xml" /> </isdirectory> DescriptionFrist we define the tags because they arenīt standard in Ant. We use the <taskdef name="isdirectory" classname="com.inigoserrano.isdirvalidator.ISDirectory"/> <taskdef name="isfile" classname="com.inigoserrano.isdirvalidator.ISFile"/> <taskdef name="isfilepattern" classname="com.inigoserrano.isdirvalidator.ISFilePattern"/> The frist task is the simplest form (not very usefull) and checks that the directory <isdirectory dir="folder" /> The second task check that the directory
<isdirectory dir="..\ISDirCheck\"> <isfile file="build.xml" required="Y" /> <isfile file="Definition.txt" required="N" /> <isfilePattern filePattern="[az]*.txt" /> <isfilePattern filePattern=".xml" /> </isdirectory> This task will fail
WAR exampleAnother example of use coud be the definition of the structure of a Servlet's WAR folder. <isdirectory dir="some dir root of a war file"> <isfile file="index.jsp" required="Y" /> <isfilePattern filePattern="^[a-zA-Z]+\.jsp$" /> <isfilePattern filePattern="^[a-zA-Z]+\.htm$" /> ... </isdirectory> <isdirectory dir="some dir with a war file/META-INF"> <isfile file="MANIFEST.MF" required="Y" /> ... </isdirectory> <isdirectory dir="some dir with a war file/WEB-INF"> <isfile file="web.xml" required="Y" /> <isfilePattern filePattern="^[a-zA-Z-]+\.tld$" /> ... </isdirectory> |