| 1 | |
package org.apache.maven.execution; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
import org.apache.maven.artifact.repository.ArtifactRepository; |
| 23 | |
import org.apache.maven.monitor.event.EventDispatcher; |
| 24 | |
import org.apache.maven.plugin.descriptor.PluginDescriptor; |
| 25 | |
import org.apache.maven.project.MavenProject; |
| 26 | |
import org.apache.maven.settings.Settings; |
| 27 | |
import org.codehaus.plexus.PlexusContainer; |
| 28 | |
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; |
| 29 | |
|
| 30 | |
import java.util.Date; |
| 31 | |
import java.util.List; |
| 32 | |
import java.util.Map; |
| 33 | |
import java.util.Properties; |
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
public class MavenSession |
| 40 | |
{ |
| 41 | |
private PlexusContainer container; |
| 42 | |
|
| 43 | |
private ArtifactRepository localRepository; |
| 44 | |
|
| 45 | |
private List goals; |
| 46 | |
|
| 47 | |
private EventDispatcher eventDispatcher; |
| 48 | |
|
| 49 | |
|
| 50 | |
private final Settings settings; |
| 51 | |
|
| 52 | |
private ReactorManager reactorManager; |
| 53 | |
|
| 54 | |
private final String executionRootDir; |
| 55 | |
|
| 56 | 0 | private boolean usingPOMsFromFilesystem = true; |
| 57 | |
|
| 58 | |
private final Properties executionProperties; |
| 59 | |
|
| 60 | |
private final Date startTime; |
| 61 | |
|
| 62 | |
private MavenProject currentProject; |
| 63 | |
|
| 64 | |
public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository, |
| 65 | |
EventDispatcher eventDispatcher, ReactorManager reactorManager, List goals, |
| 66 | |
String executionRootDir, Properties executionProperties, Date startTime ) |
| 67 | 0 | { |
| 68 | 0 | this.container = container; |
| 69 | |
|
| 70 | 0 | this.settings = settings; |
| 71 | |
|
| 72 | 0 | this.localRepository = localRepository; |
| 73 | |
|
| 74 | 0 | this.eventDispatcher = eventDispatcher; |
| 75 | |
|
| 76 | 0 | this.reactorManager = reactorManager; |
| 77 | |
|
| 78 | 0 | this.goals = goals; |
| 79 | |
|
| 80 | 0 | this.executionRootDir = executionRootDir; |
| 81 | |
|
| 82 | 0 | this.executionProperties = executionProperties; |
| 83 | |
|
| 84 | 0 | this.startTime = startTime; |
| 85 | 0 | } |
| 86 | |
|
| 87 | |
public Map getPluginContext( PluginDescriptor pluginDescriptor, MavenProject project ) |
| 88 | |
{ |
| 89 | 0 | return reactorManager.getPluginContext( pluginDescriptor, project ); |
| 90 | |
} |
| 91 | |
|
| 92 | |
public PlexusContainer getContainer() |
| 93 | |
{ |
| 94 | 0 | return container; |
| 95 | |
} |
| 96 | |
|
| 97 | |
public ArtifactRepository getLocalRepository() |
| 98 | |
{ |
| 99 | 0 | return localRepository; |
| 100 | |
} |
| 101 | |
|
| 102 | |
public List getGoals() |
| 103 | |
{ |
| 104 | 0 | return goals; |
| 105 | |
} |
| 106 | |
|
| 107 | |
public Properties getExecutionProperties() |
| 108 | |
{ |
| 109 | 0 | return executionProperties; |
| 110 | |
} |
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
public Object lookup( String role ) |
| 117 | |
throws ComponentLookupException |
| 118 | |
{ |
| 119 | 0 | return container.lookup( role ); |
| 120 | |
} |
| 121 | |
|
| 122 | |
public Object lookup( String role, String roleHint ) |
| 123 | |
throws ComponentLookupException |
| 124 | |
{ |
| 125 | 0 | return container.lookup( role, roleHint ); |
| 126 | |
} |
| 127 | |
|
| 128 | |
public List lookupList( String role ) |
| 129 | |
throws ComponentLookupException |
| 130 | |
{ |
| 131 | 0 | return container.lookupList( role ); |
| 132 | |
} |
| 133 | |
|
| 134 | |
public Map lookupMap( String role ) |
| 135 | |
throws ComponentLookupException |
| 136 | |
{ |
| 137 | 0 | return container.lookupMap( role ); |
| 138 | |
} |
| 139 | |
|
| 140 | |
public EventDispatcher getEventDispatcher() |
| 141 | |
{ |
| 142 | 0 | return eventDispatcher; |
| 143 | |
} |
| 144 | |
|
| 145 | |
public Settings getSettings() |
| 146 | |
{ |
| 147 | 0 | return settings; |
| 148 | |
} |
| 149 | |
|
| 150 | |
public List getSortedProjects() |
| 151 | |
{ |
| 152 | 0 | return reactorManager.getSortedProjects(); |
| 153 | |
} |
| 154 | |
|
| 155 | |
public String getExecutionRootDirectory() |
| 156 | |
{ |
| 157 | 0 | return executionRootDir; |
| 158 | |
} |
| 159 | |
|
| 160 | |
public void setUsingPOMsFromFilesystem( boolean usingPOMsFromFilesystem ) |
| 161 | |
{ |
| 162 | 0 | this.usingPOMsFromFilesystem = usingPOMsFromFilesystem; |
| 163 | 0 | } |
| 164 | |
|
| 165 | |
public boolean isUsingPOMsFromFilesystem() |
| 166 | |
{ |
| 167 | 0 | return usingPOMsFromFilesystem; |
| 168 | |
} |
| 169 | |
|
| 170 | |
public Date getStartTime() |
| 171 | |
{ |
| 172 | 0 | return startTime; |
| 173 | |
} |
| 174 | |
|
| 175 | |
public void setCurrentProject( MavenProject currentProject ) |
| 176 | |
{ |
| 177 | 0 | this.currentProject = currentProject; |
| 178 | 0 | } |
| 179 | |
|
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | |
public MavenProject getCurrentProject() |
| 184 | |
{ |
| 185 | 0 | return currentProject; |
| 186 | |
} |
| 187 | |
|
| 188 | |
} |