001package 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
022import org.apache.maven.execution.scope.WeakMojoExecutionListener;
023import org.apache.maven.plugin.Mojo;
024import org.apache.maven.plugin.MojoExecution;
025import org.apache.maven.project.MavenProject;
026
027/**
028 * Encapsulates parameters of MojoExecutionListener callback methods and is meant to provide API evolution path should
029 * it become necessary to introduce new parameters in the existing callbacks in the future.
030 * 
031 * @see MojoExecutionListener
032 * @see WeakMojoExecutionListener
033 * @since 3.1.2
034 * @provisional This class is part of work in progress and can be changed or removed without notice.
035 */
036public class MojoExecutionEvent
037{
038    private final MavenSession session;
039
040    private final MavenProject project;
041
042    private final MojoExecution mojoExecution;
043
044    private final Mojo mojo;
045
046    private final Throwable cause;
047
048    public MojoExecutionEvent( MavenSession session, MavenProject project, MojoExecution mojoExecution, Mojo mojo )
049    {
050        this( session, project, mojoExecution, mojo, null );
051    }
052
053    public MojoExecutionEvent( MavenSession session, MavenProject project, MojoExecution mojoExecution, Mojo mojo,
054                               Throwable cause )
055    {
056        this.session = session;
057        this.project = project;
058        this.mojoExecution = mojoExecution;
059        this.mojo = mojo;
060        this.cause = cause;
061    }
062
063    public MavenSession getSession()
064    {
065        return session;
066    }
067
068    public MavenProject getProject()
069    {
070        return project;
071    }
072
073    public MojoExecution getExecution()
074    {
075        return mojoExecution;
076    }
077
078    public Mojo getMojo()
079    {
080        return mojo;
081    }
082
083    public Throwable getCause()
084    {
085        return cause;
086    }
087}