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.helpers.KeyGeneratorImpl
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.helpers.html">This Package</a>  <a href="Package-de.tudarmstadt.ito.xmldbms.helpers.html">Previous</a>  <a href="Package-de.tudarmstadt.ito.xmldbms.helpers.html">Next</a>  <a href="AllNames.html">Index</a></pre>
14
<hr>
15
<h1>
16
  Class de.tudarmstadt.ito.xmldbms.helpers.KeyGeneratorImpl
17
</h1>
18
<pre>
19
java.lang.Object
20
   |
21
   +----de.tudarmstadt.ito.xmldbms.helpers.KeyGeneratorImpl
22
</pre>
23
<hr>
24
<dl>
25
  <dt> public class <b>KeyGeneratorImpl</b>
26
  <dt> extends Object
27
  <dt> implements <a href="de.tudarmstadt.ito.xmldbms.KeyGenerator.html#_top_">KeyGenerator</a>
28
</dl>
29
Default KeyGenerator implementation.
30
 <P>This key generator assumes that there is a table named XMLDBMSKey
31
 in the database with an INTEGER column named HighKey. It constructs keys
32
 from a high key value and a low key value: the high key value forms the
33
 upper 24 bits of the key and the low key value forms the lower 8 bits of
34
 the key. The high key value is retrieved from the XMLDBMSKey table, which
35
 is then incremented by 1. The low key value is initialized to 0 and
36
 incremented by 1 each time generateKey() is called; when it reaches 255,
37
 a new high key value is retrieved. Thus, KeyGeneratorImpl can generate
38
 256 unique key values with a single database access.</P>
39
 <P>For example, the following code instantiates KeyGeneratorImpl and
40
 passes it to DOMToDBMS, which uses it to generate keys.</P>
41
 <PRE>
42
    // Instantiate KeyGeneratorImpl and initialize it with a Connection.
43
    KeyGenerator keyGenerator = new KeyGeneratorImpl();
44
    keyGenerator.initialize(conn);<BR />
45
    // Pass the key generator to DOMToDBMS.
46
    domToDBMS = new DOMToDBMS(map, keyGenerator, null);
47
 </PRE>
48
<p>
49
<hr>
50
<a name="index"></a>
51
<h2>
52
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
53
</h2>
54
<dl>
55
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
56
	<a href="#KeyGeneratorImpl(java.sql.Connection)"><b>KeyGeneratorImpl</b></a>(Connection)
57
  <dd>  Construct a new KeyGeneratorImpl object.
58
</dl>
59
<h2>
60
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
61
</h2>
62
<dl>
63
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
64
	<a href="#generateKey()"><b>generateKey</b></a>()
65
  <dd> 
66
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
67
	<a href="#initialize()"><b>initialize</b></a>()
68
  <dd>  Initialize the KeyGeneratorImpl object.
69
</dl>
70
<a name="constructors"></a>
71
<h2>
72
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
73
</h2>
74
<a name="KeyGeneratorImpl"></a>
75
<a name="KeyGeneratorImpl(java.sql.Connection)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
76
<b>KeyGeneratorImpl</b>
77
<pre>
78
 public KeyGeneratorImpl(Connection conn)
79
</pre>
80
<dl>
81
  <dd> Construct a new KeyGeneratorImpl object.
82
<p>
83
  <dd><dl>
84
    <dt> <b>Parameters:</b>
85
    <dd> conn - A connection to the database containing the XMLDBMSKey table.
86
  Note that this connection must be different from the connection used by
87
  the Map object. The reason for this is that each commits transactions at
88
  different times and using the same connection for both objects would lead
89
  to statements being committed prematurely.
90
  </dl></dd>
91
</dl>
92
<a name="methods"></a>
93
<h2>
94
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
95
</h2>
96
<a name="initialize()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
97
<a name="initialize"><b>initialize</b></a>
98
<pre>
99
 public void initialize() throws <a href="de.tudarmstadt.ito.xmldbms.KeyException.html#_top_">KeyException</a>
100
</pre>
101
<dl>
102
  <dd> Initialize the KeyGeneratorImpl object.
103
<p>
104
  <dd><dl>
105
    <dt> <b>Throws:</b> <a href="de.tudarmstadt.ito.xmldbms.KeyException.html#_top_">KeyException</a>
106
    <dd> Thrown if an error occurred initializing the
107
  database. Usually, this will be an error setting the auto-commit or
108
  transaction isolation level.
109
  </dl></dd>
110
</dl>
111
<a name="generateKey()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
112
<a name="generateKey"><b>generateKey</b></a>
113
<pre>
114
 public Object[] generateKey() throws <a href="de.tudarmstadt.ito.xmldbms.KeyException.html#_top_">KeyException</a>
115
</pre>
116
<hr>
117
<pre>
118
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-de.tudarmstadt.ito.xmldbms.helpers.html">This Package</a>  <a href="Package-de.tudarmstadt.ito.xmldbms.helpers.html">Previous</a>  <a href="Package-de.tudarmstadt.ito.xmldbms.helpers.html">Next</a>  <a href="AllNames.html">Index</a></pre>
119
</body>
120
</html>
(67-67/72)