1 package org.apache.maven.lifecycle;
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.plugin.MojoExecution;
23
24
25
26
27
28 @SuppressWarnings( { "UnusedDeclaration" } )
29 public class Schedule
30 {
31 private String phase;
32
33 private String upstreamPhase;
34
35 private String pluginKey;
36
37 private String mojoGoal;
38
39 private boolean mojoSynchronized;
40
41
42
43 private boolean parallel;
44
45 public Schedule()
46 {
47 }
48
49 public Schedule( String phase, boolean mojoSynchronized, boolean parallel )
50 {
51 this.phase = phase;
52 this.mojoSynchronized = mojoSynchronized;
53 this.parallel = parallel;
54 }
55
56
57 public String getPhase()
58 {
59 return phase;
60 }
61
62 public void setPhase( String phase )
63 {
64 this.phase = phase;
65 }
66
67 public String getPluginKey()
68 {
69 return pluginKey;
70 }
71
72 public void setPluginKey( String pluginKey )
73 {
74 this.pluginKey = pluginKey;
75 }
76
77 public boolean isMojoSynchronized()
78 {
79 return mojoSynchronized;
80 }
81
82 public void setMojoSynchronized( boolean mojoSynchronized )
83 {
84 this.mojoSynchronized = mojoSynchronized;
85 }
86
87
88 public boolean isParallel()
89 {
90 return parallel;
91 }
92
93 public void setParallel( boolean parallel )
94 {
95 this.parallel = parallel;
96 }
97
98 public String getUpstreamPhase()
99 {
100 return upstreamPhase;
101 }
102
103 public void setUpstreamPhase( String upstreamPhase )
104 {
105 this.upstreamPhase = upstreamPhase;
106 }
107
108 public String getMojoGoal()
109 {
110 return mojoGoal;
111 }
112
113 public void setMojoGoal( String mojoGoal )
114 {
115 this.mojoGoal = mojoGoal;
116 }
117
118 public boolean hasUpstreamPhaseDefined()
119 {
120 return getUpstreamPhase() != null;
121 }
122
123 public boolean appliesTo( MojoExecution mojoExecution )
124 {
125 boolean pluginKeyMatches = true;
126 boolean pluginGoalMatches = true;
127 if ( pluginKey == null && mojoGoal == null )
128 {
129 return false;
130 }
131 if ( pluginKey != null )
132 {
133 pluginKeyMatches = pluginKey.equals( mojoExecution.getPlugin().getKey() );
134 }
135 if ( mojoGoal != null )
136 {
137 pluginGoalMatches = mojoGoal.equals( mojoExecution.getGoal() );
138 }
139
140 if ( pluginKeyMatches && pluginGoalMatches )
141 {
142 return true;
143 }
144 return false;
145 }
146
147 @Override
148 public String toString()
149 {
150 return "Schedule{" + "phase='" + phase + '\'' + ", upstreamPhase='" + upstreamPhase + '\'' + ", pluginKey='"
151 + pluginKey + '\'' + ", mojoGoal='" + mojoGoal + '\'' + ", mojoSynchronized=" + mojoSynchronized
152 + ", parallel=" + parallel + '}';
153 }
154 }