buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/CTCTask.java
--- a/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/CTCTask.java Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/CTCTask.java Thu Jul 22 17:08:43 2010 +0300
@@ -16,6 +16,13 @@
*/
package com.nokia.helium.sbs.ant.taskdefs;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+
+import com.nokia.helium.core.ant.types.Variable;
+import com.nokia.helium.core.ant.types.VariableSet;
+
/**
* This task is to execute the CTCWrap command with the list of sbs parameters
* using sbsinput type. Based on the raptor input list of additional log file path
@@ -35,19 +42,66 @@
public class CTCTask extends SBSTask {
private String instrumentType = "m";
+ private Vector<VariableSet> ctcOptions = new Vector<VariableSet>();
+ /**
+ * Constructing the task, overriding default executable to be
+ * ctcwrap.
+ */
public CTCTask() {
super();
getSbsCmd().setExecutable("ctcwrap");
}
- public void setInstrumentType(String i)
+ /**
+ * Defined the instrumentation type.
+ * @param instrumentType the instrumentation type.
+ * @ant.not-required Default is 'm'
+ */
+ public void setInstrumentType(String instrumentType)
{
- instrumentType = i;
+ this.instrumentType = instrumentType;
}
+ /**
+ * Override the command line construction.
+ */
protected String getSBSCmdLine() {
- return "-i " + instrumentType + " sbs" + super.getSBSCmdLine();
+ String ctcConfig = "";
+ for (VariableSet ctcOption : ctcOptions) {
+ ctcConfig += " "; // needed for forward compatibility
+ if (ctcOption.isReference()) {
+ Object refObject = ctcOption.getRefid().getReferencedObject();
+ if (refObject instanceof VariableSet) {
+ ctcOption = (VariableSet)refObject;
+ } else {
+ throw new BuildException(ctcOption.getRefid().getRefId() + " is not referencing a VariableSet.");
+ }
+ }
+ for (VariableSet vset : ctcOption.getVariableSets()) {
+ if (vset.isReference()) {
+ Object refObject = vset.getRefid().getReferencedObject();
+ if (refObject instanceof VariableSet) {
+ vset = (VariableSet)refObject;
+ } else {
+ throw new BuildException(vset.getRefid().getRefId() + " is not referencing a VariableSet.");
+ }
+ }
+ for (Variable var : vset.getVariablesList()) {
+ ctcConfig += " " + var.getParameter();
+ }
+ }
+ }
+ return "-i " + instrumentType + ctcConfig + " sbs" + super.getSBSCmdLine();
+ }
+
+ /**
+ * To read the ctc arguments for ctcwrap command.
+ *
+ * @param ctcArg
+ */
+ public void addCTCOptions(VariableSet ctcArg) {
+ ctcOptions.add(ctcArg);
}
}