KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > zeus > Binding


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

19 package org.enhydra.zeus;
20
21 /**
22  * <p>
23  * <code>Binding</code> represents an arbitrary Java construct,
24  * and provides a representation-independent means of showing
25  * how a constraint (presumably from an XML Schema, DTD, Relax
26  * schema, etc.) maps to Java. It provides a layer of representation
27  * between the constraint representation and generated Java.
28  * </p><p>
29  * It also allows for uniformity in mapping. For example, the DTD
30  * <code>ELEMENT</code> and XML Schema <code>element</code>
31  * constructs, while different, should both be mapped to the
32  * same implementation of a <code>Binding</code> in Zeus. In this
33  * way, constraints that represent semantically equivalent
34  * constructs result in identical sets of bindings.
35  * </p>
36  *
37  * @see org.enhydra.zeus.binder.DTDBinder
38  * @see org.enhydra.zeus.binder.SchemaBinder
39  *
40  * @author Brett McLaughlin
41  */

42 public interface Binding {
43
44     /**
45      * <p>
46      * This will return the XML name of the binding. This should
47      * be the actual XML name of the binding as would be seen in an XML
48      * document.
49      * </p>
50      *
51      * @return <code>String</code> - the XML name of the binding.
52      */

53     public String JavaDoc getXMLName();
54     
55     /**
56      * <p>
57      * This will set the XML name of the binding.
58      * </p>
59      *
60      * @param xmlName the XML name of the binding.
61      */

62     public void setXMLName(String JavaDoc xmlName);
63     
64     /**
65      * <p>
66      * The will return the XML namespace URI associated with the XML name of
67      * this binding. A value of the empty string indicates that there is no
68      * URI associated with the XML name of this binding.
69      * </p>
70      *
71      * @return <code>String</code> - the XML namespace URI associated with the
72      * XML name of this binding, or an empty string if no namespace URI.
73      */

74     public String JavaDoc getXMLNamespaceURI();
75
76     /**
77      * <p>
78      * The will set the XML namespace URI associated with the XML name of
79      * this binding. A value of the empty string indicates that there is no
80      * URI associated with the XML name of this binding.
81      * </p>
82      *
83      * @param xmlNameURI the XML namespace URI
84      */

85     public void setXMLNamespaceURI(String JavaDoc xmlNameURI);
86     
87     /**
88      * <p>
89      * This will return the XML local name associated with the XML type of this
90      * binding. When using a DTD, the XML type is the same as the XML name.
91      * However, when using an XML Schema, the type may be different from the
92      * name.
93      * </p>
94      *
95      * @return <code>String</code> - the XML local name of the XML type of this
96      * binding.
97      */

98     public String JavaDoc getXMLType();
99
100     /**
101      * <p>
102      * This will set the XML local name associated with the XML type of this
103      * binding.
104      * </p>
105      *
106      * @param xmlType the XML type.
107      */

108     public void setXMLType(String JavaDoc xmlType);
109     
110     /**
111      * <p>
112      * The will return the XML namespace URI associated with the XML type of
113      * this binding. A value of the empty string indicates that there is no
114      * URI associated with the XML type of this binding.
115      * </p><p>
116      * While this is not
117      * useful in DTD binding, it allows types like <code>xsd:string</code> to
118      * be distinguished from something like <code>myPrefix:string</code>,
119      * which a user might define.
120      * </p>
121      *
122      * @return <code>String</code> - the XML namespace URI associated with the
123      * XML type of this binding.
124      */

125     public String JavaDoc getXMLTypeNamespaceURI();
126
127     /**
128      * <p>
129      * This will set the XML namespace URI associated with the XML type of
130      * this binding. A value of the empty string indicates that there is no
131      * URI associated with the XML type of this binding.
132      * </p>
133      *
134      * @param xmlTypeNamespaceURI the XML namespace URI.
135      */

136     public void setXMLTypeNamespaceURI(String JavaDoc xmlTypeNamespaceURI);
137     
138     /**
139      * <p>
140      * This will return the XML local name associated with the XML type of this
141      * binding's XML parent. When using a DTD, the XML type is the same as
142      * the XML name. However, when using an XML Schema, the type may be
143      * different from the name.
144      * </p><p>
145      * If there is no parent XML type, such as for the root element of a
146      * document, this value is <code>null</code>.
147      *
148      * @return <code>String</code> - the XML local name of the XML type of this
149      * binding's parent.
150      */

151     public String JavaDoc getXMLParentType();
152
153     /**
154      * <p>
155      * This will set the XML local name associated with the XML type of this
156      * binding's XML parent.
157      * </p>
158      *
159      * @param xmlParentType the XML type for this binding's parent.
160      */

161     public void setXMLParentType(String JavaDoc xmlParentType);
162     
163     /**
164      * <p>
165      * The will return the XML namespace URI associated with the XML type of
166      * this binding's XML parent. A value of the empty string indicates that
167      * there is no URI associated with the XML type of this binding's parent.
168      * </p><p>
169      * While this is not
170      * useful in DTD binding, it allows types like <code>xsd:string</code> to
171      * be distinguished from something like <code>myPrefix:string</code>,
172      * which a user might define.
173      * </p>
174      *
175      * @return <code>String</code> - the XML namespace URI associated with the
176      * XML type of this binding's parent.
177      */

178     public String JavaDoc getXMLParentTypeNamespaceURI();
179
180     /**
181      * <p>
182      * This will set the XML namespace URI associated with the XML type of
183      * this binding's XML parent. A value of the empty string indicates that
184      * there is no URI associated with the XML type of this binding's parent.
185      * </p>
186      *
187      * @param xmlParentTypeNamespaceURI the XML namespace URI of the
188      * parent type.
189      */

190     public void setXMLParentTypeNamespaceURI(String JavaDoc xmlParentTypeNamespaceURI);
191     
192     /**
193      * <p>
194      * This sets whether this binding represents an XML element that is
195      * the root element of the document.
196      * </p>
197      *
198      * @param isXMLRootElement whether this is the root element.
199      */

200     public void setIsXMLRootElement(boolean isXMLRootElement);
201     
202     /**
203      * <p>
204      * This indicates if this binding represents an XML element that is the
205      * root element of the document.
206      * </p>
207      *
208      * @return <code>boolean</code> - whether this is the root element.
209      */

210     public boolean isXMLRootElement();
211
212     /**
213      * <p>
214      * This will return the Java name of the binding. This should
215      * be the valid Java name of the binding, which is most
216      * often a variable name. This is the string used to build the methods
217      * <code>setXXX()</code> and <code>getXXX()</code>. Note that this is
218      * not necessarily the variable name used by the generators, but they
219      * will provide the <code>setXXX()</code> and <code>getXXX()</code>
220      * based on this name.
221      * </p>
222      *
223      * @return <code>String</code> - the Java name of the binding.
224      */

225     public String JavaDoc getJavaName();
226
227     /**
228      * <p>
229      * The will set the name of the Java variable associated with this binding.
230      * </p>
231      *
232      * @param javaName the new variable name.
233      */

234     public void setJavaName(String JavaDoc javaName);
235
236     /**
237      * <p>
238      * This will return the Java name that can be used for a variable name in
239      * generated code. It is guaranteed to be a legal Java identifier.
240      * </p><p>
241      * To illustrate the difference between the Java name and its variable
242      * name, consider this simple example:
243      * <pre><code>
244      * <!ELEMENT default EMPTY>
245      * </code></pre>
246      * With the above DTD the XML name is "default". However, "default"
247      * is a Java keyword, but <code>setDefault()</code> and
248      * <code>getDefault()</code> are not illegal. So for a typical name
249      * binding, the Java name would be "default" and the variable name
250      * would (could) be "safeDefault". The generated interface would still
251      * contain <code>setDefault()</code> and <code>getDefault()</code>.
252      * </p><p>
253      * Note that it is not necessary for the variable name to always (or even
254      * often) be different from the normal Java name.
255      * </p>
256      *
257      * @return <code>String</code> - the Java variable name.
258      */

259     public String JavaDoc getJavaVariableName();
260
261     /**
262      * <p>
263      * This will set the Java name that can be used for a variable name in
264      * generated code. This must be a legal Java identifier, and the first
265      * character must not be an upper case letter.
266      * </p>
267      *
268      * @param javaVariableName the name to use for the Java member variable.
269      */

270     public void setJavaVariableName(String JavaDoc javaVariableName);
271
272     /**
273      * <p>
274      * This will return the Java package name for this binding's interface
275      * class.
276      * </p>
277      *
278      * @return <code>String</code> - the Java interface package associated with
279      * the binding's Java type.
280      */

281     public String JavaDoc getJavaInterfacePackage();
282
283     /**
284      * <p>
285      * This will set the Java package for this class's interface.
286      * </p>
287      *
288      * @param javaInterfacePackage the name of the interface package for this
289      * binding.
290      */

291     public void setJavaInterfacePackage(String JavaDoc javaInterfacePackage);
292     
293     /**
294      * <p>
295      * This will return the Java package name for this binding's implementation
296      * class.
297      * </p>
298      *
299      * @return <code>String</code> - the Java implementation package associated
300      * with the binding's Java type.
301      */

302     public String JavaDoc getJavaImplementationPackage();
303
304     /**
305      * <p>
306      * This will set the Java package for this class's implementation.
307      * </p>
308      *
309      * @param javaImplementationPackage the name of the implementation package
310      * for this binding.
311      */

312     public void setJavaImplementationPackage(String JavaDoc javaImplementationPackage);
313
314     /**
315      * <p>
316      * This will return the Java type associated with the
317      * binding. This is not a fully qualified name for the type. To get the
318      * fully qualified name for the type prepend the value returned from
319      * getJavaPackage() to the value returned by this method (with a "."
320      * inserted in between if the package is not the empty string).
321      * </p>
322      *
323      * @return <code>String</code> - the Java type of the binding.
324      */

325     public String JavaDoc getJavaType();
326     
327     /**
328      * <p>
329      * This will set the Java type for this binding.
330      * </p>
331      *
332      * @param javaType the Java type for this binding.
333      */

334     public void setJavaType(String JavaDoc javaType);
335     
336     /**
337      * <p>
338      * This will set the Java collection class to use for this binding,
339      * if it is a collection. This will be a fully-qualified Java class,
340      * such as <code>java.util.List</code>.
341      * </p>
342      *
343      * @param javaCollectionClass the collection class for this binding.
344      * @throws <code>InvalidCollectionTypeException</code> - when the supplied
345      * collection class is not a valid collection type.
346      */

347     public void setJavaCollectionClass(String JavaDoc javaCollectionClass)
348         throws InvalidCollectionTypeException;
349     
350     /**
351      * <p>
352      * This will return the Java collection class to use for this binding,
353      * if it is a collection. This will be a fully qualified Java class,
354      * such as <code>java.util.List</code>.
355      * </p>
356      *
357      * @return <code>String</code> - the Java collection class for this binding.
358      */

359     public String JavaDoc getJavaCollectionClass();
360     
361     /**
362      * <p>
363      * This will set whether this binding should be a Java-serializable class.
364      * </p>
365      *
366      * @param isJavaSerializable whether this binding should be Java
367      * serializable (true) or not (false).
368      */

369     public void setIsJavaSerializable(boolean isJavaSerializable);
370     
371     /**
372      * <p>
373      * This will indicate whether this binding is Java-serializable (indicated
374      * by a <code>boolean</code> value of "true"), or not (indicated by a
375      * <code>boolean</code> value of "false").
376      * </p>
377      *
378      * @return <code>boolean</code> - whether this binding is Java-serializable.
379      */

380     public boolean isJavaSerializable();
381 }
382
383
Popular Tags