[#1782] Move JAXB bindings out of XSD, in order to support more advanced

bindings
This commit is contained in:
Lukas Eder 2012-09-01 11:43:45 +02:00
parent cd8894e5d1
commit 7ba5bb1beb
6 changed files with 223 additions and 10 deletions

View File

@ -31,6 +31,7 @@
<extension>true</extension>
<strict>false</strict>
<schemaDirectory>src/main/resources/xsd</schemaDirectory>
<bindingDirectory>src/main/resources/xjb</bindingDirectory>
<schemaIncludes>
<include>jooq-codegen-2.5.0.xsd</include>
</schemaIncludes>
@ -41,6 +42,7 @@
<arg>-Xxew:delete</arg>
<arg>-Xfluent-api</arg>
<arg>-Xdefault-value</arg>
<arg>-Xannotate</arg>
</args>
<plugins>
<plugin>
@ -58,6 +60,11 @@
<artifactId>jaxb2-default-value</artifactId>
<version>1.1</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.2</version>
</plugin>
</plugins>
</configuration>
</execution>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:annox="http://annox.dev.java.net"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
version="2.1">
<jaxb:globalBindings>
<!-- Force all classes implements Serializable -->
<xjc:serializable uid="250" />
</jaxb:globalBindings>
<!-- Annotate the following classes with @SuppressWarnings -->
<jaxb:bindings schemaLocation="../xsd/jooq-codegen-2.5.0.xsd" multiple="true" node="//xs:complexType">
<annox:annotate>
<annox:annotate annox:class="java.lang.SuppressWarnings" value="all" />
</annox:annotate>
</jaxb:bindings>
</jaxb:bindings>

View File

@ -37,8 +37,9 @@
<extension>true</extension>
<strict>false</strict>
<schemaDirectory>src/main/resources/xsd</schemaDirectory>
<bindingDirectory>src/main/resources/xjb</bindingDirectory>
<schemaIncludes>
<include>jooq-runtime-2.5.0.xsd</include>
<include>jooq-runtime-2.6.0.xsd</include>
</schemaIncludes>
<generatePackage>org.jooq.conf</generatePackage>
<args>
@ -47,6 +48,7 @@
<arg>-Xxew:delete</arg>
<arg>-Xfluent-api</arg>
<arg>-Xdefault-value</arg>
<arg>-Xannotate</arg>
</args>
<plugins>
<plugin>
@ -64,6 +66,11 @@
<artifactId>jaxb2-default-value</artifactId>
<version>1.1</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.2</version>
</plugin>
</plugins>
</configuration>
</plugin>

View File

@ -1,9 +0,0 @@
/**
* The <code>org.jooq.conf</code> package contains jOOQ's runtime configuration
* classes
* <p>
* This package contains JAXB-annotated configuration classes that can be
* provided to a {@link org.jooq.impl.Factory} in order to influence jOOQ's
* runtime behaviour.
*/
package org.jooq.conf;

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:annox="http://annox.dev.java.net"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
version="2.1">
<jaxb:globalBindings>
<!-- Force all classes implements Serializable -->
<xjc:serializable uid="260" />
</jaxb:globalBindings>
<!-- Annotate the following classes with @SuppressWarnings -->
<jaxb:bindings schemaLocation="../xsd/jooq-runtime-2.6.0.xsd" multiple="true" node="//xs:complexType">
<annox:annotate>
<annox:annotate annox:class="java.lang.SuppressWarnings" value="all" />
</annox:annotate>
</jaxb:bindings>
</jaxb:bindings>

View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:jooq-runtime="http://www.jooq.org/xsd/jooq-runtime-2.6.0.xsd"
targetNamespace="http://www.jooq.org/xsd/jooq-runtime-2.6.0.xsd">
<element name="settings" type="jooq-runtime:Settings"/>
<complexType name="Settings">
<all>
<!-- Whether any schema name should be rendered at all.
Use this for single-schema environments, or when all objects are made
available using synonyms -->
<element name="renderSchema" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
<!-- Configure render mapping for runtime schema / table rewriting in
generated SQL -->
<element name="renderMapping" type="jooq-runtime:RenderMapping" minOccurs="0" maxOccurs="1"/>
<!-- Whether rendered schema, table, column names, etc should be quoted
in rendered SQL, or transformed in any other way.
This is set to "QUOTED" by default for backwards-compatibility -->
<element name="renderNameStyle" type="jooq-runtime:RenderNameStyle" minOccurs="0" maxOccurs="1" default="QUOTED"/>
<!-- Whether SQL keywords should be rendered with upper or lower case -->
<element name="renderKeywordStyle" type="jooq-runtime:RenderKeywordStyle" minOccurs="0" maxOccurs="1" default="LOWER"/>
<!-- Whether rendered SQL should be pretty-printed -->
<element name="renderFormatted" type="boolean" minOccurs="0" maxOccurs="1" default="false"/>
<!-- The type of statement that is to be executed -->
<element name="statementType" type="jooq-runtime:StatementType" minOccurs="0" maxOccurs="1" default="PREPARED_STATEMENT"/>
<!-- When set to true, this will add jOOQ's default logging ExecuteListeners -->
<element name="executeLogging" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
<!-- The event listeners to be notified upon execution events -->
<element name="executeListeners" type="jooq-runtime:ExecuteListeners" minOccurs="0" maxOccurs="1"/>
<!-- Whether store() and delete() methods should be executed with optimistic locking -->
<element name="executeWithOptimisticLocking" type="boolean" minOccurs="0" maxOccurs="1" default="false"/>
<!-- Whether fetched records should be attached to the fetching configuration -->
<element name="attachRecords" type="boolean" minOccurs="0" maxOccurs="1" default="true"/>
</all>
</complexType>
<complexType name="RenderMapping">
<all>
<!-- The default schema as defined in org.jooq.Schema.getName()
This schema will be omitted in rendered SQL -->
<element name="defaultSchema" type="string" minOccurs="0" maxOccurs="1"/>
<!-- The mapped schemata configuration -->
<element name="schemata" type="jooq-runtime:MappedSchemata" minOccurs="0" maxOccurs="1"/>
</all>
</complexType>
<complexType name="MappedSchemata">
<sequence>
<element name="schema" type="jooq-runtime:MappedSchema" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="MappedSchema">
<all>
<!-- The input schema as defined in org.jooq.Schema.getName() -->
<element name="input" type="string" minOccurs="1" maxOccurs="1"/>
<!-- The output schema as it will be rendered in SQL
When this is omitted, you can still apply table mapping -->
<element name="output" type="string" minOccurs="0" maxOccurs="1"/>
<!-- Configure table mapping for runtime table rewriting in
generated SQL -->
<element name="tables" type="jooq-runtime:MappedTables" minOccurs="0" maxOccurs="1"/>
</all>
</complexType>
<complexType name="MappedTables">
<sequence>
<element name="table" type="jooq-runtime:MappedTable" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="MappedTable">
<all>
<!-- The input schema as defined in org.jooq.Table.getName() -->
<element name="input" type="string" minOccurs="1" maxOccurs="1"/>
<!-- The output schema as it will be rendered in SQL -->
<element name="output" type="string" minOccurs="1" maxOccurs="1"/>
</all>
</complexType>
<simpleType name="StatementType">
<restriction base="string">
<!-- Execute statements with inlined bind values, avoiding JDBC's
PreparedStatements -->
<enumeration value="STATIC_STATEMENT"/>
<!-- Execute statements with bind values, using JDBC's
PreparedStatements -->
<enumeration value="PREPARED_STATEMENT"/>
</restriction>
</simpleType>
<simpleType name="RenderNameStyle">
<restriction base="string">
<!-- Render object names quoted, as defined in the database. Use this
to stay on the safe side with case-sensitivity and special
characters. For instance:
Oracle : "SYS"."ALL_TAB_COLS"
MySQL : `information_schema`.`TABLES`
SQL Server: [INFORMATION_SCHEMA].[TABLES] -->
<enumeration value="QUOTED"/>
<!-- Render object names, as defined in the database. For instance:
Oracle : SYS.ALL_TAB_COLS
MySQL : information_schema.TABLES
SQL Server: INFORMATION_SCHEMA.TABLES -->
<enumeration value="AS_IS"/>
<!-- Force rendering object names in lower case. For instance:
Oracle : sys.all_tab_cols
MySQL : information_schema.tables
SQL Server: information_schema.tables -->
<enumeration value="LOWER"/>
<!-- Force rendering object names in upper case. For instance:
Oracle : SYS.ALL_TAB_COLS
MySQL : INFORMATION_SCHEMA.TABLES
SQL Server: INFORMATION_SCHEMA.TABLES -->
<enumeration value="UPPER"/>
</restriction>
</simpleType>
<simpleType name="RenderKeywordStyle">
<restriction base="string">
<!-- Keywords are rendered in lower case. For instance:
select .. from .. where .. -->
<enumeration value="LOWER"/>
<!-- Keywords are rendered in upper case. For instance:
SELECT .. FROM .. WHERE .. -->
<enumeration value="UPPER"/>
</restriction>
</simpleType>
<complexType name="ExecuteListeners">
<sequence>
<!-- An event listener implementing org.jooq.ExecuteListener -->
<element name="executeListener" type="string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</schema>