KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > tool > codegen > Generator


1
2 /*
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  *
22  */

23 package org.enhydra.tool.codegen;
24
25 // ToolBox imports
26
import org.enhydra.tool.codegen.wizard.CodeGenPanel;
27
28 // Standard imports
29
import java.io.File JavaDoc;
30 import java.util.Properties JavaDoc;
31
32 /**
33  * Interface for defining generators. CodeGen can use any generator
34  * that implements this interface, is in the class path and has an
35  * entry in the codegen.properties file.
36  */

37 public interface Generator {
38
39     /**
40      * Set CodeGen customization properties. The CodeGen
41      * class calls this method after it instantiates a
42      * generator class.
43      *
44      * @param properties
45      * Properties passed from the CodeGen class.
46      */

47     abstract public void setProperties(Properties JavaDoc properties)
48             throws GeneratorException;
49
50     /**
51      * Get properties used to customize CodeGen. This may contain
52      * information on the template directory location and
53      * persisted generation options.
54      *
55      * @return
56      * Properties passed from the CodeGen class.
57      */

58     abstract public Properties JavaDoc getProperties();
59
60     /**
61      * Get short name used in command line. May also be used
62      * to locate template directory.
63      *
64      * @return
65      * Command line identifier.
66      */

67     abstract public String JavaDoc getCommandName();
68
69     /**
70      * Name to display in command line messages and in the wizard.
71      *
72      * @return
73      * Display name for generator.
74      */

75     abstract public String JavaDoc getDisplayName();
76
77     /**
78      * Name to display in command line messages and in the wizard.
79      *
80      * @return
81      * Display name for generator.
82      */

83     abstract public String JavaDoc getWizardTitle();
84
85
86     /**
87      * Get text that breifly explains the application that
88      * the generator creates.
89      *
90      *
91      * @return
92      * Descriptive text to display in a wizard or in a command
93      * line help response.
94      *
95      */

96     abstract public String JavaDoc getDescription();
97
98     /**
99      * Get an array of generator options that can
100      * be set through command line options or through
101      * wizard panels.
102      *
103      * @return
104      * An OptionSet that contains an array of GeneratorOptions.
105      *
106      */

107     abstract public OptionSet getOptionSet();
108
109     /**
110      * Get swing panels for setting generator options.
111      * The panels can be used within a standalone
112      * wizard or incorporated into the JBuilder wizard
113      * framework.
114      *
115      * @return
116      * An array of one or more JPanel based panels.
117      * Return null to specify that the wizard only
118      * supports a command line interface.
119      */

120     abstract public CodeGenPanel[] getWizardPanels()
121             throws GeneratorException;
122
123     /**
124      * Try the generating the application and return a list
125      *
126      * @param to
127      * The destination directory to generate source files into.
128      *
129      * @param overwrite
130      * If true, the generator will overwrite existing files without
131      * warning. Otherwise, any attempt to overwrite results in an
132      * exception.
133      *
134      * @return
135      * An array of the generated files.
136      *
137      * @throws GeneratorException
138      * Thrown if all the files could not be generated without error.
139      *
140      */

141     abstract public File JavaDoc[] generate() throws GeneratorException;
142
143
144     /**
145      * Get steps required to build the project with an IDE addin.
146      *
147      * @return
148      * An array of strings, each string will be inserted into
149      * a readme.html file as numbered step for building the
150      * project within an IDE.
151      */

152     abstract public String JavaDoc[] getAddinSteps();
153
154     /**
155      * Set the steps required to build the project from
156      * within an IDE.
157      *
158      * @param steps
159      * An array of strings, each string will be inserted into
160      * a readme.html file as numbered step for building the
161      * project within an IDE.
162      */

163     abstract public void setAddinSteps(String JavaDoc[] steps);
164
165     /**
166      * Get steps required to build the project from
167      * a unix shell.
168      *
169      * @return
170      * An array of strings, each string will be inserted into
171      * a readme.html file as numbered step for building the
172      * project using make files.
173      */

174     abstract public String JavaDoc[] getShellSteps();
175
176     /**
177      * Set the steps required to build the project from
178      * a unix shell.
179      *
180      * @param steps
181      * An array of strings, each string will be inserted into
182      * a readme.html file as numbered step for building the
183      * project from a unix shell.
184      */

185     abstract public void setShellSteps(String JavaDoc[] steps);
186
187     abstract public void setEcho(boolean b);
188     abstract boolean isEcho();
189     abstract public void setSwing(boolean b);
190     abstract boolean isSwing();
191
192 }
193
Popular Tags