1 28 29 package com.idaremedia.antx.flowcontrol.wrap; 30 31 import java.util.Iterator ; 32 import java.util.List ; 33 34 import org.apache.tools.ant.BuildException; 35 import org.apache.tools.ant.Project; 36 37 import com.idaremedia.antx.AntX; 38 import com.idaremedia.antx.FixtureOverlay; 39 import com.idaremedia.antx.apis.Requester; 40 import com.idaremedia.antx.helpers.Strings; 41 import com.idaremedia.antx.helpers.Tk; 42 import com.idaremedia.antx.starters.TaskSet; 43 44 68 69 public class IsolatedTaskSet extends TaskSet 70 implements FixtureOverlay 71 { 72 75 public IsolatedTaskSet() 76 { 77 super(AntX.flow+"isolated"); 78 } 79 80 81 82 86 public IsolatedTaskSet(String iam) 87 { 88 super(iam); 89 } 90 91 92 93 99 public IsolatedTaskSet(String iam, boolean delayConfigure) 100 { 101 super(iam,delayConfigure); 102 } 103 104 105 106 112 public void init() 113 { 114 super.init(); 115 m_bubble = newRunBubble(); 116 m_bubble.setProject(getProject()); 117 } 118 119 120 121 128 public void setCareful(boolean careful) 129 { 130 m_bubble.setCarefulObjectChecks(careful); 131 } 132 133 134 135 150 public void setWarnProperty(String property) 151 { 152 m_bubble.setWarningsUpdateProperty(property); 153 setCareful(true); 154 } 155 156 157 158 172 public void setResetFixture(String fixidList) 173 { 174 require_(fixidList!=null,"resetFix- nonzro idlist"); 175 List l= Tk.splitList(fixidList); 176 if (!l.isEmpty()) { 177 int i; 178 String fxid,aspect; 179 for (Iterator itr=l.iterator();itr.hasNext();) { 180 fxid= itr.next().toString(); 181 aspect = Strings.ALL; 182 i= fxid.indexOf('='); 183 if (i>0) { 184 aspect= fxid.substring(i+1); 185 fxid= fxid.substring(0,i); 186 } 187 m_bubble.addFixtureReset(fxid,aspect); 188 } 189 } 190 } 191 192 193 194 202 public final void setBlock(String localsId) 203 { 204 require_(localsId!=null,"setBlock- nonzro id"); 205 setFilters(localsId,true); 206 } 207 208 209 210 211 219 public final void setAllow(String localsId) 220 { 221 require_(localsId!=null,"setAllow- nonzro id"); 222 setFilters(localsId,false); 223 } 224 225 226 227 228 237 public void setFixtureExcludes(boolean letEmPassThru) 238 { 239 m_bubble.setFixtureExcludes(letEmPassThru); 240 } 241 242 243 244 248 protected void performNestedTasks() 249 { 250 Requester me = new Requester.ForComponent(this); 251 m_bubble.enter(me); 252 try { 253 performTheTasksList(); 254 } finally { 255 m_bubble.leave(me); 256 } 257 } 258 259 260 261 266 protected LocalExecutionBubble newRunBubble() 267 { 268 return new LocalExecutionBubble(); 269 } 270 271 272 273 274 281 private void setFilters(String localsId, boolean blocking) 282 { 283 if (m_bubble.isFiltered()) { 284 String error = getAntXMsg("task.one.or.other.attr","allow","deny"); 285 log(error, Project.MSG_ERR); 286 throw new BuildException(error,getLocation()); 287 } 288 Locals locals = (Locals)getReferencedObject(null,localsId,Locals.class); 289 locals.uninstall(new Requester.ForComponent(this)); 290 locals.setBlocking(blocking); 291 m_bubble.setFilterControls(locals); 292 } 293 294 295 private LocalExecutionBubble m_bubble; 296 } 297 298 299 300 | Popular Tags |