View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.eventspy.internal;
20  
21  import org.apache.maven.execution.AbstractExecutionListener;
22  import org.apache.maven.execution.ExecutionEvent;
23  import org.apache.maven.execution.ExecutionListener;
24  
25  /**
26   * Forwards execution events to EventSpies.
27   * @since 3.0.2
28   */
29  class EventSpyExecutionListener extends AbstractExecutionListener {
30  
31      private final EventSpyDispatcher dispatcher;
32  
33      private final ExecutionListener delegate;
34  
35      EventSpyExecutionListener(EventSpyDispatcher dispatcher, ExecutionListener delegate) {
36          this.dispatcher = dispatcher;
37          this.delegate = delegate;
38      }
39  
40      @Override
41      public void projectDiscoveryStarted(ExecutionEvent event) {
42          dispatcher.onEvent(event);
43          delegate.projectDiscoveryStarted(event);
44      }
45  
46      @Override
47      public void sessionStarted(ExecutionEvent event) {
48          dispatcher.onEvent(event);
49          delegate.sessionStarted(event);
50      }
51  
52      @Override
53      public void sessionEnded(ExecutionEvent event) {
54          dispatcher.onEvent(event);
55          delegate.sessionEnded(event);
56      }
57  
58      @Override
59      public void projectSkipped(ExecutionEvent event) {
60          dispatcher.onEvent(event);
61          delegate.projectSkipped(event);
62      }
63  
64      @Override
65      public void projectStarted(ExecutionEvent event) {
66          dispatcher.onEvent(event);
67          delegate.projectStarted(event);
68      }
69  
70      @Override
71      public void projectSucceeded(ExecutionEvent event) {
72          dispatcher.onEvent(event);
73          delegate.projectSucceeded(event);
74      }
75  
76      @Override
77      public void projectFailed(ExecutionEvent event) {
78          dispatcher.onEvent(event);
79          delegate.projectFailed(event);
80      }
81  
82      @Override
83      public void forkStarted(ExecutionEvent event) {
84          dispatcher.onEvent(event);
85          delegate.forkStarted(event);
86      }
87  
88      @Override
89      public void forkSucceeded(ExecutionEvent event) {
90          dispatcher.onEvent(event);
91          delegate.forkSucceeded(event);
92      }
93  
94      @Override
95      public void forkFailed(ExecutionEvent event) {
96          dispatcher.onEvent(event);
97          delegate.forkFailed(event);
98      }
99  
100     @Override
101     public void mojoSkipped(ExecutionEvent event) {
102         dispatcher.onEvent(event);
103         delegate.mojoSkipped(event);
104     }
105 
106     @Override
107     public void mojoStarted(ExecutionEvent event) {
108         dispatcher.onEvent(event);
109         delegate.mojoStarted(event);
110     }
111 
112     @Override
113     public void mojoSucceeded(ExecutionEvent event) {
114         dispatcher.onEvent(event);
115         delegate.mojoSucceeded(event);
116     }
117 
118     @Override
119     public void mojoFailed(ExecutionEvent event) {
120         dispatcher.onEvent(event);
121         delegate.mojoFailed(event);
122     }
123 
124     @Override
125     public void forkedProjectStarted(ExecutionEvent event) {
126         dispatcher.onEvent(event);
127         delegate.forkedProjectStarted(event);
128     }
129 
130     @Override
131     public void forkedProjectSucceeded(ExecutionEvent event) {
132         dispatcher.onEvent(event);
133         delegate.forkedProjectSucceeded(event);
134     }
135 
136     @Override
137     public void forkedProjectFailed(ExecutionEvent event) {
138         dispatcher.onEvent(event);
139         delegate.forkedProjectFailed(event);
140     }
141 }