|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.helium.core.ant.types; |
|
20 |
|
21 import java.util.List; |
|
22 |
|
23 import org.apache.tools.ant.types.DataType; |
|
24 import java.util.ArrayList; |
|
25 import com.nokia.helium.core.ant.Message; |
|
26 |
|
27 /** |
|
28 * Helper class to store the list of targets to be recorded and to be sent for diamonds. |
|
29 * |
|
30 * Example 1: |
|
31 * <pre> |
|
32 * <hlm:targetMessageTrigger id="diamonds.id" target="diamonds"> |
|
33 * <hlm:fmppMessage> |
|
34 * <converterTask id="tools-conversion" sourceFile="${helium.dir}/tools/common/templates/diamonds/tool.xml.ftl" outputFile="${build.output.dir}/tool.xml"> |
|
35 * <data expandProperties="yes"> |
|
36 * ant: antProperties() |
|
37 * </data> |
|
38 * </converterTask> |
|
39 * </hlm:fmppMessage> |
|
40 * </hlm:targetMessageTrigger> |
|
41 * <pre> |
|
42 * @ant.type name="TargetMessageTrigger" category="Core" |
|
43 */ |
|
44 |
|
45 |
|
46 public class TargetMessageTrigger extends DataType { |
|
47 |
|
48 private String targetName; |
|
49 |
|
50 private boolean condition = true; |
|
51 |
|
52 private List<Message> messageList = new ArrayList<Message>(); |
|
53 |
|
54 /** |
|
55 * Helper function to add message to the list. |
|
56 * |
|
57 * @param message message to be added to the list |
|
58 */ |
|
59 public void add(Message message) { |
|
60 messageList.add(message); |
|
61 } |
|
62 |
|
63 public void setCondition(boolean condition) { |
|
64 this.condition = condition; |
|
65 } |
|
66 public boolean isTriggerNeeded() { |
|
67 return condition; |
|
68 } |
|
69 /** |
|
70 * To get the message list to be processed further. |
|
71 * |
|
72 * @return the message list. |
|
73 */ |
|
74 public List<Message> getMessageList() { |
|
75 return messageList; |
|
76 } |
|
77 |
|
78 /** |
|
79 * Sets the target name for which the message to be processed. |
|
80 * |
|
81 * @param name of the target. |
|
82 */ |
|
83 public void setTarget(String name) { |
|
84 targetName = name; |
|
85 } |
|
86 |
|
87 /** |
|
88 * Helper function to get the target name for which the message is processed. |
|
89 * |
|
90 * @return target name. |
|
91 */ |
|
92 public String getTargetName() { |
|
93 return targetName; |
|
94 } |
|
95 } |