KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > mapping > StorageContext


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.mapping;
24
25 import java.sql.Connection JavaDoc;
26
27
28 /** Provide access to storage system variables.
29  *
30  * <p>This interface is passed to generator, notably user generators.</p>
31  * @see UserGenerator
32  */

33 public interface StorageContext
34 {
35     /** Return the rank (within its siblings) of the current node being stored.
36      * @return a numeric OID
37      */

38     int getNodeRank();
39     
40     /** Return the character data attached to the current node if any.
41      * @return a String containing concatenation of all character data attached to the
42      * current node. Null if node has no value.
43      */

44     String JavaDoc getNodeData();
45     
46     /** Return the character data attached to the current node if any, normalized
47      * according the XML Schema recommendation.
48      * @return a String containing concatenation of all character data attached to the
49      * current node. Null if node has no value.
50      */

51     String JavaDoc getNormalizedNodeData();
52     
53     /** Return the XML Schema actual value attached to the current node if any,
54      * converted to a java object.
55      * @return a java object corresponding to the XML Schema actual value of the node.
56      * Null if node has no value. The type of the object is either a standard Java object or
57      * a specific one defined by the XQuark XML specification in the org.xquark.schema.datatypes
58      * package. The mapping used is the following :
59      * <table>
60      * <tr><th>XML schema base built-in primitive type</th><th>Java class</th></tr>
61      * <tr><td>string</td><td>{@link String}</td></tr>
62      * <tr><td>boolean</td><td>{@link Boolean}</td></tr>
63      * <tr><td>decimal</td><td>{@link java.math.BigDecimal} or {@link Long} if type facet ensure it fits.</td></tr>
64      * <tr><td>float</td><td>{@link Float}</td></tr>
65      * <tr><td>double</td><td>{@link Double}</td></tr>
66      * <tr><td>QName</td><td>{@link org.xquark.schema.datatypes.QName}</td></tr>
67      * <tr><td>NOTATION</td><td>{@link org.xquark.schema.datatypes.QName}</td></tr>
68      * <tr><td>duration</td><td>{@link org.xquark.schema.datatypes.Duration}</td></tr>
69      * <tr><td>dateTime</td><td>{@link org.xquark.schema.datatypes.DateTime}</td></tr>
70      * <tr><td>time</td><td>{@link org.xquark.schema.datatypes.DateTime}</td></tr>
71      * <tr><td>date</td><td>{@link org.xquark.schema.datatypes.DateTime}</td></tr>
72      * <tr><td>gYearMonth</td><td>{@link org.xquark.schema.datatypes.DateTime}</td></tr>
73      * <tr><td>gYear</td><td>{@link org.xquark.schema.datatypes.DateTime}</td></tr>
74      * <tr><td>gMonthDay</td><td>{@link org.xquark.schema.datatypes.DateTime}</td></tr>
75      * <tr><td>gDay</td><td>{@link org.xquark.schema.datatypes.DateTime}</td></tr>
76      * <tr><td>gMonth</td><td>{@link org.xquark.schema.datatypes.DateTime}</td></tr>
77      * <tr><td>hexBinary</td><td>{@link org.xquark.schema.datatypes.ByteArray}</td></tr>
78      * <tr><td>base64Binary</td><td>{@link org.xquark.schema.datatypes.ByteArray}</td></tr>
79      * <tr><td>anyURI</td><td>{@link org.xquark.schema.datatypes.URI}</td></tr>
80      * <tr><td>union</td><td>not supported</td></tr>
81      * <tr><td>list</td><td>{@link java.util.List}</td></tr>
82      * <tr><td>anySimpleType</td><td>{@link String}</td></tr>
83      * </table>
84      */

85     Object JavaDoc getActualNodeData();
86     
87     /** Return the Full Qualified Name of the node being stored.
88      * @return a string of the form prefix:name if the node being stored is an element or an
89      * attribute. Null, otherwise.
90      */

91     String JavaDoc getQName();
92     
93     /** Return the local name of the node being stored.
94      * @return a String if the node being stored is an element or an attribute. Null, otherwise.
95      */

96     String JavaDoc getLocalName();
97     
98     /** Return the namespace URI of the node being stored.
99      * @return a String if the node being stored is an element or an attribute. Null, otherwise.
100      */

101     String JavaDoc getNamespaceURI();
102     
103     /** Return the character data stored in a tuple waiting to be stored.
104      * @param tableIndex index of the table mapping corresponding to tuple
105      * containing data.
106      * @param columnIndex index of the column in the table mapping used to
107      * identify the data.
108      * @return an Object.
109      */

110     Object JavaDoc getRefValue(int tableIndex, int columnIndex);
111     
112     /** Return the JDBC Connection used by the storage module.
113      * <p>This connection may be used, for example, to fetch information from the
114      * relational database in order to generate a column value.</p>
115      * @return a JDBC connection.
116      */

117     Connection JavaDoc getConnection();
118     
119     /** get the document ID set by the user or internally generated.
120      * <p><B>This method is only implemented by the Repository.</B></p>
121      * @return the document ID. null for the Bridge.
122      */

123     String JavaDoc getDocumentID();
124     
125     /** get the numeric ID allocated for the document.
126      * <p><B>This method is only implemented by the Repository.</B></p>
127      * @return the document ID. -1 for the Bridge.
128      */

129     long getDocumentOID();
130
131     /** Return the local (to a storage operation) OID (Object IDentifier) of the current
132      * node being stored.
133      * <p><B>This method is only implemented by the Repository.</B></p>
134      * @return a numeric OID. -1 for the Bridge.
135      */

136     long getOID();
137     
138     /** Return the universal OID (Object IDentifier) of the current node being stored.
139      * This ID is global to the XML Repository.
140      * <p><B>This method is only implemented by the Repository.</B></p>
141      * @return a numeric OID. -1 for the Bridge.
142      */

143     long getUOID();
144     
145     /** Return the path OID (Object IDentifier) of the current node being stored.
146      * <p><B>This method is only implemented by the Repository.</B></p>
147      * @return a numeric OID. -1 for the Bridge.
148      */

149     short getPathOID();
150 }
151
Popular Tags