1 28 29 package com.idaremedia.antx.feedback; 30 31 import org.apache.tools.ant.Project; 32 import org.apache.tools.ant.types.Reference; 33 34 import com.idaremedia.antx.AntX; 35 import com.idaremedia.antx.helpers.Strings; 36 import com.idaremedia.antx.starters.TaskSet; 37 38 55 56 public class EmitLogsTask extends TaskSet implements EmitConfigurable 57 { 58 61 public EmitLogsTask() 62 { 63 super(AntX.feedback); 64 } 65 66 67 72 public EmitConfiguration getDefaults() 73 { 74 return EmitContext.getConfigurationNoNull(); 75 } 76 77 78 84 public void setWith(Reference r) 85 { 86 require_(r!=null,"setWith- nonzro refid"); 87 m_withEC= r; 88 } 89 90 91 96 public final Reference getWith() 97 { 98 return m_withEC; 99 } 100 101 102 107 public void setLabels(Reference r) 108 { 109 require_(r!=null,"setLabels- nonzro refid"); 110 m_withLabels = r; 111 } 112 113 114 118 public final Reference getLabelsMapper() 119 { 120 return m_withLabels; 121 } 122 123 124 128 protected GroupingMapper getGroupingMapper() 129 { 130 if (getLabelsMapper()!=null) { 131 return (GroupingMapper)getReferencedObject 132 (getProject(), getLabelsMapper().getRefId(), GroupingMapper.class); 133 } 134 return null; 135 } 136 137 138 139 144 public void setIncludes(String filterstring) 145 { 146 require_(filterstring!=null,"setInc- nonzro mask"); 147 m_groupingFilter = filterstring; 148 } 149 150 151 155 public String getIncludes() 156 { 157 return m_groupingFilter; 158 } 159 160 161 168 protected EmitConfiguration getConfiguration() 169 { 170 if (m_ECInstance!=null) { 171 return m_ECInstance; 172 } 173 if (getWith()!=null) { 174 m_ECInstance = (EmitConfiguration)getReferencedObject 175 (getProject(), getWith().getRefId(), EmitConfiguration.class); 176 } 177 else { 178 m_ECInstance = getDefaults(); 179 } 180 return m_ECInstance; 181 } 182 183 184 188 protected void performNestedTasks() 189 { 190 Project P = getProject(); 191 EventEmitConduit conduit = getWorker(); 192 try { 193 verify_(!m_isInstalled,"perform- not installed"); 194 verify_(!P.getBuildListeners().contains(conduit),"perform- not installed"); 195 conduit.setConfiguration(getConfiguration()); 196 conduit.setIncludes(getIncludes()); 197 conduit.setGroupingMapper(getGroupingMapper()); 198 P.addBuildListener(conduit); 199 m_isInstalled = true; 200 performTheTasksList(); 201 } finally { 202 if (m_isInstalled) { 203 m_isInstalled = false; 204 P.removeBuildListener(conduit); 205 conduit.setConfiguration(null); 206 } 207 } 208 } 209 210 211 215 protected final EventEmitConduit getWorker() 216 { 217 return m_emitWorker; 218 } 219 220 221 private Reference m_withEC; 222 private EmitConfiguration m_ECInstance; 223 private volatile boolean m_isInstalled; 224 private final EventEmitConduit m_emitWorker = new EventEmitConduit(); 225 private String m_groupingFilter=Strings.DEFAULT; 226 private Reference m_withLabels; 227 } 228 229 230 | Popular Tags |