org.apache.maven
Class MavenSession

java.lang.Object
  extended byorg.apache.maven.AbstractMavenComponent
      extended byorg.apache.maven.MavenSession

public class MavenSession
extends AbstractMavenComponent

This class should represent the single place to access everything that MavenSession provides and control any options provided by MavenSession. Currently this is not entirely the case: there are bits of logic that need to be moved out of App.java and some code that needs to be shuffled between the PluginManager and MavenSession proper.

Version:
$Id: MavenSession.java 517014 2007-03-11 21:15:50Z ltheussl $
Author:
bob mcwhirter, Jason van Zyl
To Do:
Filter the MavenSession version number into a Java constant that will change during compilation.

Field Summary
static java.lang.String BUILD_END_GOAL
          Tag for build end goal.
static java.lang.String BUILD_START_GOAL
          Tag for build start goal.
static java.lang.String DRIVER_SCRIPT_NAME
          Initialization jellyscript name.
 
Constructor Summary
MavenSession()
          Default Constructor.
 
Method Summary
 void attainGoals(Project project, java.util.List goals)
          Attain a list of goals.
 java.util.Set getAllGoalNames()
          Return all goals requested to be attained.
 java.lang.String getGoalDescription(java.lang.String goalName)
          Get a given goal's description.
 java.util.Collection getPluginList()
          Return the current list of plugins.
 PluginManager getPluginManager()
           
 Project getPluginProjectFromGoal(java.lang.String goal)
          Returns a plugin project for the given goal.
 java.util.Set getProjectGoals(Project project)
          Return the goals for the given project.
 MavenJellyContext getRootContext()
           
static java.io.File getRootDescriptorFile()
           
 Project getRootProject()
           
 void initialize()
          Perform pre-build initialization.
 void setPluginManager(PluginManager pluginManager)
          Set the plugin manager to handle plugin loading for the session
 void setRootContext(MavenJellyContext context)
          Set the context for the session
static void setRootDescriptorFile(java.io.File descriptorFile)
          Set the top level project for the session
 void setRootProject(Project project)
          Set the top level project object for the session
 
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

BUILD_START_GOAL

public static final java.lang.String BUILD_START_GOAL
Tag for build start goal.

See Also:
Constant Field Values

BUILD_END_GOAL

public static final java.lang.String BUILD_END_GOAL
Tag for build end goal.

See Also:
Constant Field Values

DRIVER_SCRIPT_NAME

public static final java.lang.String DRIVER_SCRIPT_NAME
Initialization jellyscript name.

See Also:
Constant Field Values
Constructor Detail

MavenSession

public MavenSession()
Default Constructor.

Method Detail

setRootContext

public void setRootContext(MavenJellyContext context)
Set the context for the session

Parameters:
context - the context to use

getRootContext

public MavenJellyContext getRootContext()
Returns:
the root context for the session

setRootDescriptorFile

public static void setRootDescriptorFile(java.io.File descriptorFile)
Set the top level project for the session

Parameters:
descriptorFile - the POM for the top level project

getRootDescriptorFile

public static java.io.File getRootDescriptorFile()
Returns:
the top level project for the session

setRootProject

public void setRootProject(Project project)
Set the top level project object for the session

Parameters:
project - the top level project

getRootProject

public Project getRootProject()
Returns:
the top level project object for the session

setPluginManager

public void setPluginManager(PluginManager pluginManager)
Set the plugin manager to handle plugin loading for the session

Parameters:
pluginManager - a plugin manager

getPluginManager

public PluginManager getPluginManager()
Returns:
the plugin manager for the session

initialize

public void initialize()
                throws java.lang.Exception
Perform pre-build initialization.

Throws:
java.lang.Exception - If an error occurs while performing runtime initialization.

getAllGoalNames

public java.util.Set getAllGoalNames()
Return all goals requested to be attained.

Returns:
All goal names.

getGoalDescription

public java.lang.String getGoalDescription(java.lang.String goalName)
Get a given goal's description.

Parameters:
goalName - Goal name to get the description for.
Returns:
Goal description.

attainGoals

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

Parameters:
project - the project being processed
goals - a list of goal names to execute
Throws:
java.lang.Exception - when anything goes wrong
To Do:
don't throw exception

getPluginProjectFromGoal

public Project getPluginProjectFromGoal(java.lang.String goal)
                                 throws MavenException
Returns a plugin project for the given goal.

Parameters:
goal - a goal name
Returns:
Project
Throws:
MavenException - when anything goes wrong

getProjectGoals

public java.util.Set getProjectGoals(Project project)
                              throws MavenException
Return the goals for the given project.

Parameters:
project - A project
Returns:
A set of goals
Throws:
MavenException - when anything goes wrong

getPluginList

public java.util.Collection getPluginList()
Return the current list of plugins.

Returns:
Collection


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