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.plugin.MojoExecution;
023    import org.apache.maven.project.MavenProject;
024    
025    /**
026     * Holds data relevant for an execution event.
027     * 
028     * @author Benjamin Bentmann
029     */
030    public interface ExecutionEvent
031    {
032    
033        /**
034         * The possible types of execution events.
035         */
036        enum Type
037        {
038            ProjectDiscoveryStarted,
039            SessionStarted,
040            SessionEnded,
041            ProjectSkipped,
042            ProjectStarted,
043            ProjectSucceeded,
044            ProjectFailed,
045            MojoSkipped,
046            MojoStarted,
047            MojoSucceeded,
048            MojoFailed,
049            ForkStarted,
050            ForkSucceeded,
051            ForkFailed,
052            ForkedProjectStarted,
053            ForkedProjectSucceeded,
054            ForkedProjectFailed,
055        }
056    
057        /**
058         * Gets the type of the event.
059         * 
060         * @return The type of the event, never {@code null}.
061         */
062        Type getType();
063    
064        /**
065         * Gets the session from which this event originates.
066         * 
067         * @return The current session, never {@code null}.
068         */
069        MavenSession getSession();
070    
071        /**
072         * Gets the current project (if any).
073         * 
074         * @return The current project or {@code null} if not applicable.
075         */
076        MavenProject getProject();
077    
078        /**
079         * Gets the current mojo execution (if any).
080         * 
081         * @return The current mojo execution or {@code null} if not applicable.
082         */
083        MojoExecution getMojoExecution();
084    
085        /**
086         * Gets the exception that caused the event (if any).
087         * 
088         * @return The exception or {@code null} if none.
089         */
090        Exception getException();
091    
092    }