Project

General

Profile

1
<!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.Map
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.LinkInfo.html#_top_">Previous</a>  <a href="de.tudarmstadt.ito.xmldbms.OrderInfo.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
14
<hr>
15
<h1>
16
  Class de.tudarmstadt.ito.xmldbms.Map
17
</h1>
18
<pre>
19
java.lang.Object
20
   |
21
   +----<a href="de.tudarmstadt.ito.utils.XMLOutputStream.html#_top_">de.tudarmstadt.ito.utils.XMLOutputStream</a>
22
           |
23
           +----de.tudarmstadt.ito.xmldbms.Map
24
</pre>
25
<hr>
26
<dl>
27
  <dt> public class <b>Map</b>
28
  <dt> extends <a href="de.tudarmstadt.ito.utils.XMLOutputStream.html#_top_">XMLOutputStream</a>
29
</dl>
30
Describes how an XML document is mapped to a database and vice versa;
31
 <A HREF="../readme.html#NotForUse">for limited use</A>.
32
 <P>Map objects describe how XML documents are mapped to databases and
33
 vice versa. They are created by map factories, which can be found in
34
 de.tudarmstadt.ito.xmldbms.mapfactories. Map objects are opaque. That is,
35
 programmers create them with map factories and pass them to DOMToDBMS and
36
 DBMSToDOM objects, but never instantiate them directly or call methods on
37
 them.</P>
38
 <P>For example, the following code creates a map from the sales.map
39
 mapping document.</P>
40
 <PRE>
41
    // Instantiate a new map factory from a database connection
42
    // and SAX parser.
43
    factory = new MapFactory_MapDocument(conn, parser);<BR />
44
    // Create a Map from sales.map.
45
    map = factory.createMap(new InputSource(new FileReader("sales.map")));<BR />
46
    // Pass the Map to DOMToDBMS.
47
    DOMToDBMS = new DOMToDBMS(map);
48
 </PRE>
49
<p>
50
<hr>
51
<a name="index"></a>
52
<h2>
53
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
54
</h2>
55
<dl>
56
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
57
	<a href="#Map(de.tudarmstadt.ito.xmldbms.Table[], de.tudarmstadt.ito.xmldbms.TableMap[], java.util.Hashtable, java.util.Hashtable, java.util.Hashtable, java.lang.String[], java.lang.String[], boolean, boolean, java.text.DateFormat, java.text.DateFormat, java.text.DateFormat)"><b>Map</b></a>(Table[], TableMap[], Hashtable, Hashtable, Hashtable, String[], String[], boolean, boolean, DateFormat, DateFormat, DateFormat)
58
  <dd> Construct a new Map.
59
</dl>
60
<h2>
61
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
62
</h2>
63
<dl>
64
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
65
	<a href="#closeStatements()"><b>closeStatements</b></a>()
66
  <dd>  Close any open prepared statements.
67
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
68
	<a href="#finalize()"><b>finalize</b></a>()
69
  <dd> 
70
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
71
	<a href="#getCreateTableStrings()"><b>getCreateTableStrings</b></a>()
72
  <dd>  Return an array of CREATE TABLE statements.
73
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
74
	<a href="#initColumnMetadata(java.sql.ResultSet)"><b>initColumnMetadata</b></a>(ResultSet)
75
  <dd>  Initialize the column metadata for the current Connection.
76
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
77
	<a href="#serialize(java.io.OutputStream, boolean, int)"><b>serialize</b></a>(OutputStream, boolean, int)
78
  <dd>  Serialize a Map in the XML-DBMS mapping language to an OutputStream.
79
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
80
	<a href="#setConnection(java.sql.Connection)"><b>setConnection</b></a>(Connection)
81
  <dd>  Initialize the Map to use a particular Connection; usually called only
82
 by map factories.
83
</dl>
84
<a name="constructors"></a>
85
<h2>
86
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
87
</h2>
88
<a name="Map"></a>
89
<a name="Map(de.tudarmstadt.ito.xmldbms.Table[], de.tudarmstadt.ito.xmldbms.TableMap[], java.util.Hashtable, java.util.Hashtable, java.util.Hashtable, java.lang.String[], java.lang.String[], boolean, boolean, java.text.DateFormat, java.text.DateFormat, java.text.DateFormat)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
90
<b>Map</b>
91
<pre>
92
 public Map(<a href="de.tudarmstadt.ito.xmldbms.Table.html#_top_">Table</a> tables[],
93
            <a href="de.tudarmstadt.ito.xmldbms.TableMap.html#_top_">TableMap</a> tableMaps[],
94
            Hashtable rootTableMaps,
95
            Hashtable classMaps,
96
            Hashtable rootClassMaps,
97
            String prefixes[],
98
            String uris[],
99
            boolean generateKeys,
100
            boolean emptyStringIsNull,
101
            DateFormat dateFormatter,
102
            DateFormat timeFormatter,
103
            DateFormat timestampFormatter)
104
</pre>
105
<dl>
106
  <dd> Construct a new Map.
107
<p>
108
</dl>
109
<a name="methods"></a>
110
<h2>
111
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
112
</h2>
113
<a name="setConnection(java.sql.Connection)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
114
<a name="setConnection"><b>setConnection</b></a>
115
<pre>
116
 public void setConnection(Connection conn) throws SQLException
117
</pre>
118
<dl>
119
  <dd> Initialize the Map to use a particular Connection; usually called only
120
 by map factories.
121
 <p>This method sets the Connection used by the Map and retrieves
122
 various database metadata used both when transferring data and when
123
 when constructing SQL statements. Until this method is called, the
124
 Map cannot be used to transfer data or get CREATE TABLE strings. It
125
 is legal to call the serialize() method before this method is called.</p>
126
 <p>Generally, this method is called only by map factories that
127
 connect to the database, such as MapFactory_MapDocument. It can be
128
 called by applications, such as to use the same Map with different
129
 database, but such use is likely to be rare. If an application calls
130
 this method, they usually call initTableMetadata() directly afterwards
131
 to initialize the Map according the the table and column metadata of
132
 the new connection.</p>
133
<p>
134
  <dd><dl>
135
    <dt> <b>Throws:</b> SQLException
136
    <dd> Thrown if a problem occurs while retrieving
137
  the database metadata.
138
  </dl></dd>
139
</dl>
140
<a name="initColumnMetadata(java.sql.ResultSet)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
141
<a name="initColumnMetadata"><b>initColumnMetadata</b></a>
142
<pre>
143
 public void initColumnMetadata(ResultSet mappedResultSet) throws SQLException, <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>
144
</pre>
145
<dl>
146
  <dd> Initialize the column metadata for the current Connection.
147
 <p>This method initializes the column metadata for the
148
 current Connection. This metadata is used both when transferring
149
 data and when when constructing SQL statements. Until the metadata
150
 is set, either directly or by calling this method, the Map cannot
151
 be used to transfer data or get CREATE TABLE strings.</p>
152
 <p>Generally, this method is called only by map factories that
153
 connect to the database, such as MapFactory_MapDocument. It is not
154
 called by map factories that generate their own column metadata,
155
 such as MapFactory_DTD, which predicts data types and lengths.</p>
156
<p>
157
  <dd><dl>
158
    <dt> <b>Parameters:</b>
159
    <dd> mappedResultSet - The result set from which to retrieve metadata
160
  if the Map maps an element type to a table named "Result Set".
161
  Ignored (and may be null) if no such table is named.
162
    <dt> <b>Throws:</b> SQLException
163
    <dd> Thrown if a problem occurs while retrieving
164
  the metadata.
165
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>
166
    <dd> Thrown if a column is not found.
167
    <dt> <b>See Also:</b>
168
    <dd> <a href="de.tudarmstadt.ito.xmldbms.DBMSToDOM.html#retrieveDocument(ResultSet)">retrieveDocument</a>
169
  </dl></dd>
170
</dl>
171
<a name="serialize(java.io.OutputStream, boolean, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
172
<a name="serialize"><b>serialize</b></a>
173
<pre>
174
 public void serialize(OutputStream out,
175
                       boolean pretty,
176
                       int indent) throws IOException
177
</pre>
178
<dl>
179
  <dd> Serialize a Map in the XML-DBMS mapping language to an OutputStream.
180
 <p>Note that serialize cannot currently create the Locale element
181
 or the values FULL, LONG, MEDIUM, or SHORT in the Date, Time, and
182
 Timestamp attributes of the Patterns element.</p>
183
<p>
184
  <dd><dl>
185
    <dt> <b>Parameters:</b>
186
    <dd> out - The OutputStream.
187
    <dt> <b>Throws:</b> IOException
188
    <dd> Thrown if an I/O exception occurs.
189
  </dl></dd>
190
</dl>
191
<a name="closeStatements()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
192
<a name="closeStatements"><b>closeStatements</b></a>
193
<pre>
194
 public void closeStatements() throws SQLException
195
</pre>
196
<dl>
197
  <dd> Close any open prepared statements.
198
 <p>By default, Maps maintain INSERT and DELETE statements in a
199
 prepared state for later use, such as when the same Map is used
200
 to transfer data from multiple documents. The statements are
201
 closed only when the application calls this method, the Map
202
 object is deleted (such as by the garbage collector), or the database
203
 closes them when committing a transaction.</p>
204
 <p>Applications can use this method to close statements and
205
 release JDBC and database resources earlier than when it might
206
 be done by the garbage collector. Because this method does not
207
 close the Connection, the Map can be reused, although it must
208
 reprepare statements as needed.<p>
209
 For example, consider an application that maintains a pool of
210
 Maps, one for each type of XML document for which it transfers
211
 data. If each Map is used infrequently, the application might
212
 choose to free database resources by calling closeStatements()
213
 after each use of a given Map. Although the Map must reprepare
214
 statements each time it is used, this might result in better
215
 overall performance.</p>
216
 <p>closeStatement() is called by Map.finalize().</p>
217
<p>
218
  <dd><dl>
219
    <dt> <b>Throws:</b> SQLException
220
    <dd> Thrown if a problem occurs while closing
221
 statements.
222
  </dl></dd>
223
</dl>
224
<a name="getCreateTableStrings()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
225
<a name="getCreateTableStrings"><b>getCreateTableStrings</b></a>
226
<pre>
227
 public String[] getCreateTableStrings() throws <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>, SQLException
228
</pre>
229
<dl>
230
  <dd> Return an array of CREATE TABLE statements.
231
 <p>This method returns an array of CREATE TABLE statements in the
232
 form of strings. Generally, the calling application will edit these
233
 strings before using them.</p>
234
 <p>WARNING! These strings currently use hard-coded data type names;
235
 in the future, this method should retrieve data type names from the
236
 database.</p>
237
<p>
238
  <dd><dl>
239
    <dt> <b>Returns:</b>
240
    <dd> The array of CREATE TABLE statements.
241
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.InvalidMapException.html#_top_">InvalidMapException</a>
242
    <dd> The Map contained an invalid data type.
243
    <dt> <b>Throws:</b> SQLException
244
    <dd> An error occurred retrieving metadata from the
245
  database.
246
  </dl></dd>
247
</dl>
248
<a name="finalize()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
249
<a name="finalize"><b>finalize</b></a>
250
<pre>
251
 protected void finalize() throws Throwable
252
</pre>
253
<dl>
254
  <dd><dl>
255
    <dt> <b>Overrides:</b>
256
    <dd> <a href="java.lang.Object.html#finalize()">finalize</a> in class Object
257
  </dl></dd>
258
</dl>
259
<hr>
260
<pre>
261
<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.LinkInfo.html#_top_">Previous</a>  <a href="de.tudarmstadt.ito.xmldbms.OrderInfo.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
262
</body>
263
</html>
(59-59/72)