ammulder 2005/07/07 17:37:08
Modified: modules/openejb-builder/src/schema openejb-jar.xsd
xmlconfig.xml
Added: modules/openejb-builder/src/schema openejb-pkgen.xsd
Log:
Add option to configure PK generation via direct schema elements instead
of only using references to GBeans.
The old style configuration is still supported, though the syntax is
different (if you want to use a GBean reference, put it in a
key-generator/custom-generator element)
There's also a placeholder commented out of the XML Schema for key
generation using IDs inserted directly into the target table by the
database (using AUTO_INCREMENT columns or triggers) though that
requires additional features from TranQL before it works.
Revision Changes Path
1.17 +3 -10
openejb/modules/openejb-builder/src/schema/openejb-jar.xsd
Index: openejb-jar.xsd
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/schema/openejb-jar.xsd,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- openejb-jar.xsd 3 Jul 2005 10:08:40 -0000 1.16
+++ openejb-jar.xsd 7 Jul 2005 21:37:07 -0000 1.17
@@ -52,6 +52,7 @@
xmlns:naming="http://geronimo.apache.org/xml/ns/naming"
xmlns:security="http://geronimo.apache.org/xml/ns/security"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment"
+ xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
@@ -60,6 +61,7 @@
<xs:import namespace="http://geronimo.apache.org/xml/ns/naming"
schemaLocation="geronimo-naming.xsd"/>
<xs:import namespace="http://geronimo.apache.org/xml/ns/security"
schemaLocation="geronimo-security.xsd"/>
<xs:import namespace="http://geronimo.apache.org/xml/ns/deployment"
schemaLocation="geronimo-config.xsd"/>
+ <xs:import namespace="http://www.openejb.org/xml/ns/pkgen"
schemaLocation="openejb-pkgen.xsd"/>
<!-- <xs:include schemaLocation="geronimo-security.xsd"/>-->
@@ -201,16 +203,7 @@
</xs:complexType>
</xs:element>
<xs:element name="primkey-field" type="xs:string"
minOccurs="0"/>
- <xs:sequence minOccurs="0">
- <xs:element name="automatic-key-generation">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="generator-name"
type="xs:string"/>
- <xs:element name="primary-key-class"
type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
+ <xs:element ref="pkgen:key-generator" minOccurs="0" />
<xs:element name="prefetch-group" minOccurs="0">
<xs:complexType>
<xs:sequence>
1.3 +4 -0 openejb/modules/openejb-builder/src/schema/xmlconfig.xml
Index: xmlconfig.xml
===================================================================
RCS file:
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/schema/xmlconfig.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- xmlconfig.xml 8 Mar 2005 04:08:31 -0000 1.2
+++ xmlconfig.xml 7 Jul 2005 21:37:07 -0000 1.3
@@ -15,6 +15,10 @@
<xb:package>org.apache.geronimo.xbeans.geronimo.security</xb:package>
<xb:prefix>Ger</xb:prefix>
</xb:namespace>
+ <xb:namespace uri="http://www.openejb.org/xml/ns/pkgen">
+ <xb:package>org.openejb.xbeans.pkgen</xb:package>
+ <xb:prefix>Ejb</xb:prefix>
+ </xb:namespace>
<xb:namespace uri="http://www.openejb.org/xml/ns/corba-tss-config_1_0">
<xb:package>org.openejb.xbeans.csiv2.tss</xb:package>
<xb:prefix>TSS</xb:prefix>
1.1
openejb/modules/openejb-builder/src/schema/openejb-pkgen.xsd
Index: openejb-pkgen.xsd
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen"
targetNamespace="http://www.openejb.org/xml/ns/pkgen"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.0">
<xsd:element name="key-generator" type="pkgen:key-generatorType"/>
<xsd:complexType name="key-generatorType">
<xsd:annotation>
<xsd:documentation>
Primary Key generation element.
If this is present, a key generator GBean will be created
and configured to generate IDs for the surrounding object.
</xsd:documentation>
</xsd:annotation>
<xsd:choice>
<!-- Add this in as soon as TranQL has support.
I assume it needs some kind of token PK generator that just tells
it which column(s) in the table will be populated automatically
by a database feature (such as MySQL AUTO_INCREMENT columns or a
pre-insert trigger or whatever)
<xsd:element name="database-generated"
type="pkgen:database-generatedType" /> -->
<xsd:element name="sequence-table"
type="pkgen:sequence-tableType" />
<xsd:element name="auto-increment-table"
type="pkgen:auto-increment-tableType" />
<xsd:element name="sql-generator" type="pkgen:sql-generatorType"
/>
<xsd:element name="custom-generator"
type="pkgen:custom-generatorType" />
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="database-generatedType" >
<xsd:annotation>
<xsd:documentation>
Indicates that the database automatically populates a primary
key
ID in the listed column(s). Typically this is used for
columns
with an AUTO_INCREMENT flag or the equivalent. This only
makes
sense if this key generator is used for an EJB or something
else
with a corresponding database table (not if it's meant to
generate
unique web session IDs or something like that -- see
auto-increment-tableType for that case).
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="identity-column" type="xsd:string"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="sequence-tableType" >
<xsd:annotation>
<xsd:documentation>
Indicates that a separate table holds a list of table name/ID
pairs and the server should fetch the next ID from that table.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="table-name" type="xsd:string"/>
<xsd:element name="sequence-name" type="xsd:string"/>
<xsd:element name="batch-size" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="sql-generatorType" >
<xsd:annotation>
<xsd:documentation>
Indicates that an arbitrary SQL statement should be used to
generate the next ID.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="sql" type="xsd:string"/>
<xsd:element name="return-type" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="auto-increment-tableType" >
<xsd:annotation>
<xsd:documentation>
Handles the case where an arbitrary SQL statement is executed,
and the JDBC driver returns a new automatically generated ID.
This should not be used when the destination table itself
generates the ID (see database-generatedType), but it could be
used for a web session ID or something where there is no
naturally matching database table (but you could create one
with an AUTO_INCREMENT key, specify an insert statement here,
and then capture the newly returned ID and use it as your
web session ID).
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="sql" type="xsd:string"/>
<xsd:element name="return-type" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="custom-generatorType" >
<xsd:annotation>
<xsd:documentation>
Handles a user-provided generator. You deploy any old
generator
as a GBean, and then point to that GBean here. The generator
should implement org.tranql.pkgenerator.PrimaryKeyGenerator.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="generator-name" type="xsd:string"/>
<xsd:element name="primary-key-class" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>