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.ant.taskdefs;
|
|
19 |
|
|
20 |
import java.io.File;
|
|
21 |
import java.io.IOException;
|
628
|
22 |
|
587
|
23 |
import org.apache.tools.ant.BuildException;
|
628
|
24 |
import org.apache.tools.ant.Project;
|
587
|
25 |
import org.apache.tools.ant.Task;
|
|
26 |
import org.dom4j.DocumentException;
|
|
27 |
|
|
28 |
import com.nokia.ant.ModelPropertiesParser;
|
|
29 |
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Renders model property and group description to Wiki Model Syntax.
|
|
33 |
* Usage: <hlm:parsemodel output="Output file path" input="Input file path"/>
|
|
34 |
* @ant.task name="parsemodel"
|
|
35 |
*/
|
|
36 |
public class ModelPropertiesTask extends Task
|
|
37 |
{
|
|
38 |
private File outputFile;
|
|
39 |
|
|
40 |
private File inputFile;
|
|
41 |
|
|
42 |
public ModelPropertiesTask()
|
|
43 |
{
|
|
44 |
setTaskName("ModelPropertiesTask");
|
|
45 |
}
|
|
46 |
|
|
47 |
public void setOutput(File outputFile)
|
|
48 |
{
|
|
49 |
this.outputFile = outputFile;
|
|
50 |
}
|
|
51 |
|
|
52 |
public void setInput(File inputFile)
|
|
53 |
{
|
|
54 |
this.inputFile = inputFile;
|
|
55 |
}
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Executes ModelPropertyParser
|
|
59 |
* @throws BuildException
|
|
60 |
*/
|
|
61 |
public void execute()
|
|
62 |
{
|
|
63 |
log("Parsing model properties", Project.MSG_DEBUG);
|
|
64 |
try
|
|
65 |
{
|
|
66 |
ModelPropertiesParser pmp = new ModelPropertiesParser(inputFile, outputFile);
|
|
67 |
pmp.parsePropertiesDescription();
|
|
68 |
}
|
|
69 |
catch (IOException ioe)
|
|
70 |
{
|
|
71 |
throw new BuildException("Couldn't find model file: " + ioe.getMessage());
|
|
72 |
}
|
|
73 |
catch (DocumentException be)
|
|
74 |
{
|
|
75 |
throw new BuildException("Error in creating model dom object: " + be.getMessage());
|
|
76 |
}
|
|
77 |
}
|
|
78 |
}
|