1 package org.apache.maven.lifecycle.internal;
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.execution.ExecutionEvent;
23 import org.apache.maven.execution.ExecutionListener;
24 import org.apache.maven.execution.MavenSession;
25 import org.apache.maven.plugin.MojoExecution;
26 import org.codehaus.plexus.component.annotations.Component;
27
28
29
30
31
32
33
34
35 @Component( role = ExecutionEventCatapult.class )
36 public class DefaultExecutionEventCatapult
37 implements ExecutionEventCatapult
38 {
39
40 public void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution )
41 {
42 fire( eventType, session, mojoExecution, null );
43 }
44
45 public void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution,
46 Exception exception )
47 {
48 ExecutionListener listener = session.getRequest().getExecutionListener();
49
50 if ( listener != null )
51 {
52 ExecutionEvent event = new DefaultExecutionEvent( eventType, session, mojoExecution, exception );
53
54 switch ( eventType )
55 {
56 case ProjectDiscoveryStarted:
57 listener.projectDiscoveryStarted( event );
58 break;
59
60 case SessionStarted:
61 listener.sessionStarted( event );
62 break;
63 case SessionEnded:
64 listener.sessionEnded( event );
65 break;
66
67 case ProjectSkipped:
68 listener.projectSkipped( event );
69 break;
70 case ProjectStarted:
71 listener.projectStarted( event );
72 break;
73 case ProjectSucceeded:
74 listener.projectSucceeded( event );
75 break;
76 case ProjectFailed:
77 listener.projectFailed( event );
78 break;
79
80 case MojoSkipped:
81 listener.mojoSkipped( event );
82 break;
83 case MojoStarted:
84 listener.mojoStarted( event );
85 break;
86 case MojoSucceeded:
87 listener.mojoSucceeded( event );
88 break;
89 case MojoFailed:
90 listener.mojoFailed( event );
91 break;
92
93 case ForkStarted:
94 listener.forkStarted( event );
95 break;
96 case ForkSucceeded:
97 listener.forkSucceeded( event );
98 break;
99 case ForkFailed:
100 listener.forkFailed( event );
101 break;
102
103 case ForkedProjectStarted:
104 listener.forkedProjectStarted( event );
105 break;
106 case ForkedProjectSucceeded:
107 listener.forkedProjectSucceeded( event );
108 break;
109 case ForkedProjectFailed:
110 listener.forkedProjectFailed( event );
111 break;
112
113 default:
114 throw new IllegalStateException( "Unknown execution event type " + eventType );
115 }
116 }
117 }
118
119 }