com.atlassian.maven.plugin.clover.internal
Class AbstractCloverMojo

java.lang.Object
  extended byorg.apache.maven.plugin.AbstractMojo
      extended bycom.atlassian.maven.plugin.clover.internal.AbstractCloverMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
CloverAggregateMojo, CloverCheckMojo, CloverInstrumentInternalMojo, CloverInstrumentMojo, CloverLogMojo, CloverSaveHistoryMojo

public abstract class AbstractCloverMojo
extends org.apache.maven.plugin.AbstractMojo

Common code for all Clover plugin build Mojos.

Version:
$Id: AbstractCloverMojo.java 555822 2007-07-13 00:03:28Z vsiveton $
Author:
Vincent Massol

Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractCloverMojo()
           
 
Method Summary
protected  boolean areCloverDatabasesAvailable()
          Check if a Clover database exists (either a single module Clover database or an aggregated one).
 void execute()
          
 java.lang.String getCloverDatabase()
           
protected  java.lang.String getCloverMergeDatabase()
           
 int getFlushInterval()
           
 java.lang.String getFlushPolicy()
           
 java.lang.String getJdk()
           
 org.apache.maven.project.MavenProject getProject()
           
 org.codehaus.plexus.resource.ResourceManager getResourceManager()
           
 boolean getWaitForFlush()
           
static org.apache.tools.ant.Project registerCloverAntTasks()
          Register the Clover Ant tasks against a fake Ant {Project} object so that we can the tasks later on.
protected  void registerLicenseFile()
           
static void registerLicenseFile(org.apache.maven.project.MavenProject project, org.codehaus.plexus.resource.ResourceManager resourceManager, java.lang.String licenseLocation, org.apache.maven.plugin.logging.Log logger, java.lang.ClassLoader classloader)
          Registers the license file for Clover runtime by setting the clover.license.path system property.
protected  void setLicenseLocation(java.lang.String licenseLocation)
           
 void setProject(org.apache.maven.project.MavenProject project)
           
 void setResourceManager(org.codehaus.plexus.resource.ResourceManager resourceManager)
           
static void waitForFlush(boolean waitForFlush, int flushInterval)
          Wait 2*'flush interval' milliseconds to ensure that the coverage data have been flushed to the Clover database.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCloverMojo

public AbstractCloverMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException

Throws:
org.apache.maven.plugin.MojoExecutionException
See Also:
Mojo.execute()

setResourceManager

public void setResourceManager(org.codehaus.plexus.resource.ResourceManager resourceManager)

getResourceManager

public org.codehaus.plexus.resource.ResourceManager getResourceManager()

registerLicenseFile

protected void registerLicenseFile()
                            throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

registerLicenseFile

public static void registerLicenseFile(org.apache.maven.project.MavenProject project,
                                       org.codehaus.plexus.resource.ResourceManager resourceManager,
                                       java.lang.String licenseLocation,
                                       org.apache.maven.plugin.logging.Log logger,
                                       java.lang.ClassLoader classloader)
                                throws org.apache.maven.plugin.MojoExecutionException
Registers the license file for Clover runtime by setting the clover.license.path system property. If the user has configured the licenseLocation parameter the plugin tries to resolve it first as a resource, then as a URL, and then as a file location on the filesystem. If the licenseLocation parameter has not been defined by the user we look up a default Clover license in the classpath in /clover.license.

Note: We're defining this method as static because it is also required in the report mojo and reporting mojos and main mojos cannot share anything right now. See http://jira.codehaus.org/browse/MNG-1886.

Throws:
org.apache.maven.plugin.MojoExecutionException - when the license file cannot be found

registerCloverAntTasks

public static org.apache.tools.ant.Project registerCloverAntTasks()
Register the Clover Ant tasks against a fake Ant {Project} object so that we can the tasks later on. This is the Java equivalent of the taskdef call that you would need in your Ant build.xml file if you wanted to use the Clover Ant tasks from Ant.

Note: We're defining this method as static because it is also required in the report mojo and reporting mojos and main mojos cannot share anything right now. See http://jira.codehaus.org/browse/MNG-1886.

Returns:
A {Project} instance with the Clover Ant tasks registered in it

waitForFlush

public static void waitForFlush(boolean waitForFlush,
                                int flushInterval)
Wait 2*'flush interval' milliseconds to ensure that the coverage data have been flushed to the Clover database. TODO: This method should not be static but we need it static here because we cannot share code between non report mojos and main build mojos. See http://jira.codehaus.org/browse/MNG-1886


areCloverDatabasesAvailable

protected boolean areCloverDatabasesAvailable()
Check if a Clover database exists (either a single module Clover database or an aggregated one).

Returns:
true if a Clover database exists.

setLicenseLocation

protected void setLicenseLocation(java.lang.String licenseLocation)

getProject

public org.apache.maven.project.MavenProject getProject()

getWaitForFlush

public boolean getWaitForFlush()

getJdk

public java.lang.String getJdk()

getCloverDatabase

public java.lang.String getCloverDatabase()

getCloverMergeDatabase

protected java.lang.String getCloverMergeDatabase()

getFlushInterval

public int getFlushInterval()

getFlushPolicy

public java.lang.String getFlushPolicy()

setProject

public void setProject(org.apache.maven.project.MavenProject project)


Copyright © 2007 Atlassian Software Systems Pty Ltd. All Rights Reserved.