buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/HlmListenerDef.java
--- a/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/HlmListenerDef.java Wed Jun 16 16:51:40 2010 +0300
+++ b/buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/HlmListenerDef.java Fri Aug 13 14:59:05 2010 +0300
@@ -1,33 +1,36 @@
/*
-* 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 org.apache.tools.ant.Project;
+import org.apache.log4j.Logger;
+import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildListener;
-import org.apache.log4j.Logger;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+import com.nokia.helium.core.ant.PreBuildAction;
/**
* This class implements a listener registration action.
*
* @ant.type name="listenerdef" category="Core"
*/
-public class HlmListenerDef extends HlmPreDefImpl {
+public class HlmListenerDef extends DataType implements PreBuildAction {
private String classname;
private Logger log = Logger.getLogger(HlmListenerDef.class);
@@ -39,18 +42,22 @@
/**
* Register given listener to the project.
*/
- public void execute(Project prj, String module, String[] targetNames) {
+ public void executeOnPreBuild(Project project, String[] targetNames) {
try {
Class<?> listenerClass = Class.forName(classname);
BuildListener listener = (BuildListener) listenerClass
.newInstance();
- prj.addBuildListener(listener);
+ project.addBuildListener(listener);
+ log.debug(classname + " is registered");
} catch (ClassNotFoundException ex) {
- log.debug("Class not found exception:" + ex.getMessage(), ex);
+ throw new BuildException("Class not found exception:"
+ + ex.getMessage(), ex);
} catch (InstantiationException ex1) {
- log.debug("Class Instantiation exception:" + ex1.getMessage(), ex1);
+ throw new BuildException("Class Instantiation exception:"
+ + ex1.getMessage(), ex1);
} catch (IllegalAccessException ex1) {
- log.debug("Illegal Class Access exception:" + ex1.getMessage(), ex1);
+ throw new BuildException("Illegal Class Access exception:"
+ + ex1.getMessage(), ex1);
}
}
}
\ No newline at end of file