buildframework/helium/sf/java/core/src/com/nokia/helium/core/ant/types/HlmDefList.java
changeset 628 7c4a911dc066
parent 587 85df38eb4012
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5  * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description:  
    14  * Description:  
    15 *
    15  *
    16 */
    16  */
    17 
       
    18 
    17 
    19 package com.nokia.helium.core.ant.types;
    18 package com.nokia.helium.core.ant.types;
    20 
    19 
    21 import java.util.Vector;
    20 import java.util.Vector;
       
    21 
    22 import org.apache.tools.ant.types.DataType;
    22 import org.apache.tools.ant.types.DataType;
       
    23 
    23 import com.nokia.helium.core.ant.HlmExceptionHandler;
    24 import com.nokia.helium.core.ant.HlmExceptionHandler;
       
    25 import com.nokia.helium.core.ant.PostBuildAction;
       
    26 import com.nokia.helium.core.ant.PreBuildAction;
    24 
    27 
    25 /**
    28 /**
       
    29  * HlmDefList is a class used to store the pre/post build events and the
       
    30  * exception handlers.
    26  * 
    31  * 
       
    32  * @ant.type name="deflist" category="Core"
    27  */
    33  */
    28 public class HlmDefList extends DataType {
    34 public class HlmDefList extends DataType {
    29 
    35 
    30     private Vector<HlmPreDefImpl> preDefList = new Vector<HlmPreDefImpl>();
    36     private Vector<PreBuildAction> preBuildActions = new Vector<PreBuildAction>();
    31     private Vector<HlmPostDefImpl> postDefList = new Vector<HlmPostDefImpl>();
    37     private Vector<PostBuildAction> postBuildActions = new Vector<PostBuildAction>();
    32     private Vector<HlmExceptionHandler> exceptionHandlerList = new Vector<HlmExceptionHandler>();
    38     private Vector<HlmExceptionHandler> exceptionHandlers = new Vector<HlmExceptionHandler>();
    33 
    39 
    34     /**
    40     /**
    35      * Creates an empty hlm post-action definition and adds it to the list.
    41      * Method to add a pre/post build action or an exception handler.
       
    42      * 
       
    43      * @param type
       
    44      *            is the datatype representing a pre/post build action or an
       
    45      *            exception handler.
    36      */
    46      */
    37     public HlmPreDefImpl createHlmPreDefImpl() {
    47     public void add(DataType type) {
    38         HlmPreDefImpl def = new HlmPreDefImpl();
    48         if (type instanceof PreBuildAction) {
    39         add(def);
    49             preBuildActions.add((PreBuildAction) type);
    40         return (HlmPreDefImpl) def;
    50         }
    41     }
    51         if (type instanceof PostBuildAction) {
    42 
    52             postBuildActions.add((PostBuildAction) type);
    43     /**
    53         }
    44      * Creates an empty hlm post-action definition and adds it to the list.
    54         if (type instanceof HlmExceptionHandler) {
    45      */
    55             exceptionHandlers.add((HlmExceptionHandler) type);
    46     public HlmPostDefImpl createHlmPostDefImpl() {
       
    47         HlmPostDefImpl def = new HlmPostDefImpl();
       
    48         add(def);
       
    49         return (HlmPostDefImpl) def;
       
    50     }
       
    51 
       
    52     /**
       
    53      * Add a given variable to the list
       
    54      * 
       
    55      * @param var
       
    56      *            variable to add
       
    57      */
       
    58     public void add(HlmPreDefImpl definition) {
       
    59         if (definition != null) {
       
    60             preDefList.add(definition);
       
    61         }
    56         }
    62     }
    57     }
    63 
    58 
    64     /**
    59     /**
    65      * Add a post-action to the list.
    60      * Get the list of pre build actions.
       
    61      * 
       
    62      * @return the list of pre build actions.
    66      */
    63      */
    67     public void add(HlmPostDefImpl definition) {
    64     public Vector<PreBuildAction> getPreBuildActions() {
    68         if (definition != null) {
    65         return preBuildActions;
    69             postDefList.add(definition);
       
    70         }
       
    71     }
       
    72     
       
    73     /**
       
    74      * Add a exception handler to the list.
       
    75      */
       
    76     public void add(HlmExceptionHandler exceptionHandler) {
       
    77         if (exceptionHandler != null) {
       
    78             exceptionHandlerList.add(exceptionHandler);
       
    79         }
       
    80     }
    66     }
    81 
    67 
    82     /**
    68     /**
    83      * Get the pre-action list.
    69      * Get the list of post build actions.
    84      * 
    70      * 
    85      * @return a vector containing all the pre-actions
    71      * @return the list of post build actions.
    86      */
    72      */
    87     public Vector<HlmPreDefImpl> getPreDefList() {
    73     public Vector<PostBuildAction> getPostBuildActions() {
    88         return preDefList;
    74         return postBuildActions;
    89     }
    75     }
    90 
    76 
    91     /**
    77     /**
    92      * Get the post-action list.
    78      * Get the list of exception handlers.
    93      * 
    79      * 
    94      * @return a vector containing all the post-actions
    80      * @return the list of exception handlers
    95      */
    81      */
    96     public Vector<HlmPostDefImpl> getPostDefList() {
    82     public Vector<HlmExceptionHandler> getExceptionHandlers() {
    97         return postDefList;
    83         return exceptionHandlers;
    98     }
       
    99     
       
   100     /**
       
   101      * Get the exception handler list.
       
   102      * 
       
   103      * @return a vector containing all the exception handlers
       
   104      */
       
   105     public Vector<HlmExceptionHandler> getExceptionHandlerList() {
       
   106         return exceptionHandlerList;
       
   107     }
    84     }
   108 }
    85 }