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.conditions;
|
|
20 |
|
628
|
21 |
import org.apache.tools.ant.ProjectComponent;
|
587
|
22 |
import org.apache.tools.ant.taskdefs.condition.Condition;
|
628
|
23 |
|
587
|
24 |
import com.nokia.helium.signal.SignalStatus;
|
|
25 |
import com.nokia.helium.signal.SignalStatusList;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* The hasDeferredFailure condition allows you to know if any diferred failure are pending,
|
|
29 |
* or simply if a specific kind of failure has been deferred.
|
|
30 |
*
|
|
31 |
* Check for any pending failure, e.g:
|
|
32 |
* <pre>
|
|
33 |
* <condition property="pending.failure">
|
|
34 |
* <hlm:hasDeferredFailure/>
|
|
35 |
* </condition>
|
|
36 |
* </pre>
|
|
37 |
|
|
38 |
* Check for a particular pending failure e.g:
|
|
39 |
* <pre>
|
|
40 |
* <condition property="pending.compile.failure">
|
|
41 |
* <hlm:hasDeferredFailure name="compileSignal"/>
|
|
42 |
* </condition>
|
|
43 |
* </pre>
|
|
44 |
* @ant.type name="hasDeferredFailure" category="Signaling"
|
|
45 |
*
|
|
46 |
*/
|
|
47 |
public class DeferredFailureCondition extends ProjectComponent implements
|
|
48 |
Condition {
|
|
49 |
|
|
50 |
private String name;
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Set the signal name.
|
|
54 |
* @ant.not-required Ignored by default
|
|
55 |
*/
|
|
56 |
public void setName(String name) {
|
|
57 |
this.name = name;
|
|
58 |
}
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Evaluate to true if name is not defined and has any pending failure. Or
|
|
62 |
* if name is defined and has any pending failure with that particular
|
|
63 |
* signal name.
|
|
64 |
*/
|
|
65 |
public boolean eval() {
|
|
66 |
if (name != null) {
|
|
67 |
getProject().log("Has deferred " + name + " failure?");
|
|
68 |
for (SignalStatus signal : SignalStatusList.getDeferredSignalList().getSignalStatusList()) {
|
|
69 |
if (signal.getName().equals(name)) {
|
|
70 |
getProject().log("Failure " + name + " found.");
|
|
71 |
return true;
|
|
72 |
}
|
|
73 |
}
|
|
74 |
} else {
|
|
75 |
getProject().log(
|
|
76 |
"Deferred failure: "
|
|
77 |
+ ((SignalStatusList.getDeferredSignalList().hasSignalInList()) ? "Yes"
|
|
78 |
: "No"));
|
|
79 |
return SignalStatusList.getDeferredSignalList().hasSignalInList();
|
|
80 |
}
|
|
81 |
return false;
|
|
82 |
}
|
|
83 |
|
|
84 |
}
|