KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > node > XMLNode


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.deployment.node;
25
26 import org.xml.sax.Attributes JavaDoc;
27 import org.w3c.dom.Node JavaDoc;
28 import com.sun.enterprise.deployment.Descriptor;
29
30 /**
31  * This interface defines the protocol associated with all the nodes. An
32  * XML node is responsible for reading the XML file into a object
33  * representation
34  *
35  * @author Jerome Dochez
36  * @version
37  */

38 public interface XMLNode {
39
40     /**
41      * notification of the start of an XML element tag in the processed
42      * XML source file.
43      *
44      * @param element the XML element type name
45      * @param attributes the specified or defaultted attritutes
46      */

47     public void startElement(XMLElement element, Attributes JavaDoc attributes);
48      
49     /**
50      * sets the value of an XML element
51      *
52      * @param element the XML element type name
53      * @param value the element value
54      */

55     public void setElementValue(XMLElement element, String JavaDoc value);
56     
57     /**
58      * notification of the end of an XML element in the source XML
59      * file.
60      *
61      * @param element the XML element type name
62      * @return true if this node is done with the processing of elements
63      * in the processing
64      */

65     public boolean endElement(XMLElement element);
66     
67     /**
68      * Return true if the XMLNode is responisble for handling the
69      * XML element
70      *
71      * @param element the XML element type name
72      * @return true if the node processes this element name
73      */

74     public boolean handlesElement(XMLElement element);
75     
76     /**
77      * Return the XMLNode implementation respionsible for
78      * handling the sub-element of the current node
79      *
80      * @param element the XML element type name
81      * @return XMLNode implementation responsible for handling
82      * the XML tag
83      */

84     public XMLNode getHandlerFor(XMLElement element);
85     
86     /**
87      * @return the parent node for this XMLNode
88      */

89     public XMLNode getParentNode();
90     
91     /**
92      * @return the XMLPath for the element name this node
93      * is handling. The XML path can be a absolute or a
94      * relative XMLPath.
95      */

96     public String JavaDoc getXMLPath();
97     
98     /**
99      * @return the Descriptor subclass that was populated by reading
100      * the source XML file
101      */

102     public Object JavaDoc getDescriptor();
103     
104     /**
105      * Add a new descriptor to the current descriptor associated with
106      * this node. This method is usually called by sub XMLNodes
107      * (Returned by getHandlerFor) to add the result of their parsing
108      * to the main descriptor.
109      *
110      * @param descriptor the new descriptor to be added to the current
111      * descriptor.
112      */

113     public void addDescriptor(Object JavaDoc descriptor);
114     
115     /**
116      * write the descriptor to an JAXP DOM node and return it
117      *
118      * @param parent node in the DOM tree
119      * @param descriptor the descriptor to be written
120      * @return the JAXP DOM node for this descriptor
121      */

122     public Node JavaDoc writeDescriptor(Node JavaDoc parent, Descriptor descriptor);
123     
124     /**
125      * notify of a new prefix mapping used from this node
126      */

127     public void addPrefixMapping(String JavaDoc prefix, String JavaDoc uri);
128     
129     /**
130      * Resolve a QName prefix to its corresponding Namespace URI by
131      * searching up node chain starting with the child.
132      */

133     public String JavaDoc resolvePrefix(XMLElement element, String JavaDoc prefix);
134 }
135
136
Popular Tags