1 28 29 package com.idaremedia.antx.flowcontrol.match; 30 31 import org.apache.tools.ant.BuildException; 32 import org.apache.tools.ant.Project; 33 import org.apache.tools.ant.Task; 34 import org.apache.tools.ant.types.Reference; 35 36 import com.idaremedia.antx.helpers.TaskHandle; 37 import com.idaremedia.antx.parameters.FlexValueSupport; 38 import com.idaremedia.antx.starters.Quiet; 39 import com.idaremedia.antx.starters.StrictInnerTaskSet; 40 41 52 53 public abstract class ChoiceTask extends StrictInnerTaskSet 54 implements Quiet, FlexValueSupport 55 { 56 59 protected ChoiceTask(String iam) 60 { 61 super(iam); 62 } 63 64 65 66 71 protected ChoiceTask(String iam, boolean delayConfiguration) 72 { 73 super(iam,delayConfiguration); 74 } 75 76 77 78 82 public abstract String getFlexValue(); 83 84 85 86 89 public abstract boolean isUndefined(); 90 91 92 93 98 public abstract String getVUT(); 99 100 101 102 106 protected boolean includeTask(TaskHandle taskH) 107 { 108 Task task = candidateTask(taskH,COI_); 109 return (task!=null) && !(task instanceof ChoiceTask); 110 } 111 112 113 114 122 public abstract boolean eval(String vut, Reference context) 123 throws BuildException; 124 125 126 127 131 protected void verifyCanExecute_(String calr) 132 { 133 super.verifyCanExecute_(calr); 134 135 if (isUndefined()) { 136 String ermsg = uistrs().get("flow.switch.needs.value",getTaskName()); 137 log(ermsg, Project.MSG_ERR); 138 throw new BuildException(ermsg,getLocation()); 139 } 140 } 141 142 143 144 149 private static final Class [] COI_= { 150 ChoiceTask.class 151 }; 152 } 153 154 155 | Popular Tags |