[#1096] Add support for generator.generate.unsigned-types in Maven source code generation

[#1108] Add support for multi-schema databases using Maven code generation
This commit is contained in:
Lukas Eder 2012-02-11 15:03:13 +00:00
parent bdc1ba559d
commit c40db95450
40 changed files with 317 additions and 1389 deletions

View File

@ -83,6 +83,13 @@
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<type>jar</type>
<optional>true</optional>
</dependency>
</dependencies>
<properties>
@ -126,6 +133,7 @@
<relations>true</relations>
<deprecated>false</deprecated>
<instanceFields>false</instanceFields>
<pojos>true</pojos>
</generate>
<target>
<packageName>org.jooq.util.maven.example.postgres</packageName>
@ -161,6 +169,7 @@
<relations>true</relations>
<deprecated>false</deprecated>
<instanceFields>true</instanceFields>
<jpaAnnotations>true</jpaAnnotations>
</generate>
<target>
<packageName>org.jooq.util.maven.example.ase</packageName>
@ -188,6 +197,7 @@
<name>org.jooq.util.mysql.MySQLDatabase</name>
<includes>.*</includes>
<excludes>t_book_details</excludes>
<unsignedTypes>true</unsignedTypes>
<!-- [#958] This checks the schema-rewriting functionality -->
<inputSchema>test</inputSchema>
@ -262,6 +272,8 @@
<deprecated>false</deprecated>
<instanceFields>true</instanceFields>
<generatedAnnotation>false</generatedAnnotation>
<pojos>true</pojos>
<jpaAnnotations>true</jpaAnnotations>
</generate>
<target>
<packageName>org.jooq.util.maven.example.mysql</packageName>

View File

@ -1,91 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
import java.util.List;
/**
* @author Sander Plas
* @author Lukas Eder
*/
public class Database {
private String name;
private String includes = "";
private String excludes = "";
private String inputSchema;
private String outputSchema;
private String dateAsTimestamp = "false";
private String unsignedTypes = "true";
private List<EnumType> enumTypes;
private List<ForcedType> forcedTypes;
String getName() {
return name;
}
String getIncludes() {
return includes;
}
String getExcludes() {
return excludes;
}
String getInputSchema() {
return inputSchema;
}
String getOutputSchema() {
return outputSchema;
}
String getDateAsTimestamp() {
return dateAsTimestamp;
}
String getUnsignedTypes() {
return unsignedTypes;
}
List<EnumType> getEnumTypes() {
return enumTypes;
}
List<ForcedType> getForcedTypes() {
return forcedTypes;
}
}

View File

@ -1,53 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
/**
* @author Lukas Eder
*/
public class EnumType {
private String name;
private String literals;
String getName() {
return name;
}
String getLiterals() {
return literals;
}
}

View File

@ -1,53 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
/**
* @author Lukas Eder
*/
public class ForcedType {
private String name;
private String expressions;
String getName() {
return name;
}
String getExpressions() {
return expressions;
}
}

View File

@ -1,73 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
/**
* @author Sander Plas
*/
public class Generate {
private String relations = "false";
private String deprecated = "true";
private String instanceFields = "true";
private String generatedAnnotation = "true";
private String pojos = "false";
private String jpaAnnotations = "false";
String getRelations() {
return relations;
}
String getDeprecated() {
return deprecated;
}
String getInstanceFields() {
return instanceFields;
}
String getGeneratedAnnotation() {
return generatedAnnotation;
}
String getPojos() {
return pojos;
}
String getJPAAnnotations() {
return jpaAnnotations;
}
}

View File

@ -1,77 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
import java.util.List;
import org.jooq.util.DefaultGenerator;
/**
* @author Sander Plas
*/
public class Generator {
private String name = DefaultGenerator.class.getName();
private Strategy strategy;
private Database database;
private Generate generate;
private List<MasterDataTable> masterDataTables;
private Target target;
String getName() {
return name;
}
Strategy getStrategy() {
return strategy;
}
Database getDatabase() {
return database;
}
Generate getGenerate() {
return generate;
}
List<MasterDataTable> getMasterDataTables() {
return masterDataTables;
}
Target getTarget() {
return target;
}
}

View File

@ -1,68 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
/**
* @author Sander Plas
*/
public class Jdbc {
private String driver;
private String url;
private String schema = "";
private String user = "";
private String password = "";
String getDriver() {
return driver;
}
String getUrl() {
return url;
}
String getSchema() {
return schema;
}
String getUser() {
return user;
}
String getPassword() {
return password;
}
}

View File

@ -1,58 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
/**
* @author Sander Plas
*/
public class MasterDataTable {
private String name;
private String literal;
private String description;
String getName() {
return name;
}
String getLiteral() {
return literal;
}
String getDescription() {
return description;
}
}

View File

@ -35,13 +35,12 @@
*/
package org.jooq.util.maven;
import static org.jooq.tools.StringUtils.defaultString;
import java.io.StringWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Properties;
import javax.xml.bind.JAXB;
import org.jooq.util.GenerationTool;
import org.jooq.util.jaxb.Configuration;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@ -62,91 +61,34 @@ public class Plugin extends AbstractMojo {
* @required
* @readonly
*/
private MavenProject project;
private MavenProject project;
/**
* The jdbc settings.
*
* @parameter
*/
private Jdbc jdbc;
private org.jooq.util.jaxb.Jdbc jdbc;
/**
* The generator settings
*
* @parameter
*/
private Generator generator;
private org.jooq.util.jaxb.Generator generator;
@Override
public void execute() throws MojoExecutionException {
Properties props = new Properties();
props.put("jdbc.Driver", jdbc.getDriver());
props.put("jdbc.URL", jdbc.getUrl());
props.put("jdbc.Schema", defaultString(jdbc.getSchema()));
props.put("jdbc.User", defaultString(jdbc.getUser()));
props.put("jdbc.Password", defaultString(jdbc.getPassword()));
props.put("generator", defaultString(generator.getName()));
props.put("generator.database", defaultString(generator.getDatabase().getName()));
props.put("generator.database.includes", defaultString(generator.getDatabase().getIncludes()));
props.put("generator.database.excludes", defaultString(generator.getDatabase().getExcludes()));
props.put("generator.database.input-schema", defaultString(generator.getDatabase().getInputSchema()));
props.put("generator.database.output-schema", defaultString(generator.getDatabase().getOutputSchema()));
props.put("generator.database.date-as-timestamp", defaultString(generator.getDatabase().getDateAsTimestamp()));
props.put("generator.generate.unsigned-types", defaultString(generator.getDatabase().getUnsignedTypes()));
if (generator.getDatabase().getEnumTypes() != null) {
for (EnumType type : generator.getDatabase().getEnumTypes()) {
props.put("generator.database.enum-type." + type.getName(), type.getLiterals());
}
}
if (generator.getDatabase().getForcedTypes() != null) {
for (ForcedType type : generator.getDatabase().getForcedTypes()) {
props.put("generator.database.forced-type." + type.getName(), type.getExpressions());
}
}
props.put("generator.generate.relations", defaultString(generator.getGenerate().getRelations()));
props.put("generator.generate.deprecated", defaultString(generator.getGenerate().getDeprecated()));
props.put("generator.generate.instance-fields", defaultString(generator.getGenerate().getInstanceFields()));
props.put("generator.generate.pojos", defaultString(generator.getGenerate().getPojos()));
props.put("generator.generate.jpa-annotations", defaultString(generator.getGenerate().getJPAAnnotations()));
props.put("generator.target.package", generator.getTarget().getPackageName());
props.put("generator.target.directory", generator.getTarget().getDirectory());
if (generator.getMasterDataTables() != null) {
StringBuilder mdtList = new StringBuilder();
for (MasterDataTable mdt : generator.getMasterDataTables()) {
if (mdtList.length() > 0) {
mdtList.append(",");
}
mdtList.append(mdt.getName());
props.put("generator.generate.master-data-table-literal." + mdt.getName(), mdt.getLiteral());
props.put("generator.generate.master-data-table-description." + mdt.getName(), mdt.getDescription());
}
props.put("generator.generate.master-data-tables", mdtList.toString());
}
if (getLog().isDebugEnabled()) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
try {
props.store(stream, "passing these properties to jooq-codegen:");
}
catch (IOException ex) {
throw new RuntimeException(ex);
}
getLog().debug(stream.toString());
}
try {
GenerationTool.main(props);
Configuration configuration = new Configuration();
configuration.setJdbc(jdbc);
configuration.setGenerator(generator);
StringWriter writer = new StringWriter();
JAXB.marshal(configuration, writer);
getLog().info("Using this configuration:\n" + writer.toString());
GenerationTool.main(configuration);
}
catch (Exception ex) {
throw new MojoExecutionException("Error running jOOQ code generation tool", ex);

View File

@ -1,50 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
import org.jooq.util.DefaultGeneratorStrategy;
/**
* @author Lukas Eder
*/
public class Strategy {
private String name = DefaultGeneratorStrategy.class.getName();
String getName() {
return name;
}
}

View File

@ -1,53 +0,0 @@
/**
* Copyright (c) 2009-2011, Lukas Eder, lukas.eder@gmail.com
* All rights reserved.
*
* This software is licensed to you under the Apache License, Version 2.0
* (the "License"); You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.maven;
/**
* @author Sander Plas
*/
public class Target {
private String packageName;
private String directory = "target/generated-sources/jooq";
String getPackageName() {
return packageName;
}
String getDirectory() {
return directory;
}
}

View File

@ -42,6 +42,7 @@ import static org.jooq.tools.StringUtils.isBlank;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@ -50,16 +51,12 @@ import javax.xml.bind.JAXB;
import org.jooq.tools.JooqLogger;
import org.jooq.tools.StringUtils;
import org.jooq.util.jaxb.Configuration;
import org.jooq.util.jaxb.Database.EnumTypes;
import org.jooq.util.jaxb.Database.ForcedTypes;
import org.jooq.util.jaxb.Database.MasterDataTables;
import org.jooq.util.jaxb.EnumType;
import org.jooq.util.jaxb.ForcedType;
import org.jooq.util.jaxb.Generate;
import org.jooq.util.jaxb.Jdbc;
import org.jooq.util.jaxb.MasterDataTable;
import org.jooq.util.jaxb.Schemata;
import org.jooq.util.jaxb.Schemata.Schema;
import org.jooq.util.jaxb.Schema;
import org.jooq.util.jaxb.Strategy;
import org.jooq.util.jaxb.Target;
@ -135,7 +132,7 @@ public class GenerationTool {
Strategy strategy = new Strategy();
strategy.setName(properties.containsKey("generator.strategy") ? properties.getProperty("generator.strategy") : null);
MasterDataTables masterDataTables = new MasterDataTables();
List<MasterDataTable> masterDataTables = new ArrayList<MasterDataTable>();
for (String name : defaultString(properties.getProperty("generator.generate.master-data-tables")).split(",")) {
if (isBlank(name)) continue;
@ -145,10 +142,10 @@ public class GenerationTool {
table.setLiteral(properties.getProperty("generator.generate.master-data-table-literal." + name));
table.setDescription(properties.getProperty("generator.generate.master-data-table-description." + name));
masterDataTables.getMasterDataTable().add(table);
masterDataTables.add(table);
}
EnumTypes enumTypes = new EnumTypes();
List<EnumType> enumTypes = new ArrayList<EnumType>();
for (String property : properties.stringPropertyNames()) {
if (property.startsWith("generator.database.enum-type.")) {
String name = property.replace("generator.database.enum-type.", "");
@ -156,11 +153,11 @@ public class GenerationTool {
EnumType type = new EnumType();
type.setName(name);
type.setLiterals(properties.getProperty(property));
enumTypes.getEnumType().add(type);
enumTypes.add(type);
}
}
ForcedTypes forcedTypes = new ForcedTypes();
List<ForcedType> forcedTypes = new ArrayList<ForcedType>();
for (String property : properties.stringPropertyNames()) {
if (property.startsWith("generator.database.forced-type.")) {
String name = property.replace("generator.database.forced-type.", "");
@ -168,34 +165,28 @@ public class GenerationTool {
ForcedType type = new ForcedType();
type.setName(name);
type.setExpressions(properties.getProperty(property));
forcedTypes.getForcedType().add(type);
forcedTypes.add(type);
}
}
Schema schema = new Schema();
schema.setInputSchema(properties.containsKey("generator.database.input-schema") ? properties.getProperty("generator.database.input-schema") : null);
schema.setOutputSchema(properties.containsKey("generator.database.output-schema") ? properties.getProperty("generator.database.output-schema") : null);
Schemata schemata = new Schemata();
schemata.getSchema().add(schema);
org.jooq.util.jaxb.Database database = new org.jooq.util.jaxb.Database();
database.setName(properties.getProperty("generator.database"));
database.setIncludes(properties.containsKey("generator.database.includes") ? properties.getProperty("generator.database.includes") : null);
database.setExcludes(properties.containsKey("generator.database.excludes") ? properties.getProperty("generator.database.excludes") : null);
database.setDateAsTimestamp("true".equalsIgnoreCase(properties.getProperty("generator.database.date-as-timestamp")));
database.setUnsignedTypes(!"false".equalsIgnoreCase(properties.getProperty("generator.generate.unsigned-types")));
database.setSchemata(schemata);
database.setInputSchema(properties.containsKey("generator.database.input-schema") ? properties.getProperty("generator.database.input-schema") : null);
database.setOutputSchema(properties.containsKey("generator.database.output-schema") ? properties.getProperty("generator.database.output-schema") : null);
// Avoid creating these empty elements when migrating
if (!masterDataTables.getMasterDataTable().isEmpty())
database.setMasterDataTables(masterDataTables);
if (!masterDataTables.isEmpty())
database.getMasterDataTables().addAll(masterDataTables);
if (!enumTypes.getEnumType().isEmpty())
database.setEnumTypes(enumTypes);
if (!enumTypes.isEmpty())
database.getEnumTypes().addAll(enumTypes);
if (!forcedTypes.getForcedType().isEmpty())
database.setForcedTypes(forcedTypes);
if (!forcedTypes.isEmpty())
database.getForcedTypes().addAll(forcedTypes);
Target target = new Target();
target.setPackageName(properties.getProperty("generator.target.package"));
@ -250,12 +241,6 @@ public class GenerationTool {
g.setStrategy(new Strategy());
if (g.getTarget() == null)
g.setTarget(new Target());
if (g.getDatabase().getEnumTypes() == null)
g.getDatabase().setEnumTypes(new EnumTypes());
if (g.getDatabase().getForcedTypes() == null)
g.getDatabase().setForcedTypes(new ForcedTypes());
if (g.getDatabase().getMasterDataTables() == null)
g.getDatabase().setMasterDataTables(new MasterDataTables());
Class.forName(j.getDriver());
Connection connection = null;
@ -281,17 +266,23 @@ public class GenerationTool {
Class<Database> databaseClass = (Class<Database>) Class.forName(g.getDatabase().getName());
Database database = databaseClass.newInstance();
Schemata schemata = g.getDatabase().getSchemata();
if (schemata == null) {
schemata = new Schemata();
g.getDatabase().setSchemata(schemata);
List<Schema> schemata = g.getDatabase().getSchemata();
if (schemata.isEmpty()) {
Schema schema = new Schema();
schema.setInputSchema(g.getDatabase().getInputSchema());
schema.setOutputSchema(g.getDatabase().getOutputSchema());
schemata.add(schema);
}
else {
if (!StringUtils.isBlank(g.getDatabase().getInputSchema())) {
log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/inputSchema and /configuration/generator/database/schemata");
}
if (!StringUtils.isBlank(g.getDatabase().getOutputSchema())) {
log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/outputSchema and /configuration/generator/database/schemata");
}
}
List<Schema> schemaList = schemata.getSchema();
if (schemaList.isEmpty())
schemaList.add(new Schema());
for (Schema schema : schemaList) {
for (Schema schema : schemata) {
if (StringUtils.isBlank(schema.getInputSchema())) {
log.warn("WARNING: The configuration property jdbc.Schema is deprecated and will be removed in the future. Use /configuration/generator/database/inputSchema instead");
schema.setInputSchema(j.getSchema());
@ -306,15 +297,20 @@ public class GenerationTool {
database.setConfiguredSchemata(schemata);
database.setIncludes(defaultString(g.getDatabase().getIncludes()).split(","));
database.setExcludes(defaultString(g.getDatabase().getExcludes()).split(","));
database.setConfiguredMasterDataTables(g.getDatabase().getMasterDataTables().getMasterDataTable());
database.setConfiguredEnumTypes(g.getDatabase().getEnumTypes().getEnumType());
database.setConfiguredForcedTypes(g.getDatabase().getForcedTypes().getForcedType());
database.setConfiguredMasterDataTables(g.getDatabase().getMasterDataTables());
database.setConfiguredEnumTypes(g.getDatabase().getEnumTypes());
database.setConfiguredForcedTypes(g.getDatabase().getForcedTypes());
if (g.getDatabase().isDateAsTimestamp() != null)
database.setDateAsTimestamp(g.getDatabase().isDateAsTimestamp());
if (g.getDatabase().isUnsignedTypes() != null)
database.setSupportsUnsignedTypes(g.getDatabase().isUnsignedTypes());
if (StringUtils.isBlank(g.getTarget().getPackageName()))
g.getTarget().setPackageName("org.jooq.generated");
if (StringUtils.isBlank(g.getTarget().getDirectory()))
g.getTarget().setPackageName("target/generated-sources/jooq");
generator.setTargetPackage(g.getTarget().getPackageName());
generator.setTargetDirectory(g.getTarget().getDirectory());

View File

@ -14,6 +14,9 @@
<!-- Run a full mvn clean package install deploy first before this -->
<target name="xjc-generator" description="Generate JAXB artefacts from XSD">
<mkdir dir="${dir.java}/org/jooq/util/jaxb" />
<xjc schema="${dir.resources}/jooq-codegen-2.0.4.xsd" destdir="${dir.java}" package="org.jooq.util.jaxb"/>
<xjc schema="${dir.resources}/jooq-codegen-2.0.4.xsd" destdir="${dir.java}" package="org.jooq.util.jaxb">
<arg value="-Xxew" />
<arg value="-instantiate lazy" />
</xjc>
</target>
</project>

Binary file not shown.

Binary file not shown.

BIN
jOOQ-meta/lib/jaxb-api.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
jOOQ-meta/lib/jaxb-impl.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
jOOQ-meta/lib/xew.jar Normal file

Binary file not shown.

View File

@ -49,8 +49,7 @@ import org.jooq.tools.csv.CSVReader;
import org.jooq.util.jaxb.EnumType;
import org.jooq.util.jaxb.ForcedType;
import org.jooq.util.jaxb.MasterDataTable;
import org.jooq.util.jaxb.Schemata;
import org.jooq.util.jaxb.Schemata.Schema;
import org.jooq.util.jaxb.Schema;
/**
* A base implementation for all types of databases.
@ -70,7 +69,7 @@ public abstract class AbstractDatabase implements Database {
private String[] includes;
private boolean supportsUnsignedTypes;
private boolean dateAsTimestamp;
private Schemata configuredSchemata;
private List<Schema> configuredSchemata;
private List<MasterDataTable> configuredMasterDataTables;
private List<EnumType> configuredEnumTypes;
private List<ForcedType> configuredForcedTypes;
@ -135,7 +134,7 @@ public abstract class AbstractDatabase implements Database {
public final List<String> getInputSchemata() {
List<String> result = new ArrayList<String>();
for (Schema schema : configuredSchemata.getSchema()) {
for (Schema schema : configuredSchemata) {
result.add(schema.getInputSchema());
}
@ -144,7 +143,7 @@ public abstract class AbstractDatabase implements Database {
@Override
public String getOutputSchema(String inputSchema) {
for (Schema schema : configuredSchemata.getSchema()) {
for (Schema schema : configuredSchemata) {
if (inputSchema.equals(schema.getInputSchema())) {
return schema.getOutputSchema();
}
@ -154,7 +153,7 @@ public abstract class AbstractDatabase implements Database {
}
@Override
public final void setConfiguredSchemata(Schemata schemata) {
public final void setConfiguredSchemata(List<Schema> schemata) {
this.configuredSchemata = schemata;
}

View File

@ -44,7 +44,7 @@ import org.jooq.impl.Factory;
import org.jooq.util.jaxb.EnumType;
import org.jooq.util.jaxb.ForcedType;
import org.jooq.util.jaxb.MasterDataTable;
import org.jooq.util.jaxb.Schemata;
import org.jooq.util.jaxb.Schema;
/**
* A general database model.
@ -157,7 +157,7 @@ public interface Database {
/**
* The input and output schemata
*/
void setConfiguredSchemata(Schemata schemata);
void setConfiguredSchemata(List<Schema> schemata);
/**
* Only database objects matching any of these regular expressions will be

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//
@ -13,6 +13,7 @@ import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
@ -31,40 +32,12 @@ import javax.xml.bind.annotation.XmlType;
* &lt;element name="excludes" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="dateAsTimestamp" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="unsignedTypes" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* &lt;element name="inputSchema" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="outputSchema" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="schemata" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}Schemata" minOccurs="0"/>
* &lt;element name="masterDataTables" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="masterDataTable" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}MasterDataTable" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="enumTypes" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="enumType" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}EnumType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="forcedTypes" minOccurs="0">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="forcedType" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}ForcedType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;element name="masterDataTables" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}MasterDataTables" minOccurs="0"/>
* &lt;element name="enumTypes" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}EnumTypes" minOccurs="0"/>
* &lt;element name="forcedTypes" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}ForcedTypes" minOccurs="0"/>
* &lt;/all>
* &lt;/restriction>
* &lt;/complexContent>
@ -89,10 +62,22 @@ public class Database {
protected Boolean dateAsTimestamp;
@XmlElement(defaultValue = "true")
protected Boolean unsignedTypes;
protected Schemata schemata;
protected Database.MasterDataTables masterDataTables;
protected Database.EnumTypes enumTypes;
protected Database.ForcedTypes forcedTypes;
@XmlElement(defaultValue = "")
protected String inputSchema;
@XmlElement(defaultValue = "")
protected String outputSchema;
@XmlElementWrapper(name = "schemata")
@XmlElement(name = "schema")
protected List<Schema> schemata;
@XmlElementWrapper(name = "masterDataTables")
@XmlElement(name = "masterDataTable")
protected List<MasterDataTable> masterDataTables;
@XmlElementWrapper(name = "enumTypes")
@XmlElement(name = "enumType")
protected List<EnumType> enumTypes;
@XmlElementWrapper(name = "forcedTypes")
@XmlElement(name = "forcedType")
protected List<ForcedType> forcedTypes;
/**
* Gets the value of the name property.
@ -215,276 +200,79 @@ public class Database {
}
/**
* Gets the value of the schemata property.
* Gets the value of the inputSchema property.
*
* @return
* possible object is
* {@link Schemata }
* {@link String }
*
*/
public Schemata getSchemata() {
public String getInputSchema() {
return inputSchema;
}
/**
* Sets the value of the inputSchema property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInputSchema(String value) {
this.inputSchema = value;
}
/**
* Gets the value of the outputSchema property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutputSchema() {
return outputSchema;
}
/**
* Sets the value of the outputSchema property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutputSchema(String value) {
this.outputSchema = value;
}
public List<Schema> getSchemata() {
if (schemata == null) {
schemata = new ArrayList<Schema>();
}
return schemata;
}
/**
* Sets the value of the schemata property.
*
* @param value
* allowed object is
* {@link Schemata }
*
*/
public void setSchemata(Schemata value) {
this.schemata = value;
}
/**
* Gets the value of the masterDataTables property.
*
* @return
* possible object is
* {@link Database.MasterDataTables }
*
*/
public Database.MasterDataTables getMasterDataTables() {
public List<MasterDataTable> getMasterDataTables() {
if (masterDataTables == null) {
masterDataTables = new ArrayList<MasterDataTable>();
}
return masterDataTables;
}
/**
* Sets the value of the masterDataTables property.
*
* @param value
* allowed object is
* {@link Database.MasterDataTables }
*
*/
public void setMasterDataTables(Database.MasterDataTables value) {
this.masterDataTables = value;
}
/**
* Gets the value of the enumTypes property.
*
* @return
* possible object is
* {@link Database.EnumTypes }
*
*/
public Database.EnumTypes getEnumTypes() {
public List<EnumType> getEnumTypes() {
if (enumTypes == null) {
enumTypes = new ArrayList<EnumType>();
}
return enumTypes;
}
/**
* Sets the value of the enumTypes property.
*
* @param value
* allowed object is
* {@link Database.EnumTypes }
*
*/
public void setEnumTypes(Database.EnumTypes value) {
this.enumTypes = value;
}
/**
* Gets the value of the forcedTypes property.
*
* @return
* possible object is
* {@link Database.ForcedTypes }
*
*/
public Database.ForcedTypes getForcedTypes() {
public List<ForcedType> getForcedTypes() {
if (forcedTypes == null) {
forcedTypes = new ArrayList<ForcedType>();
}
return forcedTypes;
}
/**
* Sets the value of the forcedTypes property.
*
* @param value
* allowed object is
* {@link Database.ForcedTypes }
*
*/
public void setForcedTypes(Database.ForcedTypes value) {
this.forcedTypes = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="enumType" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}EnumType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"enumType"
})
public static class EnumTypes {
protected List<EnumType> enumType;
/**
* Gets the value of the enumType property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the enumType property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEnumType().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link EnumType }
*
*
*/
public List<EnumType> getEnumType() {
if (enumType == null) {
enumType = new ArrayList<EnumType>();
}
return this.enumType;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="forcedType" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}ForcedType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"forcedType"
})
public static class ForcedTypes {
protected List<ForcedType> forcedType;
/**
* Gets the value of the forcedType property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the forcedType property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getForcedType().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ForcedType }
*
*
*/
public List<ForcedType> getForcedType() {
if (forcedType == null) {
forcedType = new ArrayList<ForcedType>();
}
return this.forcedType;
}
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="masterDataTable" type="{http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd}MasterDataTable" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"masterDataTable"
})
public static class MasterDataTables {
protected List<MasterDataTable> masterDataTable;
/**
* Gets the value of the masterDataTable property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the masterDataTable property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMasterDataTable().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link MasterDataTable }
*
*
*/
public List<MasterDataTable> getMasterDataTable() {
if (masterDataTable == null) {
masterDataTable = new ArrayList<MasterDataTable>();
}
return this.masterDataTable;
}
}
}

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,159 +0,0 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
//
package org.jooq.util.jaxb;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the org.jooq.util.jaxb package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jooq.util.jaxb
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Target }
*
*/
public Target createTarget() {
return new Target();
}
/**
* Create an instance of {@link Generator }
*
*/
public Generator createGenerator() {
return new Generator();
}
/**
* Create an instance of {@link Strategy }
*
*/
public Strategy createStrategy() {
return new Strategy();
}
/**
* Create an instance of {@link Database.MasterDataTables }
*
*/
public Database.MasterDataTables createDatabaseMasterDataTables() {
return new Database.MasterDataTables();
}
/**
* Create an instance of {@link Configuration }
*
*/
public Configuration createConfiguration() {
return new Configuration();
}
/**
* Create an instance of {@link MasterDataTable }
*
*/
public MasterDataTable createMasterDataTable() {
return new MasterDataTable();
}
/**
* Create an instance of {@link EnumType }
*
*/
public EnumType createEnumType() {
return new EnumType();
}
/**
* Create an instance of {@link Database }
*
*/
public Database createDatabase() {
return new Database();
}
/**
* Create an instance of {@link Schemata.Schema }
*
*/
public Schemata.Schema createSchemataSchema() {
return new Schemata.Schema();
}
/**
* Create an instance of {@link Generate }
*
*/
public Generate createGenerate() {
return new Generate();
}
/**
* Create an instance of {@link Database.ForcedTypes }
*
*/
public Database.ForcedTypes createDatabaseForcedTypes() {
return new Database.ForcedTypes();
}
/**
* Create an instance of {@link Schemata }
*
*/
public Schemata createSchemata() {
return new Schemata();
}
/**
* Create an instance of {@link Jdbc }
*
*/
public Jdbc createJdbc() {
return new Jdbc();
}
/**
* Create an instance of {@link ForcedType }
*
*/
public ForcedType createForcedType() {
return new ForcedType();
}
/**
* Create an instance of {@link Database.EnumTypes }
*
*/
public Database.EnumTypes createDatabaseEnumTypes() {
return new Database.EnumTypes();
}
}

View File

@ -0,0 +1,96 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//
package org.jooq.util.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Schema complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="Schema">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;all>
* &lt;element name="inputSchema" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="outputSchema" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/all>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Schema", propOrder = {
})
public class Schema {
@XmlElement(required = true, defaultValue = "")
protected String inputSchema;
@XmlElement(defaultValue = "")
protected String outputSchema;
/**
* Gets the value of the inputSchema property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getInputSchema() {
return inputSchema;
}
/**
* Sets the value of the inputSchema property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInputSchema(String value) {
this.inputSchema = value;
}
/**
* Gets the value of the outputSchema property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutputSchema() {
return outputSchema;
}
/**
* Sets the value of the outputSchema property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutputSchema(String value) {
this.outputSchema = value;
}
}

View File

@ -1,169 +0,0 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
//
package org.jooq.util.jaxb;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Schemata complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="Schemata">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="schema" maxOccurs="unbounded">
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;all>
* &lt;element name="inputSchema" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="outputSchema" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/all>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* &lt;/element>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Schemata", propOrder = {
"schema"
})
public class Schemata {
@XmlElement(required = true)
protected List<Schemata.Schema> schema;
/**
* Gets the value of the schema property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the schema property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSchema().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Schemata.Schema }
*
*
*/
public List<Schemata.Schema> getSchema() {
if (schema == null) {
schema = new ArrayList<Schemata.Schema>();
}
return this.schema;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;all>
* &lt;element name="inputSchema" type="{http://www.w3.org/2001/XMLSchema}string"/>
* &lt;element name="outputSchema" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/all>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
})
public static class Schema {
@XmlElement(required = true, defaultValue = "")
protected String inputSchema;
@XmlElement(defaultValue = "")
protected String outputSchema;
/**
* Gets the value of the inputSchema property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getInputSchema() {
return inputSchema;
}
/**
* Sets the value of the inputSchema property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInputSchema(String value) {
this.inputSchema = value;
}
/**
* Gets the value of the outputSchema property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOutputSchema() {
return outputSchema;
}
/**
* Sets the value of the outputSchema property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOutputSchema(String value) {
this.outputSchema = value;
}
}
}

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,8 +1,8 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
// Generated on: 2012.02.11 at 03:39:37 PM MEZ
//

View File

@ -1,9 +0,0 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.02.11 at 11:05:31 AM MEZ
//
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.jooq.util.jaxb;

View File

@ -53,8 +53,7 @@ import org.jooq.util.RoutineDefinition;
import org.jooq.util.SequenceDefinition;
import org.jooq.util.TableDefinition;
import org.jooq.util.UDTDefinition;
import org.jooq.util.jaxb.Schemata;
import org.jooq.util.jaxb.Schemata.Schema;
import org.jooq.util.jaxb.Schema;
import org.jooq.util.sqlite.sqlite_master.SQLiteMaster;
/**
@ -71,10 +70,10 @@ public class SQLiteDatabase extends AbstractDatabase {
schema.setInputSchema("");
schema.setOutputSchema("");
Schemata s = new Schemata();
s.getSchema().add(schema);
List<Schema> schemata = new ArrayList<Schema>();
schemata.add(schema);
setConfiguredSchemata(s);
setConfiguredSchemata(schemata);
}
@Override

View File

@ -92,46 +92,52 @@
minOccurs="0" maxOccurs="1" />
<element name="unsignedTypes" type="boolean" default="true"
minOccurs="0" maxOccurs="1" />
<element name="inputSchema" type="string" default=""
minOccurs="0" maxOccurs="1" />
<element name="outputSchema" type="string" default=""
minOccurs="0" maxOccurs="1" />
<element name="schemata" type="tns:Schemata" minOccurs="0" maxOccurs="1"/>
<element name="masterDataTables" minOccurs="0" maxOccurs="1">
<complexType>
<sequence>
<element name="masterDataTable" type="tns:MasterDataTable"
minOccurs="0" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
<element name="enumTypes" minOccurs="0" maxOccurs="1">
<complexType>
<sequence>
<element name="enumType" type="tns:EnumType" minOccurs="0"
maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
<element name="forcedTypes" minOccurs="0" maxOccurs="1">
<complexType>
<sequence>
<element name="forcedType" type="tns:ForcedType"
minOccurs="0" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
<element name="masterDataTables" type="tns:MasterDataTables" minOccurs="0" maxOccurs="1"/>
<element name="enumTypes" type="tns:EnumTypes" minOccurs="0" maxOccurs="1"/>
<element name="forcedTypes" type="tns:ForcedTypes" minOccurs="0" maxOccurs="1"/>
</all>
</complexType>
<complexType name="Schemata">
<sequence>
<element name="schema" minOccurs="1" maxOccurs="unbounded">
<complexType>
<all>
<element name="inputSchema" type="string" default=""
minOccurs="1" maxOccurs="1" />
<element name="outputSchema" type="string" default=""
minOccurs="0" maxOccurs="1" />
</all>
</complexType>
</element>
<element name="schema" type="tns:Schema" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="Schema">
<all>
<element name="inputSchema" type="string" default=""
minOccurs="1" maxOccurs="1" />
<element name="outputSchema" type="string" default=""
minOccurs="0" maxOccurs="1" />
</all>
</complexType>
<complexType name="MasterDataTables">
<sequence>
<element name="masterDataTable" type="tns:MasterDataTable"
minOccurs="0" maxOccurs="unbounded" />
</sequence>
</complexType>
<complexType name="EnumTypes">
<sequence>
<element name="enumType" type="tns:EnumType" minOccurs="0"
maxOccurs="unbounded" />
</sequence>
</complexType>
<complexType name="ForcedTypes">
<sequence>
<element name="forcedType" type="tns:ForcedType"
minOccurs="0" maxOccurs="unbounded" />
</sequence>
</complexType>