KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > generator > common > api > Generator


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): Sylvain Leblanc.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.generator.common.api;
28
29 /**
30  * This interface is a Velocity Wrapper (http://jakarta.apache.org/Velocity).
31  **/

32 public interface Generator
33 {
34     /**
35      * Sets the file ressource loader path.
36      *
37      * @param path - The path from where files will be loaded.
38      **/

39     public void
40     setRessourcePath(java.util.List JavaDoc v);
41
42     /**
43      * Sets the name of the local Velocimacro library template.
44      *
45      * @param name - The local Velocimacro library template path.
46      **/

47     public void
48     setLibrary(java.util.List JavaDoc v);
49
50     /**
51      * Sets the current context.
52      *
53      * @param context - The context to be set.
54      **/

55     public void
56     setContext(org.apache.velocity.context.Context context);
57
58     /**
59      * Disable the log system.
60      **/

61     public void
62     disableLog();
63     
64     /**
65      * Initialize the generator.
66      **/

67     public void
68     init();
69
70     /**
71      * Open a new generation stream.
72      *
73      * @param filename - The name of the file into generation will be done.
74      * @param id - An identifiant for this stream.
75      */

76     public void
77     open(String JavaDoc filename, String JavaDoc id);
78
79     /**
80      * Close a generation stream and
81      * eventually indent the generated file.
82      *
83      * @param id - The identifiant of the file to close.
84      * @param indent - True if the file must be indented, else false.
85      */

86     public void
87     close(String JavaDoc id, boolean indent);
88
89     /**
90      * Close a generation stream and indent the generated file.
91      *
92      * @param id - The identifiant of the file to close.
93      */

94     public void
95     close(String JavaDoc id);
96
97     /**
98      * Switch generation output to file with identifiant id.
99      *
100      * @param id - The identifiant of the file to close.
101      */

102     public void
103     switchToFile(String JavaDoc id);
104
105     /**
106      * Gets a value from the context.
107      *
108      * @param key - The name to key the provided value with.
109      *
110      * @return The associated value.
111      **/

112     public Object JavaDoc
113     get(String JavaDoc key);
114
115     /**
116      * Adds a name/value pair to the context.
117      *
118      * @param key - The name to key the provided value with.
119      * name - The corresponding value.
120      **/

121     public void
122     put(String JavaDoc key, Object JavaDoc value);
123
124     /**
125      * Removes the value associated with the specified key from the context.
126      *
127      * @param key - The name of the value to remove.
128      **/

129     public void
130     remove(Object JavaDoc key);
131
132     /**
133      * Uses velocity to map a template file.
134      *
135      * @param template_name - The name of the template file.
136      **/

137     public void
138     map_file(String JavaDoc template_name);
139
140     /**
141      * Uses velocity to map a template file.
142      *
143      * @param template_name - The name of the template file.
144      * @param id - The identifiant of the output file.
145      **/

146     public void
147     map_file(String JavaDoc template_name, String JavaDoc id);
148
149     /**
150      * Uses velocity to map a currently registered Velocimacro.
151      *
152      * @param macro_name - The name of the macro to invoke (map)
153      **/

154     public void
155     map(String JavaDoc macro_name);
156
157     /**
158      * Uses velocity to map a currently registered Velocimacro.
159      *
160      * @param macro_name - The name of the macro to invoke (map)
161      * @param context - The context used to map the macro.
162      **/

163     public void
164     map(String JavaDoc macro_name, org.apache.velocity.context.Context context);
165     
166     /**
167      * Uses velocity to map a currently registered Velocimacro.
168      *
169      * @param macro_name - The name of the macro to invoke (map)
170      * @param id - The identifiant of the output file.
171      **/

172     public void
173     map(String JavaDoc macro_name, String JavaDoc id);
174
175     /**
176      * Print immediatly the text in the output stream.
177      *
178      * @param text - The text to be written.
179      **/

180     public void
181     print(String JavaDoc text);
182
183     /**
184      * Print immediatly the text in the output stream.
185      *
186      * @param text - The text to be written.
187      * @param id - The identifiant of the output file.
188      **/

189     public void
190     print(String JavaDoc text, String JavaDoc id);
191
192     /**
193      * Return a string if nb spaces.
194      *
195      * @param nb - The number of spaces to print.
196      *
197      * @return A string containing nb spaces.
198      **/

199     public String JavaDoc
200     print_spaces(int nb);
201 }
202
Popular Tags