helium_9.0.5-4399343f4f50 helium-9.0 helium-9.0.5
authorwbernard
Thu, 22 Jul 2010 17:08:43 +0300
branchhelium-9.0
changeset 618 df88fead2976
parent 587 85df38eb4012
child 619 f5b4d1b4622d
helium_9.0.5-4399343f4f50
buildframework/helium/config/version.txt
buildframework/helium/external/python/lib/2.6/site.pyc
buildframework/helium/hlm.bat
buildframework/helium/sf/java/antdata/src/com/nokia/helium/ant/data/AntComment.java
buildframework/helium/sf/java/core/src/com/nokia/helium/core/EmailDataSender.java
buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java
buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java
buildframework/helium/sf/java/diamonds/tests/config/diamonds_config.xml.ftl
buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml
buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/build_imaker_roms_signing.mk.ftl
buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/taskdefs/IMakerTask.java
buildframework/helium/sf/java/imaker/tests/antunit/test_imaker.ant.xml
buildframework/helium/sf/java/imaker/tests/antunit/test_imaker_drive_letter.ant.xml
buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMEntityManager.java
buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMReader.java
buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMUtil.java
buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/Metadata.java
buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/MetadataUtil.java
buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ORMFMPPLoader.java
buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java
buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataRegexTestCondition.java
buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java
buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/SBSLogMetaDataInput.java
buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/db/ORMMetadataDB.java
buildframework/helium/sf/java/metadata/tests/data/all_regex1_type.log
buildframework/helium/sf/java/metadata/tests/data/metadatacount_error_and_missing_files.log
buildframework/helium/sf/java/metadata/tests/data/metadatacount_missing_files.log
buildframework/helium/sf/java/metadata/tests/functionality/test_regex.ant.xml
buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/Coverity.java
buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/taskdefs/CTCTask.java
buildframework/helium/sf/java/sbs/tests/antunit/test_ctc.ant.xml
buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/ExecuteTaskNotifier.java
buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/templates/root_sysdef_model.xml.ftl
buildframework/helium/sf/python/pythoncore/lib/archive/builders.py
buildframework/helium/sf/python/pythoncore/lib/ats3/__init__.py
buildframework/helium/sf/python/pythoncore/lib/ats3/ats4_template.xml
buildframework/helium/sf/python/pythoncore/lib/ats3/custom.py
buildframework/helium/sf/python/pythoncore/lib/ats3/dropgenerator.py
buildframework/helium/sf/python/pythoncore/lib/ats3/parsers.py
buildframework/helium/sf/python/pythoncore/lib/ats3/templates/ats4_macros.xml
buildframework/helium/sf/python/pythoncore/lib/atsant.py
buildframework/helium/sf/python/pythoncore/lib/ccm/__init__.py
buildframework/helium/sf/python/pythoncore/lib/ccm/extra.py
buildframework/helium/sf/python/pythoncore/lib/pkg2iby.py
buildframework/helium/sf/python/pythoncore/lib/preparation.py
buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_archive.py
buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atsant.py
buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_parsers.py
buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_object.py
buildframework/helium/tests/data/diamonds-faults_compile.text.log
buildframework/helium/tools/common/templates/diamonds/faults_metadata_orm.ftl
buildframework/helium/tools/common/templates/log/cc_summary_metadata_orm.html.ftl
buildframework/helium/tools/common/test/test_scanlog.ant.xml
buildframework/helium/tools/compile/cmaker.ant.xml
buildframework/helium/tools/compile/sbs/sbs.ant.xml
buildframework/helium/tools/preparation/bom/bom.ant.xml
buildframework/helium/tools/quality/validate-policy.ant.xml
buildframework/helium/tools/startup/bootstrap/bootstrap.ant.xml
buildframework/helium/tools/testing/ats/ats.ant.xml
buildframework/helium/tools/testing/ats/templates/ats4_naviengine_template.xml
--- a/buildframework/helium/config/version.txt	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/config/version.txt	Thu Jul 22 17:08:43 2010 +0300
@@ -2,4 +2,4 @@
 #Fri Dec 18 15:07:03 EET 2009
 last.major.helium.version=8.0
 second.last.major.helium.version=7.0
-helium.version=9.0
+helium.version=9.0.5
Binary file buildframework/helium/external/python/lib/2.6/site.pyc has changed
--- a/buildframework/helium/hlm.bat	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/hlm.bat	Thu Jul 22 17:08:43 2010 +0300
@@ -32,7 +32,7 @@
 call %HELIUM_HOME%\runtime\runtime_env.bat
 ) 
 
-if not exist "%HELIUM_HOME%\extensions\nokia\distribution.policy.S60" ( 
+if not exist "%HELIUM_HOME%\extensions\nokia\build.xml" ( 
 set HLM_SUBCON=1
 set HLM_DISABLE_INTERNAL_DATA=1
 )
--- a/buildframework/helium/sf/java/antdata/src/com/nokia/helium/ant/data/AntComment.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/antdata/src/com/nokia/helium/ant/data/AntComment.java	Thu Jul 22 17:08:43 2010 +0300
@@ -96,7 +96,9 @@
                 while (tokenizer.hasMoreElements()) {
                     String tagText = (String) tokenizer.nextElement();
                     String[] tagParts = tagText.split("\\s", 2);
-                    tags.put(tagParts[0], tagParts[1].trim());
+                    if (tagParts.length > 1) {
+                        tags.put(tagParts[0], tagParts[1].trim());
+                    }
                 }
             }
         }
--- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/EmailDataSender.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/EmailDataSender.java	Thu Jul 22 17:08:43 2010 +0300
@@ -268,6 +268,9 @@
                 try {
                     InternetAddress fromAddress = getFromAddress(); 
                     message.setFrom(fromAddress);
+                } catch (HlmAntLibException e) {
+                    // We are Ignoring the errors as no need to fail the build.
+                    log.debug("Error retrieving current user email address: " + e.getMessage(), e);                    
                 } catch (javax.mail.internet.AddressException e) {
                     // We are Ignoring the errors as no need to fail the build.
                     log.debug("Error retrieving current user email address: " + e.getMessage(), e);
@@ -358,9 +361,11 @@
             NamingEnumeration<SearchResult> en = ctx.search("", "uid=" + username, controls);
             if (en.hasMore()) {
                 SearchResult sr = en.next();
-                String email = (String) sr.getAttributes().get("mail").get();
-                log.debug("getUserEmail:" + email);
-                return email;
+                if (sr.getAttributes().get("mail") != null) {
+                    String email = (String) sr.getAttributes().get("mail").get();
+                    log.debug("getUserEmail:" + email);
+                    return email;
+                }
             }
         } catch (javax.naming.NameNotFoundException ex) {
             throw new HlmAntLibException("Error finding user email for " + username );
--- a/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/DiamondsClient.java	Thu Jul 22 17:08:43 2010 +0300
@@ -197,6 +197,10 @@
                 postMethod = getPostMethod(fileName, strURL);
                 result = processPostMethodResult(httpClient
                         .executeMethod(postMethod));
+            } catch (IllegalArgumentException e) {
+                // Catching this exception is needed because it is raised by httpclient
+                // library if the server is under update.
+                log.error("sendData:The final data via http not sent because errors:IllegalArgumentException ", e);
             } catch (DiamondsException e) {
                 log.error("sendData:The final data via http not sent because errors:DiamondsException ", e);
             } catch (IOException e) {
--- a/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/diamonds/src/com/nokia/helium/diamonds/StageDiamondsListener.java	Thu Jul 22 17:08:43 2010 +0300
@@ -18,14 +18,14 @@
 package com.nokia.helium.diamonds;
 
 import org.apache.tools.ant.BuildEvent;
+
+
 import org.apache.tools.ant.Target;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.BuildException;
-
-
-
 import java.util.Date;
-
+import java.util.LinkedHashMap;
+import java.util.Set;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Enumeration;
@@ -35,11 +35,8 @@
 import java.util.Vector;
 import java.util.ArrayList;
 import org.apache.log4j.Logger;
-
 import com.nokia.helium.core.PropertiesSource;
 import com.nokia.helium.core.TemplateInputSource;
-
-
 import com.nokia.helium.core.XMLTemplateSource;
 
 /**
@@ -57,15 +54,16 @@
 
     private Map<String, Stage> stageTargetEndMap = new HashMap<String, Stage>();
 
+    private Map<String, String> stageStartTargetMap = new HashMap<String, String>();
+
+    private Map<String, Date> stageStartTargetTimeMap = new HashMap<String, Date>();
+
     private boolean isTargetMapInitialized;
 
     private Project project;
 
-    private String currentStartTargetName;
-
     private List<Stage> stages;
 
-    private Date currentStartTargetTime;
 
     public StageDiamondsListener() {
         stages = DiamondsConfig.getStages();
@@ -73,6 +71,7 @@
 
     public void targetBegin(BuildEvent buildEvent) throws DiamondsException {
         project = buildEvent.getProject();
+        int hashCode = project.hashCode();
         String targetName = buildEvent.getTarget().getName();
         if (!isTargetMapInitialized && stages != null) {
             log
@@ -80,16 +79,49 @@
             initStageTargetsMap();
             isTargetMapInitialized = true;
         }
-        log.debug("targetBegin targetName: " + targetName + " - currentStartTargetName:" + currentStartTargetName);
-        if (currentStartTargetName == null) {
-            findAndSetStartTimeForTargetInStageList(targetName);
+        String targetNameWithHashCode = targetName + "-" + hashCode;
+        log.debug("targetBegin: targetNameWithHashCode: " + targetNameWithHashCode);
+        log.debug("targetBegin targetName: " + targetName +
+               " - currentStartTargetName:" + stageStartTargetMap.get(targetNameWithHashCode));
+        if (stageStartTargetMap.get(targetNameWithHashCode) == null) {
+            log.debug("looking for start target match and associating time to it");
+            findAndSetStartTimeForTargetInStageList(targetName, targetNameWithHashCode);
         }
     }
+    
+    private Date getStartTime(Stage stage, int hasCode) {
+        String startTargetName = stage.getStartTargetName();
+        String endTargetName = stage.getEndTargetName();
+        for (Iterator<Map<String, Date>> listIter = stageTargetBeginList.iterator(); listIter
+        .hasNext();) {
+            Map<String, Date> stageMap = listIter.next();
+            if (stageMap.get(startTargetName) != null && 
+                    stageMap.get(endTargetName) != null) {
+                Set<String> targetSet = stageMap.keySet();
+                for (String key : targetSet) {
+                    log.debug("key: " + key);
+                    Date time = stageMap.get(key);
+                    log.debug("time: " + time);
+                    if ( time != INVALID_DATE) {
+                        return time;
+                    }
+                }
+            }
+        }
+        throw new BuildException("No time recorded " +
+                "for stage:" + stage.getStageName());
+    }
 
     @SuppressWarnings("unchecked")
     public void targetEnd(BuildEvent buildEvent) throws DiamondsException {
+        String targetName = buildEvent.getTarget().getName();
+        project = buildEvent.getProject();
+        int hashCode = project.hashCode();
+        String targetNameWithHashCode = targetName + "-" + hashCode;
+        log.debug("targetEnd: targetNamewith-hashcode: " + targetNameWithHashCode);
+        String currentStartTargetName = 
+            stageStartTargetMap.get(targetNameWithHashCode);
         if (currentStartTargetName != null) {
-            String targetName = buildEvent.getTarget().getName();
             Stage stage = stageTargetEndMap.get(targetName);
             if (stage != null && getIsInitialized() ) {
                 //initDiamondsClient();
@@ -101,12 +133,12 @@
                 if (sourceFile == null) {
                     sourceFile = getSourceFile(stageName);
                 }
+                Date startTime = getStartTime(stage, hashCode); 
                 project.setProperty("logical.stage", stageName);
                 project.setProperty("stage.start.time", getTimeFormat()
-                        .format(currentStartTargetTime));
+                        .format(startTime));
                 project.setProperty("stage.end.time", getTimeFormat()
                         .format(new Date()));
-                currentStartTargetName = null;
                 // Look for template file with stage name
                 String stageTemplateFileName = stageName + ".xml.ftl";
                 File stageTemplateFile = new File(stageTemplateFileName);
@@ -123,9 +155,6 @@
                                 .getTemplateDir(), stageTemplateFileName,
                                 output, sourceList);
                         mergeToFullResults(new File(output));
-
-                        // String mergedFile = mergeFiles(new File(output));
-
                         log.info("Sending data to diamonds for stage: "
                                 + stageName);
                         getDiamondsClient().sendData(output, DiamondsConfig
@@ -166,18 +195,20 @@
         }
     }
 
-    private void findAndSetStartTimeForTargetInStageList(String targetName)
-            throws DiamondsException {
+    private void findAndSetStartTimeForTargetInStageList(String targetName,
+            String targetNameWithHashCode) throws DiamondsException {
         for (Iterator<Map<String, Date>> listIter = stageTargetBeginList.iterator(); listIter
                 .hasNext();) {
             Map<String, Date> stageMap = listIter.next();
             Date targetTime = stageMap.get(targetName);
             if (targetTime != null && targetTime.equals(INVALID_DATE)) {
-                log.debug("diamonds:StageDiamondsListener: started recording for stage-target: "
+                log.debug("diamonds:StageDiamondsListener: started recording for stage-target-----: "
                                 + targetName);
+                log.debug("findtime: targetNamewith-hashcode: " + targetNameWithHashCode);
+                log.debug("findtime: time: " + new Date());
                 stageMap.put(targetName, new Date());
-                currentStartTargetName = targetName;
-                currentStartTargetTime = new Date();
+                stageStartTargetMap.put(targetNameWithHashCode, targetName);
+                stageStartTargetTimeMap.put(targetNameWithHashCode, new Date());
             }
         }
     }
@@ -189,7 +220,7 @@
             // stage begin process
             Stage stage = iter.next();
             String startTargetName = stage.getStartTargetName();
-            Map<String, Date> stageMap = new HashMap<String, Date>();
+            Map<String, Date> stageMap = new LinkedHashMap<String, Date>();
             Vector<Target> arrayList = null;
             try {
                 arrayList = project.topoSort(startTargetName, project
--- a/buildframework/helium/sf/java/diamonds/tests/config/diamonds_config.xml.ftl	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/diamonds/tests/config/diamonds_config.xml.ftl	Thu Jul 22 17:08:43 2010 +0300
@@ -43,7 +43,18 @@
     <stages>
             <!-- verifying basic stage input -->
             <stage name="pre-build" start="version" end="version" />
-            
+            <stage name="test-echo-operation" 
+                start="test-echo-operation" end="test-echo-operation" />
+            <stage name="test-echo-operation1" 
+                start="test-echo-operation1" end="test-echo-operation1" />
+            <stage name="test-echo-operation2" 
+                start="test-echo-operation2" end="test-echo-operation2" />
+            <stage name="test-echo-operation3" 
+                start="test-echo-operation3" end="test-echo-operation3" />
+            <stage name="test-echo-operation4" 
+                start="test-echo-operation4" end="test-echo-operation4" />
+            <stage name="test-echo-operation5" 
+                start="test-echo-operation5" end="test-echo-operation5" />
             <!-- verifying basic stage input with input xml file-->
             <stage name="build" start="compile-target" end="compile-target"
                 logfile="${ant['compile.log.input']}"/>
--- a/buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/diamonds/tests/scenarii/build/build.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -40,7 +40,6 @@
     <property name="invalid.target.input.file" location="${diamonds.unitest.dir}/data/invalid.target.input.log.xml" />
     <property name="symsee.version" value="9.1.0" />
 
-
     <target name="unittest" depends="unittest-diamonds" />
     
     <target name="unittest-diamonds" >
@@ -155,8 +154,63 @@
         </au:assertFalse>
     </target>
 
+    <target name="test-echo-operation">
+        <echo message="echo operation: test" />
+    </target>
+
+    <target name="test-echo-operation1">
+        <echo message="echo operation1: test" />
+    </target>
+
+    <target name="test-echo-operation2">
+        <echo message="echo operation2: test" />
+    </target>
+
+    <target name="test-echo-operation3">
+        <echo message="echo operation3: test" />
+    </target>
+
+    <target name="test-echo-operation4">
+        <echo message="echo operation4: test" />
+    </target>
+
+    <target name="test-echo-operation5">
+        <echo message="echo operation5: test" />
+    </target>
+
+    <target name="test-depend-target" depends="test-echo-operation">
+        <echo message="test-ant-call" />
+        <antcall target="test-echo-operation" />
+        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation-time.xml" />
+    </target>
+
+    <target name="test-ant-call">
+        <echo message="test-ant-call" />
+        <antcall target="test-echo-operation1" />
+        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation1-time.xml" />
+    </target>
+
+    <target name="test-ant-call-multiple">
+        <echo message="test-ant-call" />
+        <antcall target="test-echo-operation2" />
+        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation2-time.xml" />
+        <antcall target="test-echo-operation3" />
+        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation3-time.xml" />
+    </target>
+
+    <target name="test-ant-call-multiple-parallel">
+        <echo message="test-ant-call" />
+        <parallel>
+            <antcall target="test-echo-operation4" />
+            <antcall target="test-echo-operation5" />
+        </parallel>
+        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation4-time.xml" />
+        <au:assertFileExists file="${diamonds.output.dir}/test-echo-operation5-time.xml" />
+    </target>
+
     <target name="test-all" depends="test-buildid-notset, diamonds, test-buildid-set, test-defer-type, test-version,
         test-create-bom-log,test-codescanner,test-compile-target,test-invalid-diamonds-server-properties,
         test-non-existing-ant-properties,test-invalid-ant-properties-input,test-invalid-template-file,
-        test-invalid-target-input-file,test-invalid-stage-input-file " />
+        test-invalid-target-input-file,test-invalid-stage-input-file, test-depend-target,
+        test-ant-call, test-ant-call-multiple, test-ant-call-multiple-parallel" />
 </project>
\ No newline at end of file
--- a/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/build_imaker_roms_signing.mk.ftl	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/engines/build_imaker_roms_signing.mk.ftl	Thu Jul 22 17:08:43 2010 +0300
@@ -54,11 +54,11 @@
     <#list cmds as cmd>
         <#assign cmdline="">
         <#list cmd.getArguments() as arg>
-            <#assign cmdline="${cmdline} ${arg}">
+            <#assign cmdline="${cmdline} \"${arg}\"">
         </#list>
         <#assign vars=cmd.getVariables()>
         <#list vars?keys as var>
-            <#assign cmdline="${cmdline} ${var}=${vars[var]}">
+            <#assign cmdline="${cmdline} \"${var}=${vars[var]}\"">
         </#list>
 	@echo $(call iif,$(USE_UNIX),,cmd /c) ${cmd.getCommand()} WORKDIR=$(ROMBUILD_TEMPDIR)/config_${iid} ${cmdline} ${cmd.getTarget()}-dir >> $(ROMBUILD_TEMPDIR)/command-dir-list-${cid}.txt 
 <#assign iid=iid+1>
@@ -70,11 +70,11 @@
     <#list cmds as cmd>
         <#assign cmdline="">
         <#list cmd.getArguments() as arg>
-            <#assign cmdline="${cmdline} ${arg}">
+            <#assign cmdline="${cmdline} \"${arg}\"">
         </#list>
         <#assign vars=cmd.getVariables()>
         <#list vars?keys as var>
-            <#assign cmdline="${cmdline} ${var}=${vars[var]}">
+            <#assign cmdline="${cmdline} \"${var}=${vars[var]}\"">
         </#list>
 #
 #  Building configuration ${iid}.
@@ -104,11 +104,11 @@
     <#list cmds as cmd>
         <#assign cmdline="">
         <#list cmd.getArguments() as arg>
-            <#assign cmdline="${cmdline} ${arg}">
+            <#assign cmdline="${cmdline} \"${arg}\"">
         </#list>
         <#assign vars=cmd.getVariables()>
         <#list vars?keys as var>
-            <#assign cmdline="${cmdline} ${var}=${vars[var]}">
+            <#assign cmdline="${cmdline} \"${var}=${vars[var]}\"">
         </#list>
 	@echo $(call iif,$(USE_UNIX),,cmd /c) ${cmd.getCommand()} WORKDIR=$(ROMBUILD_TEMPDIR)/config_${iid} ${cmdline} ${cmd.getTarget()}-e2flash >> $(ROMBUILD_TEMPDIR)/command-e2flash-list-${cid}.txt 
 <#assign iid=iid+1>
--- a/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/taskdefs/IMakerTask.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/imaker/src/com/nokia/helium/imaker/ant/taskdefs/IMakerTask.java	Thu Jul 22 17:08:43 2010 +0300
@@ -115,6 +115,10 @@
             engine.setTask(this);
             return engine;
         } else {
+            log("Using engine: " + engineRefId);
+            if (this.getProject().getReference(engineRefId) == null) {
+                throw new BuildException("Could not find engine reference: '" + engineRefId + "'.");
+            }
             try {
                 Engine engine = (Engine)this.getProject().getReference(engineRefId);
                 engine.setTask(this);
--- a/buildframework/helium/sf/java/imaker/tests/antunit/test_imaker.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/imaker/tests/antunit/test_imaker.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -278,4 +278,28 @@
         <au:assertLogContains text="Nothing to build." />
     </target>
 
+    <target name="test-imaker-imakerconfiguration-variableset-invalid-engine">
+        <au:expectfailure message="Could not find engine reference: 'invalid.engine.ref'.">
+            <hlm:imaker epocroot="${epocroot}" output="${epocroot.temp}/output.log" engineRefid="invalid.engine.ref">
+                <hlm:imakerconfiguration>
+                    <makefileset>
+                        <include name="**/product/*ui.mk" />
+                    </makefileset>
+                    <targetset>
+                        <include name="core" />
+                        <include name="langpack_\d+" />
+                    </targetset>
+                    <variablegroup>
+                        <variable name="TYPE" value="rnd" />
+                    </variablegroup>
+                    <variablegroup>
+                        <variable name="TYPE" value="prd" />
+                    </variablegroup>
+                </hlm:imakerconfiguration>
+            </hlm:imaker>
+        </au:expectfailure>
+        <au:assertLogContains text="Using engine: invalid.engine.ref" />
+        <au:assertFileDoesntExist file="${epocroot.temp}/output.log" />
+    </target>
+    
 </project>
--- a/buildframework/helium/sf/java/imaker/tests/antunit/test_imaker_drive_letter.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/imaker/tests/antunit/test_imaker_drive_letter.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -41,13 +41,15 @@
         <delete dir="${epocroot}/epoc32" failonerror="false" />
         <echo>-------------------------------------------------------------------------------</echo>
     </target>
-
+    
+    <!-- once imaker is in SymSEE this does not fail 
     <target name="test-imaker-noargs-noconfig">
         <echo>Will fail because it can't find imaker.</echo>
         <au:expectfailure>
             <hlm:imaker />
         </au:expectfailure>
     </target>
+    -->
 
     <target name="test-imaker-epocroot">
         <echo>Usin custom epocroot.</echo>
--- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMEntityManager.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMEntityManager.java	Thu Jul 22 17:08:43 2010 +0300
@@ -33,6 +33,7 @@
 import java.sql.SQLException;
 import org.apache.tools.ant.BuildException;
 import java.io.IOException;
+import javax.persistence.FlushModeType;
 
 /**
  * This class handles the generic ORM entity management.
@@ -117,6 +118,7 @@
                 name,
                 persistProperties);
         entityManager = factory.createEntityManager();
+        entityManager.setFlushMode(FlushModeType.COMMIT);
         entityManager.getTransaction().begin();
         entityManager.persist(new Version());
         entityManager.getTransaction().commit();
--- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMReader.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMReader.java	Thu Jul 22 17:08:43 2010 +0300
@@ -22,7 +22,7 @@
 import org.apache.log4j.Logger;
 import java.util.List;
 import javax.persistence.Query;
-
+import javax.persistence.FlushModeType;
 /**
  * This class provides an interface to read data from the 
  * database using JPA.
@@ -36,11 +36,14 @@
     private ORMEntityManager manager;
     
     private int startPos;
+    
+    private String dbPath;
 
     /**Constructor:
      * @param dbPath - path of the database to connect to.
      */
-    public ORMReader(String dbPath) {
+    public ORMReader(String path) {
+        dbPath = path;
         ORMUtil.initializeORM(dbPath);
         manager = ORMUtil.getEntityManager(dbPath);
     }
@@ -54,28 +57,32 @@
      */
     public List executeNativeQuery(String queryString, String type) {
         int maxResults = READ_CACHE_LIMIT;
-        String queryWithSubSet = queryString + " OFFSET " + startPos +
-                " ROWS FETCH FIRST " + maxResults + " ROW ONLY";
-        Query query = null;
-        if (type != null) {
-            try {
-                query = manager.getEntityManager().createNativeQuery(queryWithSubSet,
-                        Class.forName(type));
-            } catch (ClassNotFoundException ex) {
-                log.debug("Exception during native query", ex);
+        Object mutexObject = ORMUtil.getMutexObject();
+        synchronized (mutexObject) {
+            String queryWithSubSet = queryString + " OFFSET " + startPos +
+                    " ROWS FETCH FIRST " + maxResults + " ROW ONLY";
+            Query query = null;
+            if (type != null) {
+                try {
+                    query = manager.getEntityManager().createNativeQuery(queryWithSubSet,
+                            Class.forName(type));
+                } catch (ClassNotFoundException ex) {
+                    log.debug("Exception during native query", ex);
+                }
+            } else {
+                query = manager.getEntityManager().createNativeQuery(queryWithSubSet);
             }
-        } else {
-            query = manager.getEntityManager().createNativeQuery(queryWithSubSet);
+            query.setHint("eclipselink.maintain-cache", "false");
+            query.setFlushMode(FlushModeType.COMMIT);
+            List results = query.getResultList();
+            int resultsSize = results.size();
+            if (resultsSize == 0 || resultsSize < READ_CACHE_LIMIT) {
+                startPos += resultsSize;
+            } else {
+                startPos += maxResults;
+            }
+            return results;
         }
-        query.setHint("eclipselink.maintain-cache", "false");
-        List results = query.getResultList();
-        int resultsSize = results.size();
-        if (resultsSize == 0 || resultsSize < READ_CACHE_LIMIT) {
-            startPos += resultsSize;
-        } else {
-            startPos += maxResults;
-        }
-        return results;
     }
 
     /**
@@ -85,20 +92,23 @@
      * @return an Object of return type.
      */
     public Object  executeSingleResult(String queryString, String type) {
-        log.debug("executeSingleResult: " + queryString);
-        Query query = manager.getEntityManager().createQuery(queryString);
-        query.setHint("eclipselink.persistence-context.reference-mode", "WEAK");
-        query.setHint("eclipselink.maintain-cache", "false");
-        query.setHint("eclipselink.read-only", "true");
-        Object obj = null;
-        try {
-            obj = query.getSingleResult();
-        } catch (javax.persistence.NoResultException nex) {
-            log.debug("no results:", nex);
-        } catch (javax.persistence.NonUniqueResultException nux) {
-            log.debug("more than one result returned:", nux);
+        Object mutexObject = ORMUtil.getMutexObject();
+        synchronized (mutexObject) {
+            Query query = manager.getEntityManager().createQuery(queryString);
+            query.setHint("eclipselink.persistence-context.reference-mode", "WEAK");
+            query.setHint("eclipselink.maintain-cache", "false");
+            query.setHint("eclipselink.read-only", "true");
+            query.setFlushMode(FlushModeType.COMMIT);
+            Object obj = null;
+            try {
+                obj = query.getSingleResult();
+            } catch (javax.persistence.NoResultException nex) {
+                log.debug("no results:", nex);
+            } catch (javax.persistence.NonUniqueResultException nux) {
+                log.debug("more than one result returned:", nux);
+            }
+            return obj;
         }
-        return obj;
     }
 
     /**
@@ -107,21 +117,34 @@
      * @return List of objects read from database.
      */
     public List executeQuery (String queryString) {
-        int maxResults = READ_CACHE_LIMIT;
-        Query query = manager.getEntityManager().createQuery(queryString);
-        query.setHint("eclipselink.persistence-context.reference-mode", "WEAK");
-        query.setHint("eclipselink.maintain-cache", "false");
-        query.setHint("eclipselink.read-only", "true");
-        query.setFirstResult(startPos);
-        query.setMaxResults(maxResults);
-        List results = (List) query.getResultList();
-        int resultsSize = results.size();
-        log.debug("result size: " + resultsSize);
-        if (results.size() == 0 || resultsSize < READ_CACHE_LIMIT) {
-            startPos += resultsSize;
-        } else {
-            startPos += maxResults;
+        Object mutexObject = ORMUtil.getMutexObject();
+        synchronized (mutexObject) {
+            int maxResults = READ_CACHE_LIMIT;
+            log.debug("executeSingleResult: " + queryString);
+            Query query = manager.getEntityManager().createQuery(queryString);
+            query.setHint("eclipselink.persistence-context.reference-mode", "WEAK");
+            query.setHint("eclipselink.maintain-cache", "false");
+            query.setHint("eclipselink.read-only", "true");
+            query.setFirstResult(startPos);
+            query.setMaxResults(maxResults);
+            query.setFlushMode(FlushModeType.COMMIT);
+            List results = (List) query.getResultList();
+            int resultsSize = results.size();
+            log.debug("result size: " + resultsSize);
+            if (results.size() == 0 || resultsSize < READ_CACHE_LIMIT) {
+                startPos += resultsSize;
+            } else {
+                startPos += maxResults;
+            }
+            return results;
         }
-        return results;
+    }
+    
+    
+    public void close() {
+        Object mutexObject = ORMUtil.getMutexObject();
+        synchronized (mutexObject) {
+            ORMUtil.finalizeORM(dbPath);
+        }
     }
 }
\ No newline at end of file
--- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMUtil.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/ORMUtil.java	Thu Jul 22 17:08:43 2010 +0300
@@ -38,6 +38,10 @@
     private static HashMap<String, ORMEntityManager> emMap = 
         new HashMap<String, ORMEntityManager>();
 
+    private static HashMap<String, Integer> emMapCount = 
+        new HashMap<String, Integer>();
+
+    private static Object mutexObject = new Object();
     private ORMUtil() {
     }
     
@@ -45,17 +49,28 @@
      * Initializes the entity manager and begins the transcations.
      * @param urlPath - database path to be connected to.
      */
-    public static synchronized void initializeORM(String urlPath) {
-        ORMEntityManager manager = emMap.get(urlPath);
-        log.debug("initializeORM: urlpath: " + urlPath);
-        if (manager == null) {
-            try {
-                manager = new ORMEntityManager(urlPath);
-                emMap.put(urlPath, manager);
-                log.debug("initializeORM: manager: " + manager);
-                log.debug("initializeORM: manager: " + manager.getEntityManager());
-            } catch ( IOException ex ) {
-                throw new BuildException("Entity Manager creation failure");
+    public static void initializeORM(String urlPath) {
+        synchronized (mutexObject) {
+            ORMEntityManager manager = emMap.get(urlPath);
+            log.debug("initializeORM: urlpath: " + urlPath);
+            if (manager == null) {
+                try {
+                    log.debug("initializing for the first time");
+                    manager = new ORMEntityManager(urlPath);
+                    emMap.put(urlPath, manager);
+                    Integer countObj = new Integer(1);
+                    emMapCount.put(urlPath, countObj);
+                    log.debug("initializeORM: manager: " + manager);
+                    log.debug("initializeORM: manager: " + manager.getEntityManager());
+                } catch ( IOException ex ) {
+                    throw new BuildException("Entity Manager creation failure");
+                }
+            } else {
+                Integer countObj = emMapCount.get(urlPath);
+                log.debug("object exists and incrementing the value");
+                countObj = new Integer(countObj.intValue() + 1);
+                log.debug("object exists count value: " + countObj.intValue());
+                emMapCount.put(urlPath, countObj);
             }
         }
     }
@@ -66,14 +81,16 @@
      */
     public static ORMEntityManager getEntityManager(String urlPath) {
         log.debug("getEntityManager: urlpath: " + urlPath);
-        ORMEntityManager manager = emMap.get(urlPath);
-        if (manager != null) {
-            log.debug("getEntityManager: manager: " + manager);
-            log.debug("getEntityManager: manager.entityManager: " + manager.getEntityManager());
-            return manager;
-        } else {
-            log.debug("getEntityManager: manager: is null");
-            throw new BuildException("ORM entity manager is null");
+        synchronized (mutexObject) {
+            ORMEntityManager manager = emMap.get(urlPath);
+            if (manager != null) {
+                log.debug("getEntityManager: manager: " + manager);
+                log.debug("getEntityManager: manager.entityManager: " + manager.getEntityManager());
+                return manager;
+            } else {
+                log.debug("getEntityManager: manager: is null");
+                throw new BuildException("ORM entity manager is null");
+            }
         }
     }
     
@@ -81,13 +98,31 @@
      * Finalize the entity manager and release all the objects.
      */
     public static void finalizeORM(String urlPath) {
-        ORMEntityManager manager = emMap.get(urlPath);
-        log.debug("finalizeORM: urlpath: " + urlPath);
-        if (manager != null) {
-            manager.finalizeEntityManager();
-            manager = null;
-            log.debug("finalizeORM: manager" + manager);
-            emMap.remove(urlPath);
+        synchronized (mutexObject) {
+            ORMEntityManager manager = emMap.get(urlPath);
+            log.debug("finalizeORM: urlpath: " + urlPath);
+            if (manager != null) {
+                Integer countObj = emMapCount.get(urlPath);
+                if (countObj != null) {
+                    int count = countObj.intValue();
+                    count = count - 1;
+                    if (count > 0) {
+                        countObj = new Integer (count);
+                        log.debug("countOBj value: " + countObj.intValue());
+                        emMapCount.put(urlPath, countObj);
+                    } else {
+                        manager.finalizeEntityManager();
+                        manager = null;
+                        log.debug("finalizeORM: manager" + manager);
+                        emMap.remove(urlPath);
+                        emMapCount.remove(urlPath);
+                    }
+                }
+            }
         }
     }
+    
+    public static Object getMutexObject() {
+        return mutexObject;
+    }
 }
\ No newline at end of file
--- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/Metadata.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/Metadata.java	Thu Jul 22 17:08:43 2010 +0300
@@ -35,6 +35,7 @@
 import javax.persistence.Query;
 import javax.persistence.CascadeType;
 import com.nokia.helium.jpa.ORMCommitCount;
+import com.nokia.helium.jpa.ORMUtil;
 import com.nokia.helium.jpa.ORMEntityManager;
 
 /**
@@ -236,9 +237,10 @@
     private void loadFromDB(String path) {
         LogFile logFile = null;
         logFiles = new Hashtable<String, LogFile>();
+        Query query = manager.getEntityManager().createQuery("SELECT l FROM LogFile l");
+        query.setFlushMode(FlushModeType.COMMIT);
         List<LogFile> logFilesList =
-            (List<LogFile>) manager.getEntityManager().createQuery(
-                "SELECT l FROM LogFile l").getResultList();
+            (List<LogFile>) query.getResultList();
         for (LogFile file : logFilesList) {
             log.debug("getting logfile from db: " + file.getPath());
             logFiles.put(file.getPath(), file);
@@ -260,18 +262,20 @@
      * @param obj - object to be stored in the data.
      */
     private void persist(Object obj) {
-        synchronized (manager) {
-            EntityManager em = manager.getEntityManager();
-            ORMCommitCount countObject = manager.getCommitCountObject();
-            //log.debug("object: " + obj);
-            //log.debug("object: " + em);
-            em.persist(obj);
-            countObject.decreaseCount();
-            if (countObject.isCommitRequired()) {
-                countObject.reset();
-                em.getTransaction().commit();
-                em.clear();
-                em.getTransaction().begin();
+        Object mutexObject = ORMUtil.getMutexObject();
+        synchronized (mutexObject) {
+            synchronized (manager) {
+                EntityManager em = manager.getEntityManager();
+                ORMCommitCount countObject = manager.getCommitCountObject();
+                //log.debug("object: " + em);
+                em.persist(obj);
+                countObject.decreaseCount();
+                if (countObject.isCommitRequired()) {
+                    countObject.reset();
+                    em.getTransaction().commit();
+                    em.clear();
+                    em.getTransaction().begin();
+                }
             }
         }
     }
@@ -315,11 +319,13 @@
      * Internal function to cache the logpath for performance.
      */
     private void initializeLogPath() {
-        EntityManager em = manager.getEntityManager();
-        Query q = em.createQuery("select m from LogFile m");
+        EntityManager entityManager = manager.getEntityManager();
+        Query query = entityManager.createQuery("select m from LogFile m");
+        query.setFlushMode(FlushModeType.COMMIT);
+        
         name = "metadata";
-        if (q.getResultList().size() == 0) {
-            log.debug("query result: size" + q.getResultList().size());
+        if (query.getResultList().size() == 0) {
+            log.debug("query result: size" + query.getResultList().size());
             populatePriorities();
             populateDB(logPath);
         } else {
@@ -489,7 +495,6 @@
      * priority.
      */
     public final void removeEntries() {
-        EntityManager em = manager.getEntityManager();
         LogFile file = (LogFile)executeSingleQuery("select l from LogFile l where l.path like '%" + logPath + "'");
         if ( file != null ) {
             log.debug("removing entries for : " + file.getPath());
@@ -510,19 +515,22 @@
      * @return object - record from the executed query.
      */
     private Object executeSingleQuery (String queryString) {
-        EntityManager em = manager.getEntityManager();
-        Query query = em.createQuery(queryString);
-        query.setHint("eclipselink.persistence-context.reference-mode", "WEAK");
-        query.setHint("eclipselink.maintain-cache", "false");
-        query.setHint("eclipselink.read-only", "true");
-        query.setFlushMode(FlushModeType.COMMIT);
+        Object mutexObject = ORMUtil.getMutexObject();
         Object obj = null;
-        try {
-            obj = query.getSingleResult();
-        } catch (javax.persistence.NoResultException nex) {
-            log.debug("no results for query: " + queryString, nex);
-        } catch (javax.persistence.NonUniqueResultException nux) {
-            log.debug("more than one result returned by query: " + queryString, nux);
+        synchronized (mutexObject) {
+            EntityManager em = manager.getEntityManager();
+            Query query = em.createQuery(queryString);
+            query.setHint("eclipselink.persistence-context.reference-mode", "WEAK");
+            query.setHint("eclipselink.maintain-cache", "false");
+            query.setHint("eclipselink.read-only", "true");
+            query.setFlushMode(FlushModeType.COMMIT);
+            try {
+                obj = query.getSingleResult();
+            } catch (javax.persistence.NoResultException nex) {
+                log.debug("no results for query: " + queryString, nex);
+            } catch (javax.persistence.NonUniqueResultException nux) {
+                log.debug("more than one result returned by query: " + queryString, nux);
+            }
         }
         return obj;
     }
@@ -532,19 +540,22 @@
      * @param queryString - query string for whcih the result to be obtained.
      */
     private void removeEntries(String queryString) {
-        EntityManager em = manager.getEntityManager();
-        Query query = em.createNativeQuery(queryString);
-        query.setHint("eclipselink.persistence-context.reference-mode", "WEAK");
-        query.setHint("eclipselink.maintain-cache", "false");
-        query.setFlushMode(FlushModeType.COMMIT);
-        try {
-            int deletedRecords = query.executeUpdate();
-            log.debug("total records deleted " + deletedRecords 
-                    + "for query:" + queryString);
-        } catch (javax.persistence.NoResultException nex) {
-            log.debug("no results:", nex);
-        } catch (javax.persistence.NonUniqueResultException nux) {
-            log.debug("more than one result returned:", nux);
+        Object mutexObject = ORMUtil.getMutexObject();
+        synchronized (mutexObject) {
+            EntityManager em = manager.getEntityManager();
+            Query query = em.createNativeQuery(queryString);
+            query.setHint("eclipselink.persistence-context.reference-mode", "WEAK");
+            query.setHint("eclipselink.maintain-cache", "false");
+            query.setFlushMode(FlushModeType.COMMIT);
+            try {
+                int deletedRecords = query.executeUpdate();
+                log.debug("total records deleted " + deletedRecords 
+                        + "for query:" + queryString);
+            } catch (javax.persistence.NoResultException nex) {
+                log.debug("no results:", nex);
+            } catch (javax.persistence.NonUniqueResultException nux) {
+                log.debug("more than one result returned:", nux);
+            }
         }
     }
 
--- a/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/MetadataUtil.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/jpa/src/com/nokia/helium/jpa/entity/metadata/MetadataUtil.java	Thu Jul 22 17:08:43 2010 +0300
@@ -69,10 +69,15 @@
      * Finalize the orm, calls ORMUtil finalize function to close
      * entity manager.
      */
-    public static void finalizeMetadata(String logPath) {
+    public static void finalizeMetadata(String urlPath, String logPath) {
         synchronized (mutexObject) {
-            log.debug("finalizing metadata");
-            metadataMap.remove(logPath);
+            Object readMutexObject = ORMUtil.getMutexObject();
+            synchronized (readMutexObject) {
+                ORMEntityManager manager = ORMUtil.getEntityManager(urlPath);
+                manager.commitToDB();
+                log.debug("finalizing metadata: " + logPath);
+                metadataMap.remove(logPath);
+            }
         }
     }
 
@@ -82,8 +87,11 @@
      */
     public static void addEntry(String urlPath, Metadata.LogEntry entry) {
         synchronized (mutexObject) {
-            metadata = getMetadata(entry.getLogPath(), urlPath);
-            metadata.addEntry(entry);
+            Object readMutexObject = ORMUtil.getMutexObject();
+            synchronized (readMutexObject) {
+                metadata = getMetadata(entry.getLogPath(), urlPath);
+                metadata.addEntry(entry);
+            }
         }
     }
 
@@ -92,8 +100,12 @@
      */
     public static void addEntry(String urlPath, String logPath, int time) {
         synchronized (mutexObject) {
-            metadata = getMetadata(logPath, urlPath);
-            metadata.addExecutionTime(time);
+            Object readMutexObject = ORMUtil.getMutexObject();
+            synchronized (readMutexObject) {
+                
+                metadata = getMetadata(logPath, urlPath);
+                metadata.addExecutionTime(time);
+            }
         }
     }
     
@@ -104,9 +116,12 @@
      */
     public static void removeEntries(String urlPath, String logPath) {
         synchronized (mutexObject) {
-            metadata = getMetadata(logPath, urlPath);
-            metadata.removeEntries();
-            finalizeMetadata(logPath);
+            Object readMutexObject = ORMUtil.getMutexObject();
+            synchronized (readMutexObject) {
+                metadata = getMetadata(logPath, urlPath);
+                metadata.removeEntries();
+                finalizeMetadata(urlPath, logPath);
+            }
         }
     }
 
--- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ORMFMPPLoader.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ORMFMPPLoader.java	Thu Jul 22 17:08:43 2010 +0300
@@ -31,8 +31,6 @@
 import freemarker.template.SimpleNumber;
 import freemarker.template.TemplateModelIterator;
 import com.nokia.helium.jpa.ORMReader;
-import com.nokia.helium.jpa.ORMUtil;
-
 import org.apache.log4j.Logger;
 import freemarker.ext.beans.BeanModel;
 import freemarker.ext.beans.BeansWrapper;
@@ -113,10 +111,10 @@
         @Override
         public void notifyProgressEvent(Engine engine, int event, File src,
                 int pMode, Throwable error, Object param) throws Exception {
-            if (event == ProgressListener.EVENT_END_PROCESSING_SESSION) {
-                log.debug("notifyProgressEvent - finalizeORM");
-                ORMUtil.finalizeORM(dbPath);
-            }  
+            //if (event == ProgressListener.EVENT_END_PROCESSING_SESSION) {
+            //    log.debug("notifyProgressEvent - finalizeORM");
+            //    ORMUtil.finalizeORM(dbPath);
+            //}  
          }
     }
 
@@ -144,16 +142,21 @@
             //log.debug("QueryTemplateModel: query" + query);
             if (queryMode.equals("jpasingle")) {
                 //log.debug("query executing with single result mode");
-                resultObject = getModel((new ORMReader(dbPath)).executeSingleResult(query, returnType));
+                resultObject = getModel(dbPath, query, returnType);
+                
             } else {
                 //log.debug("query executing with multiple result mode");
-                resultObject = new ORMQueryModel(new ORMReader(dbPath), query, queryMode, returnType); 
+                resultObject = new ORMQueryModel(dbPath, query, queryMode, returnType); 
             }
             return resultObject;
         }
         
-        private TemplateModel getModel(Object result) {
-            return new ORMSequenceModel(result);
+        private TemplateModel getModel(String dbPath, String query, 
+                String returnType) {
+            ORMReader reader = new ORMReader(dbPath);
+            ORMSequenceModel model = new ORMSequenceModel(reader.executeSingleResult(query, returnType));
+            reader.close();
+            return model;
         }
 
         public boolean isEmpty() {
@@ -199,8 +202,8 @@
         private String query;
         private String returnType;
 
-        public ORMQueryModel (ORMReader reader, String queryString, String type, String retType) {
-            ormReader = reader;
+        public ORMQueryModel (String dbPath, String queryString, String type, String retType) {
+            ormReader = new ORMReader(dbPath);
             queryType = type;
             query = queryString;
             returnType = retType;
@@ -275,6 +278,7 @@
                     }
                     if (rowList == null || rowList.size() == 0) {
                         finished = true;
+                        ormReader.close();
                     }
                 }
             }
@@ -286,6 +290,5 @@
         public ORMObjectModel(Object obj) {
             super(obj, new BeansWrapper());
         }
-        
     }
 }
\ No newline at end of file
--- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataLogCondition.java	Thu Jul 22 17:08:43 2010 +0300
@@ -105,14 +105,17 @@
         // log file under the DB is always represented with / and not \.
         String logname = logFile.replace('\\', '/'); 
         String query = "select Count(m.id) from MetadataEntry m JOIN  m.logFile as l JOIN m.priority as p where l.path like '%" + logname + "' and UPPER(p.priority)='" + severity.toUpperCase() + "'";
-        Number number = (Number) (new ORMReader(fileName.getAbsolutePath())).executeSingleResult(query, null);
+        ORMReader reader = new ORMReader(fileName.getAbsolutePath());
+        Number number = (Number)reader.executeSingleResult(query, null);
+        int retValue = number.intValue();
         // Looking for missing file as error
         if (countMissing && prty == Metadata.PriorityEnum.ERROR) {
             String queryMissing = "select Count(m.id) from WhatLogEntry m JOIN m.component as c JOIN c.logFile as l where l.path like '%" + logname + "' and m.missing=1";
-            Number numberMissing = (Number) (new ORMReader(fileName.getAbsolutePath())).executeSingleResult(queryMissing, null);
-            return number.intValue() + numberMissing.intValue();
+            Number numberMissing = (Number) reader.executeSingleResult(queryMissing, null);
+            retValue = number.intValue() + numberMissing.intValue();
         }
-        return number.intValue();
+        reader.close();
+        return retValue;
     }
 
     /**
--- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataRegexTestCondition.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/conditions/MetaDataRegexTestCondition.java	Thu Jul 22 17:08:43 2010 +0300
@@ -99,9 +99,9 @@
           throw new BuildException("'string' attribute is not defined");
       for (MetaDataFilterSet set : filterSets) {
           for (MetaDataFilter filter : set.getAllFilters()) {
-              Pattern p = filter.getPattern();
-              Matcher m = p.matcher(this.string);
-              if (m.matches()) {
+              Pattern pattern = filter.getPattern();
+              Matcher matcher = pattern.matcher(this.string);
+              if (matcher.matches()) {
                   return this.severity.equalsIgnoreCase(filter.getPriority());
               }
           }
--- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/taskdefs/MetaDataRecord.java	Thu Jul 22 17:08:43 2010 +0300
@@ -121,24 +121,31 @@
             for (MetaDataInput metadataInput : metadataList) {
                 boolean removed = false;
                 String logPath = null;
+                String currentLogPath = null;
                 Iterator<Metadata.LogEntry> inputIterator = metadataInput.iterator();
                 while (inputIterator.hasNext()) {
+                    //Todo: better way of log handling, with metadatainput
+                    // metadata initialization for each logfile within 
+                    //metadatainput itself would be better. this is temporary.
                     Metadata.LogEntry logEntry = inputIterator.next();
-                    if (!removed) {
-                        logPath = logEntry.getLogPath();
+                    logPath = logEntry.getLogPath();
+                    if (currentLogPath == null) {
+                        currentLogPath = logPath;
+                        removed = false;
+                    } else if (!currentLogPath.equals(logPath)) {
+                        finalizeForLogPath(currentLogPath, metadataInput, ormDB);
+                        currentLogPath = logPath;
+                        removed = false;
+                    }
+                    if (!removed ) {
+                        log.debug("processing for log: " + logPath);
                         ormDB.removeEntries(logPath);
                         removed = true;
                     }
                     //initializes the metadata if none exists
                     ormDB.addLogEntry(logEntry);
                 }
-                if (logPath != null && metadataInput instanceof CustomMetaDataProvider) {
-                    CustomMetaDataProvider provider = (CustomMetaDataProvider)metadataInput;
-                    provider.provide(ormDB, logPath);
-                }
-                if (logPath != null) {
-                    ormDB.finalizeMetadata(logPath);
-                }
+                finalizeForLogPath(currentLogPath, metadataInput, ormDB);
             }
             Date after = new Date();
             log("Time after recording to db: " + after);
@@ -155,4 +162,16 @@
             }
         }
     }
+    
+    private void finalizeForLogPath(String currentLogPath, 
+            MetaDataInput metadataInput, ORMMetadataDB ormDB) {
+        if (currentLogPath != null) {
+            if (metadataInput instanceof CustomMetaDataProvider) {
+                CustomMetaDataProvider provider = 
+                    (CustomMetaDataProvider)metadataInput;
+                provider.provide(ormDB, currentLogPath);
+            }
+            ormDB.finalizeMetadata(currentLogPath);
+        }
+    }
 }
\ No newline at end of file
--- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/SBSLogMetaDataInput.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/ant/types/SBSLogMetaDataInput.java	Thu Jul 22 17:08:43 2010 +0300
@@ -403,9 +403,9 @@
                 inMainDataSection = true;
                 recordText = false;
                 if (logTextInfo != null) {
-                    Matcher m = buildTimeMatcher.matcher(logTextInfo);
-                    if (m.matches()) {
-                        buildTime = Integer.parseInt(m.group(1));
+                    Matcher matcher = buildTimeMatcher.matcher(logTextInfo);
+                    if (matcher.matches()) {
+                        buildTime = Integer.parseInt(matcher.group(1));
                         logger.info("Run time: " + buildTime);
                     }
                 }
--- a/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/db/ORMMetadataDB.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/src/com/nokia/helium/metadata/db/ORMMetadataDB.java	Thu Jul 22 17:08:43 2010 +0300
@@ -58,7 +58,7 @@
     }
 
     public void finalizeMetadata(String logPath) {
-        MetadataUtil.finalizeMetadata(logPath);
+        MetadataUtil.finalizeMetadata(dbPath, logPath);
     }
 
     public void finalizeDB() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/sf/java/metadata/tests/data/all_regex1_type.log	Thu Jul 22 17:08:43 2010 +0300
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<buildlog sbs_version="2.5.3 [2009-03-12 release]" xmlns="http://symbian.com/xml/build/log" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symbian.com/xml/build/log http://symbian.com/xml/build/log/1_0.xsd">
+<info>sbs: version 2.5.3 [2009-03-12 release]
+</info>
+<info>SBS_HOME E:/Build_E/ido-config-df/sbs</info>
+<info>Set-up E:/Build_E/ido-config-df/sbs/sbs_init.xml</info>
+<warning>E:/build_e/sbs_2.8.4/sbs/win32/mingw/bin/cpp.exe: </warning>
+<info>Command-line-arguments -s z:\output/build/canonical_system_definition_build.xml -k -c armv5 -j 4 -m z:\output\logs/ido_imm_mcl_devlon70_robot_5.1.005__armv5_multiple_thread_build_Makefile --filters=FilterHeliumLog -f z:\output\logs/ido_imm_mcl_devlon70_robot_5.1.005__armv5_multiple_thread_build_compile.log</info>
+<recipe name='resourcedependencies' target='z:/epoc32/build/camera/c_87f62b1af2e7d874/gscameraplugin_dll/gscameraplugin_resource_plugins_27.rpp.d' host='fawec012' layer='app_layer' component='' bldinf='z:/sf/app/camera/group/bld.inf' mmp='z:/sf/app/camera/camerauis/cameraapp/generic/GsCamcorderPlugin/group/gscameraplugin.mmp' config='armv5_udeb' platform='' phase='RESOURCE_DEPS' source=''>
+<![CDATA[
+mingw_make.exe: error
+test FATAL ERROR(S):abcd
+): Missing file:
+abcd FLEXlm error:
+ABLD ERROR: 1234
+BLDMAKE ERROR: 43543
+test FATAL ERROR 
+fatal error U1077 error occured
+test warning U4010
+Warning:
+WARNING:
+LINK : warning
+REMARK: 
+:10: warning: cannot find matching deallocation function
+INFO:
+make[10]: ***abcd
+make[10]: abcd not remade because of errors
+error: ((Internal fault)):
+ERROR,error: ((Internal fault):)$,
+ error given more than once in the same rule
+ERROR: build error
+ERROR EC95940: ec error
+Errors caused tool to abort. asdfasdf
+test no rule to make target
+ERROR,.*no rule to make.*,
+ERROR	testing
+100) : WARNING: TEST123
+MAKEDEF WARNING: TEST
+TEST 123 \\(10) : Warning: (400)
+BLDMAKE WARNING: bldm warning
+MAKEDEF WARNING: make warning
+atest(100) : warning C aasdfa
+testas 100: warning: test123
+usage Usage Warning: warn1
+abcd mwld.exe: abcd
+Command line warning abcd
+anything ERROR: bad relocation: test123
+10 warning in component1
+EventType: Error Source: SweepNTabcde
+WARNING,.EventType:\s+Error\s+Source:\s+SweepNT.*,
+WARN	test
+anything Command line warning D4025 : test
+REMARK: test remark anything
+EventType: Error Source: GNU Make.
+abcd :10: warning: cannot find matching deallocation function 100:note abcd
+INFO: any info match
+"abcd" 
+line 100+: Warning:', : warning 30:,
+"abcd , line 100: Error: 100abcd:. abcd
+line 10: Warning:\', r\': warning 10: abcd
+"abcd, line 100: Warning: 100 abcd: abcd",
+]]><time start='1238421421.153697000' elapsed='0.171' />
++ RV=0
++ set +x
+<status exit='ok' attempt='1' />
+</recipe>
+</buildlog>
--- a/buildframework/helium/sf/java/metadata/tests/data/metadatacount_error_and_missing_files.log	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/tests/data/metadatacount_error_and_missing_files.log	Thu Jul 22 17:08:43 2010 +0300
@@ -95,8 +95,8 @@
 <info>Environment __CYGWIN__=C:\apps\sbs\win32\cygwin</info>
 <info>Environment __MINGW__=C:\apps\sbs\win32\mingw</info>
 <info>Environment __PYTHON__=C:\APPS\actpython\python.exe</info>
-<info>Duplicate alias 'make' (the one from 'G:/epoc32/sbs_config\s60_sbs_config.xml' will override the one in 'C:/apps/sbs/lib/config\make.xml')</info>
-<info>Duplicate alias 'emake' (the one from 'G:/epoc32/sbs_config\s60_sbs_config.xml' will override the one in 'C:/apps/sbs/lib/config\make.xml')</info>
+<info>Duplicate alias 'make' (the one from 'G:/invalid_sdk/epoc32/sbs_config\s60_sbs_config.xml' will override the one in 'C:/apps/sbs/lib/config\make.xml')</info>
+<info>Duplicate alias 'emake' (the one from 'G:/invalid_sdk/epoc32/sbs_config\s60_sbs_config.xml' will override the one in 'C:/apps/sbs/lib/config\make.xml')</info>
 <info>Buildable configuration 'armv5_urel'</info>
 <info>Buildable configuration 'armv5_udeb'</info>
 <info>Buildable configuration 'winscw_udeb'</info>
@@ -114,42 +114,42 @@
 <info>Found 30 bld.inf references in layer "addon_layer"</info>
 <info>Found 0 bld.inf references in layer "unit_test_layer"</info>
 <info>Found 6 bld.inf references in layer "complementary_layer"</info>
-<info>Toolcheck cache G:/epoc32/build/toolcheck_cache_.tmp ignored - environment changed
+<info>Toolcheck cache G:/invalid_sdk/epoc32/build/toolcheck_cache_.tmp ignored - environment changed
 </info>
-<info>OS version "vtb92sf" determined from file "G:/epoc32/data/buildinfo.txt"</info>
+<info>OS version "vtb92sf" determined from file "G:/invalid_sdk/epoc32/data/buildinfo.txt"</info>
 <info>applying the OS variant to the configuration "armv5_urel".</info>
-<info>'armv5_urel' uses variant hrh file 'G:/epoc32/include/feature_settings.hrh'</info>
-<info>OS version "vtb92sf" determined from file "G:/epoc32/data/buildinfo.txt"</info>
+<info>'armv5_urel' uses variant hrh file 'G:/invalid_sdk/epoc32/include/feature_settings.hrh'</info>
+<info>OS version "vtb92sf" determined from file "G:/invalid_sdk/epoc32/data/buildinfo.txt"</info>
 <info>applying the OS variant to the configuration "armv5_udeb".</info>
-<info>'armv5_udeb' uses variant hrh file 'G:/epoc32/include/feature_settings.hrh'</info>
-<info>OS version "vtb92sf" determined from file "G:/epoc32/data/buildinfo.txt"</info>
+<info>'armv5_udeb' uses variant hrh file 'G:/invalid_sdk/epoc32/include/feature_settings.hrh'</info>
+<info>OS version "vtb92sf" determined from file "G:/invalid_sdk/epoc32/data/buildinfo.txt"</info>
 <info>applying the OS variant to the configuration "winscw_udeb".</info>
-<info>'winscw_udeb' uses variant hrh file 'G:/epoc32/include/feature_settings.hrh'</info>
-<info>OS version "vtb92sf" determined from file "G:/epoc32/data/buildinfo.txt"</info>
+<info>'winscw_udeb' uses variant hrh file 'G:/invalid_sdk/epoc32/include/feature_settings.hrh'</info>
+<info>OS version "vtb92sf" determined from file "G:/invalid_sdk/epoc32/data/buildinfo.txt"</info>
 <info>applying the OS variant to the configuration "winscw_urel".</info>
-<info>'winscw_urel' uses variant hrh file 'G:/epoc32/include/feature_settings.hrh'</info>
+<info>'winscw_urel' uses variant hrh file 'G:/invalid_sdk/epoc32/include/feature_settings.hrh'</info>
 <info>Processing G:/sf/mw/svgt/group/bld.inf</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h to G:/epoc32/include/platform/mw/SVGImageLoadingObserver.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGEngineInterfaceImpl.h to G:/epoc32/include/platform/mw/SVGEngineInterfaceImpl.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SvgListener.h to G:/epoc32/include/platform/mw/SVGListener.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGErrorImpl.h to G:/epoc32/include/platform/mw/SVGErrorImpl.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SvgJavaInterfaceImpl.h to G:/epoc32/include/platform/mw/SvgJavaInterfaceImpl.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGHyperlinkListener.h to G:/epoc32/include/platform/mw/SVGHyperlinkListener.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGAnimationListener.h to G:/epoc32/include/platform/mw/SVGAnimationListener.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGRequestObserver.h to G:/epoc32/include/platform/mw/SVGRequestObserver.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGRendererId.h to G:/epoc32/include/platform/mw/SVGRendererId.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/nvg.h to G:/epoc32/include/platform/mw/nvg.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/MVGImageBinder.h to G:/epoc32/include/platform/mw/MVGImageBinder.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/NVGIcon.h to G:/epoc32/include/platform/mw/NVGIcon.h</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/SVGEngine.iby to G:/epoc32/rom/include/core/mw/SVGEngine.iby</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/SvgtPluginEcom.iby to G:/epoc32/rom/include/core/mw/SvgtPluginEcom.iby</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/nvgdecoder.iby to G:/epoc32/rom/include/core/mw/NVGDecoder.iby</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/NVGDecoder_SW.iby to G:/epoc32/rom/include/core/mw/NVGDecoder_SW.iby</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/VGRenderer.iby to G:/epoc32/rom/include/core/mw/VGRenderer.iby</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGImageLoadingObserver.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGEngineInterfaceImpl.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGEngineInterfaceImpl.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SvgListener.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGListener.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGErrorImpl.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGErrorImpl.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SvgJavaInterfaceImpl.h to G:/invalid_sdk/epoc32/include/platform/mw/SvgJavaInterfaceImpl.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGHyperlinkListener.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGHyperlinkListener.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGAnimationListener.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGAnimationListener.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGRequestObserver.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGRequestObserver.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGRendererId.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGRendererId.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/nvg.h to G:/invalid_sdk/epoc32/include/platform/mw/nvg.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/MVGImageBinder.h to G:/invalid_sdk/epoc32/include/platform/mw/MVGImageBinder.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/NVGIcon.h to G:/invalid_sdk/epoc32/include/platform/mw/NVGIcon.h</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/SVGEngine.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/SVGEngine.iby</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/SvgtPluginEcom.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/SvgtPluginEcom.iby</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/nvgdecoder.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/NVGDecoder.iby</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/NVGDecoder_SW.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/NVGDecoder_SW.iby</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/VGRenderer.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/VGRenderer.iby</info>
 <whatlog bldinf='G:/sf/mw/svgt/group/bld.inf' mmp='' config=''>
-<export destination='G:/epoc32/include/platform/mw/SVGImageLoadingObserver.h' source='G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h'/>
-<resource>G:/epoc32/include/hrv_gain_mappings.rsg</resource>
-<build>G:/epoc32/release/armv5/urel/ekeyb.dll</build>
+<export destination='G:/invalid_sdk/epoc32/include/platform/mw/SVGImageLoadingObserver.h' source='G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h'/>
+<resource>G:/invalid_sdk/epoc32/include/hrv_gain_mappings.rsg</resource>
+<build>G:/invalid_sdk/epoc32/release/armv5/urel/ekeyb.dll</build>
 </whatlog>
 <recipe name='compile' target='X:/epoc32/build/organizer/c_aff6bae36b1df6c4/srchuiresviewplugin_dll/armv5/urel/srchuiresultview.o' host='' layer='app_layer' component='' bldinf='X:/sf/app/organizer/group/bld.inf' mmp='X:/sf/app/organizer/searchui/searchapp/plugins/resultviewerplugin/group/srchuiresviewplugin.mmp' config='armv5_urel.product' platform='armv5' phase='ALL' source='X:/sf/app/organizer/searchui/searchapp/plugins/resultviewerplugin/src/srchuiresultview2.cpp'>
 <![CDATA[
@@ -157,16 +157,16 @@
 <status exit='failed' code='1' attempt='3' />
 </recipe>
 <clean bldinf='G:/sf/os/deviceplatformrelease/locfiles/group/set14/bld.inf' mmp='' config=''>
-<zipmarker>G:/epoc32/build/G__sf_os_deviceplatformrelease_locfiles_data_65.zipG__epoc32_include_platform_loc.unzipped</zipmarker>
+<zipmarker>G:/invalid_sdk/epoc32/build/G__sf_os_deviceplatformrelease_locfiles_data_65.zipG__epoc32_include_platform_loc.unzipped</zipmarker>
 </clean>
 <whatlog bldinf='G:/sf/os/deviceplatformrelease/locfiles/group/set14/bld.inf' mmp='' config=''>
 <archive zipfile='G:/sf/os/deviceplatformrelease/locfiles/data/65.zip'>
-<member>G:/epoc32/include/platform/loc/65/101f6dd6_65.loc</member>
-<member>G:/epoc32/include/platform/loc/65/101f6dd7_65.loc</member>
+<member>G:/invalid_sdk/epoc32/include/platform/loc/65/101f6dd6_65.loc</member>
+<member>G:/invalid_sdk/epoc32/include/platform/loc/65/101f6dd7_65.loc</member>
 </archive>
 </whatlog>
 <info>The make-engine exited successfully.</info>
 <info>Run time 999 seconds</info>
-<info>Created/Updated toolcheck cache: G:/epoc32/build/toolcheck_cache_.tmp
+<info>Created/Updated toolcheck cache: G:/invalid_sdk/epoc32/build/toolcheck_cache_.tmp
 </info>
 </buildlog>
--- a/buildframework/helium/sf/java/metadata/tests/data/metadatacount_missing_files.log	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/tests/data/metadatacount_missing_files.log	Thu Jul 22 17:08:43 2010 +0300
@@ -95,8 +95,8 @@
 <info>Environment __CYGWIN__=C:\apps\sbs\win32\cygwin</info>
 <info>Environment __MINGW__=C:\apps\sbs\win32\mingw</info>
 <info>Environment __PYTHON__=C:\APPS\actpython\python.exe</info>
-<info>Duplicate alias 'make' (the one from 'G:/epoc32/sbs_config\s60_sbs_config.xml' will override the one in 'C:/apps/sbs/lib/config\make.xml')</info>
-<info>Duplicate alias 'emake' (the one from 'G:/epoc32/sbs_config\s60_sbs_config.xml' will override the one in 'C:/apps/sbs/lib/config\make.xml')</info>
+<info>Duplicate alias 'make' (the one from 'G:/invalid_sdk/epoc32/sbs_config\s60_sbs_config.xml' will override the one in 'C:/apps/sbs/lib/config\make.xml')</info>
+<info>Duplicate alias 'emake' (the one from 'G:/invalid_sdk/epoc32/sbs_config\s60_sbs_config.xml' will override the one in 'C:/apps/sbs/lib/config\make.xml')</info>
 <info>Buildable configuration 'armv5_urel'</info>
 <info>Buildable configuration 'armv5_udeb'</info>
 <info>Buildable configuration 'winscw_udeb'</info>
@@ -114,54 +114,54 @@
 <info>Found 30 bld.inf references in layer "addon_layer"</info>
 <info>Found 0 bld.inf references in layer "unit_test_layer"</info>
 <info>Found 6 bld.inf references in layer "complementary_layer"</info>
-<info>Toolcheck cache G:/epoc32/build/toolcheck_cache_.tmp ignored - environment changed
+<info>Toolcheck cache G:/invalid_sdk/epoc32/build/toolcheck_cache_.tmp ignored - environment changed
 </info>
-<info>OS version "vtb92sf" determined from file "G:/epoc32/data/buildinfo.txt"</info>
+<info>OS version "vtb92sf" determined from file "G:/invalid_sdk/epoc32/data/buildinfo.txt"</info>
 <info>applying the OS variant to the configuration "armv5_urel".</info>
-<info>'armv5_urel' uses variant hrh file 'G:/epoc32/include/feature_settings.hrh'</info>
-<info>OS version "vtb92sf" determined from file "G:/epoc32/data/buildinfo.txt"</info>
+<info>'armv5_urel' uses variant hrh file 'G:/invalid_sdk/epoc32/include/feature_settings.hrh'</info>
+<info>OS version "vtb92sf" determined from file "G:/invalid_sdk/epoc32/data/buildinfo.txt"</info>
 <info>applying the OS variant to the configuration "armv5_udeb".</info>
-<info>'armv5_udeb' uses variant hrh file 'G:/epoc32/include/feature_settings.hrh'</info>
-<info>OS version "vtb92sf" determined from file "G:/epoc32/data/buildinfo.txt"</info>
+<info>'armv5_udeb' uses variant hrh file 'G:/invalid_sdk/epoc32/include/feature_settings.hrh'</info>
+<info>OS version "vtb92sf" determined from file "G:/invalid_sdk/epoc32/data/buildinfo.txt"</info>
 <info>applying the OS variant to the configuration "winscw_udeb".</info>
-<info>'winscw_udeb' uses variant hrh file 'G:/epoc32/include/feature_settings.hrh'</info>
-<info>OS version "vtb92sf" determined from file "G:/epoc32/data/buildinfo.txt"</info>
+<info>'winscw_udeb' uses variant hrh file 'G:/invalid_sdk/epoc32/include/feature_settings.hrh'</info>
+<info>OS version "vtb92sf" determined from file "G:/invalid_sdk/epoc32/data/buildinfo.txt"</info>
 <info>applying the OS variant to the configuration "winscw_urel".</info>
-<info>'winscw_urel' uses variant hrh file 'G:/epoc32/include/feature_settings.hrh'</info>
+<info>'winscw_urel' uses variant hrh file 'G:/invalid_sdk/epoc32/include/feature_settings.hrh'</info>
 <info>Processing G:/sf/mw/svgt/group/bld.inf</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h to G:/epoc32/include/platform/mw/SVGImageLoadingObserver.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGEngineInterfaceImpl.h to G:/epoc32/include/platform/mw/SVGEngineInterfaceImpl.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SvgListener.h to G:/epoc32/include/platform/mw/SVGListener.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGErrorImpl.h to G:/epoc32/include/platform/mw/SVGErrorImpl.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SvgJavaInterfaceImpl.h to G:/epoc32/include/platform/mw/SvgJavaInterfaceImpl.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGHyperlinkListener.h to G:/epoc32/include/platform/mw/SVGHyperlinkListener.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGAnimationListener.h to G:/epoc32/include/platform/mw/SVGAnimationListener.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGRequestObserver.h to G:/epoc32/include/platform/mw/SVGRequestObserver.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGRendererId.h to G:/epoc32/include/platform/mw/SVGRendererId.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/nvg.h to G:/epoc32/include/platform/mw/nvg.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/MVGImageBinder.h to G:/epoc32/include/platform/mw/MVGImageBinder.h</info>
-<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/NVGIcon.h to G:/epoc32/include/platform/mw/NVGIcon.h</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/SVGEngine.iby to G:/epoc32/rom/include/core/mw/SVGEngine.iby</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/SvgtPluginEcom.iby to G:/epoc32/rom/include/core/mw/SvgtPluginEcom.iby</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/nvgdecoder.iby to G:/epoc32/rom/include/core/mw/NVGDecoder.iby</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/NVGDecoder_SW.iby to G:/epoc32/rom/include/core/mw/NVGDecoder_SW.iby</info>
-<info>Copied G:/sf/mw/svgt/svgtopt/rom/VGRenderer.iby to G:/epoc32/rom/include/core/mw/VGRenderer.iby</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGImageLoadingObserver.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGEngineInterfaceImpl.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGEngineInterfaceImpl.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SvgListener.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGListener.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGErrorImpl.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGErrorImpl.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SvgJavaInterfaceImpl.h to G:/invalid_sdk/epoc32/include/platform/mw/SvgJavaInterfaceImpl.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGHyperlinkListener.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGHyperlinkListener.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGAnimationListener.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGAnimationListener.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGRequestObserver.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGRequestObserver.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGRendererId.h to G:/invalid_sdk/epoc32/include/platform/mw/SVGRendererId.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/nvg.h to G:/invalid_sdk/epoc32/include/platform/mw/nvg.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/MVGImageBinder.h to G:/invalid_sdk/epoc32/include/platform/mw/MVGImageBinder.h</info>
+<info>Copied G:/sf/mw/svgt/svgt_plat/nvg_api/inc/NVGIcon.h to G:/invalid_sdk/epoc32/include/platform/mw/NVGIcon.h</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/SVGEngine.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/SVGEngine.iby</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/SvgtPluginEcom.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/SvgtPluginEcom.iby</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/nvgdecoder.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/NVGDecoder.iby</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/NVGDecoder_SW.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/NVGDecoder_SW.iby</info>
+<info>Copied G:/sf/mw/svgt/svgtopt/rom/VGRenderer.iby to G:/invalid_sdk/epoc32/rom/include/core/mw/VGRenderer.iby</info>
 <whatlog bldinf='G:/sf/mw/svgt/group/bld.inf' mmp='' config=''>
-<export destination='G:/epoc32/include/platform/mw/SVGImageLoadingObserver.h' source='G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h'/>
-<resource>G:/epoc32/include/hrv_gain_mappings.rsg</resource>
-<build>G:/epoc32/release/armv5/urel/ekeyb.dll</build>
+<export destination='G:/invalid_sdk/epoc32/include/platform/mw/SVGImageLoadingObserver.h' source='G:/sf/mw/svgt/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h'/>
+<resource>G:/invalid_sdk/epoc32/include/hrv_gain_mappings.rsg</resource>
+<build>G:/invalid_sdk/epoc32/release/armv5/urel/ekeyb.dll</build>
 </whatlog>
 <clean bldinf='G:/sf/os/deviceplatformrelease/locfiles/group/set14/bld.inf' mmp='' config=''>
-<zipmarker>G:/epoc32/build/G__sf_os_deviceplatformrelease_locfiles_data_65.zipG__epoc32_include_platform_loc.unzipped</zipmarker>
+<zipmarker>G:/invalid_sdk/epoc32/build/G__sf_os_deviceplatformrelease_locfiles_data_65.zipG__epoc32_include_platform_loc.unzipped</zipmarker>
 </clean>
 <whatlog bldinf='G:/sf/os/deviceplatformrelease/locfiles/group/set14/bld.inf' mmp='' config=''>
 <archive zipfile='G:/sf/os/deviceplatformrelease/locfiles/data/65.zip'>
-<member>G:/epoc32/include/platform/loc/65/101f6dd6_65.loc</member>
-<member>G:/epoc32/include/platform/loc/65/101f6dd7_65.loc</member>
+<member>G:/invalid_sdk/epoc32/include/platform/loc/65/101f6dd6_65.loc</member>
+<member>G:/invalid_sdk/epoc32/include/platform/loc/65/101f6dd7_65.loc</member>
 </archive>
 </whatlog>
 <info>The make-engine exited successfully.</info>
 <info>Run time 999 seconds</info>
-<info>Created/Updated toolcheck cache: G:/epoc32/build/toolcheck_cache_.tmp
+<info>Created/Updated toolcheck cache: G:/invalid_sdk/epoc32/build/toolcheck_cache_.tmp
 </info>
 </buildlog>
--- a/buildframework/helium/sf/java/metadata/tests/functionality/test_regex.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/metadata/tests/functionality/test_regex.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -78,21 +78,62 @@
     </target>
     <!-- Test parser error
     -->
-    <target name="test-parser-error">
-        <delete dir="${test.temp.dir}/parser_error_db" failonerror="false" />
-        <au:expectfailure>
-            <hlm:metadatarecord database="${test.temp.dir}/parser_error_db">
-                <hlm:sbsmetadatainput>
-                    <fileset dir="${project.dir}/../data/">
-                        <include  name="parser_error.log"/>
-                    </fileset>
-                    <metadatafilterset refid="all-regex-filterfile" />
-                </hlm:sbsmetadatainput>
-            </hlm:metadatarecord>
-        </au:expectfailure>
-    </target>
     <!-- Test parser error
     -->
+    <target name="parser-error">
+        <property name="metadata-read-db" value="${test.temp.dir}/log_all_filterfile_db"/>
+        <delete dir="${metadata-read-db}" failonerror="false"/>
+        <echo message="all regular expression validation" />
+        <echo message="database:${metadata-read-db}" />
+        <!-- do some checks that files are present and raise asserts if not present-->
+        <au:assertFileExists file="${metadata-filterfile}" message="${metadata-filterfile} filter file does not exist"/>
+        <mkdir dir="${test.temp.dir}"/>
+        
+        <hlm:metadatarecord database="${metadata-read-db}">
+            <hlm:sbsmetadatainput>
+                <fileset dir="${project.dir}/../data/">
+                    <include  name="all_regex_type.log"/>
+                </fileset>
+                <metadatafilterset refid="all-regex-filterfile" />
+            </hlm:sbsmetadatainput>
+        </hlm:metadatarecord>
+        <!-- check we have created the DB file-->
+        <au:assertTrue>
+            <available type="dir" file="${metadata-read-db}" />
+        </au:assertTrue>
+    </target>
+
+    <target name="parser-error1">
+        <property name="metadata-read-db" value="${test.temp.dir}/log_all_filterfile_db"/>
+        <delete dir="${metadata-read-db}" failonerror="false"/>
+        <echo message="all regular expression validation" />
+        <echo message="database:${metadata-read-db}" />
+        <!-- do some checks that files are present and raise asserts if not present-->
+        <au:assertFileExists file="${metadata-filterfile}" message="${metadata-filterfile} filter file does not exist"/>
+        <mkdir dir="${test.temp.dir}"/>
+        
+        <hlm:metadatarecord database="${metadata-read-db}">
+            <hlm:sbsmetadatainput>
+                <fileset dir="${project.dir}/../data/">
+                    <include  name="all_regex1_type.log"/>
+                </fileset>
+                <metadatafilterset refid="all-regex-filterfile" />
+            </hlm:sbsmetadatainput>
+        </hlm:metadatarecord>
+        <!-- check we have created the DB file-->
+        <au:assertTrue>
+            <available type="dir" file="${metadata-read-db}" />
+        </au:assertTrue>
+    </target>
+
+    <target name="test-parser-error-ant-call">
+        <parallel>
+            <antcall target="parser-error" />
+            <antcall target="parser-error1" />
+        </parallel>
+    </target>
+
+    <!-- Test parser error-->
     <target name="test-parser-error-keepgoing">
         <delete dir="${test.temp.dir}/parser_error_db" failonerror="false" />
         <hlm:metadatarecord database="${test.temp.dir}/parser_error_db" failonerror="false">
@@ -164,6 +205,7 @@
             </hlm:sbsmetadatainput>
         </hlm:metadatarecord>
         <hlm:metadataCountSeverity severity="error" log="categorization_failed_empty_recipe.log" db="${test.temp.dir}/log-entry-failed-empty-recipe_db" property="empty_nocleanlog_errors"/>
+        <echo message="no.of empty_nocleanlog_errors: ${empty_nocleanlog_errors}" />
         <au:assertTrue>
             <equals arg1="${empty_nocleanlog_errors}" arg2="2"/>
         </au:assertTrue>
@@ -181,6 +223,7 @@
             </hlm:sbsmetadatainput>
         </hlm:metadatarecord>
         <hlm:metadataCountSeverity severity="error" log="categorization_failed_error_in_recipe.log" db="${test.temp.dir}/log-entry-failed-error-in-recipe_db" property="empty_nocleanlog_errors"/>
+        <echo message="no.of empty_nocleanlog_errors: ${empty_nocleanlog_errors}" />
         <au:assertTrue>
             <equals arg1="${empty_nocleanlog_errors}" arg2="2"/>
         </au:assertTrue>
@@ -558,7 +601,7 @@
         </hlm:metadatarecord>
 
         <hlm:metadataCountSeverity severity="error" log="_fixslashes_raptor.log" db="${test.temp.dir}/dp_db" property="errors"/>
-        <echo message="${errors}" />
+        <echo message="errors:${errors}" />
         <au:assertTrue>
             <equals arg1="${errors}" arg2="24"/>
         </au:assertTrue>
@@ -585,6 +628,7 @@
             </hlm:sbsmetadatainput>
         </hlm:metadatarecord>
         <hlm:metadataCountSeverity severity="error" log="data\metadatacount_missing_files.log" db="${test.temp.dir}/metadatacount_with_missing_files_db" property="errors"/>
+        <echo message="errors: ${errors}" />
         <au:assertTrue message="We must have 5 missing files counted as error.">
             <equals arg1="${errors}" arg2="5"/>
         </au:assertTrue>
@@ -711,6 +755,7 @@
             </hlm:sbsmetadatainput>
         </hlm:metadatarecord>
         <hlm:metadataCountSeverity severity="error" log="metadatacount_missing_files.log" db="${test.temp.dir}/metadatacount_with_missing_files_db" property="errors"/>
+        <echo message="errors: ${errors}" />
         <au:assertTrue message="We must have 5 missing files counted as error.">
             <equals arg1="${errors}" arg2="5"/>
         </au:assertTrue>
@@ -730,6 +775,7 @@
             </hlm:sbsmetadatainput>
         </hlm:metadatarecord>
         <hlm:metadataCountSeverity severity="error" log="metadatacount_error_and_missing_files.log" db="${test.temp.dir}/metadatacount_with_missing_files_db" property="errors"/>
+        <echo message="errors: ${errors}" />
         <au:assertTrue message="We must have 6 missing files counted as error.">
             <equals arg1="${errors}" arg2="6"/>
         </au:assertTrue>
@@ -751,9 +797,9 @@
         <hlm:metadataCountSeverity severity="error" log="metadatacount_error_and_missing_files.log"
             db="${test.temp.dir}/metadatacount_with_missing_files_db" property="errors"
             countMissing="false"/>
+        <echo message="errors: ${errors}" />
         <au:assertTrue message="We must have 1 missing files counted as error.">
             <equals arg1="${errors}" arg2="1"/>
         </au:assertTrue>
     </target>
-
 </project>
\ No newline at end of file
--- a/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/Coverity.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/Coverity.java	Thu Jul 22 17:08:43 2010 +0300
@@ -18,8 +18,6 @@
 
 import java.io.File;
 import java.util.Vector;
-import java.util.Map.Entry;
-
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.taskdefs.ExecTask;
@@ -85,10 +83,16 @@
         task.setDir(new File(this.dir));
         
         for (VariableSet coverityArg : coverityOptions) {
-            for (Entry<String, Variable> entry : coverityArg.getVariablesMap().entrySet() ) {
-                task.createArg().setValue(entry.getKey());
-                task.createArg().setValue(entry.getValue().getValue());
-                commandString = commandString + " " + entry.getKey() + " " + entry.getValue().getValue();
+            for (Variable var : coverityArg.getVariables()) {
+                if (var.getValue().startsWith(var.getName())) {
+                    task.createArg().setLine(var.getValue());
+                    commandString = commandString + " " + var.getValue() ;
+                } else {
+                    task.createArg().setValue(var.getName());
+                    task.createArg().setValue(var.getValue());
+                    commandString = commandString + " " + var.getName() + " "
+                            + var.getValue();
+                }
             }
         }
         
--- 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);
     }
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/sf/java/sbs/tests/antunit/test_ctc.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!-- 
+============================================================================ 
+Name        : test_ctc.ant.xml 
+Part of     : Helium AntLib
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
+This component and the accompanying materials are made available
+under the terms of the License "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+Initial Contributors:
+Nokia Corporation - initial contribution.
+
+Contributors:
+
+Description:
+
+============================================================================
+-->
+
+<project name="test-sbs-ctc" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
+    <description>Helium Antlib ctc-sbs unittests.</description>
+
+    <taskdef resource="com/nokia/helium/core/ant/antlib.xml" uri="http://www.nokia.com/helium"/>
+    <taskdef resource="com/nokia/helium/sbs/ant/antlib.xml" uri="http://www.nokia.com/helium"/>
+    
+    <property name="build.system" value="sbs" />
+
+    <import file="sbs_default_config.ant.xml" />
+
+    <target name="test-ctc">
+        <property name="build.system" value="sbs" />
+        <hlm:getsbsinputs config="pf_7952" outputProperty="sbs-inputs"/>
+        <hlm:ctctask outputLog="tmp" sbsinput="${sbs-inputs}" sysdefFile="../data/test.sysdef.xml" 
+            layerPatternSetRef="includeNoNameLayerPatternSet" workingDir="${working.dir}"
+            execute="false"/>
+        <au:assertLogContains text="-i m sbs" />
+    </target>
+    
+    <target name="test-ctc-custom-config">
+        <property name="build.system" value="sbs" />
+        <hlm:getsbsinputs config="pf_7952" outputProperty="sbs-inputs"/>
+        <hlm:ctctask outputLog="tmp" sbsinput="${sbs-inputs}" sysdefFile="../data/test.sysdef.xml" 
+            layerPatternSetRef="includeNoNameLayerPatternSet" workingDir="${working.dir}"
+            execute="false">
+            <CTCOptions>
+                <arg line="-C OPT_ADD_COMPILE+-DCTC_NO_START_CTCMAN" />
+            </CTCOptions>
+        </hlm:ctctask>
+        <au:assertLogContains text="-i m  -C OPT_ADD_COMPILE+-DCTC_NO_START_CTCMAN sbs" />
+    </target>
+
+    <hlm:argSet id="ctc.extra.params">
+        <arg line="-C OPT_ADD_COMPILE+-DCTC_NO_START_CTCMAN" />
+    </hlm:argSet>
+
+    <target name="test-ctc-custom-ref-config">
+        <property name="build.system" value="sbs" />
+        <hlm:getsbsinputs config="pf_7952" outputProperty="sbs-inputs"/>
+        <hlm:ctctask outputLog="tmp" sbsinput="${sbs-inputs}" sysdefFile="../data/test.sysdef.xml" 
+            layerPatternSetRef="includeNoNameLayerPatternSet" workingDir="${working.dir}"
+            execute="false">
+            <CTCOptions refid="ctc.extra.params" />
+        </hlm:ctctask>
+        <au:assertLogContains text="-i m  -C OPT_ADD_COMPILE+-DCTC_NO_START_CTCMAN sbs" />
+    </target>
+
+
+    <target name="test-ctc-custom-ref-config-instrumentType">
+        <property name="build.system" value="sbs" />
+        <hlm:getsbsinputs config="pf_7952" outputProperty="sbs-inputs"/>
+        <hlm:ctctask outputLog="tmp" sbsinput="${sbs-inputs}" sysdefFile="../data/test.sysdef.xml" 
+            layerPatternSetRef="includeNoNameLayerPatternSet" workingDir="${working.dir}"
+            execute="false"
+            instrumentType="i">
+            <CTCOptions refid="ctc.extra.params" />
+        </hlm:ctctask>
+        <au:assertLogContains text="-i i  -C OPT_ADD_COMPILE+-DCTC_NO_START_CTCMAN sbs" />
+    </target>
+</project>
--- a/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/ExecuteTaskNotifier.java	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/signaling/src/com/nokia/helium/signal/ant/types/ExecuteTaskNotifier.java	Thu Jul 22 17:08:43 2010 +0300
@@ -88,7 +88,7 @@
             prj.setProperty("signal.message", message );
             // Converting the list of inputs into a string.
             String inputs = "";
-            if (notifierInput != null) {
+            if (notifierInput != null && notifierInput.getFile() != null) {
                 inputs += notifierInput.getFile().toString();
             }
             prj.setProperty("signal.notifier.inputs", inputs);
--- a/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/templates/root_sysdef_model.xml.ftl	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/templates/root_sysdef_model.xml.ftl	Thu Jul 22 17:08:43 2010 +0300
@@ -149,7 +149,7 @@
     <#list roots?keys as root>
         <#if roots[root]?keys?seq_contains(layer)>
             <#list roots[root][layer] as pkg>
-        <package id="${pkg}" href="${dest_dir_to_epocroot?replace('\\', '/')}${root}/${layer}/${pkg}/package_definition.xml"/>
+        <package id="${pkg?replace('/', '_')}" href="${dest_dir_to_epocroot?replace('\\', '/')}${root}/${layer}/${pkg}/package_definition.xml"/>
             </#list>
         </#if>
     </#list>
--- a/buildframework/helium/sf/python/pythoncore/lib/archive/builders.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/archive/builders.py	Thu Jul 22 17:08:43 2010 +0300
@@ -115,10 +115,23 @@
         writer.close()
 
     def getCommonUncRoots(self, uncPaths):
-        """get common UNC roots"""
+        """ Get common UNC roots.
+            The following [r'\\server1\foo\bar', r'\\server2\foo', r'\\server1\foo'] input
+            will return [r'\\server1\foo\', r'\\server2\foo'].
+        """
         commonRoots = {}
+        uncPaths = [os.path.normpath(p_path) for p_path in uncPaths]
+        # sorting the input by alphabetical order, so smaller roots 
+        # are coming first.
+        uncPaths.sort()
         for p_path in uncPaths:
-            commonRoots["\\\\" + os.sep.join(p_path[2:].split(os.sep)[0:2]) + os.sep] = 1
+            common_path = "\\\\"
+            for p_comp in p_path[2:].split(os.sep):
+                common_path = common_path + p_comp + os.sep
+                if common_path in commonRoots:
+                    break
+            else:
+                commonRoots[common_path] = 1
         return commonRoots.keys()
 
     def getPrefix(self, dir, commonUncRoots):
@@ -138,7 +151,7 @@
         # Of course this is only on windows platform
         if os.sep == '\\':
             for config in self.configs:
-                (drive, root_dir) = os.path.splitdrive(os.path.normpath(config['root.dir']))
+                (drive, root_dir) = os.path.splitdrive(os.path.abspath(os.path.normpath(config['root.dir'])))
                 _logger.debug("drive=%s, root_dir=%s" % (drive, root_dir))
                 if drive == "":
                     self.listToFindPrefix.append(root_dir)
@@ -153,14 +166,16 @@
                 substDrives.append(driveMapping[root] + os.sep)
 
             for config in self.configs:
-                (drive, root_dir) = os.path.splitdrive(os.path.normpath(config['root.dir']) + os.sep) 
+                (drive, root_dir) = os.path.splitdrive(os.path.abspath(os.path.normpath(config['root.dir'])) + os.sep) 
                 if drive == "":
                     for root in driveMapping:
                         if root_dir.startswith(root):
                             config['root.dir'] = os.path.normpath(driveMapping[root] + os.sep + root_dir[len(root):len(root_dir)])
                             _logger.info("Updated %s in %s" % (root_dir, config['root.dir']))
                             config['unsubst.dir'] = driveMapping[root]
-                            break                
+                            break
+                    else:
+                        _logger.error("Could not find root for %s." % root_dir)
                 elif drive != build_drive:
                     if config['root.dir'] not in substDrives:
                         substDrives.append(config['root.dir'])
--- a/buildframework/helium/sf/python/pythoncore/lib/ats3/__init__.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/__init__.py	Thu Jul 22 17:08:43 2010 +0300
@@ -53,24 +53,32 @@
         pkg_parser = parser.PkgFileParser()
         
         # Customize some attributes from how optparse leaves them.
-        self.build_drive = path(self._opts.build_drive)
+        if hasattr(self._opts, 'build_drive'):
+            self.build_drive = path(self._opts.build_drive)
         self.file_store = path(self._opts.file_store)
         self.flash_images = split_paths(self._opts.flash_images)
-        self.sis_files = split_paths(self._opts.sis_files)
-        self.config_file = self._opts.config
-        self.obey_pkgfiles = to_bool(self._opts.obey_pkgfiles)
-        self.hti = to_bool(self._opts.hti)
-        self.specific_pkg = self._opts.specific_pkg
-        if self.specific_pkg == '':
-            self.specific_pkg = None
+        if hasattr(self._opts, 'sis_files'):
+            self.sis_files = split_paths(self._opts.sis_files)
+        if hasattr(self._opts, 'config'):
+            self.config_file = self._opts.config
+        if hasattr(self._opts, 'obey_pkgfiles'):
+            self.obey_pkgfiles = to_bool(self._opts.obey_pkgfiles)
+        if hasattr(self._opts, 'hti'):
+            self.hti = to_bool(self._opts.hti)
+        if hasattr(self._opts, 'test_type'):
+            self.test_type = self._opts.test_type
+        if hasattr(self._opts, 'specific_pkg'):
+            self.specific_pkg = self._opts.specific_pkg
+            if self.specific_pkg == '':
+                self.specific_pkg = None
         self.tsrc_paths_dict = {}
-
-        ats_nd = self._opts.ctc_run_process_params.strip()
-        if ats_nd != "":
-            ats_nd = ats_nd.split("#")[0].strip()
-            if ats_nd == "":
-                self._opts.ctc_run_process_params = ""
-                _logger.warning("Property \'ats.ctc.host\' is not set. Code coverage measurement report(s) will not be created.")
+        if hasattr(self._opts, 'ctc_run_process_params'):
+            ats_nd = self._opts.ctc_run_process_params.strip()
+            if ats_nd != "":
+                ats_nd = ats_nd.split("#")[0].strip()
+                if ats_nd == "":
+                    self._opts.ctc_run_process_params = ""
+                    _logger.warning("Property \'ats.ctc.host\' is not set. Code coverage measurement report(s) will not be created.")
                 
         main_comps = []
                 
@@ -126,27 +134,45 @@
 
     def __init__(self, config):
         self.diamonds_build_url = config.diamonds_build_url
-        self.ctc_run_process_params = config.ctc_run_process_params
+        if hasattr(config, 'ctc_run_process_params'):
+            self.ctc_run_process_params = config.ctc_run_process_params
         self.testrun_name = config.testrun_name
-        self.harness = config.harness
+        if hasattr(config, 'harness'):
+            self.harness = config.harness
         self.device_type = config.device_type
-        self.device_hwid = config.device_hwid
-        self.plan_name = config.plan_name
+        if hasattr(config, 'device_hwid'):
+            self.device_hwid = config.device_hwid
+        if hasattr(config, 'plan_name'):
+            self.plan_name = config.plan_name
         self.report_email = config.report_email
         self.file_store = config.file_store
         self.test_timeout = config.test_timeout
-        self.eunitexerunner_flags = config.eunitexerunner_flags
+        if hasattr(config, 'eunitexerunner_flags'):
+            self.eunitexerunner_flags = config.eunitexerunner_flags
         self.sets = []
         self.src_dst = []
         self.pmd_files = []
         self.trace_activation_files = []
-        self.trace_enabled = to_bool(config.trace_enabled)
-        self.ctc_enabled = to_bool(config.ctc_enabled)
-        self.multiset_enabled = to_bool(config.multiset_enabled)
-        self.monsym_files = config.monsym_files
-        self.hti = config.hti
+        self.trace_enabled = 'False'
+        if hasattr(config, 'trace_enabled'):
+            self.trace_enabled = to_bool(config.trace_enabled)
+        self.ctc_enabled = 'False'
+        if hasattr(config, 'ctc_enabled'):
+            self.ctc_enabled = to_bool(config.ctc_enabled)
+        if hasattr(config, 'multiset_enabled'):
+            self.multiset_enabled = to_bool(config.multiset_enabled)
+        if hasattr(config, 'monsym_files'):
+            self.monsym_files = config.monsym_files
+        if hasattr(config, 'hti'):
+            self.hti = config.hti
+        if hasattr(config, 'custom_template'):
+            self.custom_template = config.custom_template
         self.component_path = ""
         self.custom_dir = None
+        if hasattr(config, 'flash_images'):
+            self.flash_images = config.flash_images
+        if hasattr(config, 'test_type'):
+            self.test_type = config.test_type
     
     def insert_set(self, data_files=None, config_files=None, 
                    engine_ini_file=None,  image_files=None, sis_files=None,
@@ -206,6 +232,7 @@
         eunit = False
         stif = False
         stifunit = False
+        generic = False
         for setd in self.sets:
             if setd["test_harness"] == "STIF":
                 stif = True
@@ -213,8 +240,12 @@
                 eunit = True
             elif setd["test_harness"] == "STIFUNIT":
                 stifunit = True
+            else:
+                generic = True
                 
-        if eunit and stif:
+        if stif and generic:
+            self.harness = "MULTI_HARNESS_GENERIC_STIF"
+        elif eunit and stif:
             self.harness = "MULTI_HARNESS"
         elif eunit:
             self.harness = "EUNIT"
--- a/buildframework/helium/sf/python/pythoncore/lib/ats3/ats4_template.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/ats4_template.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -73,7 +73,7 @@
             <task>
                 <type>CreateDirTask</type>
                 <parameters>                
-                    <parameter value="{{ atsself.getlogdir(setd) }}" name="dir"/>
+                    <parameter value="{{ atsself.getlogdir(test_plan, setd) }}" name="dir"/>
                 </parameters>
             </task>
                       
@@ -84,6 +84,8 @@
                 <parameters>
                     <parameter name="src" value="ATS3Drop\{{ setd.name }}\sis\{{ os.path.basename(sis_file) }}"/>
                     <parameter name="dst" value="c:\testframework\{{ os.path.basename(sis_file) }}"/>
+                    <parameter name="reboot-retry-count" value="2"/>
+                    <parameter name="retry-count" value="2"/>
                 </parameters>
             </task>
               {% endfor -%}
@@ -95,6 +97,8 @@
                 <parameters>
                     <parameter value="ATS3Drop\{{ setd.name }}\{{ file[1].replace(":", "") }}" name="src"/>
                     <parameter value="{{ file[1] }}" name="dst"/>
+                    <parameter name="reboot-retry-count" value="2"/>
+                    <parameter name="retry-count" value="2"/>
                 </parameters>
             </task>
                 {% endfor -%}
@@ -105,6 +109,8 @@
                 <parameters>
                     <parameter name="src" value="ATS3Drop\{{ setd.name }}\data\{{ os.path.basename(data_file) }}"/>
                     <parameter name="dst" value="e:\testing\data\{{ os.path.basename(data_file) }}"/>
+                    <parameter name="reboot-retry-count" value="2"/>
+                    <parameter name="retry-count" value="2"/>
                 </parameters>
             </task>
                   {% endfor -%}
@@ -114,6 +120,8 @@
                 <parameters>
                     <parameter name="src" value="ATS3Drop\{{ setd.name }}\conf\{{ os.path.basename(data_file) }}"/>
                     <parameter name="dst" value="e:\testing\conf\{{ os.path.basename(data_file) }}"/>
+                    <parameter name="reboot-retry-count" value="2"/>
+                    <parameter name="retry-count" value="2"/>
                 </parameters>
             </task>
                   {% endfor -%}
@@ -123,6 +131,8 @@
                 <parameters>
                     <parameter name="src" value="ATS3Drop\{{ setd.name }}\testmodules\{{ os.path.basename(data_file) }}"/>
                     <parameter name="dst" value="c:\sys\bin\{{ os.path.basename(data_file) }}"/>
+                    <parameter name="reboot-retry-count" value="2"/>
+                    <parameter name="retry-count" value="2"/>
                 </parameters>
             </task>
                   {% endfor -%}
@@ -136,6 +146,8 @@
                 <parameters>
                     <parameter name="src" value="ATS3Drop\{{ setd.name }}\init\{{ os.path.basename(setd["engine_ini_file"]) }}"/>
                     <parameter name="dst" value="c:\testframework\{{ os.path.basename(setd["engine_ini_file"]) }}"/>
+                    <parameter name="reboot-retry-count" value="2"/>
+                    <parameter name="retry-count" value="2"/>
                 </parameters>
             </task>
               {% endif %}
@@ -238,7 +250,7 @@
             <task>
                 <type>FileDownloadTask</type>
                 <parameters>
-                    <parameter value="{{ atsself.getlogdir(setd) }}\*" name="src"/>
+                    <parameter value="{{ atsself.getlogdir(test_plan, setd) }}\*" name="src"/>
                     <parameter name="recursive" value="true"/>
                 </parameters>
             </task>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/custom.py	Thu Jul 22 17:08:43 2010 +0300
@@ -0,0 +1,62 @@
+#============================================================================ 
+#Name        : custom.py 
+#Part of     : Helium 
+
+#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+#All rights reserved.
+#This component and the accompanying materials are made available
+#under the terms of the License "Eclipse Public License v1.0"
+#which accompanies this distribution, and is available
+#at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+#Initial Contributors:
+#Nokia Corporation - initial contribution.
+#
+#Contributors:
+#
+#Description:
+#===============================================================================
+
+import ats3
+import ats3.dropgenerator as adg
+from optparse import OptionParser
+from path import path # pylint: disable-msg=F0401
+import logging
+_logger = logging.getLogger('ats')
+
+def create_drop(config):
+    """Create a test drop."""
+    test_plan = ats3.Ats3TestPlan(config)
+    test_plan.set_plan_harness()
+    flash_images = [path(p) for p in config.flash_images]
+    test_plan.insert_set(image_files=flash_images)
+    generator = adg.Ats3TemplateTestDropGenerator()
+    _logger.info("generating drop file: %s" % config.drop_file)
+    generator.generate(test_plan, output_file=config.drop_file, config_file=config.config_file)
+
+def main():
+    cli = OptionParser(usage="%prog [options]")
+    cli.add_option("--device-type", help="Device type (e.g. 'PRODUCT')", default="unknown")
+    cli.add_option("--diamonds-build-url", help="Diamonds build url", default='')
+    cli.add_option("--drop-file", help="Name for the final drop zip file", default="ATS3Drop.zip")
+    cli.add_option("--file-store", help="Destination path for reports.", default="")
+    cli.add_option("--flash-images", help="Paths to the flash image files", default="")     
+    cli.add_option("--report-email", help="Email notification receivers", default="")
+    cli.add_option("--testrun-name", help="Name of the test run", default="run")
+    cli.add_option("--config", help="Path to the config file", default="")
+    cli.add_option("--test-timeout", help="Test execution timeout value (default: %default)", default="60")
+    cli.add_option("--custom-template", help="Path to the ats template file")
+    cli.add_option("--ats4-enabled", help="ATS4 enabled", default="True")
+    cli.add_option("--verbose", help="Increase output verbosity", action="store_true", default=True)
+    cli.add_option("--test-type", help="Name of test harness")
+    opts, _ = cli.parse_args()
+    
+    if opts.verbose:
+        _logger.setLevel(logging.DEBUG)
+        logging.basicConfig(level=logging.DEBUG)
+    
+    config = ats3.Configuration(opts, [])
+    create_drop(config)
+
+if __name__ == "__main__":
+    main()
\ No newline at end of file
--- a/buildframework/helium/sf/python/pythoncore/lib/ats3/dropgenerator.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/dropgenerator.py	Thu Jul 22 17:08:43 2010 +0300
@@ -818,6 +818,8 @@
     harness = test_plan["harness"]
     if harness == "MULTI_HARNESS":
         input_targets(test_plan, root, ["STIF", "EUNIT"])
+    elif harness == "MULTI_HARNESS_GENERIC_STIF":
+        input_targets(test_plan, root, ["STIF", "GENERIC"])
     elif harness == "STIF":
         input_targets(test_plan, root, ["STIF"])
     elif harness == "EUNIT":
@@ -915,6 +917,7 @@
     #QT_LOG_DIR = r"c:\private\Qt\logs"
     QT_LOG_DIR = r"c:\shared\EUnit\logs"
     CTC_LOG_DIR = r"c:\data\ctc"
+    AtsInterface_LOG_DIR = r"c:\spd_logs\xml"
 
     def stif_init_file(self, src_dst):
         """init the STIF format file"""
@@ -953,11 +956,22 @@
             drop_id = temp_drop_id
 
         return atspath.join(ats_network, "ctc_helium" , diamonds_id, drop_id, setd["name"], "ctcdata")
+    
+    def stifmodulename(self, ini_file):
+        modname = None
+        ini = open(ini_file)
+        for l in ini:
+            if l.startswith('ModuleName'):
+                modname = l.split('=')[1].strip()
+        ini.close()
+        return modname
 
-    def getlogdir(self, setd):
+    def getlogdir(self, test_plan, setd):
         """ find the logger directory"""
         if setd["test_harness"] == "STIF":
-            return self.STIF_LOG_DIR
+            if test_plan['hti'] == 'True':
+                return self.STIF_LOG_DIR
+            return self.AtsInterface_LOG_DIR
         elif setd["test_harness"] == "STIFUNIT":
             return self.STIFUNIT_LOG_DIR
         elif setd["test_harness"] == "GENERIC":
@@ -983,7 +997,11 @@
         
         loader = jinja2.ChoiceLoader([jinja2.PackageLoader(__name__, 'templates')] + customdirs)
         env = jinja2.Environment(loader=loader)
-        template = env.from_string(pkg_resources.resource_string(__name__, 'ats4_template.xml'))# pylint: disable-msg=E1101
+        
+        if hasattr(test_plan, 'custom_template'):
+            template = env.from_string(open(test_plan.custom_template).read())
+        else:
+            template = env.from_string(pkg_resources.resource_string(__name__, 'ats4_template.xml'))# pylint: disable-msg=E1101
 
         xmltext = template.render(test_plan=test_plan, os=os, atspath=atspath, atsself=self).encode('ISO-8859-1')
         return et.ElementTree(et.XML(xmltext))
\ No newline at end of file
--- a/buildframework/helium/sf/python/pythoncore/lib/ats3/parsers.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/parsers.py	Thu Jul 22 17:08:43 2010 +0300
@@ -545,13 +545,13 @@
     for every file in the pkg file
     """
 
-    def __init__(self, platform = None, specific_pkg = None):
+    def __init__(self, platform = None, specific_pkg = None, drive=''):
         self.platform = platform
         self.build_platform = None
         if self.platform is not None and "_" in self.platform:
             plat_tar = re.search(r"(.*)_(.*).pkg", self.platform)
             self.build_platform, self.build_target = plat_tar.groups() 
-        self.drive = ""
+        self.drive = drive
         self._files = []
         self.pkg_files = []
         self.pkg_file_path = None
@@ -636,7 +636,7 @@
                 for p_file in self.get_pkg_files(self.location, True):
                     self._files.append(p_file)
 
-        return self.__read_pkg_file(self._files)
+        return self.read_pkg_file(self._files)
 
     def __map_pkg_path(self, pkg_line, pkg_file_path, pkg_file):
         """Parse package file to get the src and dst paths" for installing files"""
@@ -669,7 +669,7 @@
                 val1 = val1.lower().replace("$(target)", self.build_target)
 
             if path.isabs(path(val1).normpath()):
-                map_src = str(path.joinpath(self.drive, val1).normpath())
+                map_src = os.path.normpath(os.path.join(self.drive, val1))
             elif re.search(r"\A\w", val1, 1):
                 map_src = str(path.joinpath(self.pkg_file_path + os.sep, os.path.normpath(val1)).normpath())
             else:
@@ -738,10 +738,12 @@
 
         if not map_src or map_src == "." or not map_dst or map_dst == ".":
             return None
-
+        if not os.path.exists(map_src):
+            _logger.error(map_src + ' not found')
+            return None
         return path(map_src).normpath(), path(map_dst).normpath(), file_type, pkg_file
 
-    def __read_pkg_file(self, pkg_files):
+    def read_pkg_file(self, pkg_files):
         """Reads contents of PKG file"""
         pkg_paths = []
         for pkg_file in pkg_files:
@@ -755,7 +757,7 @@
                 except UnicodeError:
                     file1 = open(pkg_file, 'r')
                     lines = file1.readlines()
-                pkg_file_path = path((pkg_file.rsplit(os.sep, 1))[0])
+                pkg_file_path = path(os.path.dirname(pkg_file))
                 for line in lines:
                     pkg_path = self.__map_pkg_path(line, pkg_file_path, os.path.basename(pkg_file))
                     if pkg_path is None:
--- a/buildframework/helium/sf/python/pythoncore/lib/ats3/templates/ats4_macros.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/ats3/templates/ats4_macros.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -87,8 +87,8 @@
             <parameters>
               	<parameter name="timeout" value="{{ test_plan["test_timeout"] }}"/>
               	<parameter name="file" value="atsinterface.exe" />
-              	<parameter name="parameters" value="-engineini {{ ini_file[1] }}" />
-              	<parameter name="result-file" value="{{ atsself.STIF_LOG_DIR }}\{{ os.path.basename(ini_file[1]).replace('.' + ini_file[1].rsplit(".")[1], '.xml') }}" />
+                <parameter name="parameters" value="-testmodule {{ atsself.stifmodulename(ini_file[0]) }} -engineini {{ ini_file[1] }}" />
+                <parameter name="result-file" value="{{ atsself.AtsInterface_LOG_DIR }}\{{ atsself.stifmodulename(ini_file[0]) + '.xml' }}" />
             </parameters>
         </task>
         {% endif %}
@@ -113,7 +113,7 @@
               	<parameter name="timeout" value="{{ test_plan["test_timeout"] }}"/>
               	<parameter name="file" value="atsinterface.exe" />
               	<parameter name="parameters" value="-testmodule TESTSCRIPTER" />
-              	<parameter name="result-file" value="{{ atsself.STIF_LOG_DIR }}\TESTSCRIPTER.xml" />
+                <parameter name="result-file" value="{{ atsself.AtsInterface_LOG_DIR }}\TESTSCRIPTER.xml" />
             </parameters>
         </task>
         {% endif %}
@@ -135,7 +135,7 @@
               	<parameter name="timeout" value="{{ test_plan["test_timeout"] }}"/>
               	<parameter name="file" value="atsinterface.exe" />
               	<parameter name="parameters" value="-testmodule {{ os.path.basename(file[1]) }}" />
-              	<parameter name="result-file" value="{{ atsself.STIF_LOG_DIR }}\{{ os.path.basename(file[1]).replace('.' + file[1].rsplit(".")[1], '.xml') }}" />
+                <parameter name="result-file" value="{{ atsself.AtsInterface_LOG_DIR }}\{{ os.path.basename(file[1]).replace('.' + file[1].rsplit(".")[1], '.xml') }}" />
             </parameters>
         </task>
         {% endif %}
@@ -164,7 +164,7 @@
               	<parameter name="timeout" value="{{ test_plan["test_timeout"] }}"/>
               	<parameter name="file" value="atsinterface.exe" />
               	<parameter name="parameters" value="-engineini c:\testframework\{{ os.path.basename(setd["engine_ini_file"]) }}" />
-              	<parameter name="result-file" value="{{ atsself.STIF_LOG_DIR }}\{{ os.path.basename(setd["engine_ini_file"]).replace('.' + setd["engine_ini_file"].rsplit(".")[1], '.xml') }}" />
+                <parameter name="result-file" value="{{ atsself.AtsInterface_LOG_DIR }}\{{ os.path.basename(setd["engine_ini_file"]).replace('.' + setd["engine_ini_file"].rsplit(".")[1], '.xml') }}" />
             </parameters>
         </task>
         {% endif %}
@@ -187,7 +187,7 @@
               	<parameter name="timeout" value="{{ test_plan["test_timeout"] }}"/>
               	<parameter name="file" value="atsinterface.exe" />
               	<parameter name="parameters" value="-config e:\testing\conf\{{ os.path.basename(config_file) }}" />
-              	<parameter name="result-file" value="{{ atsself.STIF_LOG_DIR }}\{{ os.path.basename(config_file).replace('.' + config_file.rsplit(".")[1], '.xml') }}" />
+                <parameter name="result-file" value="{{ atsself.AtsInterface_LOG_DIR }}\{{ os.path.basename(config_file).replace('.' + config_file.rsplit(".")[1], '.xml') }}" />
             </parameters>
         </task>
         {% endif %}
@@ -209,8 +209,8 @@
             <parameters>
               	<parameter name="timeout" value="{{ test_plan["test_timeout"] }}"/>
               	<parameter name="file" value="atsinterface.exe" />
-              	<parameter name="parameters" value="-module {{ os.path.basename(testmodule_file) }}" />
-              	<parameter name="result-file" value="{{ atsself.STIF_LOG_DIR }}\{{ os.path.basename(testmodule_file).replace('.' + testmodule_file.rsplit(".")[1], '.xml') }}" />
+                <parameter name="parameters" value="-testmodule {{ os.path.basename(testmodule_file) }}" />
+                <parameter name="result-file" value="{{ atsself.AtsInterface_LOG_DIR }}\{{ os.path.basename(testmodule_file).replace('.' + testmodule_file.rsplit(".")[1], '.xml') }}" />
             </parameters>
         </task>
         {% endif %}
--- a/buildframework/helium/sf/python/pythoncore/lib/atsant.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/atsant.py	Thu Jul 22 17:08:43 2010 +0300
@@ -31,11 +31,12 @@
 
 class IConfigATS(object):
     """ Class used to read configuration file iconfig.xml """
-    def __init__(self, imagesdir):
+    def __init__(self, imagesdir, productname):
         self.imagesdir = imagesdir
+        self.productname = productname
         self.config = self.getconfig()
         
-    def getconfig(self, type=None):
+    def getconfig(self, type=None, productname=None):
         """get configuration"""
         noncust = None
         for root, _, files in os.walk(self.imagesdir, topdown=False):
@@ -45,8 +46,8 @@
                     configBuilder = configuration.NestedConfigurationBuilder(open(filePath, 'r'))
                     configSet = configBuilder.getConfiguration()
                     for config in configSet.getConfigurations():
-                        if type:
-                            if type in config.type:
+                        if type and productname:
+                            if type in config.type and config['PRODUCT_NAME'] in productname:
                                 return config
                         else:
                             noncust = config
@@ -68,7 +69,7 @@
         """find images"""
         output = ''
         for imagetype, imagetypename in [('core', 'CORE'), ('langpack', 'ROFS2'), ('cust', 'ROFS3'), ('udaerase', 'UDAERASE')]:
-            iconfigxml = self.getconfig(imagetype)
+            iconfigxml = self.getconfig(imagetype, self.productname)
             if iconfigxml == None:
                 iconfigxml = self.config
 
@@ -83,7 +84,7 @@
                     raise Exception(image + ' not found')
             else:
                 if imagetype == 'core':
-                    raise Exception(imagetypename + '_FLASH not found in iconfig.xml')
+                    raise Exception(imagetypename + '_FLASH not found in iconfig.xml in ' + self.imagesdir)
                 print imagetypename + '_FLASH not found in iconfig.xml'
         return output
 
--- a/buildframework/helium/sf/python/pythoncore/lib/ccm/__init__.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/ccm/__init__.py	Thu Jul 22 17:08:43 2010 +0300
@@ -1201,7 +1201,7 @@
         result = self._session.execute("finduse \"%s\"" % self, FinduseResult(self))
         return result.output
     
-    def delete(self, recurse=False):
+    def delete(self, recurse=False, scope=None):
         """ Delete a synergy project. """
         args = ""
         if recurse:
@@ -1209,8 +1209,10 @@
         parg = ""
         if self.type == "project":
             parg = "-project"
+        if scope:
+            args = args + ' -scope "' + scope + '"'
         result = self._session.execute("delete %s %s \"%s\"" % (args, parg, self))
-        if result.status != 0 and result.status != None:
+        if (result.status != 0 and result.status != None) or (result.output.strip().startswith('Cannot use')):
             raise CCMException("An error occurred while deleting object %s (error status: %s)\n%s" % (self, result.status, result.output), result)
         return result
 
--- a/buildframework/helium/sf/python/pythoncore/lib/ccm/extra.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/ccm/extra.py	Thu Jul 22 17:08:43 2010 +0300
@@ -133,7 +133,7 @@
         _logger.error( "Exception occured in request #%s: %s\n%s" % (request.requestID, exc_info[1], traceback.format_exception(exc_info[0], exc_info[1], exc_info[2])))
         exceptions.append(exc_info[1])
     
-    def handle_result(result):
+    def handle_result(request, result):
         """append  the result"""
         results.append(result)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/sf/python/pythoncore/lib/pkg2iby.py	Thu Jul 22 17:08:43 2010 +0300
@@ -0,0 +1,86 @@
+#============================================================================ 
+#Name        : pkg2iby.py 
+#Part of     : Helium 
+
+#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+#All rights reserved.
+#This component and the accompanying materials are made available
+#under the terms of the License "Eclipse Public License v1.0"
+#which accompanies this distribution, and is available
+#at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+#Initial Contributors:
+#Nokia Corporation - initial contribution.
+#
+#Contributors:
+#
+#Description:
+#===============================================================================
+import sys
+import ats3
+import os
+
+def main():
+    if len(sys.argv) < 3:
+        print 'Usage: ' + sys.argv[0] + ' builddrive tef pkg1 pkg2 ..'
+        sys.exit(1)
+    generateromcontent(sys.argv[1], sys.argv[2], sys.argv[3:])
+
+def generateromcontent(drive, testtype, pkgs):
+    ibyfilename = os.path.join(drive + os.sep, 'epoc32', 'rom', 'include', 'atsauto.iby')
+    execfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'atsautoexec.bat')
+    rtestexecfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'atsrtestexec.bat')
+    dummyexecfilename = os.path.join(drive + os.sep, 'epoc32', 'data', 'dummy.bat')
+    pkgfilesnames = []
+    for p in pkgs:
+        pkgfilesnames.append(os.path.join(drive + os.sep, p))
+    pkg_parser = ats3.parsers.PkgFileParser(drive=drive)
+    pkgfiles = pkg_parser.read_pkg_file(pkgfilesnames)
+    
+    writeautoexec = False
+    
+    myiby = open(ibyfilename, 'w')
+    atsautoexec = open(execfilename, 'w')
+    atsrtestexec = open(rtestexecfilename, 'w')
+    dummyexec = open(dummyexecfilename, 'w')
+    dummyexec.close()
+    
+    myiby.write("#ifndef __ATSAUTO_IBY__\n")
+    myiby.write("#define __ATSAUTO_IBY__\n")
+    
+    atsautoexec.write(r'md c:\logs' + '\n')
+    atsautoexec.write(r'md c:\logs\testresults' + '\n')
+    atsautoexec.write(r'md c:\logs\testexecute' + '\n')
+    
+    for src, dst, filetype, _ in pkgfiles:
+        (_, dst) = os.path.splitdrive(dst)
+        dst_nodrive = 'atsdata' + dst
+        dst = r'z:\atsdata' + dst
+        myiby.write('data=' + src + ' ' + dst_nodrive + '\n')
+        if 'testscript' in filetype and testtype == 'tef':
+            atsautoexec.write('testexecute.exe ' + dst + '\n')
+            atsautoexec.write('thindump -nop c:\\logs\\testexecute\\' + os.path.basename(dst.replace('.script', '.htm')) + '\n')
+            writeautoexec = True
+        if 'testscript' in filetype and testtype == 'mtf':
+            atsautoexec.write('testframework.exe ' + dst + '\n')            
+            atsautoexec.write('thindump -nop c:\\logs\\testresults\\' + os.path.basename(dst.replace('.script', '.htm')) + '\n')
+            writeautoexec = True
+        if '.exe' in dst and testtype == 'rtest':
+            atsrtestexec.write(dst + '\n')
+            writeautoexec = True
+    if writeautoexec:
+        myiby.write("#include <thindump.iby>\n")
+        myiby.write(r'data=' + execfilename + ' autoexec.bat' + '\n')
+        if testtype == 'rtest':
+            atsautoexec.write(r'runtests \sys\bin\atsrtestexec.bat' + '\n')
+            myiby.write(r'data=' + rtestexecfilename + r' \sys\bin\atsrtestexec.bat' + '\n')
+            
+        myiby.write(r'data=' + dummyexecfilename + r' z:\dummytest.txt' + '\n')
+        atsautoexec.write(r'RUNTESTS z:\dummytest.txt -p')
+    myiby.write("#endif\n")
+    myiby.close()
+    atsautoexec.close()
+    atsrtestexec.close()
+    
+if __name__ == "__main__":
+    main()
\ No newline at end of file
--- a/buildframework/helium/sf/python/pythoncore/lib/preparation.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/preparation.py	Thu Jul 22 17:08:43 2010 +0300
@@ -240,7 +240,7 @@
             co_role = ccm.get_role_for_purpose(session, str(self._config['purpose']))
             session.role = co_role
             try:
-                delResult = result.delete(recurse=True)
+                delResult = result.delete(scope='project_and_subproject_hierarchy')
             finally:
                 session.role = role
             ccm.log_result(delResult, ccm.CHECKOUT_LOG_RULES, _logger)
--- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_archive.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_archive.py	Thu Jul 22 17:08:43 2010 +0300
@@ -920,8 +920,8 @@
                                                '\\\\server2\\share\\somedir'])
             self.assert_(len(roots) == 3)
             self.assert_('\\\\server\\share\\' in roots)
-            self.assert_('\\\\server\\share1\\' in roots)
-            self.assert_('\\\\server2\\share\\' in roots)
+            self.assert_('\\\\server\\share1\\dir\\' in roots)
+            self.assert_('\\\\server2\\share\\somedir\\' in roots)
 
 class MockedConfigBuilder:
     """."""
--- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atsant.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atsant.py	Thu Jul 22 17:08:43 2010 +0300
@@ -31,13 +31,14 @@
     """test atsant and check 3 files in the file"""
     files = atsant.files_to_test(os.path.join(os.environ['TEST_DATA'], 'data/packageiad/layers.sysdef.xml'), None, None, 'z:')
     assert len(files) == 3
-    
+
 def test_IConfigATS():
+    """test I config ATS"""
     tmpdir = tempfile.mkdtemp()
     shutil.copy(os.path.join(os.environ['TEST_DATA'], 'data', 'example_corernd.iconfig.xml'), os.path.join(tmpdir, 'example_corernd.iconfig.xml'))
     open(os.path.join(tmpdir, 'RX-60_00_rnd.core.fpsx'), 'w').close()
     open(os.path.join(tmpdir, 'RX-60_00.01_rnd.rofs2.fpsx'), 'w').close()
     open(os.path.join(tmpdir, 'RX-60_00_rnd.rofs3.fpsx'), 'w').close()
     open(os.path.join(tmpdir, 'RX-60_00_rnd.udaerase.fpsx'), 'w').close()
-    ic = atsant.IConfigATS(tmpdir)
-    ic.findimages()
\ No newline at end of file
+    i_c = atsant.IConfigATS(tmpdir, '')
+    i_c.findimages()
\ No newline at end of file
--- a/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_parsers.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_parsers.py	Thu Jul 22 17:08:43 2010 +0300
@@ -362,6 +362,8 @@
             (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "tc1.sisx").normpath(), path(r"e:" + os.sep + "sys" + os.sep + "bin" + os.sep + "tc1.sisx").normpath(), "", 'tc1.pkg'),
             (path(TSRC_DIR+r"" + os.sep + "tsrc" + os.sep + "tc1" + os.sep + "data" + os.sep + "DUMP.xyz").normpath(), path(r"e:" + os.sep + "sys" + os.sep + "bin" + os.sep + "DUMP.xyz").normpath(), "data", 'tc1.pkg'),
             ]
+        for p, _, _, _ in self.data_files:
+            open(p, 'w').close()
 
     def test_get_pkg_files(self):
         """Test if pkg files are returned from a specified location"""
--- a/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_object.py	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_object.py	Thu Jul 22 17:08:43 2010 +0300
@@ -117,7 +117,26 @@
         project = session.create('project-1:project:db#1')
         result = project.delete()        
         assert "Deleting object 'project-1:project:db#1'" in result.output
-    
+
+    def test_delete_project_scope(self):
+        """ Check project deletion with custom scope """
+        behave = {'delete  -scope "project_and_subproject_hierarchy" -project "project-1:project:db#1"': "Deleting object 'project-1:project:db#1'"}
+        session = MockResultSession(behave)
+        project = session.create('project-1:project:db#1')
+        result = project.delete(scope='project_and_subproject_hierarchy')        
+        assert "Deleting object 'project-1:project:db#1'" in result.output
+
+    def test_delete_project_invalid_args(self):
+        """ Check project synergy is failing in case of bad synergy parameters for delete """
+        behave = {'delete  -project "project-1:project:db#1"': "Cannot use '-scope' option with '-r' option."}
+        session = MockResultSession(behave)
+        project = session.create('project-1:project:db#1')
+        try:
+            result = project.delete(recurse=True, scope='project_and_subproject_hierarchy')        
+            assert False, "The delete method must fail in case of synergy failure"
+        except:
+            pass
+
     def test_delete_object(self):
         """ Check object deletion """
         behave = {'delete   "object-1:object:db#1"': "Deleting object 'object-1:object:db#1'"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/tests/data/diamonds-faults_compile.text.log	Thu Jul 22 17:08:43 2010 +0300
@@ -0,0 +1,1 @@
+ERROR: This error must not affect the test.
--- a/buildframework/helium/tools/common/templates/diamonds/faults_metadata_orm.ftl	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/common/templates/diamonds/faults_metadata_orm.ftl	Thu Jul 22 17:08:43 2010 +0300
@@ -1,6 +1,6 @@
 <#--
 ============================================================================ 
-Name        : macro.ftl 
+Name        : faults_metadata_orm.ftl 
 Part of     : Helium 
 
 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
@@ -26,26 +26,26 @@
     <#assign table_info = pp.loadData('com.nokia.helium.metadata.ORMFMPPLoader',
         "${dbPath}") >
     <faults>
-        <total severity="error">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and p.priority like \'%ERROR%\''][0]
-        + table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and w.missing = \'true\''][0]}</total>
-        <total severity="warning">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and p.priority like \'%WARNING%\''][0]}</total>
-        <total severity="warning_rvct_other">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and p.priority like \'%WARNING%\''][0]}</total>
+        <total severity="error">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and p.priority = \'ERROR\''][0]
+        + table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and w.missing = \'true\''][0]}</total>
+        <total severity="warning">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and p.priority = \'WARNING\''][0]}</total>
+        <total severity="warning_rvct_other">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and UPPER(p.priority) = \'WARNING\''][0]}</total>
         <!-- todo update to calculate the correct value -->
-        <total severity="warning_rvct_bad">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and p.priority like \'%REMARK%\''][0]}</total>
-    <#list table_info['native:java.lang.String']['select DISTINCT component.component from component INNER JOIN logfile ON logfile.logpath_id=component.logpath_id where logfile.path like \'%_compile%.log\' and logfile.path not like \'%_compile_clean%.log\''] as component>
+        <total severity="warning_rvct_bad">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.priority as p JOIN m.logFile as l where LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and UPPER(p.priority) = \'REMARK\''][0]}</total>
+    <#list table_info['native:java.lang.String']['select DISTINCT component.component from component INNER JOIN logfile ON logfile.logpath_id=component.logpath_id where logfile.path like \'%_compile.log\' and logfile.path not like \'%\\_clean\\_%compile.log\''] as component>
         <component>
             <name>${component}</name>
-            <total severity="error">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority) like \'%ERROR%\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\''][0]
-            + table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\' and w.missing = \'true\''][0]}</total>
-            <total severity="warning">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority) like \'%WARNING%\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\''][0]}</total>
-            <total severity="critical">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority) like \'%REMARK%\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile%.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_compile\\_clean%.log\' ESCAPE \'\\\''][0]}</total>
+            <total severity="error">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'ERROR\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\''][0]
+            + table_info['jpasingle']['select Count(w.id) from WhatLogEntry w JOIN w.component as c JOIN c.logFile as l where c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\' and w.missing = \'true\''][0]}</total>
+            <total severity="warning">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'WARNING\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\''][0]}</total>
+            <total severity="critical">${table_info['jpasingle']['select Count(m.id) from MetadataEntry m JOIN m.logFile as l JOIN m.priority as p JOIN m.component as c where UPPER(p.priority)=\'REMARK\' and c.component=\'${component}\' and LOWER(l.path) like \'%\\_compile.log\' ESCAPE \'\\\' and LOWER(l.path) not like \'%\\_clean\\_%compile.log\' ESCAPE \'\\\''][0]}</total>
         </component>
     </#list>
     </faults>
+
+    <!-- all components -->
     <components>
-
-    <#list table_info['native:java.lang.String']['select DISTINCT component.component from component INNER JOIN logfile ON logfile.logpath_id=component.logpath_id where logfile.path like \'%_compile%.log\' and logfile.path not like \'%_compile_clean%.log\''] as component>
-    <!-- all components -->
+    <#list table_info['native:java.lang.String']['select DISTINCT component.component from component INNER JOIN logfile ON logfile.logpath_id=component.logpath_id where logfile.path like \'%_compile.log\' and logfile.path not like \'%\\_clean\\_%compile.log\''] as component>
         <component>${component}</component>
     </#list>
     </components>
--- a/buildframework/helium/tools/common/templates/log/cc_summary_metadata_orm.html.ftl	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/common/templates/log/cc_summary_metadata_orm.html.ftl	Thu Jul 22 17:08:43 2010 +0300
@@ -69,7 +69,7 @@
     <#list colors?keys as type>
         <#assign count =  table_info['jpasingle']['select count(m.id) from MetadataEntry m JOIN  m.priority as p JOIN m.component as c where (UPPER(p.priority)=\'${type?upper_case}\' and c.id=${component.id})'][0] >    
         <#if type=='error'>
-            <#assign count_missing = table_info['jpasingle']['select count(w.id) from WhatLogEntry w JOIN w.component c where c.logPathID=${logfile.id} and w.missing=\'true\''][0]> 
+            <#assign count_missing = table_info['jpasingle']['select count(w.id) from WhatLogEntry w JOIN w.component c where c.logPathID=${logfile.id} and c.id=${component.id} and w.missing=\'true\''][0]> 
             <#assign count = count?number + count_missing?number>
         </#if>
         <#if (count?number > 0)>
--- a/buildframework/helium/tools/common/test/test_scanlog.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/common/test/test_scanlog.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -104,10 +104,12 @@
                 <contains string="${scanlog}" substring="sf/app/HelloWorldCons/group" />
             </and>
         </au:assertTrue>
-        <au:assertTrue message="Check for 23 errors">
-            <contains string="${scanlog}" substring="&gt;23&lt;/td&gt;" />
+        <au:assertTrue message="Check for 7 errors">
+            <contains string="${scanlog}" substring="&gt;7&lt;/td&gt;" />
         </au:assertTrue>
-        
+        <au:assertTrue message="Check for 16 errors">
+            <contains string="${scanlog}" substring="&gt;16&lt;/td&gt;" />
+        </au:assertTrue>        
     </target>
     
     
@@ -190,11 +192,27 @@
             <os family="unix" />
         </condition>
         <property name="sbs.log.file" location="${helium.dir}/tests/data/test-scanlog_helium_minibuild_ido_input_compile.log" />
+        <copy file="${sbs.log.file}" tofile="${scanlog.temp.dir}/test-scanlog_helium_minibuild_ido_input_clean_compile.log" />
+        <copy file="${sbs.log.file}" tofile="${scanlog.temp.dir}/test-scanlog_helium_minibuild_ido_input2_compile.log" />
         <hlm:metadatarecord  database="${scanlog.temp.dir}/test-diamonds-faults_db">
             <hlm:sbsmetadatainput>
                 <fileset casesensitive="false" file="${sbs.log.file}"/>
+                <fileset casesensitive="false" file="${scanlog.temp.dir}/test-scanlog_helium_minibuild_ido_input_clean_compile.log" />
+                <fileset casesensitive="false" file="${scanlog.temp.dir}/test-scanlog_helium_minibuild_ido_input2_compile.log" />
+                <metadatafilterset refid="filterset.sbs" />
+            </hlm:sbsmetadatainput>
+            <hlm:sbsmetadatainput>
+                <fileset casesensitive="false" file="${scanlog.temp.dir}/test-scanlog_helium_minibuild_ido_input_clean_compile.log" />
                 <metadatafilterset refid="filterset.sbs" />
             </hlm:sbsmetadatainput>
+            <hlm:sbsmetadatainput>
+                <fileset casesensitive="false" file="${scanlog.temp.dir}/test-scanlog_helium_minibuild_ido_input2_compile.log" />
+                <metadatafilterset refid="filterset.sbs" />
+            </hlm:sbsmetadatainput>
+            <hlm:textmetadatainput>
+                <fileset casesensitive="false" file="${helium.dir}/tests/data/diamonds-faults_compile.text.log"/>
+                <metadatafilterset refid="filterset.sbs" />
+            </hlm:textmetadatainput>
         </hlm:metadatarecord>
 
         <fmpp sourceFile="${helium.dir}/tools/common/templates/diamonds/faults_metadata_orm.ftl"
@@ -211,14 +229,20 @@
                 <contains string="${scanlog}" substring="&lt;name&gt;sf/app/HelloWorldCons/group&lt;/name&gt;" />
             </and>
         </au:assertTrue>
-        <au:assertTrue message="Check for 23 errors">
-            <contains string="${scanlog}" substring="&gt;23&lt;/total&gt;" />
+        
+        <au:assertTrue message="Check that diamonds-faults_compile.text.log is not pushed to diamonds">
+            <not>
+                <contains string="${scanlog}" substring="&lt;name&gt;diamonds-faults_compile.text.log&lt;/name&gt;" />
+            </not>
         </au:assertTrue>
-        <au:assertTrue message="Check for 16 errors">
-            <contains string="${scanlog}" substring="&gt;16&lt;/total&gt;" />
+        <au:assertTrue message="Check for 46 errors">
+            <contains string="${scanlog}" substring="&gt;46&lt;/total&gt;" />
         </au:assertTrue>
-        <au:assertTrue message="Check for 7 errors">
-            <contains string="${scanlog}" substring="&gt;7&lt;/total&gt;" />
+        <au:assertTrue message="Check for 32 errors">
+            <contains string="${scanlog}" substring="&gt;32&lt;/total&gt;" />
+        </au:assertTrue>
+        <au:assertTrue message="Check for 14 errors">
+            <contains string="${scanlog}" substring="&gt;14&lt;/total&gt;" />
         </au:assertTrue>
     </target>
 
@@ -255,11 +279,11 @@
         <au:assertTrue message="Check for build errors"> 
             <contains string="${cclog}" substring="test-scanlog_cc_summary_compile.log" /> 
         </au:assertTrue> 
-        <au:assertTrue message="Check for 24 build errors"> 
-            <contains string="${cclog}" substring="24" /> 
+        <au:assertTrue message="Check for 8 build errors"> 
+            <contains string="${cclog}" substring="8" /> 
         </au:assertTrue> 
-        <au:assertTrue message="Check for 23 build errors"> 
-            <contains string="${cclog}" substring="23" /> 
+        <au:assertTrue message="Check for 16 build errors"> 
+            <contains string="${cclog}" substring="16" /> 
         </au:assertTrue> 
         <au:assertTrue message="Check for validate policy errors"> 
             <and>
--- a/buildframework/helium/tools/compile/cmaker.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/compile/cmaker.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -100,14 +100,15 @@
     
     <!--  Installing CMaker. -->    
     <target name="cmaker-install">
-        <hlm:recordStartMacro name="${build.id}_install.cmaker.log" emacsmode="true"/>
+        <mkdir dir="${compile.log.dir}" />
+        <record name="${compile.log.dir}/${build.id}_install.cmaker.log" emacsmode="true" action="start" />
         <exec executable="${cmaker.component.dir}/bin/mingw_make.exe" osfamily="windows" dir="${cmaker.component.dir}" failonerror="true">
             <arg line="install"/>
         </exec>
         <exec executable="make" osfamily="unix" dir="${cmaker.component.dir}" failonerror="true">
             <arg line="install"/>
         </exec>
-        <hlm:recordStopMacro name="${build.id}_install.cmaker.log"/>
+        <record name="${compile.log.dir}/${build.id}_install.cmaker.log" action="stop" />
         <!-- Blocks packaging configuration generation. -->
         <if>
             <istrue value="${blocks.enabled}" />
@@ -119,7 +120,7 @@
                     <arg value="--epocroot=${build.drive}/" />
                     <arg value="--config=${blocks.config.dir}" />
                     <arg value="--datasource=cmaker" />
-                    <arg value="-Dwhatlog=${build.log.dir}/${build.id}_install.cmaker.log" />
+                    <arg value="-Dwhatlog=${compile.log.dir}/${build.id}_install.cmaker.log" />
                     <arg value="-Dconfigdir=${cmaker.component.dir}" />
                     <arg value="--updateData" />
                 </exec>
@@ -129,14 +130,15 @@
     
     <!-- CMaker export configuration. -->    
     <target name="cmaker-export" depends="cmaker-install" if="enable.cmaker">
-        <hlm:recordStartMacro name="${build.id}${cmaker.log.label}.export.cmaker.log" emacsmode="true"/>
+        <mkdir dir="${compile.log.dir}" />
+        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.export.cmaker.log" emacsmode="true" action="start" />
         <hlm:cmakerMacro ncp="${cmaker.pp.version}"
                       s60="${cmaker.s60.version}"
                       action="export"/>
-        <hlm:recordStopMacro name="${build.id}${cmaker.log.label}.export.cmaker.log"/>
+        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.export.cmaker.log" action="stop" />
         <hlm:metadatarecord database="${metadata.dbfile}">
             <hlm:abldmetadatainput>
-                <fileset casesensitive="false" file="${build.log.dir}/${build.id}${cmaker.log.label}.export.cmaker.log" />
+                <fileset casesensitive="false" file="${compile.log.dir}/${build.id}${cmaker.log.label}.export.cmaker.log" />
                 <metadatafilterset refid="filterset.compile" />
             </hlm:abldmetadatainput>
         </hlm:metadatarecord>
@@ -144,14 +146,15 @@
 
     <!-- CMaker cleanup exported configuration. -->
     <target name="cmaker-clean" depends="cmaker-install" if="enable.cmaker">
-        <hlm:recordStartMacro name="${build.id}${cmaker.log.label}.clean.cmaker.log" emacsmode="true"/>
+        <mkdir dir="${compile.log.dir}" />
+        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.clean.cmaker.log" emacsmode="true" action="start" />
         <hlm:cmakerMacro ncp="${cmaker.pp.version}"
                       s60="${cmaker.s60.version}"
                       action="clean"/>
-        <hlm:recordStopMacro name="${build.id}${cmaker.log.label}.clean.cmaker.log"/>
+        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.clean.cmaker.log" action="stop" />
         <hlm:metadatarecord database="${metadata.dbfile}">
             <hlm:abldmetadatainput>
-                <fileset casesensitive="false" file="${build.log.dir}/${build.id}${cmaker.log.label}.clean.cmaker.log" />
+                <fileset casesensitive="false" file="${compile.log.dir}/${build.id}${cmaker.log.label}.clean.cmaker.log" />
                 <metadatafilterset refid="filterset.compile" />
             </hlm:abldmetadatainput>
         </hlm:metadatarecord>
@@ -159,14 +162,15 @@
     
     <!-- CMaker list the final destination of what will be exported. -->
     <target name="cmaker-what" depends="cmaker-install" if="enable.cmaker">
-        <hlm:recordStartMacro name="${build.id}${cmaker.log.label}.what.cmaker.log" emacsmode="true"/>
+        <mkdir dir="${compile.log.dir}" />
+        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" emacsmode="true" action="start" />
         <hlm:cmakerMacro ncp="${cmaker.pp.version}"
                       s60="${cmaker.s60.version}"
                       action="what"/>
-        <hlm:recordStopMacro name="${build.id}${cmaker.log.label}.what.cmaker.log"/>
+        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" action="stop" />
         <hlm:metadatarecord database="${metadata.dbfile}">
             <hlm:abldmetadatainput>
-                <fileset casesensitive="false" file="${build.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" />
+                <fileset casesensitive="false" file="${compile.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" />
                 <metadatafilterset refid="filterset.compile" />
             </hlm:abldmetadatainput>
         </hlm:metadatarecord>
@@ -182,7 +186,7 @@
                     <arg value="--epocroot=${build.drive}/" />
                     <arg value="--config=${blocks.config.dir}" />
                     <arg value="--datasource=cmaker" />
-                    <arg value="-Dwhatlog=${build.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" />
+                    <arg value="-Dwhatlog=${compile.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" />
                     <arg value="-Dconfigdir=${cmaker.config.dir}" />
                     <!--arg value="-Dname=${cmaker.log.label}"-->
                     <arg value="--updateData" />
@@ -193,14 +197,15 @@
 
     <!-- CMaker list the source files what will be exported. -->
     <target name="cmaker-whatdeps" depends="cmaker-install" if="enable.cmaker">
-        <hlm:recordStartMacro name="${build.id}${cmaker.log.label}.whatdeps.cmaker.log" emacsmode="true"/>
+        <mkdir dir="${compile.log.dir}" />
+        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.whatdeps.cmaker.log" emacsmode="true" action="start" />
         <hlm:cmakerMacro ncp="${cmaker.pp.version}"
                       s60="${cmaker.s60.version}"
                       action="what_deps"/>
-        <hlm:recordStopMacro name="${build.id}${cmaker.log.label}.whatdeps.cmaker.log"/>
+        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.whatdeps.cmaker.log" action="stop" />
         <hlm:metadatarecord database="${metadata.dbfile}">
             <hlm:abldmetadatainput>
-                <fileset casesensitive="false" file="${build.log.dir}/${build.id}${cmaker.log.label}.whatdeps.cmaker.log" />
+                <fileset casesensitive="false" file="${compile.log.dir}/${build.id}${cmaker.log.label}.whatdeps.cmaker.log" />
                 <metadatafilterset refid="filterset.compile" />
             </hlm:abldmetadatainput>
         </hlm:metadatarecord>
--- a/buildframework/helium/tools/compile/sbs/sbs.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/compile/sbs/sbs.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -43,6 +43,15 @@
     @type boolean
     -->
     <property name="skip.sbs.layer.generation" value="false" />
+
+    <!-- Default CTC command line option, override it to customize it. -->
+    <hlm:argSet id="ctc.build.options" />
+
+    <!-- This property define what instrumentation CTC should create.
+    @type string
+    -->
+    <property name="ctc.instrument.type" value="m" />
+    
     
     <!-- This target filters the canonical system definition file compare to the "raptor_${sysdef.configuration}" filter. -->
     <macrodef name="generate-layers" uri="http://www.nokia.com/helium">
@@ -153,7 +162,10 @@
                                                     errorOutput="${sbs.log.file}.sbs_error.log" 
                                                     workingDir="${build.drive}/" 
                                                     failOnError="false" 
-                                                    outputLog="${sbs.log.file}" />                                
+                                                    outputLog="${sbs.log.file}"
+                                                    instrumentType="${ctc.instrument.type}">
+                                        <hlm:CTCOptions refid="ctc.build.options" />
+                                    </hlm:ctctask>
                                 </then>
                             </elseif>
                             <else>
--- a/buildframework/helium/tools/preparation/bom/bom.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/preparation/bom/bom.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -137,9 +137,10 @@
                 <!-- Transform bom data into the diamonds xml format: 
                      * BOM folders are flattened into tasks.
                      * Schema version is extracted from the appropriate FMPP template. -->
+                <mkdir dir="${temp.build.dir}" />
                 <fmpp sourcefile="${helium.dir}/tools/common/templates/diamonds/diamonds_header.ftl" 
-                      outputfile="${build.temp.dir}/diamonds_header.xml" quiet="true"/>
-                <loadfile srcfile="${build.temp.dir}/diamonds_header.xml" property="diamonds.schema.xml">
+                      outputfile="${temp.build.dir}/diamonds_header.xml" quiet="true"/>
+                <loadfile srcfile="${temp.build.dir}/diamonds_header.xml" property="diamonds.schema.xml">
                     <filterchain>
                         <linecontains>
                             <contains value="schema"/>
@@ -153,7 +154,7 @@
                     <remove path="bom/build"/>
                     <rename path="bom" to="diamonds-build"/>
                 </xmltask>                
-                <delete file="${build.temp.dir}/diamonds_header.xml"/>
+                <delete file="${temp.build.dir}/diamonds_header.xml"/>
                 <replace file="${diamonds.build.output.dir}/create-bom.xml" token="&lt;folder&gt;" value="&lt;!-- &lt;folder&gt; --&gt;"/>
                 <replace file="${diamonds.build.output.dir}/create-bom.xml" token="&lt;/folder&gt;" value="&lt;!-- &lt;/folder&gt; --&gt;"/>
                 <xmltask source="${diamonds.build.output.dir}/create-bom.xml" dest="${diamonds.build.output.dir}/create-bom.xml"
@@ -215,9 +216,7 @@
                                     <actions>
                                         <var name="task.owner" value="@{task.owner}"/>
                                         <if>
-                                            <and>
-                                                <isset property="task.owners"/>
-                                            </and>
+                                            <isset property="task.owners"/>
                                             <then>
                                                 <var name="task.owners" value="${task.owners},${task.owner}"/>
                                             </then>
@@ -242,9 +241,7 @@
                                 <actions>
                                     <var name="task.owner" value="@{task.owner}"/>
                                     <if>
-                                        <and>
-                                            <isset property="task.owners"/>
-                                        </and>
+                                        <isset property="task.owners"/>
                                         <then>
                                             <var name="task.owners" value="${task.owners},${task.owner}"/>
                                         </then>
@@ -272,17 +269,20 @@
         <for list="${task.owners.unique}" delimiter="," param="task.owner" >
             <sequential>
                 <var name="task.owner" value="@{task.owner}"/>
-                <hlm:ldap url="${email.ldap.server}" rootdn="${email.ldap.rootdn}" filter="uid=${task.owner}" outputproperty="task.owner.email" key="mail"/>
                 <if>
-                    <and>
-                        <isset property="task.owners.email"/>
-                    </and>
+                    <isset property="email.ldap.server"/>
                     <then>
-                        <var name="task.owners.email" value="${task.owners.email},${task.owner.email}"/>
-                    </then>
-                    <else>
-                        <var name="task.owners.email" value="${task.owner.email}"/>
-                    </else>
+                        <hlm:ldap url="${email.ldap.server}" rootdn="${email.ldap.rootdn}" filter="uid=${task.owner}" outputproperty="task.owner.email" key="mail"/>
+                        <if>
+                            <isset property="task.owners.email"/>
+                            <then>
+                                <var name="task.owners.email" value="${task.owners.email},${task.owner.email}"/>
+                            </then>
+                            <else>
+                                <var name="task.owners.email" value="${task.owner.email}"/>
+                            </else>
+                        </if>
+                    </then>   
                 </if>
             </sequential>
         </for>
--- a/buildframework/helium/tools/quality/validate-policy.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/quality/validate-policy.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -194,8 +194,10 @@
     
     <!-- Policy validation target for IDO. Only detected ADO will get scanned. -->    
     <target name="ido-validate-policy" depends="ido-create-ado-mapping,ido-validate-policy-skip" unless="do.skip.policy-validation">
+        <record name="${temp.build.dir}/${build.id}_validate-policy.ant.log" action="start" />
         <hlm:iniKeys2Path ini="${ado.quality.mapping.file}" pathid="reference.policy.path.list"/>
         <runtarget target="render-validate-policy" />
+        <record name="${temp.build.dir}/${build.id}_validate-policy.ant.log" action="stop" />
     </target>
 
 </project>
--- a/buildframework/helium/tools/startup/bootstrap/bootstrap.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/startup/bootstrap/bootstrap.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -51,12 +51,12 @@
     @type string
     @scope private
     -->
-    <property name="ivy.file" value="${helium.dir}/external/antlibs/${ivy.filename}" />
+    <property name="ivy.file" value="${helium.dir}/external/antlibs2/${ivy.filename}" />
     <available file="${ivy.file}" property="ivy.file.present" />
 
     <!-- Download ivy jar -->
     <target name="get-ivy" unless="ivy.file.present" depends="proxy">
-        <mkdir dir="${helium.dir}/external/antlibs" />
+        <mkdir dir="${helium.dir}/external/antlibs2" />
         <get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/ivy/ivy/2.0.0-beta2/${ivy.filename}" dest="${ivy.file}" />
     </target>
 
@@ -88,7 +88,7 @@
     <!-- Set libs for bootstrap -->
     <target name="set-libs">
         <path id="lib.path">
-            <fileset dir="${helium.dir}/external/antlibs" includes="**/*.jar" />
+            <fileset dir="${helium.dir}/external/antlibs2" includes="**/*.jar" />
         </path>
 
         <!-- External tasks. -->
@@ -103,7 +103,7 @@
 
     <!-- unzip jars. @scope private-->
     <target name="unzip-jar">
-        <unzip src="${artifact.file}" dest="${helium.dir}/external/antlibs" />
+        <unzip src="${artifact.file}" dest="${helium.dir}/external/antlibs2" />
     </target>
     <!-- unzip eggs. @scope private -->
     <target name="unzip-egg">
@@ -125,13 +125,13 @@
         <ivy:configure file="${tools.ivy.config.file}" />
         <ivy:resolve file="${helium.dir}/config/ivy/ivy.xml" conf="${build.type}" haltonfailure="false" />
 
-        <ivy:retrieve pattern="${helium.dir}/external/antlibs/[artifact]-[revision].[ext]" type="jar" />
+        <ivy:retrieve pattern="${helium.dir}/external/antlibs2/[artifact]-[revision].[ext]" type="jar" />
         <ivy:retrieve pattern="${helium.dir}/external/python/lib/2.5/[artifact]-[revision].[ext]" type="egg" />
         <ivy:retrieve pattern="${helium.dir}/external/sources/[artifact]-[revision].[ext]" type="zip" />
 
         <delete>
-            <fileset dir="${helium.dir}/external/antlibs" includes="ant-optional*.jar" />
-            <fileset dir="${helium.dir}/external/antlibs" includes="ant-1.5.jar" />
+            <fileset dir="${helium.dir}/external/antlibs2" includes="ant-optional*.jar" />
+            <fileset dir="${helium.dir}/external/antlibs2" includes="ant-1.5.jar" />
         </delete>
 
         <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="lib.path" />
--- a/buildframework/helium/tools/testing/ats/ats.ant.xml	Tue Apr 27 08:33:08 2010 +0300
+++ b/buildframework/helium/tools/testing/ats/ats.ant.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -199,58 +199,68 @@
             </else>
         </if>
 
-        <!-- Notify ATS about the drop. -->
-        <if>
-            <istrue value="${ats4.enabled}" />
-            <then>
-                <hlm:python failonerror="true">
+        <trycatch property="exception">
+            <try>
+                <!-- Notify ATS about the drop. -->
+                <if>
+                    <istrue value="${ats4.enabled}" />
+                    <then>
+                        <hlm:python failonerror="true">
 version = r'${java.version}'
 if '1.6.0' in version:
     assert int(version.split('_')[1]) > 6, 'Java 6 u7 required'
-                </hlm:python>
-                <condition property="ats.import.arg" value="-import" else="">
-                    <equals arg1="${ats.script.type}" arg2="import" />
-                </condition>
-                <condition property="ats4.libs" value="${helium.dir}/extensions/nokia/external/ats4" else="${helium.dir}/external/antlibs">
-                    <available type="dir" file="${helium.dir}/extensions/nokia/external/ats4"/>
-                </condition>
-                <java classname="com.nokia.ats.util.server.CommandLineClient" fork="true" maxmemory="1024m" failonerror="true">
-                    <classpath>
-                        <pathelement path="${java.class.path}"/>
-                        <fileset dir="${ats4.libs}" includes="*.jar"/>
-                    </classpath>
-                    <arg line="-url http://${ats.server}/ServerService -path ${ats.drop.location.file} ${ats.import.arg}"/>
-                </java>
-            </then>
-            <else>
-                <if>
-                    <and>
-                        <equals arg1="${ats.script.type}" arg2="import" />
-                        <available classname="com.nokia.taitei.util.TestDropImporter"/>
-                    </and>
-                    <then>
-                        <java classname="com.nokia.taitei.util.TestDropImporter" fork="true" maxmemory="1024m" failonerror="true">
+                        </hlm:python>
+                        <condition property="ats.import.arg" value="-import" else="">
+                            <equals arg1="${ats.script.type}" arg2="import" />
+                        </condition>
+                        <condition property="ats4.libs" value="${helium.dir}/extensions/nokia/external/ats4" else="${helium.dir}/external/antlibs">
+                            <available type="dir" file="${helium.dir}/extensions/nokia/external/ats4"/>
+                        </condition>
+                        <java classname="com.nokia.ats.util.server.CommandLineClient" fork="true" maxmemory="1024m" failonerror="true">
                             <classpath>
                                 <pathelement path="${java.class.path}"/>
+                                <fileset dir="${ats4.libs}" includes="*.jar"/>
                             </classpath>
-                            <arg line="${ats.server} ${ats.drop.location.file} ${ats.username} ${ats.password}"/>
+                            <arg line="-url http://${ats.server}/ServerService -path ${ats.drop.location.file} ${ats.import.arg}"/>
                         </java>
                     </then>
                     <else>
-                        <condition property="ats.wsh.testrun.file" value="wshTestRunImport.vbs" else="wshTestRunX.vbs">
-                            <equals arg1="${ats.script.type}" arg2="import" />
-                        </condition>
-                        <exec executable="cscript" dir="${build.drive}/" failonerror="true">
-                            <env key="ats3.username" value="${ats.username}" />
-                            <env key="ats3.password" value="${ats.password}" />
-                            <env key="ats3.host" value="${ats.server}" />
-                            <env key="ats3.pathToDrop" value="${ats.drop.location.file}"/>
-                            <arg value="${helium.dir}/tools/testing/ats/${ats.wsh.testrun.file}" />
-                        </exec>
+                        <if>
+                            <and>
+                                <equals arg1="${ats.script.type}" arg2="import" />
+                                <available classname="com.nokia.taitei.util.TestDropImporter"/>
+                                <not>
+                                    <istrue value="${ats.disable.java.importer}" />
+                                </not>
+                            </and>
+                            <then>
+                                <java classname="com.nokia.taitei.util.TestDropImporter" fork="true" maxmemory="1024m" failonerror="true">
+                                    <classpath>
+                                        <pathelement path="${java.class.path}"/>
+                                    </classpath>
+                                    <arg line="${ats.server} ${ats.drop.location.file} ${ats.username} ${ats.password}"/>
+                                </java>
+                            </then>
+                            <else>
+                                <condition property="ats.wsh.testrun.file" value="wshTestRunImport.vbs" else="wshTestRunX.vbs">
+                                    <equals arg1="${ats.script.type}" arg2="import" />
+                                </condition>
+                                <exec executable="cscript" dir="${build.drive}/" failonerror="true">
+                                    <env key="ats3.username" value="${ats.username}" />
+                                    <env key="ats3.password" value="${ats.password}" />
+                                    <env key="ats3.host" value="${ats.server}" />
+                                    <env key="ats3.pathToDrop" value="${ats.drop.location.file}"/>
+                                    <arg value="${helium.dir}/tools/testing/ats/${ats.wsh.testrun.file}" />
+                                </exec>
+                            </else>
+                        </if>             
                     </else>
-                </if>             
-            </else>
-        </if>
+                </if>
+            </try>
+            <catch>
+                <echo message="Error: ${exception}"/>
+            </catch>
+        </trycatch>
     </target>
 
     <!-- The target is dependent on "ats-test", should not be called independently. The target fetches flash files location -->
@@ -263,7 +273,7 @@
     import atsant
     ic = None
     try:
-        ic = atsant.IConfigATS(project.getProperty('release.images.dir'))
+        ic = atsant.IConfigATS(project.getProperty('release.images.dir'), project.getProperty('ats.product.name'))
     except Exception, ex:
         print ex
     if ic:
@@ -493,7 +503,7 @@
                             <arg value="--verbose" />
                             <arg line="${module.tsrc.@{module}}" />
                         </exec>
-                        <runtarget target="do-ats-test" />
+                        <antcall target="do-ats-test" />
                         <math result="drop.file.counter" operand1="1" operation="+" operand2="${drop.file.counter}" datatype="int" />
                     </sequential>
                 </for>
@@ -717,4 +727,26 @@
             </else>
         </if>        
     </target>
+    
+    <!-- Generate and upload drop using custom template -->
+    <target name="ats-custom-drop">
+        <mkdir dir="${build.output.dir}/ats" />
+        <runtarget target="ats-set-flash-image-path" />
+        <runtarget target="ats-set-defaults-stifeunit" />
+        <property name="ats.custom.template" value="${helium.dir}/tools/testing/ats/templates/ats4_naviengine_template.xml"/>
+        <exec executable="python">
+            <arg line="-Wignore -m ats3.custom" />
+            <arg value="--custom-template=${ats.custom.template}" />
+            <arg value="--device-type=${ats.product.name}" />
+            <arg value="${internal.ats.diamonds.arg}" />
+            <arg value="--drop-file=${build.output.dir}/ats/${ats.drop.file}" />
+            <arg value="--report-email=${ats.email.list}" />
+            <arg value="--testrun-name=${ats.testrun.name}" />
+            <arg value="--flash-images=${ats.flash.images}" />
+            <arg value="--test-timeout=${ats.test.timeout}" />
+            <arg value="--test-type=${ats.custom.test.type}" />
+        </exec>
+        <runtarget target="do-ats-test" />
+    </target>
+
 </project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildframework/helium/tools/testing/ats/templates/ats4_naviengine_template.xml	Thu Jul 22 17:08:43 2010 +0300
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
+<!-- 
+============================================================================ 
+Name        : ats_template.xml
+Part of     : Helium 
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
+This component and the accompanying materials are made available
+under the terms of the License "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+Initial Contributors:
+Nokia Corporation - initial contribution.
+
+Contributors:
+
+Description:
+Contains the template for the test.xml file output. The test.xml file contains
+information on the files used to create the drop file.
+============================================================================
+-->
+
+<testrun>
+    <metadata>
+        {% if test_plan['diamonds_build_url'] -%}
+        <meta name="diamonds-buildid">{{ test_plan['diamonds_build_url'] }}</meta> 
+        <meta name="diamonds-testtype">Smoke</meta>
+        {% endif %}
+        <meta name="name">{{ test_plan['testrun_name'] }}</meta> 
+    </metadata>
+    
+    <agents>
+        <agent alias="DEFAULT_{{ test_plan['harness'] }}">
+            <property name="hardware" value="{{ test_plan["device_type"] }}"/>
+        </agent>
+    </agents>
+    
+    <execution defaultAgent="DEFAULT_{{ test_plan['harness'] }}">
+        <task>
+            <type>ExecutableTestCaseTask</type>
+            <parameters>
+                <parameter value="{{ test_plan["test_timeout"] }}" name="timeout"/>
+                <parameter value="cmd.exe" name="file"/>
+                {% for setd in test_plan.sets -%}                
+                <parameter value="/C NaviTest.bat %DEFAULT_GENERIC->NaviPowerIP% %DEFAULT_GENERIC->NaviPowerPort% %DEFAULT_GENERIC->NaviSerialPort% %TEST_RUN_SANDBOX% ATS3Drop\images\{{ os.path.basename(atsself.get_sorted_images(setd)[0]) }} c:\temp\%DEFAULT_GENERIC->name%-console.log" name="parameters"/>
+                {% endfor -%}
+                <parameter value="c:\temp\%DEFAULT_GENERIC->name%-console.log" name="result-file"/>
+                <parameter value="true" name="local-execute"/>
+                <parameter value="true" name="local-result"/>
+                <parameter value="true" name="extract-html"/>
+                {% if test_plan['test_type'] == 'tef' -%}
+                <parameter name="parser" value="TEFResultParser" />
+                {% elif test_plan['test_type'] == 'mtf' -%}
+                <parameter name="parser" value="MTFResultParser" />
+                {% else %}
+                <parameter name="parser" value="RTestResultParser" />
+                {% endif %}
+            </parameters>
+        </task>
+        
+        <finalization>
+            <task>
+                <type>CleanupTask</type>
+                <parameters>
+                    <parameter value="true" name="upload-files"/>
+                </parameters>
+            </task>
+        </finalization>
+    </execution>
+    
+    <postActions>
+        {% for action_type, parameters in test_plan.post_actions -%}
+            {% if action_type == 'RunProcessAction' %}
+        <action>
+            <type>{{ action_type }}</type>
+            <parameters>
+                {% for name, value in parameters -%}
+                <parameter name="{{ name }}" value="{{ value }}"/>
+                {% endfor -%}
+            </parameters>
+        </action>
+            {% endif %}
+        {% endfor -%}
+        {% if test_plan['report_email'] -%}
+        <action>
+            <type>EmailAction</type>
+            <parameters>
+                <parameter value="Release testing" name="subject"/>
+                <parameter value="{{ test_plan['report_email'] }}" name="to"/>
+                <parameter value="simplelogger" name="format"/>
+            </parameters>
+        </action>
+        {% endif %}
+        {% if test_plan['diamonds_build_url'] -%}
+        <action>
+            <type>DiamondsAction</type>
+        </action>
+        {% endif %}
+    </postActions>
+    
+</testrun>