KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > xmlc > metadata > MetaData


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  * Contributor(s):
20  *
21  * $Id: MetaData.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
22  */

23
24 package org.enhydra.xml.xmlc.metadata;
25
26 import org.w3c.dom.Document JavaDoc;
27
28 /*
29  * Notes:
30  * Can't create section elements in constructor or we will get in
31  * a second when added by the parser. Instead, create them on the
32  * fly.
33  */

34
35
36 /**
37  * Root element of XMLC metadata. The child elements of this class represent
38  * the major sections of the XMLC metadata. Only one instance of a section
39  * element object can exist. All sections are created on first reference
40  * if they don't exist to make it easy to use them to get defaults.
41  */

42 public class MetaData extends MetaDataElement {
43     /**
44      * Element name.
45      */

46     public static final String JavaDoc TAG_NAME = "xmlc";
47
48     /**
49      * Constructor.
50      */

51     public MetaData(Document JavaDoc ownerDoc) {
52         super(ownerDoc, TAG_NAME);
53     }
54
55     /**
56      * Get the parser metadata or null if it doesn't exist.
57      */

58     public Parser getParser() {
59         return (Parser)getCreateChild(Parser.class);
60     }
61
62     /**
63      * Set the parser metadata, or delete by setting to null.
64      */

65     public void setParser(Parser parser) {
66         if (parser == null) {
67             deleteChild(Parser.class);
68         } else {
69             setChild(parser);
70         }
71     }
72
73     /**
74      * Get the document class metadata or null if it doesn't exist.
75      */

76     public DocumentClass getDocumentClass() {
77         return (DocumentClass)getCreateChild(DocumentClass.class);
78     }
79
80     /**
81      * Set the document class metdata, or delete by specifying null.
82      */

83     public void setDocumentClass(DocumentClass documentClass) {
84         if (documentClass == null) {
85             deleteChild(DocumentClass.class);
86         } else {
87             setChild(documentClass);
88         }
89     }
90
91     /**
92      * Get the HTML metadata or null if it doesn't exist.
93      */

94     public HTMLSection getHTMLSection() {
95         return (HTMLSection)getCreateChild(HTMLSection.class);
96     }
97
98     /**
99      * Set the HTML metadata, or delete by specifying null.
100      */

101     public void setHTMLSection(HTMLSection htmlMetaData) {
102         if (htmlMetaData == null) {
103             deleteChild(HTMLSection.class);
104         } else {
105             setChild(htmlMetaData);
106         }
107     }
108
109     /**
110      * Get the DOM edits metadata or null if it doesn't exist.
111      */

112     public DOMEdits getDOMEdits() {
113         return (DOMEdits)getCreateChild(DOMEdits.class);
114     }
115
116     /**
117      * Set the DOM edits metadata, or delete by specifying null.
118      */

119     public void setDOMEdits(DOMEdits domEditsMetaData) {
120         if (domEditsMetaData == null) {
121             deleteChild(DOMEdits.class);
122         } else {
123             setChild(domEditsMetaData);
124         }
125     }
126
127     /**
128      * Get the java compiler metadata or null if it doesn't exist.
129      */

130     public JavaCompilerSection getJavaCompilerSection() {
131         return (JavaCompilerSection)getCreateChild(JavaCompilerSection.class);
132     }
133
134     /**
135      * Set the java compiler metadata, or delete by specifying null.
136      */

137     public void setJavaCompiler(JavaCompilerSection compilerSection) {
138         if (compilerSection == null) {
139             deleteChild(JavaCompilerSection.class);
140         } else {
141             setChild(compilerSection);
142         }
143     }
144
145     /**
146      * Get the document metadata or null if it doesn't exist.
147      */

148     public DocumentSection getDocumentSection() {
149         return (DocumentSection)getCreateChild(DocumentSection.class);
150     }
151
152     /**
153      * Set the document metadata, or delete by specifying null.
154      */

155     public void setDocumentSection(DocumentSection documentMetaData) {
156         if (documentMetaData == null) {
157             deleteChild(DocumentSection.class);
158         } else {
159             setChild(documentMetaData);
160         }
161     }
162
163     /**
164      * Get the compile options or null if it doesn't exist.
165      */

166     public CompileOptions getCompileOptions() {
167         return (CompileOptions)getCreateChild(CompileOptions.class);
168     }
169
170     /**
171      * Set the compile options, or delete by specifying null.
172      */

173     public void setCompileOptions(CompileOptions compileOptions) {
174         if (compileOptions == null) {
175             deleteChild(CompileOptions.class);
176         } else {
177             setChild(compileOptions);
178         }
179     }
180
181     /**
182      * Get the input document or null if it doesn't exist.
183      */

184     public InputDocument getInputDocument() {
185         return (InputDocument)getCreateChild(InputDocument.class);
186     }
187
188     /**
189      * Set the input document, or delete by specifying null.
190      */

191     public void setInputDocument(InputDocument inputDocument) {
192         if (inputDocument == null) {
193             deleteChild(InputDocument.class);
194         } else {
195             setChild(inputDocument);
196         }
197     }
198
199     /**
200      * Merge another element into this element. Don't append clones of the
201      * children, merge them.
202      */

203     protected void mergeElement(MetaDataElement srcElement) {
204         mergeAttributes(srcElement);
205         mergeSingletonChild(Parser.class, srcElement);
206         mergeSingletonChild(DocumentClass.class, srcElement);
207         mergeSingletonChild(HTMLSection.class, srcElement);
208         mergeSingletonChild(DOMEdits.class, srcElement);
209         mergeSingletonChild(JavaCompilerSection.class, srcElement);
210         mergeSingletonChild(DocumentSection.class, srcElement);
211         mergeSingletonChild(CompileOptions.class, srcElement);
212         mergeSingletonChild(InputDocument.class, srcElement);
213     }
214 }
215
Popular Tags