KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > task > Idl2JavaTask


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Christophe Demarey.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.task;
28
29 // Package dependencies.
30
import org.apache.tools.ant.BuildException;
31 import org.apache.tools.ant.Task;
32
33 /**
34  * This task run an idl2java compiler.
35  *
36  * @author <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
37  *
38  * @version 0.1
39  */

40 public class Idl2JavaTask
41      extends Task
42 {
43     // ==================================================================
44
//
45
// Internal states.
46
//
47
// ==================================================================
48

49     /** The idl2java application. */
50     private Idl2JavaApplication app_;
51
52     // ==================================================================
53
//
54
// Constructors.
55
//
56
// ==================================================================
57

58     /**
59      * The default constructor.
60      */

61     public
62     Idl2JavaTask()
63     {
64         // Init internal states
65
app_ = new Idl2JavaApplication();
66     }
67
68     // ==================================================================
69
//
70
// Internal methods.
71
//
72
// ==================================================================
73

74     // ==================================================================
75
//
76
// Public methods.
77
//
78
// ==================================================================
79

80     /**
81      * Set the file to parse.
82      *
83      * @param file - The file name.
84      */

85     public void
86     setFile(String JavaDoc file)
87     {
88         app_.setFile(file);
89     }
90
91     /**
92      * Set the destination directory.
93      *
94      * @param dir - The directory name.
95      */

96     public void
97     setDestdir(String JavaDoc dir)
98     {
99        app_.setDestdir(dir);
100     }
101
102     /**
103      * Set a directory list to add to the search path.
104      *
105      * @param dirs - A directory list.
106      */

107     public void
108     setIncludes(String JavaDoc dirs)
109     {
110         app_.setIncludes(dirs);
111     }
112
113     /**
114      * Create an inner element for Package Mapping.
115      */

116     public PackageMapping
117     createMapping()
118     {
119         return app_.createMapping();
120     }
121     
122     /**
123      * The method executing the task.
124      *
125      * @throws BuildException if an error occurs.
126      */

127     public void
128     execute()
129     throws BuildException
130     {
131         app_.setProjectProperties( getProject().getProperties() );
132         app_.run();
133     }
134 }
135
Popular Tags