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