Project

General

Profile

1 14 jones
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
2
<!--NewPage-->
3
<html>
4
<head>
5
<!-- Generated by javadoc on Fri Sep 24 03:23:03 CEST 1999 -->
6
<title>
7
  Class de.tudarmstadt.ito.xmldbms.DBMSToDOM
8
</title>
9
</head>
10
<body>
11
<a name="_top_"></a>
12
<pre>
13
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-de.tudarmstadt.ito.xmldbms.html">This Package</a>  <a href="de.tudarmstadt.ito.xmldbms.ColumnMap.html#_top_">Previous</a>  <a href="de.tudarmstadt.ito.xmldbms.DOMToDBMS.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
14
<hr>
15
<h1>
16
  Class de.tudarmstadt.ito.xmldbms.DBMSToDOM
17
</h1>
18
<pre>
19
java.lang.Object
20
   |
21
   +----de.tudarmstadt.ito.xmldbms.DBMSToDOM
22
</pre>
23
<hr>
24
<dl>
25
  <dt> public class <b>DBMSToDOM</b>
26
  <dt> extends Object
27
</dl>
28
Transfers data from the database to a DOM tree.
29
 <P>DBMSToDOM transfers data from the database to a DOM tree according
30
 to a particular Map. The caller must provide a DocumentFactory for the
31
 DOM implementation they are using (many are available in
32
 de.tudarmstadt.ito.domutils), a Map object, and information about how
33
 to retrieve the data. The latter can be one or more table names and key
34
 values, a DocumentInfo object, or a result set.</P>
35
 <P>For example, the following code transfers data for sales order number 123
36
 from the Sales table to a DOM tree using Oracle's DOM implementation:</P>
37
 <PRE>
38
    // Use a user-defined function to create a map.
39
    Map map = createMap("sales.map", conn);<BR />
40
    // Create a new DBMSToDOM object.
41
    DBMSToDOM dbmsToDOM = new DBMSToDOM(map, new DF_Oracle());<BR />
42
    // Create a key and retrieve the data.
43
    Object[] key = {new Integer(123)};
44
    Document doc = dbmsToDOM.retrieveDocument("Sales", key);
45
 </PRE>
46
 <P>Currently, no DOM implementations allow the namespace of an element or
47
 attribute to be set. Therefore, the caller can choose whether element and
48
 attribute names are prefixed according to the namespace prefixes in the
49
 Map. This is useful if the DOM tree will be serialized as an XML document.
50
 It might cause problems if the DOM tree is to be used directly, as the DOM
51
 implementation will not correctly return the base name, the namespace URI,
52
 or the qualified name. That is, it will return the prefixed name as the
53
 base name and qualified name and null as the namespace URI. By default,
54
 namespace prefixes are not used.</P>
55
<p>
56
<hr>
57
<a name="index"></a>
58
<h2>
59
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
60
</h2>
61
<dl>
62
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
63
	<a href="#DBMSToDOM()"><b>DBMSToDOM</b></a>()
64
  <dd> Construct a new DBMSToDOM object.
65
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
66
	<a href="#DBMSToDOM(de.tudarmstadt.ito.xmldbms.Map, de.tudarmstadt.ito.domutils.DocumentFactory)"><b>DBMSToDOM</b></a>(Map, DocumentFactory)
67
  <dd>  Construct a new DBMSToDOM object and set the Map and
68
 DocumentFactory objects.
69
</dl>
70
<h2>
71
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
72
</h2>
73
<dl>
74
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
75
	<a href="#getDocumentFactory()"><b>getDocumentFactory</b></a>()
76
  <dd>  Get the current DocumentFactory.
77
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
78
	<a href="#getMap()"><b>getMap</b></a>()
79
  <dd>  Get the current Map.
80
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
81
	<a href="#retrieveDocument(de.tudarmstadt.ito.xmldbms.DocumentInfo)"><b>retrieveDocument</b></a>(DocumentInfo)
82
  <dd>  Construct a DOM Document according to the information in a DocumentInfo
83
 object.
84
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
85
	<a href="#retrieveDocument(java.sql.ResultSet)"><b>retrieveDocument</b></a>(ResultSet)
86
  <dd>  Construct a DOM Document from a result set.
87
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
88
	<a href="#retrieveDocument(java.lang.String, java.lang.Object[])"><b>retrieveDocument</b></a>(String, Object[])
89
  <dd>  Construct a DOM Document from the specified table.
90
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
91
	<a href="#retrieveDocument(java.lang.String[], java.lang.Object[][])"><b>retrieveDocument</b></a>(String[], Object[][])
92
  <dd>  Construct a DOM Document from the specified tables.
93
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
94
	<a href="#setDocumentFactory(de.tudarmstadt.ito.domutils.DocumentFactory)"><b>setDocumentFactory</b></a>(DocumentFactory)
95
  <dd>  Set the current DocumentFactory.
96
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
97
	<a href="#setMap(de.tudarmstadt.ito.xmldbms.Map)"><b>setMap</b></a>(Map)
98
  <dd>  Set the current Map.
99
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
100
	<a href="#usePrefixes(boolean)"><b>usePrefixes</b></a>(boolean)
101
  <dd>  State whether element and attribute names should be prefixed according
102
 to the namespace prefixes in the Map.
103
</dl>
104
<a name="constructors"></a>
105
<h2>
106
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
107
</h2>
108
<a name="DBMSToDOM"></a>
109
<a name="DBMSToDOM()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
110
<b>DBMSToDOM</b>
111
<pre>
112
 public DBMSToDOM()
113
</pre>
114
<dl>
115
  <dd> Construct a new DBMSToDOM object.
116
<p>
117
</dl>
118
<a name="DBMSToDOM(de.tudarmstadt.ito.xmldbms.Map, de.tudarmstadt.ito.domutils.DocumentFactory)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
119
<b>DBMSToDOM</b>
120
<pre>
121
 public DBMSToDOM(<a href="de.tudarmstadt.ito.xmldbms.Map.html#_top_">Map</a> map,
122
                  <a href="de.tudarmstadt.ito.domutils.DocumentFactory.html#_top_">DocumentFactory</a> factory)
123
</pre>
124
<dl>
125
  <dd> Construct a new DBMSToDOM object and set the Map and
126
 DocumentFactory objects.
127
<p>
128
</dl>
129
<a name="methods"></a>
130
<h2>
131
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
132
</h2>
133
<a name="getMap()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
134
<a name="getMap"><b>getMap</b></a>
135
<pre>
136
 public <a href="de.tudarmstadt.ito.xmldbms.Map.html#_top_">Map</a> getMap()
137
</pre>
138
<dl>
139
  <dd> Get the current Map.
140
<p>
141
  <dd><dl>
142
    <dt> <b>Returns:</b>
143
    <dd> The current Map.
144
  </dl></dd>
145
</dl>
146
<a name="setMap(de.tudarmstadt.ito.xmldbms.Map)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
147
<a name="setMap"><b>setMap</b></a>
148
<pre>
149
 public void setMap(<a href="de.tudarmstadt.ito.xmldbms.Map.html#_top_">Map</a> map)
150
</pre>
151
<dl>
152
  <dd> Set the current Map.
153
<p>
154
  <dd><dl>
155
    <dt> <b>Parameters:</b>
156
    <dd> map - The current Map.
157
  </dl></dd>
158
</dl>
159
<a name="getDocumentFactory()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
160
<a name="getDocumentFactory"><b>getDocumentFactory</b></a>
161
<pre>
162
 public <a href="de.tudarmstadt.ito.domutils.DocumentFactory.html#_top_">DocumentFactory</a> getDocumentFactory()
163
</pre>
164
<dl>
165
  <dd> Get the current DocumentFactory.
166
<p>
167
  <dd><dl>
168
    <dt> <b>Returns:</b>
169
    <dd> The current DocumentFactory.
170
  </dl></dd>
171
</dl>
172
<a name="setDocumentFactory(de.tudarmstadt.ito.domutils.DocumentFactory)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
173
<a name="setDocumentFactory"><b>setDocumentFactory</b></a>
174
<pre>
175
 public void setDocumentFactory(<a href="de.tudarmstadt.ito.domutils.DocumentFactory.html#_top_">DocumentFactory</a> factory)
176
</pre>
177
<dl>
178
  <dd> Set the current DocumentFactory.
179
<p>
180
  <dd><dl>
181
    <dt> <b>Parameters:</b>
182
    <dd> factory - The current DocumentFactory.
183
  </dl></dd>
184
</dl>
185
<a name="usePrefixes(boolean)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
186
<a name="usePrefixes"><b>usePrefixes</b></a>
187
<pre>
188
 public void usePrefixes(boolean usePrefixes)
189
</pre>
190
<dl>
191
  <dd> State whether element and attribute names should be prefixed according
192
 to the namespace prefixes in the Map.
193
<p>
194
  <dd><dl>
195
    <dt> <b>Parameters:</b>
196
    <dd> usePrefixes - Whether to use prefixes.
197
  </dl></dd>
198
</dl>
199
<a name="retrieveDocument(java.sql.ResultSet)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
200
<a name="retrieveDocument"><b>retrieveDocument</b></a>
201
<pre>
202
 public Document retrieveDocument(ResultSet rs) throws <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>, SQLException, <a href="de.tudarmstadt.ito.domutils.DocumentFactoryException.html#_top_">DocumentFactoryException</a>
203
</pre>
204
<dl>
205
  <dd> Construct a DOM Document from a result set.
206
 <P>In the simplest case, this method simply constructs a DOM Document
207
 from the result set. Depending on the Map, data may be retrieved from
208
 subordinate tables as well. Note that the Map must map an element type
209
 to a table named "Result Set".</P>
210
 <P>If the result set contains more than one row, the Map must specify
211
 an ignored root type; otherwise, a DOMException is thrown.</P>
212
 <P>This method closes the result set.</P>
213
<p>
214
  <dd><dl>
215
    <dt> <b>Parameters:</b>
216
    <dd> rs - The result set.
217
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.domutils.DocumentFactoryException.html#_top_">DocumentFactoryException</a>
218
    <dd> Thrown if an error occurs creating an
219
  empty Document.
220
    <dt> <b>Throws:</b> DOMException
221
    <dd> Thrown if a DOM error occurs. One possible cause
222
  of this is that the result set contains more than one row and there was
223
  no ignored root element type.
224
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>
225
    <dd> Thrown if the Map is not set or more than
226
  one ignored root type is specified.
227
    <dt> <b>Throws:</b> SQLException
228
    <dd> Thrown if an error occurs retrieving data from the
229
  database.
230
  </dl></dd>
231
</dl>
232
<a name="retrieveDocument(java.lang.String[], java.lang.Object[][])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
233
<a name="retrieveDocument"><b>retrieveDocument</b></a>
234
<pre>
235
 public Document retrieveDocument(String tableNames[],
236
                                  Object keys[][]) throws <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>, SQLException, <a href="de.tudarmstadt.ito.domutils.DocumentFactoryException.html#_top_">DocumentFactoryException</a>
237
</pre>
238
<dl>
239
  <dd> Construct a DOM Document from the specified tables.
240
 <P>In the simplest case, this method simply constructs a DOM Document
241
 from the specified tables and rows. Depending on the Map, data may be
242
 retrieved from subordinate tables as well.</P>
243
 <P>If more than one row is retrieved from the specified tables, the
244
 Map must specify an ignored root type; otherwise, a DOMException is
245
 thrown.</P>
246
<p>
247
  <dd><dl>
248
    <dt> <b>Parameters:</b>
249
    <dd> tableNames - The names of the tables from which to retrieve data.
250
    <dd> keys - The keys used to retrieve data. There must be the same
251
  number of keys as tables.
252
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.domutils.DocumentFactoryException.html#_top_">DocumentFactoryException</a>
253
    <dd> Thrown if an error occurs creating an
254
  empty Document.
255
    <dt> <b>Throws:</b> DOMException
256
    <dd> Thrown if a DOM error occurs. One possible cause
257
  of this is that more than one row was retrieved from the specified tables
258
  and there was no ignored root element type.
259
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>
260
    <dd> Thrown if the Map is not set or more than
261
  one ignored root type is specified.
262
    <dt> <b>Throws:</b> SQLException
263
    <dd> Thrown if an error occurs retrieving data from the
264
  database.
265
  </dl></dd>
266
</dl>
267
<a name="retrieveDocument(java.lang.String, java.lang.Object[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
268
<a name="retrieveDocument"><b>retrieveDocument</b></a>
269
<pre>
270
 public Document retrieveDocument(String tableName,
271
                                  Object key[]) throws DOMException, <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>, SQLException, <a href="de.tudarmstadt.ito.domutils.DocumentFactoryException.html#_top_">DocumentFactoryException</a>
272
</pre>
273
<dl>
274
  <dd> Construct a DOM Document from the specified table.
275
 <P>In the simplest case, this method simply constructs a DOM Document
276
 from the row(s) in the specified table. Depending on the Map, data may
277
 be retrieved from subordinate tables as well.</P>
278
 <P>If more than one row is retrieved from the specified table, the Map
279
 must specify an ignored root type; otherwise, a DOMException is
280
 thrown.</P>
281
<p>
282
  <dd><dl>
283
    <dt> <b>Parameters:</b>
284
    <dd> tableName - The name of the table from which to retrieve data.
285
    <dd> key - The key used to retrieve data.
286
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.domutils.DocumentFactoryException.html#_top_">DocumentFactoryException</a>
287
    <dd> Thrown if an error occurs creating an
288
  empty Document.
289
    <dt> <b>Throws:</b> DOMException
290
    <dd> Thrown if a DOM error occurs. One possible cause
291
  of this is that more than one row retrieved from the specified table
292
  and there was no ignored root element type.
293
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>
294
    <dd> Thrown if the Map is not set or more than
295
  one ignored root type is specified.
296
    <dt> <b>Throws:</b> SQLException
297
    <dd> Thrown if an error occurs retrieving data from the
298
  database.
299
  </dl></dd>
300
</dl>
301
<a name="retrieveDocument(de.tudarmstadt.ito.xmldbms.DocumentInfo)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
302
<a name="retrieveDocument"><b>retrieveDocument</b></a>
303
<pre>
304
 public Document retrieveDocument(<a href="de.tudarmstadt.ito.xmldbms.DocumentInfo.html#_top_">DocumentInfo</a> docInfo) throws DOMException, <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>, SQLException, <a href="de.tudarmstadt.ito.domutils.DocumentFactoryException.html#_top_">DocumentFactoryException</a>
305
</pre>
306
<dl>
307
  <dd> Construct a DOM Document according to the information in a DocumentInfo
308
 object.
309
 <P>In the simplest case, this method simply constructs a DOM Document
310
 from the row(s) specified in the DocumentInfo object. Depending on the
311
 Map, data may be retrieved from subordinate tables as well.</P>
312
 <P>If more than one row is retrieved from the tables specified in the
313
 DocumentInfo object, the Map must specify an ignored root type;
314
 otherwise, a DOMException is thrown.</P>
315
<p>
316
  <dd><dl>
317
    <dt> <b>Parameters:</b>
318
    <dd> docInfo - The DocumentInfo specifying which rows to retrieve.
319
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.domutils.DocumentFactoryException.html#_top_">DocumentFactoryException</a>
320
    <dd> Thrown if an error occurs creating an
321
  empty Document.
322
    <dt> <b>Throws:</b> DOMException
323
    <dd> Thrown if a DOM error occurs. One possible cause
324
  of this is that more than one row retrieved from the specified tables
325
  and there was no ignored root element type.
326
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>
327
    <dd> Thrown if the Map is not set or more than
328
  one ignored root type is specified.
329
    <dt> <b>Throws:</b> SQLException
330
    <dd> Thrown if an error occurs retrieving data from the
331
  database.
332
  </dl></dd>
333
</dl>
334
<hr>
335
<pre>
336
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-de.tudarmstadt.ito.xmldbms.html">This Package</a>  <a href="de.tudarmstadt.ito.xmldbms.ColumnMap.html#_top_">Previous</a>  <a href="de.tudarmstadt.ito.xmldbms.DOMToDBMS.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
337
</body>
338
</html>