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 |
package com.nokia.helium.sbs.ant;
|
|
19 |
|
628
|
20 |
import java.util.HashMap;
|
587
|
21 |
import java.util.Hashtable;
|
|
22 |
import java.util.List;
|
628
|
23 |
|
587
|
24 |
import org.apache.log4j.Logger;
|
628
|
25 |
import org.apache.tools.ant.BuildException;
|
|
26 |
import org.apache.tools.ant.Project;
|
|
27 |
|
|
28 |
import com.nokia.helium.sbs.ant.types.SBSBuild;
|
|
29 |
import com.nokia.helium.sbs.ant.types.SBSInput;
|
587
|
30 |
|
|
31 |
/**
|
|
32 |
* This is the final class to store the sbs build list across the ant configurations.
|
|
33 |
*/
|
|
34 |
public final class SBSBuildList {
|
|
35 |
|
|
36 |
private static HashMap<Object, SBSBuild> sbsBuildMap;
|
|
37 |
|
|
38 |
private static Logger log = Logger.getLogger(SBSBuildList.class);
|
628
|
39 |
|
587
|
40 |
private SBSBuildList() {
|
|
41 |
}
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Provides the list of sbsinput for the given configuration name. Process
|
|
45 |
* all the sbs input and returns the sbsinputlist for matchin configuration name
|
|
46 |
* from the ant xml file.
|
|
47 |
* @param project, ant project for whcih the sbs config needs to be searched for.
|
|
48 |
* @param buildName - name of the configuration for which the sbs input list needs
|
|
49 |
* to be obtained.
|
|
50 |
* @return list of sbs input for which the raptor needs to be executed one after another.
|
|
51 |
*/
|
|
52 |
public static List<SBSInput> getSBSInputList(Project project, String buildName) {
|
|
53 |
if (sbsBuildMap == null) {
|
|
54 |
initialize(project);
|
|
55 |
}
|
|
56 |
SBSBuild sbsBuild = sbsBuildMap.get(buildName);
|
|
57 |
if (sbsBuild == null) {
|
|
58 |
throw new BuildException("Config name : " + buildName + " is not valid");
|
|
59 |
}
|
|
60 |
List<SBSInput> retList = null;
|
|
61 |
if (sbsBuild != null) {
|
|
62 |
retList = sbsBuild.getSBSInputList();
|
|
63 |
}
|
|
64 |
return retList;
|
|
65 |
}
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Internal function to initialize the sbsbuild configuration to the hashmap.
|
|
69 |
* @param project, ant project for whcih the sbs config needs to be searched for.
|
|
70 |
*/
|
|
71 |
private static void initialize(Project project) {
|
|
72 |
Hashtable references = project.getReferences();
|
|
73 |
sbsBuildMap = new HashMap<Object, SBSBuild>();
|
|
74 |
for (Object key : references.keySet()) {
|
|
75 |
Object sbsBuildObject = references.get(key);
|
|
76 |
if ( sbsBuildObject != null && sbsBuildObject instanceof SBSBuild) {
|
|
77 |
sbsBuildMap.put(key, (SBSBuild)sbsBuildObject);
|
|
78 |
}
|
|
79 |
}
|
|
80 |
}
|
|
81 |
} |