org.xquark.mapping
Class KeyGenerator

java.lang.Object
  |
  +--org.xquark.mapping.KeyGenerator
All Implemented Interfaces:
Generator, UserGenerator

public class KeyGenerator
extends java.lang.Object
implements UserGenerator

This generator is a built-in default implementation intended as a device for relational primary and foreign keys generation. It uses the compilation context to get the needed parameters, especially for initialization. WARNING !!! Currently, this generator is limited: it uses the target column provided by the compilation context to initialize a counter (performing a 'SELECT MAX(...) FROM ...' which is totally managed in memory (using 1 increments). This has the advantage to be extremely rapid (no useless database access, JDBC batch usable...) but the major drawback of this approach is the fact that concurrency in insertion is not supported...


Constructor Summary
KeyGenerator(CompilationContext properties)
           
 
Method Summary
 java.lang.Object getValue(StorageContext context)
          This method is called by the XQuark storage engine when a user-generated column of a relational table is filled.
 java.lang.String getXMLType()
          Return the corresponding XML Schema type using the XML Schema recommendation syntax.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyGenerator

public KeyGenerator(CompilationContext properties)
Method Detail

getXMLType

public java.lang.String getXMLType()
Description copied from interface: UserGenerator
Return the corresponding XML Schema type using the XML Schema recommendation syntax.

You must not use the the prefix for XML Schema namespace which is implicitly defined

.

Examples:/B>

string

decimal

]]>

Specified by:
getXMLType in interface UserGenerator
Returns:
an XML Schema fragment describing a simple type

getValue

public java.lang.Object getValue(StorageContext context)
Description copied from interface: Generator
This method is called by the XQuark storage engine when a user-generated column of a relational table is filled. The Object type returned must be consistent with the type returned by the XQuark schema API as defined in the following table:
XML schema base built-in primitive typeJava class
stringString
booleanBoolean
decimalBigDecimal or Long if type facet ensure it fits.
floatFloat
doubleDouble
QNameorg.xquark.schema.datatypes.QName
NOTATIONorg.xquark.schema.datatypes.QName
durationorg.xquark.schema.datatypes.Duration
dateTimeorg.xquark.schema.datatypes.DateTime
timeorg.xquark.schema.datatypes.DateTime
dateorg.xquark.schema.datatypes.DateTime
gYearMonthorg.xquark.schema.datatypes.DateTime
gYearorg.xquark.schema.datatypes.DateTime
gMonthDayorg.xquark.schema.datatypes.DateTime
gDayorg.xquark.schema.datatypes.DateTime
gMonthorg.xquark.schema.datatypes.DateTime
hexBinaryorg.xquark.schema.datatypes.ByteArray
base64Binaryorg.xquark.schema.datatypes.ByteArray
anyURIorg.xquark.schema.datatypes.URI
unionnot supported
listList
anySimpleTypeString

Specified by:
getValue in interface Generator
Parameters:
context - Passed by the mapping algorithm to provide an access to storage system variables.
Returns:
An Object, that must be consistent with the type returned by the XQuark schema API.


Copyright © 2004 Université de Versailles Saint-Quentin, XQuark Group. All rights reserved.