org.apache.maven.plugin
Class PluginManager

java.lang.Object
  extended byorg.apache.maven.AbstractMavenComponent
      extended byorg.apache.maven.plugin.PluginManager

public class PluginManager
extends AbstractMavenComponent

Plugin manager for MavenSession.

The PluginManager deals with all aspects of a plugins lifecycle.

This is not thread safe.

Version:
$Id: PluginManager.java 517014 2007-03-11 21:15:50Z ltheussl $
Author:
Jason van Zyl, bob mcwhirter, Brett Porter

Field Summary
static java.lang.String BASE_CONTEXT
           
static java.lang.String GLOBAL_SESSION_KEY
          The variable key that holds an implementation of the com.werken.werkz.Session in the parent scope context.
static java.lang.String GOAL_MAPPER
           
static java.lang.String PLUGIN_HOUSING
           
static java.lang.String PLUGIN_MANAGER
           
 
Constructor Summary
PluginManager(MavenSession session)
          Default constructor.
 
Method Summary
 void addDelayedPops(java.util.Set set)
           
 void attainGoals(Project project, java.util.List goals)
          Attain the goals.
 void cleanupAttainGoal(java.util.Set pluginSet)
           
 java.lang.String getGoalDescription(java.lang.String goalName)
           
 java.util.Set getGoalNames()
           
 java.util.Set getGoalNames(Project project)
          Warning - this completely scrogs the default mapper.
 MavenJellyContext getPluginContext(java.lang.String id)
           
 java.util.Collection getPluginList()
           
 Project getPluginProjectFromGoal(java.lang.String goal)
           
 void initialize()
          Initialize all plugins.
 void installPlugin(java.io.File file, Project parentProject)
           
 void installPlugin(java.io.File file, Project parentProject, boolean cache)
          Load and install a plugin.
(package private)  JellyScriptHousing loadPluginHousing(java.lang.String name, java.io.File pluginDir)
           
(package private)  void mapArtifactIdToPluginHousing(java.lang.String artifactId, JellyScriptHousing housing)
           
 java.util.Set prepAttainGoal(java.lang.String goalName, MavenJellyContext baseContext, GoalToJellyScriptHousingMapper goalMapper)
          Use the name of a goal to lookup all the plugins (that are stored in the plugin housings) that need to be executed in order to satisfy all the required preconditions for successful goal attainment.
 void processDependencies(Project project)
          Process the dependencies of the project, adding dependencies to the appropriate classloader etc
(package private)  java.util.List readMavenXml(Project project, GoalToJellyScriptHousingMapper mapper)
           
(package private)  void runScript(JellyScriptHousing jellyScriptHousing, MavenJellyContext context)
           
(package private)  MavenJellyContext setupBaseContext(Project project)
           
 void uninstallPlugin(java.lang.String artifactId)
           
(package private)  java.io.File unpackPlugin(java.lang.String pluginName, java.io.File jarFile, boolean cache)
          Unpack the plugin.
 
Methods inherited from class org.apache.maven.AbstractMavenComponent
getMessage, getMessage, getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBAL_SESSION_KEY

public static final java.lang.String GLOBAL_SESSION_KEY
The variable key that holds an implementation of the com.werken.werkz.Session in the parent scope context.

See Also:
Constant Field Values

PLUGIN_MANAGER

public static final java.lang.String PLUGIN_MANAGER
See Also:
Constant Field Values

PLUGIN_HOUSING

public static final java.lang.String PLUGIN_HOUSING
See Also:
Constant Field Values

GOAL_MAPPER

public static final java.lang.String GOAL_MAPPER
See Also:
Constant Field Values

BASE_CONTEXT

public static final java.lang.String BASE_CONTEXT
See Also:
Constant Field Values
Constructor Detail

PluginManager

public PluginManager(MavenSession session)
Default constructor.

Parameters:
session - The MavenSession this plugin manager will use until Maven shuts down.
Method Detail

initialize

public void initialize()
                throws java.io.IOException,
                       MavenException
Initialize all plugins.

Throws:
java.io.IOException
MavenException

loadPluginHousing

JellyScriptHousing loadPluginHousing(java.lang.String name,
                                     java.io.File pluginDir)
                               throws java.io.IOException
Throws:
java.io.IOException

mapArtifactIdToPluginHousing

void mapArtifactIdToPluginHousing(java.lang.String artifactId,
                                  JellyScriptHousing housing)

processDependencies

public void processDependencies(Project project)
                         throws java.net.MalformedURLException,
                                java.lang.Exception
Process the dependencies of the project, adding dependencies to the appropriate classloader etc

Throws:
java.net.MalformedURLException - if a file can't be converted to a URL.
java.lang.Exception - for any other issue. FIXME

readMavenXml

java.util.List readMavenXml(Project project,
                            GoalToJellyScriptHousingMapper mapper)
                      throws MavenException
Throws:
MavenException

setupBaseContext

MavenJellyContext setupBaseContext(Project project)

attainGoals

public void attainGoals(Project project,
                        java.util.List goals)
                 throws java.lang.Exception
Attain the goals.

Throws:
java.lang.Exception - If one of the specified goals refers to an non-existent goal.
java.lang.Exception - If an exception occurs while running a goal.
To Do:
stop throwing Exception

cleanupAttainGoal

public void cleanupAttainGoal(java.util.Set pluginSet)
                       throws java.lang.Exception
Throws:
java.lang.Exception
To Do:
don't throw Exception

prepAttainGoal

public java.util.Set prepAttainGoal(java.lang.String goalName,
                                    MavenJellyContext baseContext,
                                    GoalToJellyScriptHousingMapper goalMapper)
                             throws java.lang.Exception
Use the name of a goal to lookup all the plugins (that are stored in the plugin housings) that need to be executed in order to satisfy all the required preconditions for successful goal attainment.

Parameters:
goalName - the goal
baseContext - the base context to attain in
Returns:
a set of plugins required to attain the goal
Throws:
java.lang.Exception
To Do:
don't throw Exception

getGoalNames

public java.util.Set getGoalNames()
Returns:
Set

getGoalNames

public java.util.Set getGoalNames(Project project)
                           throws MavenException
Warning - this completely scrogs the default mapper. Only use this before System.exit! (currently used by maven -u).

Returns:
Set
Throws:
MavenException
To Do:
refactor to return mapper instead and use that, or perhaps instantiate a new plugin manager

installPlugin

public void installPlugin(java.io.File file,
                          Project parentProject)
                   throws MavenException
Throws:
MavenException

installPlugin

public void installPlugin(java.io.File file,
                          Project parentProject,
                          boolean cache)
                   throws MavenException
Load and install a plugin.

Parameters:
file - the file to install. Must be a plugin jar
parentProject - the project to load the installed plugin into
Throws:
MavenException

uninstallPlugin

public void uninstallPlugin(java.lang.String artifactId)
                     throws java.io.IOException
Throws:
java.io.IOException

getPluginContext

public MavenJellyContext getPluginContext(java.lang.String id)
                                   throws MavenException,
                                          UnknownPluginException
Parameters:
id -
Returns:
MavenJellyContext
Throws:
UnknownPluginException
MavenException
To Do:
[1.0] refactor out, or make more appropriate structure, remove throws Exception

getGoalDescription

public java.lang.String getGoalDescription(java.lang.String goalName)

addDelayedPops

public void addDelayedPops(java.util.Set set)

unpackPlugin

java.io.File unpackPlugin(java.lang.String pluginName,
                          java.io.File jarFile,
                          boolean cache)
                    throws MavenException
Unpack the plugin.

Throws:
MavenException - if there was a problem unpacking

runScript

void runScript(JellyScriptHousing jellyScriptHousing,
               MavenJellyContext context)
         throws java.lang.Exception
Parameters:
context -
Throws:
java.lang.Exception
To Do:
get rid of throws Exception

getPluginProjectFromGoal

public Project getPluginProjectFromGoal(java.lang.String goal)
                                 throws MavenException
Throws:
MavenException

getPluginList

public java.util.Collection getPluginList()


Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.