org.codehaus.mojo.freeform.analyser
Class Analyser

java.lang.Object
  extended by org.codehaus.mojo.freeform.analyser.Analyser

public abstract class Analyser
extends java.lang.Object

This abstract class is the parent class of all the Analysers.

The Analyser purpose is to analyse the projects and repository for creating a FreeformProject object and a List of AntTarget.

Author:
Rapha??l Pi??roni

Field Summary
protected  java.util.List antTargets
          The list of ant targets that will be created.
protected  FreeformProject freeformProject
          The freeform project that will be created.
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          The local repository of the Maven2 execution.
protected  org.apache.maven.plugin.logging.Log log
          The logging system.
protected  org.apache.maven.project.MavenProject mavenExecutedProject
          The maven project resulting of the phase prerequisite.
protected  java.lang.String mavenpath
          The path to the Maven executable.
protected  org.apache.maven.project.MavenProject mavenProject
          The maven project.
 
Constructor Summary
Analyser()
           
 
Method Summary
 void addAdditionalActions(java.util.List actions)
          This method permits to add some additional actions to the Netbeans context menu.
 void addAdditionalFiles(java.util.List files, boolean useOutputDirectory)
          This method permits to add some additional files to the Netbeans project view.
 void addAdditionalFolders(java.util.List folders, boolean useOutputDirectory)
          This method permits to add some additional folders to the Netbeans project view.
 void addAdditionalTargets(java.util.List targets)
          This method permits to add some additionnal ant targets to the list of AntTargets.
 void analyseProject()
          This method role is to create the FreeformProject using the mavenProject, the mavenExecutedProject and the localRepository.
abstract  void analyseProject(boolean useOutputDirectory)
          This method role is to create the FreeformProject using the mavenProject, the mavenExecutedProject and the localRepository.
protected  void Analyser()
          The default constructor is set to protected to force the creation of an Analyser object only for use in the getAnalyser method.
 void analyseTargets()
          This method role is to create the List of AntTarget using the mavenProject, the mavenExecutedProject and the localRepository.
abstract  void analyseTargets(boolean useOutputDirectory)
          This method role is to create the List of AntTarget using the mavenProject, the mavenExecutedProject and the localRepository.
protected  void createProject(boolean useOutputDirectory)
          This method creates an empty FreeformProject.
protected  void createTargets()
          This method creates an empty AntTarget List.
static Analyser getAnalyser(org.apache.maven.project.MavenProject mavenProject, org.apache.maven.project.MavenProject executedProject, org.apache.maven.artifact.repository.ArtifactRepository localRepository, org.apache.maven.plugin.logging.Log log, java.lang.String mavenpath)
          This method gives the Analyser associated to the mavenProject packaging.
 FreeformProject getProject()
          This method returns the created FreeformProject.
 java.util.List getTargets()
          this method returns the created List of AntTargets.
 void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
          The localRepository setter.
 void setLog(org.apache.maven.plugin.logging.Log log)
          The log setter.
 void setMavenExecutedProject(org.apache.maven.project.MavenProject executedProject)
          The mavenExecutedProject setter.
 void setMavenPath(java.lang.String mavenpath)
          The maven path setter.
 void setMavenProject(org.apache.maven.project.MavenProject mavenProject)
          The mavenProject setter.
protected static java.lang.String toRelative(java.io.File basedir, java.lang.String absolutePath)
          This method computes a relative path given a base directory and an absolute path located in the tree of the basedir.
 java.lang.String toString()
          This method returns the classname of the Analyser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
The local repository of the Maven2 execution.


freeformProject

protected FreeformProject freeformProject
The freeform project that will be created.


antTargets

protected java.util.List antTargets
The list of ant targets that will be created.


log

protected org.apache.maven.plugin.logging.Log log
The logging system.


mavenExecutedProject

protected org.apache.maven.project.MavenProject mavenExecutedProject
The maven project resulting of the phase prerequisite.


mavenProject

protected org.apache.maven.project.MavenProject mavenProject
The maven project.


mavenpath

protected java.lang.String mavenpath
The path to the Maven executable.

Constructor Detail

Analyser

public Analyser()
Method Detail

analyseProject

public final void analyseProject()
                          throws FreeformPluginException
This method role is to create the FreeformProject using the mavenProject, the mavenExecutedProject and the localRepository.

This method must be overrided by each specific Analyser.

Throws:
FreeformPluginException - if something goes wrong.

analyseTargets

public final void analyseTargets()
                          throws FreeformPluginException
This method role is to create the List of AntTarget using the mavenProject, the mavenExecutedProject and the localRepository.

This method must be overrided by each specific Analyser.

Throws:
FreeformPluginException - if something goes wrong.

analyseProject

public abstract void analyseProject(boolean useOutputDirectory)
                             throws FreeformPluginException
This method role is to create the FreeformProject using the mavenProject, the mavenExecutedProject and the localRepository.

This method must be overrided by each specific Analyser.

Parameters:
useOutputDirectory - whether the project elements contains reference to the project directory or not.
Throws:
FreeformPluginException - if something goes wrong.

analyseTargets

public abstract void analyseTargets(boolean useOutputDirectory)
                             throws FreeformPluginException
This method role is to create the List of AntTarget using the mavenProject, the mavenExecutedProject and the localRepository.

This method must be overrided by each specific Analyser.

Parameters:
useOutputDirectory - whether the project elements contains reference to the project directory or not.
Throws:
FreeformPluginException - if something goes wrong.

getAnalyser

public static Analyser getAnalyser(org.apache.maven.project.MavenProject mavenProject,
                                   org.apache.maven.project.MavenProject executedProject,
                                   org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                                   org.apache.maven.plugin.logging.Log log,
                                   java.lang.String mavenpath)
This method gives the Analyser associated to the mavenProject packaging. The returned Analyser is injected withe the given parameters.

Parameters:
mavenProject - The maven project which defines the packaging.
executedProject - The maven prokect resulting of the phases prerequisites.
localRepository - The local repository of the Maven2 execution.
log - The logging system.
mavenpath - The path to the maven executable.
Returns:
the Analyser which is the one defined for the packaging of the given mavenProject.

setLocalRepository

public void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository)
The localRepository setter.

Parameters:
localRepository - The ArtifactRepository to be set.

setLog

public void setLog(org.apache.maven.plugin.logging.Log log)
The log setter.

Parameters:
log - The Log to be set.

setMavenExecutedProject

public void setMavenExecutedProject(org.apache.maven.project.MavenProject executedProject)
The mavenExecutedProject setter.

Parameters:
executedProject - The MavenProject to be set.

setMavenProject

public void setMavenProject(org.apache.maven.project.MavenProject mavenProject)
The mavenProject setter.

Parameters:
mavenProject - The MavenProject to be set.

setMavenPath

public void setMavenPath(java.lang.String mavenpath)
The maven path setter.

Parameters:
mavenpath - The MavenPath to be set.

getProject

public FreeformProject getProject()
This method returns the created FreeformProject.

Returns:
the created FreeformProject.

getTargets

public java.util.List getTargets()
this method returns the created List of AntTargets.

Returns:
the created List.

addAdditionalActions

public void addAdditionalActions(java.util.List actions)
                          throws FreeformPluginException
This method permits to add some additional actions to the Netbeans context menu.

Parameters:
actions - a list of actions to add. (String encoded)
Throws:
FreeformPluginException - if something goes wrong.

addAdditionalFiles

public void addAdditionalFiles(java.util.List files,
                               boolean useOutputDirectory)
                        throws FreeformPluginException
This method permits to add some additional files to the Netbeans project view.

Parameters:
useOutputDirectory - whether the project elements contains reference to the project directory or not.
files - a list of files to add. (String encoded)
Throws:
FreeformPluginException - if something goes wrong.

addAdditionalFolders

public void addAdditionalFolders(java.util.List folders,
                                 boolean useOutputDirectory)
                          throws FreeformPluginException
This method permits to add some additional folders to the Netbeans project view.

Parameters:
useOutputDirectory - whether the project elements contains reference to the project directory or not.
folders - a list of folders to add. (String encoded)
Throws:
FreeformPluginException - if something goes wrong.

addAdditionalTargets

public void addAdditionalTargets(java.util.List targets)
                          throws FreeformPluginException
This method permits to add some additionnal ant targets to the list of AntTargets.

Parameters:
targets - a list of ant target to add. (String encoded)
Throws:
FreeformPluginException - if something goes wrong.

toString

public java.lang.String toString()
This method returns the classname of the Analyser. This is not the full classname.

Overrides:
toString in class java.lang.Object
Returns:
The computed classname.

Analyser

protected void Analyser()
The default constructor is set to protected to force the creation of an Analyser object only for use in the getAnalyser method.


createProject

protected void createProject(boolean useOutputDirectory)
This method creates an empty FreeformProject.

Parameters:
useOutputDirectory - whether the project elements contains reference to the project directory or not.

createTargets

protected void createTargets()
This method creates an empty AntTarget List.


toRelative

protected static java.lang.String toRelative(java.io.File basedir,
                                             java.lang.String absolutePath)
This method computes a relative path given a base directory and an absolute path located in the tree of the basedir.

Parameters:
basedir - The base directory to compute relative path from.
absolutePath - The absolute path to make relative to the base directory.
Returns:
The computed relative path.


Copyright © 2005-2009. All Rights Reserved.