1 28 29 30 package org.objectweb.ecm.taskdefs; 31 32 47 public class TempdirTask 48 extends org.apache.tools.ant.Task 49 { 50 private String _dirprop; 52 53 public 55 TempdirTask() 56 { 57 _dirprop = null; 59 } 60 61 65 private void 67 validate() 68 throws org.apache.tools.ant.BuildException 69 { 70 String msg = ""; 71 72 if ((_dirprop==null) || (_dirprop.equals(""))) { 74 msg = "dir attribute is missing"; 75 throw new org.apache.tools.ant.BuildException(msg); 76 } 77 } 78 79 83 final public void 84 setDir(String dirprop) 85 { 86 _dirprop = dirprop; 87 } 88 89 93 final public void 94 execute() 95 throws org.apache.tools.ant.BuildException 96 { 97 validate(); 98 99 java.io.File tempdir = FileHelper.createTempDir(); 101 String dirname = tempdir.getPath(); 102 103 getProject().setProperty(_dirprop, dirname); 105 } 106 } 107 | Popular Tags |