587
|
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.signal.ant.types;
|
|
20 |
|
628
|
21 |
import java.util.Vector;
|
|
22 |
|
587
|
23 |
import org.apache.tools.ant.types.DataType;
|
|
24 |
|
|
25 |
/**
|
|
26 |
* This Ant type defines a signal input for listener based signals.
|
|
27 |
*
|
|
28 |
* E.g:
|
|
29 |
* <pre>
|
|
30 |
* <hlm:signalListenerConfig id="prepSignal" target="prep-signal-test" message="some-target-name triggered a signal" >
|
|
31 |
* <hlm:targetCondition >
|
|
32 |
* </available file="some-file.txt" />
|
|
33 |
* </hlm:targetCondition>
|
|
34 |
* <signalInput refid="prepSignalInput" >
|
|
35 |
* <notifierInput file = "${build.cache.log.dir}/signals/${build.id}_prep_status.html" />
|
|
36 |
* </signalInput>
|
|
37 |
*
|
|
38 |
* </hlm:signalListenerConfig>
|
|
39 |
* </pre>
|
|
40 |
*
|
|
41 |
* @ant.type name="signalListenerConfig" category="Signaling"
|
|
42 |
*/
|
|
43 |
|
|
44 |
public class SignalListenerConfig extends DataType
|
|
45 |
{
|
|
46 |
|
|
47 |
private Vector<SignalNotifierInput> signalNotifierInputs = new Vector<SignalNotifierInput>();
|
|
48 |
|
|
49 |
private String target;
|
|
50 |
|
|
51 |
private String errMsg;
|
|
52 |
|
|
53 |
private Vector<TargetCondition> targetConditions = new Vector<TargetCondition>();
|
|
54 |
|
|
55 |
private String configID;
|
|
56 |
|
|
57 |
public String getTargetName() {
|
|
58 |
return target;
|
|
59 |
}
|
|
60 |
|
|
61 |
public String getErrorMessage() {
|
|
62 |
return errMsg;
|
|
63 |
}
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Helper function to store the Name of the target for which
|
|
67 |
* the signal to be processed.
|
|
68 |
* @param targetName to be stored.
|
|
69 |
*/
|
|
70 |
public void setTarget(String targetName) {
|
|
71 |
target = targetName;
|
|
72 |
}
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Helper function to store the error message of
|
|
76 |
* @param errorMessage to be displayed after failure.
|
|
77 |
*/
|
|
78 |
public void setMessage(String errorMessage) {
|
|
79 |
errMsg = errorMessage;
|
|
80 |
}
|
|
81 |
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Helper function called by ant to create the new signalinput
|
|
85 |
*/
|
|
86 |
public SignalNotifierInput createSignalNotifierInput() {
|
|
87 |
SignalNotifierInput input = new SignalNotifierInput();
|
|
88 |
add(input);
|
|
89 |
return input;
|
|
90 |
}
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Helper function to add the created signalinput
|
|
94 |
* @param filter to be added to the filterset
|
|
95 |
*/
|
|
96 |
public void add(SignalNotifierInput input) {
|
|
97 |
signalNotifierInputs.add(input);
|
|
98 |
}
|
|
99 |
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Creates type target condition of type TargetCondition.
|
|
103 |
* @return ReferenceType which is created and stored by the config.
|
|
104 |
*/
|
|
105 |
public TargetCondition createTargetCondition() {
|
|
106 |
TargetCondition condition = new TargetCondition();
|
|
107 |
add(condition);
|
|
108 |
return condition;
|
|
109 |
}
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Helper function to store the config id
|
|
113 |
* @param config id to store.
|
|
114 |
*/
|
|
115 |
public void setConfigId(String confID) {
|
|
116 |
configID = confID;
|
|
117 |
}
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Helper function to return the config id
|
|
121 |
* @return The configuration id
|
|
122 |
*/
|
|
123 |
public String getConfigId() {
|
|
124 |
return configID;
|
|
125 |
}
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Adds the TargetCondition reference to the container.
|
|
129 |
* @param TargetCondition to be added to the container, to be processed during signaling.
|
|
130 |
*/
|
|
131 |
public void add(TargetCondition condition) {
|
|
132 |
if (condition != null) {
|
|
133 |
targetConditions.add(condition);
|
|
134 |
}
|
|
135 |
}
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Helper function to return the Targetcondition matching the target name.
|
|
139 |
* @param String name of the target for which the targetcondition is returned,
|
|
140 |
*/
|
|
141 |
public TargetCondition getTargetCondition() {
|
|
142 |
if (targetConditions.isEmpty()) {
|
|
143 |
return null;
|
|
144 |
}
|
|
145 |
return targetConditions.get(0);
|
|
146 |
}
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Helper function to return the Targetcondition matching the target name.
|
|
150 |
* @param String name of the target for which the targetcondition is returned,
|
|
151 |
*/
|
|
152 |
public SignalNotifierInput getSignalNotifierInput() {
|
|
153 |
if (signalNotifierInputs.isEmpty()) {
|
|
154 |
return null;
|
|
155 |
}
|
|
156 |
return signalNotifierInputs.get(0);
|
|
157 |
}
|
|
158 |
} |