FileDocCategorySizeDatePackage
reportTask.javaAPI DocAndroid 1.5 API5317Wed May 06 22:41:16 BST 2009com.vladium.emma.report

reportTask

public final class reportTask extends com.vladium.emma.ant.FileTask implements IReportEnums, IReportProperties
author
Vlad Roubtsov, (C) 2003

Fields Summary
private ReportCfg
m_reportCfg
Constructors Summary
public reportTask(com.vladium.emma.ant.SuppressableTask parent)

        super (parent);
    
Methods Summary
public com.vladium.emma.report.ReportCfg.Element_HTMLcreateHtml()

        return m_reportCfg.createHtml ();
    
public org.apache.tools.ant.types.PathcreateSourcepath()

        return m_reportCfg.createSourcepath ();
    
public com.vladium.emma.report.ReportCfg.Element_TXTcreateTxt()

        return m_reportCfg.createTxt ();
    
public com.vladium.emma.report.ReportCfg.Element_XMLcreateXml()

        return m_reportCfg.createXml ();
    
public voidexecute()

        if (isEnabled ())
        {
            final String [] reportTypes = m_reportCfg.getReportTypes ();
            
            if ((reportTypes == null) || (reportTypes.length == 0)) // no "txt" default for report processor
                throw (BuildException) newBuildException (getTaskName ()
                    + ": no report types specified: provide at least one of <txt>, <html>, <xml> nested elements", location).fillInStackTrace ();

            String [] files = getDataPath (true);
            if ((files == null) || (files.length == 0))
                throw (BuildException) newBuildException (getTaskName ()
                    + ": no valid input data files have been specified", location).fillInStackTrace ();

            final Path srcpath = m_reportCfg.getSourcepath ();
            
            // combine report and all generic settings:
            final IProperties settings; 
            {
                final IProperties taskSettings = getTaskSettings ();
                final IProperties reportSettings = m_reportCfg.getReportSettings ();
                
                // named report settings override generic named settings and file
                // settings have lower priority than any explicitly named overrides:
                settings = IProperties.Factory.combine (reportSettings, taskSettings);
            }

            final ReportProcessor processor = ReportProcessor.create ();
            
            processor.setDataPath (files); files = null;
            processor.setSourcePath (srcpath != null ? srcpath.list () : null);
            processor.setReportTypes (reportTypes);
            processor.setPropertyOverrides (settings);        
            
            processor.run ();
        }
    
public voidinit()

        super.init ();
        
        m_reportCfg = new ReportCfg (getProject (), this);
    
public voidsetColumns(java.lang.String columns)

        m_reportCfg.setColumns (columns);
    
public voidsetDepth(DepthAttribute depth)

        m_reportCfg.setDepth (depth);
    
public voidsetEncoding(java.lang.String encoding)

        m_reportCfg.setEncoding (encoding);
    
public voidsetMetrics(java.lang.String metrics)

        m_reportCfg.setMetrics (metrics);
    
public voidsetSort(java.lang.String sort)

        m_reportCfg.setSort (sort);
    
public voidsetSourcepath(org.apache.tools.ant.types.Path path)

        m_reportCfg.setSourcepath (path);
    
public voidsetSourcepathRef(org.apache.tools.ant.types.Reference ref)

        m_reportCfg.setSourcepathRef (ref);
    
public voidsetUnits(UnitsTypeAttribute units)

        m_reportCfg.setUnits (units);