KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > generator > Generator


1 /*
2  * Copyright 2003, 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15
16  */

17 package org.apache.ws.jaxme.generator;
18
19 import java.io.File JavaDoc;
20 import java.net.URL JavaDoc;
21
22 import org.apache.ws.jaxme.generator.sg.SchemaSG;
23 import org.xml.sax.EntityResolver JavaDoc;
24 import org.xml.sax.InputSource JavaDoc;
25
26 /** <p>The Generator is a frontend for working with the
27  * SchemaReaders, SourceWriters and whatever else.</p>
28  * <p>
29  * <strong>Usage:</strong> Generates java source definitions
30  * from various inputs:
31  * </p>
32  * <ul>
33  * <li>{@link #generate(java.net.URL)}</li>
34  * <li>{@link #generate(java.io.File)}</li>
35  * <li>{@link #generate(org.xml.sax.InputSource)}</li>
36  * </ul>
37  * <p>
38  * The inputs are interpreted into schema
39  * definitions by the {@link SchemaReader} set by calling
40  * {@link #setSchemaReader}.
41  * </p>
42  * <p>
43  * Other properties give fine grained
44  * control over various aspects of the file generation:
45  * </p>
46  * <ul>
47  * <li>{@link #setForcingOverwrite}</li>
48  * <li>{@link #setSettingReadOnly}</li>
49  * <li>{@link #setTargetDirectory}</li>
50  * </ul>
51  * <p>
52  * and the processing of the schema:
53  * </p>
54  * <ul>
55  * <li>{@link #setValidating}</li>
56  * </li>{@link #setEntityResolver})</li>
57  * </ul>
58  * </p>
59  * <p><em>Implementation note</em>: If you update this interface, you
60  * should consider updating the following files and classes as
61  * well:
62  * <ul>
63  * <li>{@link Main}</li>
64  * <li>{@link XJCTask}</li>
65  * <li>docs/Reference.html</li>
66  * </ul></p>
67  *
68  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
69  * @version $Id: Generator.java,v 1.5 2004/03/04 22:29:22 rdonkin Exp $
70  */

71 public interface Generator extends PropertySource {
72   /** <p>Sets the SchemaReader to use.</p>
73    */

74   public void setSchemaReader(SchemaReader pSchemaReader);
75
76   /** <p>Returns the SchemaReader being used.</p>
77    */

78   public SchemaReader getSchemaReader();
79
80   /** <p>Sets the directory where to create files.</p>
81    */

82   public void setTargetDirectory(File JavaDoc pDirectory);
83
84   /** <p>Returns the directory where to create files.</p>
85    */

86   public File JavaDoc getTargetDirectory();
87
88   /** <p>Sets whether the generator is using a validating XML
89    * schema parser. Defaults to false.</p>
90    */

91   public void setValidating(boolean pValidating);
92
93   /** <p>Returns whether the generator is using a validating XML
94    * schema parser. Defaults to false.</p>
95    */

96   public boolean isValidating();
97
98   /** <p>Returns whether the generator is forcing an overwrite of files.</p>
99    */

100   public boolean isForcingOverwrite();
101
102   /** <p>Sets whether the generator is forcing an overwrite of files.</p>
103    */

104   public void setForcingOverwrite(boolean pIsForcingOverwrite);
105
106   /** <p>Returns whether the generator will create files in read-only mode.</p>
107    */

108   public boolean isSettingReadOnly();
109
110   /** <p>Sets whether the generator will create files in read-only mode.</p>
111    */

112   public void setSettingReadOnly(boolean pIsSettingReadOnly);
113
114   /** <p>
115     * Generates java source from the given <code>File</code>.
116     * </p>
117     * @param pFile reads the schema (from which the source is to be generated)
118     * from the given file.
119     * @return <code>SchemaSG</code> describing the source generated
120     */

121   public SchemaSG generate(File JavaDoc pFile) throws Exception JavaDoc;
122
123   /** <p>
124     * Generates java source from the given <code>URL</code>.
125     * </p>
126     * @param pURL reads the schema (from which the source is to be generated)
127     * from the given URL.
128     * @return <code>SchemaSG</code> describing the source generated
129     */

130   public SchemaSG generate(URL JavaDoc pURL) throws Exception JavaDoc;
131
132   /** <p>
133     * Generates java source from the given <code>URL</code>.
134     * </p>
135     * @param pSource reads the schema (from which the source is to be generated)
136     * from the SAX Input Source. The System ID should be (if possible) set.
137     * @return <code>SchemaSG</code> describing the source generated
138     */

139   public SchemaSG generate(InputSource JavaDoc pSource) throws Exception JavaDoc;
140
141   /** <p>Returns a key for getting and setting custom data.</p>
142    */

143   public String JavaDoc getKey();
144
145   /** <p>Sets the {@link EntityResolver} being used to import external
146    * schemata.</p>
147    */

148   public void setEntityResolver(EntityResolver JavaDoc pEntityResolver);
149
150   /** <p>Returns the {@link EntityResolver} being used to import external
151    * schemata.</p>
152    */

153   public EntityResolver JavaDoc getEntityResolver();
154 }
155
Popular Tags