1 28 29 package com.idaremedia.antx.starters; 30 31 import org.apache.tools.ant.BuildException; 32 import org.apache.tools.ant.Project; 33 34 import com.idaremedia.antx.ownhelpers.OptionalExecuteHelper; 35 import com.idaremedia.antx.parameters.Conditional; 36 37 50 51 public class ConditionalTaskSet extends TaskSet implements Conditional 52 { 53 56 public ConditionalTaskSet() 57 { 58 super(); 59 } 60 61 62 63 67 protected ConditionalTaskSet(String iam) 68 { 69 super(iam); 70 } 71 72 73 74 77 public void setProject(Project project) 78 { 79 super.setProject(project); 80 m_guard.setProject(project); 81 } 82 83 84 85 91 protected ConditionalTaskSet(String iam, boolean delayConfigure) 92 { 93 super(iam,delayConfigure); 94 } 95 96 97 98 102 protected void performNestedTasks() throws BuildException 103 { 104 boolean passIf= testIfCondition(); 105 106 if (passIf && testUnlessCondition()) { 107 performTheCheckedTasks(); 108 } 109 else { 110 logSkippedBecause(passIf, Project.MSG_VERBOSE); 111 } 112 } 113 114 115 116 123 protected void performTheCheckedTasks() 124 { 125 performTheTasksList(); 126 } 127 128 129 130 133 public void setIf(String property) 134 { 135 m_guard.setIf(property); 136 } 137 138 139 140 144 public String getIfProperty() 145 { 146 String s = m_guard.getIfProperty(); 147 return s==null ? "" : s; 148 } 149 150 151 152 155 public void setUnless(String property) 156 { 157 m_guard.setUnless(property); 158 } 159 160 161 162 166 public String getUnlessProperty() 167 { 168 String s = m_guard.getUnlessProperty(); 169 return s==null ? "" : s; 170 } 171 172 173 174 180 public boolean testIfCondition() 181 { 182 return m_guard.testIfCondition(); 183 } 184 185 186 187 193 public boolean testUnlessCondition() 194 { 195 return m_guard.testUnlessCondition(); 196 } 197 198 199 200 204 protected final void logSkippedBecause(boolean passIf, int logLevel) 205 { 206 m_guard.logSkippedBecause(this,passIf,logLevel); 207 } 208 209 210 211 215 protected final void logSkippedBecause(boolean passIf) 216 { 217 m_guard.logSkippedBecause(this,passIf,Project.MSG_VERBOSE); 218 } 219 220 221 222 223 protected final OptionalExecuteHelper m_guard = 224 new OptionalExecuteHelper(); 225 } 226 227 228 | Popular Tags |