1 9 package com.vladium.emma.data; 10 11 import java.io.File ; 12 13 import org.apache.tools.ant.BuildException; 14 15 import com.vladium.emma.ant.FileTask; 16 import com.vladium.emma.ant.SuppressableTask; 17 18 22 public 23 final class mergeTask extends FileTask 24 { 25 27 28 public mergeTask (final SuppressableTask parent) 29 { 30 super (parent); 31 } 32 33 public void execute () throws BuildException 34 { 35 if (isEnabled ()) 36 { 37 String [] files = getDataPath (true); 38 if ((files == null) || (files.length == 0)) 39 throw (BuildException) newBuildException (getTaskName () 40 + ": no valid input data files have been specified", location).fillInStackTrace (); 41 42 final MergeProcessor processor = MergeProcessor.create (); 43 44 processor.setDataPath (files); files = null; 45 processor.setSessionOutFile (m_outFile != null ? m_outFile.getAbsolutePath () : null); 46 processor.setPropertyOverrides (getTaskSettings ()); 47 48 processor.run (); 49 } 50 } 51 52 53 55 public void setMergefile (final File file) 56 { 57 if (m_outFile != null) 58 throw (BuildException) newBuildException (getTaskName () 59 + ": merge data file attribute already set", location).fillInStackTrace (); 60 61 m_outFile = file; 62 } 63 64 public void setOutfile (final File file) 65 { 66 if (m_outFile != null) 67 throw (BuildException) newBuildException (getTaskName () 68 + ": merge data file attribute already set", location).fillInStackTrace (); 69 70 m_outFile = file; 71 } 72 73 public void setTofile (final File file) 74 { 75 if (m_outFile != null) 76 throw (BuildException) newBuildException (getTaskName () 77 + ": merge data file attribute already set", location).fillInStackTrace (); 78 79 m_outFile = file; 80 } 81 82 public void setFile (final File file) 83 { 84 if (m_outFile != null) 85 throw (BuildException) newBuildException (getTaskName () 86 + ": merge data file attribute already set", location).fillInStackTrace (); 87 88 m_outFile = file; 89 } 90 91 92 94 96 98 99 private File m_outFile; 100 101 } | Popular Tags |