All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----de.tudarmstadt.ito.xmldbms.helpers.KeyGeneratorImpl
This key generator assumes that there is a table named XMLDBMSKey in the database with an INTEGER column named HighKey. It constructs keys from a high key value and a low key value: the high key value forms the upper 24 bits of the key and the low key value forms the lower 8 bits of the key. The high key value is retrieved from the XMLDBMSKey table, which is then incremented by 1. The low key value is initialized to 0 and incremented by 1 each time generateKey() is called; when it reaches 255, a new high key value is retrieved. Thus, KeyGeneratorImpl can generate 256 unique key values with a single database access.
For example, the following code instantiates KeyGeneratorImpl and passes it to DOMToDBMS, which uses it to generate keys.
// Instantiate KeyGeneratorImpl and initialize it with a Connection. KeyGenerator keyGenerator = new KeyGeneratorImpl(); keyGenerator.initialize(conn);
// Pass the key generator to DOMToDBMS. domToDBMS = new DOMToDBMS(map, keyGenerator, null);
public KeyGeneratorImpl(Connection conn)
public void initialize() throws KeyException
public Object[] generateKey() throws KeyException
All Packages Class Hierarchy This Package Previous Next Index