628
|
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 org.apache.tools.ant.types.DataType;
|
|
22 |
import org.apache.tools.ant.BuildException;
|
|
23 |
import org.apache.log4j.Logger;
|
|
24 |
|
|
25 |
/**
|
|
26 |
* A <code>Stage</code> is a Data type which stores Stage information.
|
|
27 |
*
|
|
28 |
* <p>
|
|
29 |
* A Stage is defined by setting three attributes name, start and end targets, both should be a
|
|
30 |
* valid target name in the project.
|
|
31 |
*
|
|
32 |
* <p>
|
|
33 |
* Usage:
|
|
34 |
*
|
|
35 |
* <pre>
|
|
36 |
* <hlm:stage id="preparation" starttarget="stagetest" endtarget="stagetest"/>
|
|
37 |
* </pre>
|
|
38 |
*
|
|
39 |
* @ant.type name="stage" category="Core"
|
|
40 |
*
|
|
41 |
*/
|
|
42 |
public class Stage extends DataType {
|
|
43 |
|
|
44 |
//Default id is used as the stage name so overriding is possible.
|
|
45 |
private Logger log = Logger.getLogger(Stage.class);
|
|
46 |
private String stageName;
|
|
47 |
|
|
48 |
private String startTarget;
|
|
49 |
|
|
50 |
private String endTarget;
|
|
51 |
|
|
52 |
public void setStageName(String name) {
|
|
53 |
log.debug("stage-name:" + name);
|
|
54 |
if (stageName != null) {
|
|
55 |
throw new BuildException("no supported attribute stageName externally");
|
|
56 |
}
|
|
57 |
stageName = name;
|
|
58 |
}
|
|
59 |
|
|
60 |
public String getStageName() {
|
|
61 |
return stageName;
|
|
62 |
}
|
|
63 |
/**
|
|
64 |
* Returns the stage start target.
|
|
65 |
* @return stage start target name.
|
|
66 |
*/
|
|
67 |
public String getStartTarget() {
|
|
68 |
return startTarget;
|
|
69 |
}
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Returns the stage end target.
|
|
73 |
* @return end target name
|
|
74 |
*/
|
|
75 |
public String getEndTarget() {
|
|
76 |
return endTarget;
|
|
77 |
}
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Set the starting target.
|
|
81 |
*
|
|
82 |
* @param start is the starting point to set.
|
|
83 |
* @ant.required
|
|
84 |
*/
|
|
85 |
public void setStartTarget(String name) {
|
|
86 |
startTarget = name;
|
|
87 |
}
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Set the end target.
|
|
91 |
*
|
|
92 |
* @param end is the end point to set.
|
|
93 |
* @ant.required
|
|
94 |
*/
|
|
95 |
public void setEndTarget(String name) {
|
|
96 |
endTarget = name;
|
|
97 |
}
|
|
98 |
|
|
99 |
/** Check is the end target set to current target.
|
|
100 |
*
|
|
101 |
* @param target
|
|
102 |
* @return
|
|
103 |
*/
|
|
104 |
public boolean isEndTarget( String target ) {
|
|
105 |
return this.endTarget.equals( target );
|
|
106 |
}
|
|
107 |
} |