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.tools.cone;
|
|
19 |
|
|
20 |
import java.io.File;
|
|
21 |
import java.util.HashMap;
|
|
22 |
import java.util.Map;
|
|
23 |
|
|
24 |
import org.apache.tools.ant.Project;
|
|
25 |
|
|
26 |
import com.nokia.helium.core.ant.types.VariableSet;
|
|
27 |
import com.nokia.tools.Tool;
|
|
28 |
import com.nokia.tools.ToolsProcessException;
|
|
29 |
|
|
30 |
|
|
31 |
/**
|
|
32 |
* To generate the cenrep files using ConE tool.
|
|
33 |
*
|
|
34 |
*
|
|
35 |
*/
|
|
36 |
public class CONETool implements Tool {
|
|
37 |
|
|
38 |
private Map<String, String> varMapping = new HashMap<String, String>();
|
|
39 |
|
|
40 |
public void execute(VariableSet varSet, Project prj)
|
|
41 |
throws ToolsProcessException {
|
|
42 |
// TODO Auto-generated method stub
|
|
43 |
|
|
44 |
}
|
|
45 |
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Run the cone command with arguments from hashmap.
|
|
49 |
* @param prj
|
|
50 |
* @throws ToolsProcessException
|
|
51 |
*/
|
|
52 |
public void execute(Project prj) throws ToolsProcessException {
|
|
53 |
|
|
54 |
org.apache.tools.ant.taskdefs.ExecTask task = new org.apache.tools.ant.taskdefs.ExecTask();
|
|
55 |
task.setTaskName("ConE");
|
|
56 |
task.setDir(new java.io.File(varMapping.get("path")));
|
|
57 |
task.setExecutable("cmd.exe");
|
|
58 |
task.setOutput(new File(varMapping.get("output")));
|
|
59 |
task.createArg().setValue("/c");
|
|
60 |
task.setAppend(true);
|
|
61 |
task.createArg().setValue("cone.cmd");
|
|
62 |
task.createArg().setValue("generate");
|
|
63 |
for (Map.Entry<String, String> varEntry : varMapping.entrySet() ) {
|
|
64 |
if ( !varEntry.getKey().equals("path") && !varEntry.getKey().equals("output")) {
|
|
65 |
task.createArg().setValue(varEntry.getKey());
|
|
66 |
task.createArg().setValue(varEntry.getValue());
|
|
67 |
}
|
|
68 |
}
|
|
69 |
task.execute();
|
|
70 |
}
|
|
71 |
|
|
72 |
/**
|
|
73 |
* To Store the variable and it value into hashmap to read them later.
|
|
74 |
* @param name
|
|
75 |
* @param value
|
|
76 |
*/
|
|
77 |
public void storeVariables(String name, String value) {
|
|
78 |
varMapping.put(name, value);
|
|
79 |
}
|
|
80 |
|
|
81 |
}
|