buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/HlmFinalTargetDef.java
changeset 628 7c4a911dc066
parent 587 85df38eb4012
--- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/HlmFinalTargetDef.java	Wed Jun 16 16:51:40 2010 +0300
+++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/HlmFinalTargetDef.java	Fri Aug 13 14:59:05 2010 +0300
@@ -1,54 +1,62 @@
 /*
-* Copyright (c) 2007-2008 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:  
-*
-*/
+ * Copyright (c) 2007-2008 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:  
+ *
+ */
 
- 
 package com.nokia.helium.core.ant.types;
 
+import java.util.Hashtable;
+
+import org.apache.log4j.Logger;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Target;
-import java.util.Hashtable;
-import org.apache.log4j.Logger;
+import org.apache.tools.ant.types.DataType;
 
+import com.nokia.helium.core.ant.PostBuildAction;
 
 /**
- * Class to execute the final target as post operation.
+ * Class to execute the final target as post build action.
+ * 
+ * @ant.type name="finaltargetdef" category="Core"
  */
-public class HlmFinalTargetDef extends HlmPostDefImpl
-{
+public class HlmFinalTargetDef extends DataType implements PostBuildAction {
     private Logger log = Logger.getLogger(HlmFinalTargetDef.class);
-    
+
     /**
      * This post action will execute the final target if any to be executed.
+     * 
      * @param prj
      * @param module
      * @param targetNames
      * 
      */
-    public void execute(Project prj, String module, String[] targetNames) {
-        String finalTargetName = prj.getProperty("hlm.target.final");
-        log.debug("Calling final target" + finalTargetName);
+    @SuppressWarnings("unchecked")
+    public void executeOnPostBuild(Project project, String[] targetNames) {
+        String finalTargetName = project.getProperty("hlm.target.final");
+        log.debug("Calling final target : " + finalTargetName);
         if (finalTargetName != null) {
-            Hashtable targets = prj.getTargets();
-            Target finalTarget = (Target)targets.get(finalTargetName);
+            // verify the target exists.
+            Hashtable targets = project.getTargets();
+            Target finalTarget = (Target) targets.get(finalTargetName);
             if (finalTarget == null) {
-                log.info("The final target : " + finalTargetName + " not available skipping");
+                log.info("The final target : " + finalTargetName
+                        + " not available skipping");
                 return;
             }
-            finalTarget.execute();
+            // let's the project execute the target.
+            project.executeTarget(finalTargetName);
         }
     }
 }
\ No newline at end of file