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.lifecycle.Schedule;
23 import org.apache.maven.model.Plugin;
24 import org.apache.maven.plugin.MojoExecution;
25 import org.apache.maven.plugin.descriptor.MojoDescriptor;
26
27 import java.util.concurrent.CountDownLatch;
28
29
30
31
32
33
34
35
36
37 public class ExecutionPlanItem
38 {
39 private final MojoExecution mojoExecution;
40
41 private final Schedule schedule;
42
43
44 private final CountDownLatch done = new CountDownLatch( 1 );
45
46 public ExecutionPlanItem( MojoExecution mojoExecution, Schedule schedule )
47 {
48 this.mojoExecution = mojoExecution;
49 this.schedule = schedule;
50 }
51
52 public MojoExecution getMojoExecution()
53 {
54 return mojoExecution;
55 }
56
57 public String getLifecyclePhase()
58 {
59 return mojoExecution.getLifecyclePhase();
60 }
61
62 public void setComplete()
63 {
64 done.countDown();
65 }
66
67 public boolean isDone()
68 {
69 return done.getCount() < 1;
70 }
71
72 public void forceComplete()
73 {
74 setComplete();
75 }
76
77 public void waitUntilDone()
78 throws InterruptedException
79 {
80 done.await();
81 }
82
83 public Schedule getSchedule()
84 {
85 return schedule;
86 }
87
88 public Plugin getPlugin()
89 {
90 final MojoDescriptor mojoDescriptor = getMojoExecution().getMojoDescriptor();
91 return mojoDescriptor.getPluginDescriptor().getPlugin();
92 }
93
94 @Override
95 public String toString()
96 {
97 return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + ", schedule=" + schedule + '}'
98 + super.toString();
99 }
100
101 }