All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface org.xmlmiddleware.xmldbms.keygenerators.KeyGenerator

public interface KeyGenerator
Interface for a class that generates key values (object IDs).

Applications that want DOMToDBMS to generate key values pass an instance of an object that implements this class to DOMToDBMS. Keys are used to join tables (class table-to-class table or class table- to-property table) and also to retrieve data from root tables. Whether DOMToDBMS generates a key for a given table (or one or more properties are mapped to the key columns) depends on the mapping to that table.

Programmers using the lowest level interface to XML-DBMS call initialize before passing a KeyGenerator object to DOMToDBMS and close after DOMToDBMS returns. They do not call generateKey, which is called only by DOMToDBMS.

Programmers calling higher level interfaces to XML-DBMS do not call any of the methods on this interface. Instead, they specify the name of a class that implements this interface and the properties needed to initialize that class.

The helper class KeyGeneratorHighLow provides a sample implementation of this interface.

Version:
2.0
Author:
Ronald Bourret, Technical University of Darmstadt

Method Index

 o close()
Closes a key generator.
 o generateKey()
Generates a key.
 o initialize(Properties)
Initializes a key generator.

Methods

 o initialize
 public abstract void initialize(Properties props) throws XMLMiddlewareException
Initializes a key generator.

This method must be called by applications before the key generator is passed to DOMToDBMS. Applications using DOMToDBMS call this method.

Parameters:
props - A Properties object containing properties to initialize the key generator. The documentation for the key generator must give the names and legal values for these properties.
Throws: XMLMiddlewareException
An error occured while initializing the key.
 o generateKey
 public abstract Object[] generateKey() throws XMLMiddlewareException
Generates a key.

This method is called by DOMToDBMS. Applications using DOMToDBMS do not need to call this method.

Returns:
The key as an array of Objects.
Throws: XMLMiddlewareException
An error occured while generating the key.
 o close
 public abstract void close() throws XMLMiddlewareException
Closes a key generator.

This method must be called by applications after the key generator is used by DOMToDBMS. Note that it is generally possible to use the key generator multiple times before it is closed. Programmers using DOMToDBMS call this method.

Throws: XMLMiddlewareException
An error occured while closing the key.

All Packages  Class Hierarchy  This Package  Previous  Next  Index