| 1 28 29 package com.idaremedia.antx.flowcontrol.call; 30 31 import org.apache.tools.ant.BuildException; 32 import org.apache.tools.ant.Project; 33 import org.apache.tools.ant.Task; 34 35 import com.idaremedia.antx.AntX; 36 import com.idaremedia.antx.flowcontrol.ConditionalTaskSet; 37 import com.idaremedia.antx.helpers.TaskHandle; 38 import com.idaremedia.antx.helpers.Tk; 39 import com.idaremedia.antx.starters.Quiet; 40 41 76 77 public class InlineStep extends ConditionalTaskSet 78 implements Quiet, InlinedTarget, InlinedTargetContainer 79 { 80 83 public InlineStep() 84 { 85 super(AntX.flow+"step"); 86 } 87 88 89 93 protected InlineStep(String iam) 94 { 95 super(iam); 96 } 97 98 99 103 public void setName(String name) 104 { 105 require_(name!=null,"setName- nonzro name"); 106 m_name = name; 107 } 108 109 110 114 public String getName() 115 { 116 return m_name; 117 } 118 119 120 123 public String toString() 124 { 125 return getName(); 126 } 127 128 129 133 protected boolean includeTask(TaskHandle taskH) 134 { 135 Task task = candidateTask(taskH,COI_); 136 return (task!=null) && !(task instanceof InlineStep); 137 } 138 139 140 144 public void execute() 145 { 146 verifyCanExecute_("execute"); 147 } 149 150 151 155 public void run() throws BuildException 156 { 157 verifyCanExecute_("run"); 158 159 162 performNestedTasks(); 163 } 164 165 166 169 protected void verifyCanExecute_(String calr) 170 throws BuildException 171 { 172 super.verifyCanExecute_(calr); 173 174 if (Tk.isWhitespace(getName())) { 175 String ermsg = uistrs().get("flow.task.needs.name",this.getTaskName()); 176 log(ermsg, Project.MSG_ERR); 177 throw new BuildException(ermsg, getLocation()); 178 } 179 } 180 181 182 private String m_name; 184 185 190 private static final Class [] COI_= { 191 InlineStep.class 192 }; 193 } 194 195 196 | Popular Tags |