001: package org.apache.maven.execution;
002:
003: /*
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021:
022: import org.apache.maven.artifact.repository.ArtifactRepository;
023: import org.apache.maven.monitor.event.EventDispatcher;
024: import org.apache.maven.plugin.descriptor.PluginDescriptor;
025: import org.apache.maven.project.MavenProject;
026: import org.apache.maven.settings.Settings;
027: import org.codehaus.plexus.PlexusContainer;
028: import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
029:
030: import java.io.File;
031: import java.util.Date;
032: import java.util.LinkedHashMap;
033: import java.util.List;
034: import java.util.Map;
035: import java.util.Properties;
036:
037: /**
038: * @author Jason van Zyl
039: * @version $Id: MavenSession.java 573437 2007-09-07 03:49:48Z jvanzyl $
040: */
041: public class MavenSession {
042: private PlexusContainer container;
043:
044: private EventDispatcher eventDispatcher;
045:
046: private ReactorManager reactorManager;
047:
048: private boolean usingPOMsFromFilesystem = true;
049:
050: private MavenExecutionRequest request;
051:
052: private Map reports = new LinkedHashMap();
053:
054: public MavenSession(PlexusContainer container,
055: MavenExecutionRequest request,
056: EventDispatcher eventDispatcher,
057: ReactorManager reactorManager) {
058: this .container = container;
059:
060: this .request = request;
061:
062: this .eventDispatcher = eventDispatcher;
063:
064: this .reactorManager = reactorManager;
065: }
066:
067: public Map getPluginContext(PluginDescriptor pluginDescriptor,
068: MavenProject project) {
069: return reactorManager.getPluginContext(pluginDescriptor,
070: project);
071: }
072:
073: public PlexusContainer getContainer() {
074: return container;
075: }
076:
077: public ArtifactRepository getLocalRepository() {
078: return request.getLocalRepository();
079: }
080:
081: public List getGoals() {
082: return request.getGoals();
083: }
084:
085: public Properties getExecutionProperties() {
086: return request.getProperties();
087: }
088:
089: // ----------------------------------------------------------------------
090: //
091: // ----------------------------------------------------------------------
092:
093: public Object lookup(String role) throws ComponentLookupException {
094: return container.lookup(role);
095: }
096:
097: public Object lookup(String role, String roleHint)
098: throws ComponentLookupException {
099: return container.lookup(role, roleHint);
100: }
101:
102: public List lookupList(String role) throws ComponentLookupException {
103: return container.lookupList(role);
104: }
105:
106: public Map lookupMap(String role) throws ComponentLookupException {
107: return container.lookupMap(role);
108: }
109:
110: public EventDispatcher getEventDispatcher() {
111: return eventDispatcher;
112: }
113:
114: public Settings getSettings() {
115: return request.getSettings();
116: }
117:
118: public List getSortedProjects() {
119: return reactorManager.getSortedProjects();
120: }
121:
122: public String getExecutionRootDirectory() {
123: return request.getBaseDirectory();
124: }
125:
126: public boolean isUsingPOMsFromFilesystem() {
127: return request.isProjectPresent();
128: }
129:
130: public Date getStartTime() {
131: return request.getStartTime();
132: }
133:
134: public MavenExecutionRequest getRequest() {
135: return request;
136: }
137:
138: }
|