Author: gk Date: Fri Jan 10 11:38:13 2020 New Revision: 1872589 URL: http://svn.apache.org/viewvc?rev=1872589&view=rev Log: - add task Torque4JDBCTransformTask.java with test (using derby-embedded as in org.apache.torque.generator.source.jdbc.JdbcMetadataSourceTest to get some data from schema) and dependencies. - update ant task documentation - add missing xsd files in site (?)
Added: db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/Torque4JDBCTransformTask.java (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/resources/org/apache/torque/ant/task/ db/torque/torque4/trunk/torque-ant-tasks/src/test/resources/org/apache/torque/ant/task/jdbc2schemaTest.sql (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/schema/ db/torque/torque4/trunk/torque-ant-tasks/src/test/schema/expected-schema.xml (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/control.xml (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/options.properties (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/outlets/ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/outlets/jdbc2schema.xml (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0-strict.xsd (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0.xsd (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-1-strict.xsd (with props) db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-1.xsd (with props) db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/ant-tasks/reference/jdbc2schema-task.xml (with props) db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-0-strict.xsd (with props) db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-0.xsd (with props) db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-1-strict.xsd (with props) db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-1.xsd (with props) Modified: db/torque/torque4/trunk/torque-ant-tasks/pom.xml db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/ant-tasks/reference/generator-task.xml db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/ant-tasks/reference/index.xml db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step1-ant.xml db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step2.xml db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step3-ant.xml Modified: db/torque/torque4/trunk/torque-ant-tasks/pom.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/pom.xml?rev=1872589&r1=1872588&r2=1872589&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/pom.xml (original) +++ db/torque/torque4/trunk/torque-ant-tasks/pom.xml Fri Jan 10 11:38:13 2020 @@ -38,15 +38,21 @@ </scm> <dependencies> - <dependency> + <!--dependency> <groupId>org.apache.torque</groupId> <artifactId>torque-generator</artifactId> <version>${project.version}</version> + </dependency--> + <!-- includes generator and runtime --> + <dependency> + <groupId>org.apache.torque</groupId> + <artifactId>torque-templates</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant</artifactId> - <version>1.10.5</version> + <version>1.10.7</version> <scope>provided</scope> </dependency> @@ -55,6 +61,24 @@ <artifactId>commons-io</artifactId> <scope>test</scope> </dependency> + <!--dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.9</version> + </dependency--> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.14.2.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.xmlunit</groupId> + <artifactId>xmlunit-core</artifactId> + <version>2.6.2</version> + <scope>test</scope> + </dependency> + </dependencies> <build> Added: db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/Torque4JDBCTransformTask.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/Torque4JDBCTransformTask.java?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/Torque4JDBCTransformTask.java (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/Torque4JDBCTransformTask.java Fri Jan 10 11:38:13 2020 @@ -0,0 +1,313 @@ +package org.apache.torque.ant.task; + +/* + * Copyright 2001-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. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.apache.torque.generator.GeneratorException; +import org.apache.torque.generator.configuration.UnitDescriptor; +import org.apache.torque.generator.configuration.controller.Loglevel; +import org.apache.torque.generator.configuration.option.MapOptionsConfiguration; +import org.apache.torque.generator.configuration.paths.CustomProjectPaths; +import org.apache.torque.generator.configuration.paths.DefaultTorqueGeneratorPaths; +import org.apache.torque.generator.configuration.paths.Maven2DirectoryProjectPaths; +import org.apache.torque.generator.configuration.paths.ProjectPaths; +import org.apache.torque.generator.control.Controller; + +/** + * This class generates an XML schema of an existing database from + * JDBC metadata. + * + * @author <a href="mailto:jvan...@periapt.com">Jason van Zyl</a> + * @author <a href="mailto:fedor.karpelevi...@barra.com">Fedor Karpelevitch</a> + * @version $Id: TorqueJDBCTransformTask.java 229738 2005-06-14 20:51:13Z tfischer $ + */ +public class Torque4JDBCTransformTask extends Task +{ + + /** + * The packaging type of the generation unit, either "directory" + * or "classpath". Default is "classpath". + */ + private String packaging = "classpath"; + + /** + * The target directory for files which are generated each time anew. + * Default is "target/generated-sources" + */ + private File defaultOutputDir = new File("target/generated-schema"); + + /** + * The root directory of the project. + * Has no effect if packaging is "classpath". + * Default is ".". + */ + private File projectRootDir = new File("."); + + /** Name of XML database schema produced. */ + protected String xmlSchema = "schema.xml"; + + /** + * The Loglevel to use in the generation process. Must be one of + * trace, debug, info, warn or error. + * If not set, the log level defined in the generation unit is used. + */ + private String loglevel; + + /** JDBC URL. */ + protected String dbUrl; + + /** JDBC driver. */ + protected String dbDriver; + + /** JDBC user name. */ + protected String dbUser; + + /** JDBC password. */ + protected String dbPassword; + + /** + * The configuration package of the generation unit. + */ + private String configPackage; + + /** + * The configuration directory of the generation unit. + * Has no effect if packaging is "classpath". + */ + private File configDir; + + + public void setDbUrl(String v) + { + dbUrl = v; + } + + public void setDbDriver(String v) + { + dbDriver = v; + } + + +// public void setOutputFile (String v) +// { +// xmlSchema = v; +// } + + + /** + * Default constructor. + * + * @throws BuildException + */ + @Override + public void execute() throws BuildException + { + log("Torque - JDBCToXMLSchema starting"); + log("Your DB settings are:"); + log("driver : " + dbDriver); + log("URL : " + dbUrl); + // log("password : " + dbPassword); + + try + { + generateXML(); + log("Target file:" +defaultOutputDir + "/" + xmlSchema); + } + catch (Exception e) + { + throw new BuildException(e); + } + log("Torque - JDBCToXMLSchema finished"); + } + + /** + * Generates an XML database schema from JDBC metadata. + * + * @throws Exception a generic exception. + */ + public void generateXML() throws Exception + { + // Load the Driver. + //Class.forName(dbDriver); + //log("DB driver sucessfuly instantiated", Project.MSG_INFO); + + // Attemtp to connect to a database. + //Connection con = DriverManager.getConnection(dbUrl, dbUser, dbPassword); + //log("DB connection established", Project.MSG_INFO); + + Controller controller = new Controller(); + List<UnitDescriptor> unitDescriptors = new ArrayList<>(); + + Map<String, String> overrideOptions = new HashMap<>(); + overrideOptions.put("torque.jdbc2schema.url", dbUrl); + overrideOptions.put("torque.jdbc2schema.driver", dbDriver); + overrideOptions.put("torque.jdbc2schema.user", dbUser); + overrideOptions.put("torque.jdbc2schema.password", dbPassword); + + + UnitDescriptor.Packaging packaging; + if ("directory".equals(this.packaging)) + { + packaging = UnitDescriptor.Packaging.DIRECTORY; + } + else if ("classpath".equals(this.packaging)) + { + packaging = UnitDescriptor.Packaging.CLASSPATH; + } + else + { + throw new IllegalArgumentException( + "Unknown packaging " + this.packaging + + ", must be jar, directory or classpath"); + } + log("Packaging is " + packaging, Project.MSG_DEBUG); + + ProjectPaths defaultProjectPaths; + if (UnitDescriptor.Packaging.DIRECTORY == packaging) + { + defaultProjectPaths + = new Maven2DirectoryProjectPaths(projectRootDir); + } + else if (UnitDescriptor.Packaging.CLASSPATH == packaging) + { + defaultProjectPaths + = new Maven2DirectoryProjectPaths(projectRootDir); + } + else + { + throw new IllegalStateException("Unknown packaging" + packaging); + } + + CustomProjectPaths projectPaths + = new CustomProjectPaths(defaultProjectPaths); + + + if (UnitDescriptor.Packaging.CLASSPATH == packaging) + { + if (configPackage == null) + { + throw new BuildException( + "configPackage must be set for packaging =\"classpath\""); + } + projectPaths.setConfigurationPackage(configPackage); + projectPaths.setConfigurationDir(null); + } + else + { + if (configDir != null) + { + projectPaths.setConfigurationDir(configDir); + log("Setting config dir to " + configDir.toString(), + Project.MSG_DEBUG); + } + } + + if (defaultOutputDir != null) + { + projectPaths.setOutputDirectory(null, defaultOutputDir); + log("Setting defaultOutputDir to " + + defaultOutputDir.getAbsolutePath(), + Project.MSG_DEBUG); + } + + log("ProjectPaths = " + projectPaths); + + Loglevel convertedLoglevel = null; + if (this.loglevel != null) + { + convertedLoglevel = Loglevel.getByKey(loglevel); + } + + UnitDescriptor unitDescriptor = new UnitDescriptor( + packaging, + projectPaths, + new DefaultTorqueGeneratorPaths()); + unitDescriptor.setOverrideOptions( + new MapOptionsConfiguration(overrideOptions)); + unitDescriptor.setLoglevel(convertedLoglevel); + unitDescriptors.add(unitDescriptor); + + try { + log("Generation started", Project.MSG_DEBUG); + controller.run(unitDescriptors); + log("Generation successful", Project.MSG_INFO); + } catch (GeneratorException e) { + log("Error during jdbc3schema generation", e, Project.MSG_ERR); + throw new BuildException(e.getMessage()); + } + + } + + public void setConfigDir(final File configDir) + { + this.configDir = configDir; + } + + public void setConfigPackage(final String configPackage) + { + this.configPackage = configPackage; + } + + /** + * Sets the default output base directory for generated files. + * + * @param defaultOutputDir the default output directory, + * or null to use the default. + */ + public void setDefaultOutputDir(final File defaultOutputDir) + { + this.defaultOutputDir = defaultOutputDir; + } + + /** + * Sets the root directory of the project. + * + * @param projectRootDir the project root Directory. + */ + public void setProjectRootDir(final File projectRootDir) + { + this.projectRootDir = projectRootDir; + } + + + /** + * Sets the packaging. + * + * @param packaging the packaging or "directory" + */ + public void setPackaging(final String packaging) + { + this.packaging = packaging; + } + + public void setDbUser(String dbUser) { + this.dbUser = dbUser; + } + + public void setDbPassword(String dbPassword) { + this.dbPassword = dbPassword; + } + +} Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/main/java/org/apache/torque/ant/task/Torque4JDBCTransformTask.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java?rev=1872589&r1=1872588&r2=1872589&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java (original) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/java/org/apache/torque/ant/task/TorqueGeneratorTaskTest.java Fri Jan 10 11:38:13 2020 @@ -1,6 +1,10 @@ package org.apache.torque.ant.task; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +import java.io.BufferedReader; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -22,9 +26,24 @@ import static org.junit.jupiter.api.Asse */ import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.StringTokenizer; import org.apache.commons.io.FileUtils; +import org.apache.log4j.BasicConfigurator; +import org.apache.torque.templates.transformer.jdbc2schema.Jdbc2SchemaOptionName; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.xmlunit.builder.DiffBuilder; +import org.xmlunit.diff.DefaultNodeMatcher; +import org.xmlunit.diff.Diff; +import org.xmlunit.diff.ElementSelectors; public class TorqueGeneratorTaskTest { @@ -51,4 +70,96 @@ public class TorqueGeneratorTaskTest assertTrue(FileUtils.contentEquals(generatedJavaFile, expectedJavaFile), "The files differ!"); } + + /** + * @see Jdbc2SchemaTest in torque-templates + * + * @throws Exception + */ + @Test + public void testJDBC2SchemaExecute() throws Exception + { + // + try { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); + BasicConfigurator.configure(); + Connection connection = DriverManager.getConnection("jdbc:derby:memory:myDb;create=true"); + InputStream inputStream = getClass().getResourceAsStream( + "jdbc2schemaTest.sql"); + BufferedReader bufferedReader = new BufferedReader( + new InputStreamReader(inputStream, "iso-8859-1")); + String line; + StringBuilder queryBuffer = new StringBuilder(); + while ((line = bufferedReader.readLine()) != null) + { + if (line.trim().length() == 0 || line.trim().startsWith("--")) + { + continue; + } + queryBuffer.append(line); + } + StringTokenizer tokenizer + = new StringTokenizer(queryBuffer.toString(), ";", false); + while (tokenizer.hasMoreTokens()) + { + String sqlQuery = tokenizer.nextToken(); + Statement statement = connection.createStatement(); + try + { + statement.execute(sqlQuery); + } + catch (SQLException e) + { + fail(); + } + statement.close(); + } + connection.close(); + + String testRoot = "target"; + { + File generatedSchemaDir = new File(testRoot, "generated-schema"); + FileUtils.deleteDirectory(generatedSchemaDir); + } + } catch (SQLException | IOException e) { + fail(); + } + + File target = new File("target/generated-schema"); + FileUtils.deleteDirectory(target); + Torque4JDBCTransformTask task = new Torque4JDBCTransformTask(); + task.setDbUrl("jdbc:derby:memory:myDb;create=true"); + task.setDbDriver("org.apache.derby.jdbc.EmbeddedDriver"); + + task.setPackaging("directory"); + //task.setProjectRootDir(new File("src/test/torqueJDBC2SchemaTaskTest/src/main/jdbc2schema")); + //task.setPackaging("classpath"); + //task.setConfigPackage("org.apache.torque.templates.jdbc2schema"); + + task.setProjectRootDir(new File("src/test/torqueJDBC2SchemaTaskTest")); + task.setDefaultOutputDir(target); + try { + task.execute(); + } catch (Exception e) { + fail(e.getMessage()); + e.printStackTrace(); + } + + assertTrue(target.exists()); + File generatedSchemaFile = new File( + target, + "schema.xml"); + assertTrue(generatedSchemaFile.exists()); + File expectedSchemaFile = new File( + // "src/test/schema/schema.xml" + "src/test/schema/expected-schema.xml" + ); + + Diff myDiffSimilar = DiffBuilder.compare(expectedSchemaFile).ignoreComments().withTest(generatedSchemaFile) + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName)) + .checkForSimilar() + .build(); + assertFalse(myDiffSimilar.hasDifferences(), "The files differ! " + myDiffSimilar.toString()); + + } } Added: db/torque/torque4/trunk/torque-ant-tasks/src/test/resources/org/apache/torque/ant/task/jdbc2schemaTest.sql URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/resources/org/apache/torque/ant/task/jdbc2schemaTest.sql?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/resources/org/apache/torque/ant/task/jdbc2schemaTest.sql (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/resources/org/apache/torque/ant/task/jdbc2schemaTest.sql Fri Jan 10 11:38:13 2020 @@ -0,0 +1,57 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you 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. + +-- ----------------------------------------------------------------------- +-- derby SQL script for schema bookstore +-- ----------------------------------------------------------------------- + + + +-- ----------------------------------------------------------------------- +-- book +-- ----------------------------------------------------------------------- +CREATE TABLE book +( + book_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY, + isbn VARCHAR(15), + author_id INTEGER NOT NULL, + title VARCHAR(255) NOT NULL default 'no title', + PRIMARY KEY(book_id)); + + + + +-- ----------------------------------------------------------------------- +-- author +-- ----------------------------------------------------------------------- +CREATE TABLE author +( + author_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY, + name VARCHAR(50) NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, + updated_at TIMESTAMP NOT NULL, + PRIMARY KEY(author_id)); + + + + +ALTER TABLE book + ADD CONSTRAINT book_FK_1 + FOREIGN KEY (author_id) + REFERENCES author (author_id); + + Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/test/resources/org/apache/torque/ant/task/jdbc2schemaTest.sql ------------------------------------------------------------------------------ svn:eol-style = native Added: db/torque/torque4/trunk/torque-ant-tasks/src/test/schema/expected-schema.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/schema/expected-schema.xml?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/schema/expected-schema.xml (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/schema/expected-schema.xml Fri Jan 10 11:38:13 2020 @@ -0,0 +1,32 @@ +<!-- + Copyright 2001-2020 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. +--> +<database name="default"> + <table name="AUTHOR"> + <column default="GENERATED_BY_DEFAULT" primaryKey="true" name="AUTHOR_ID" type="INTEGER"/> + <column name="NAME" required="true" type="VARCHAR" size="50"/> + <column name="CREATED_AT" type="TIMESTAMP" default="CURRENT_TIMESTAMP" required="true"/> + <column name="UPDATED_AT" type="TIMESTAMP" required="true"/> + </table> + <table name="BOOK"> + <column default="GENERATED_BY_DEFAULT" primaryKey="true" name="BOOK_ID" type="INTEGER"/> + <column name="ISBN" type="VARCHAR" size="15"/> + <column name="AUTHOR_ID" required="true" type="INTEGER"/> + <column default="no title" name="TITLE" required="true" type="VARCHAR" size="255"/> + <foreign-key foreignTable="AUTHOR"> + <reference local="AUTHOR_ID" foreign="AUTHOR_ID"/> + </foreign-key> + </table> +</database> Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/test/schema/expected-schema.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/control.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/control.xml?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/control.xml (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/control.xml Fri Jan 10 11:38:13 2020 @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> + +<control loglevel="info" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd" + xmlns="http://db.apache.org/torque/4.0/generator/configuration"> + + <options xsi:type="propertiesOptions" path="options.properties"/> + + <entityReference + systemId="http://db.apache.org/torque/4.0/templates/database.xsd" + resource="../../xsd/database-4-0.xsd" /> + <entityReference + systemId="http://db.apache.org/torque/4.0/templates/database-strict.xsd" + resource="../../xsd/database-4-0-strict.xsd" /> + <entityReference + systemId="http://db.apache.org/torque/torque-4.0/documentation/orm-reference/database-4-0.xsd" + resource="../../xsd/database-4-0.xsd" /> + <entityReference + systemId="http://db.apache.org/torque/torque-4.0/documentation/orm-reference/database-4-0-strict.xsd" + resource="../../xsd/database-4-0-strict.xsd" /> + <entityReference + systemId="http://db.apache.org/torque/torque-4.1/documentation/orm-reference/database-4-1.xsd" + resource="../../xsd/database-4-1.xsd" /> + <entityReference + systemId="http://db.apache.org/torque/torque-4.1/documentation/orm-reference/database-4-1-strict.xsd" + resource="../../xsd/database-4-1-strict.xsd" /> + + <output name="jdbc2schema"> + <filenameOutlet + xsi:type="javaOutlet" + class="org.apache.torque.generator.outlet.java.OptionOutlet"> + <option>torque.jdbc2schema.filename</option> + </filenameOutlet> + <source xsi:type="jdbcMetadataSource" + urlOption="torque.jdbc2schema.url" + driverOption="torque.jdbc2schema.driver" + usernameOption="torque.jdbc2schema.user" + passwordOption="torque.jdbc2schema.password" + schemaOption="torque.jdbc2schema.schema"> + <transformer class="org.apache.torque.templates.transformer.jdbc2schema.Jdbc2SchemaTransformer"/> + </source> + <outlet name="jdbc2schema"/> + </output> + +</control> + \ No newline at end of file Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/control.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/options.properties URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/options.properties?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/options.properties (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/options.properties Fri Jan 10 11:38:13 2020 @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +torque.jdbc2schema.filename = schema.xml \ No newline at end of file Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/conf/options.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/outlets/jdbc2schema.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/outlets/jdbc2schema.xml?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/outlets/jdbc2schema.xml (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/outlets/jdbc2schema.xml Fri Jan 10 11:38:13 2020 @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> + +<outlets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd" + xmlns="http://db.apache.org/torque/4.0/generator/configuration"> + <outlet name="jdbc2schema" + xsi:type="javaOutlet" + class="org.apache.torque.generator.outlet.java.XmlOutlet"> + </outlet> +</outlets> \ No newline at end of file Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/torque-gen/outlets/jdbc2schema.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0-strict.xsd URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0-strict.xsd?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0-strict.xsd (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0-strict.xsd Fri Jan 10 11:38:13 2020 @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<!-- + Torque XML database schema DTD + $Id: database-4-0-strict.xsd 1622915 2014-09-06 19:21:17Z tfischer $ +--> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://db.apache.org/torque/4.0/templates/database" + xmlns="http://db.apache.org/torque/4.0/templates/database" + elementFormDefault="qualified" + version="4.0"> + + <xs:annotation> + <xs:documentation xml:lang="en"> +The XML schema used by version 4.0 and greater of the Apache Software +Foundation Torque project( +<a href="http://db.apache.org/torque">http://db.apache.org/torque</a> ) +to model SQL database information. +This model restricts the available characters in java names and sql names +as compared to the standard database.xsd + </xs:documentation> + </xs:annotation> + + <xs:redefine schemaLocation="http://db.apache.org/torque/torque-4.0/documentation/orm-reference/database-4-0.xsd"> + <xs:simpleType name="javaNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> + Java identifiers, e.g. [A-Za-z_$]A-Za-z_$0-9]* + </xs:documentation> + </xs:annotation> + <xs:restriction base="javaNameType"> + <xs:pattern value="[A-Za-z_$][A-Za-z_$0-9]*" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="javaQualifiedNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> + Java fully qualified names (e.g. x.y.x) + </xs:documentation> + </xs:annotation> + <xs:restriction base="javaQualifiedNameType"> + <xs:pattern + value="([A-Za-z_$][A-Za-z_$0-9]*[.])*[A-Za-z_$][A-Za-z_$0-9]*" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="sqlNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> + SQL Standard non-delimited identifiers. + </xs:documentation> + </xs:annotation> + <xs:restriction base="sqlNameType"> + <xs:pattern value="[A-Za-z$#][A-Za-z_$#0-9]*" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="sqlQualifiedNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> + SQL Standard non-delimited identifiers. + </xs:documentation> + </xs:annotation> + <xs:restriction base="sqlQualifiedNameType"> + <xs:pattern value="[A-Za-z$#][A-Za-z_$#0-9]*(\.[A-Za-z$#][A-Za-z_$#0-9]*)?" /> + </xs:restriction> + </xs:simpleType> + </xs:redefine> + +</xs:schema> \ No newline at end of file Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0-strict.xsd ------------------------------------------------------------------------------ svn:eol-style = native Added: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0.xsd URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0.xsd?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0.xsd (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0.xsd Fri Jan 10 11:38:13 2020 @@ -0,0 +1,1096 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<!-- + Torque XML database schema DTD + $Id: database-4-0.xsd 1629463 2014-10-05 02:11:26Z tfischer $ +--> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://db.apache.org/torque/4.0/templates/database" + xmlns="http://db.apache.org/torque/4.0/templates/database" + elementFormDefault="qualified" + version="4.0"> + + <xs:annotation> + <xs:documentation xml:lang="en"> +The XML schema used by version 4.0 and greater of the Apache Software +Foundation Torque project( +<a href="http://db.apache.org/torque">http://db.apache.org/torque</a> ) +to model SQL database information. This model is used by various Torque +utilities for managing the SQL Server info and to build the Java objects +to access this data. + +The basic structure of a model is built using the database element +as the root. This will contain references to options, external (include) +models, new SQL Domain definitions, and tables. See the Torque project +home page for more details. + </xs:documentation> + </xs:annotation> + +<!-- ===================================== + database element definition + ===================================== --> + <xs:element name="database" type="databaseType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The root element for defining a Torque database schema. + </xs:documentation> + </xs:annotation> + </xs:element> + + <xs:complexType name="databaseType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The root type definition for a Torque database schema. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="option" type="optionType" minOccurs="0" + maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +A set of key/value options to be passed to custom generator templates. + </xs:documentation> + </xs:annotation> + </xs:element> + + <xs:element name="include-schema" type="includeSchemaType" + minOccurs="0" maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Include another schema file in this schema (as if it were a part of this +schema file). + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="external-schema" type="externalSchemaType" + minOccurs="0" maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Reference another schema file from this schema (outbound connections only). + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="domain" type="domainType" minOccurs="0" + maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Domains are used to define common attribute sets for columns. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="table" type="tableType" minOccurs="0" + maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines a database table. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="view" type="viewType" minOccurs="0" + maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines a database view. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="javaNameType" use="required"> + <xs:annotation> + <xs:documentation xml:lang="en" > +The name used to identify this schema in the generated +Java objects and as the default JDBC connection pool to use. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="defaultJavaType" use="optional" + type="javaReturnType" default="primitive" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines if the record object property getter / setters will +use objects (e.g. Integer) or primitives (e.g. int), defaults +to primitive. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="defaultIdMethod" use="optional" type="idMethodType" + default="none" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines the defaultIdMethod to use with tables which do not have an idMethod +attribute defined. This attribute has 3 possible values, they are: + +- idbroker + Torque's software based id broker system +- native + The SQL Server's native autoincrement/identifier process +- none + Don't try to auto assign id numbers +- null + Use the value previously set or the default value. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + option element definition + ===================================== --> + <xs:complexType name="optionType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +These tags allows a set of key/value options to be passed to custom generator +templates. + </xs:documentation> + </xs:annotation> + <xs:attribute name="key" type="xs:string" use="required" /> + <xs:attribute name="value" type="xs:string" use="required" /> + </xs:complexType> + +<!-- ===================================== + include-schema element definition + ===================================== --> + <xs:complexType name="includeSchemaType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Include another schema file in this schema (as if it were a part of this +schema file). + </xs:documentation> + </xs:annotation> + <xs:attribute name="filename" type="xs:string" use="required" /> + </xs:complexType> + +<!-- ===================================== + external-schema element definition + ===================================== --> + <xs:complexType name="externalSchemaType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Includes another schema file. + </xs:documentation> + </xs:annotation> + <xs:attribute name="filename" type="xs:string" use="required" /> + </xs:complexType> + +<!-- ===================================== + domain element definition + ===================================== --> + <xs:complexType name="domainType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Domains are used to define attributes for columns. + </xs:documentation> + </xs:annotation> + <xs:attribute name="name" type="xs:string" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The name used to reference this set of column attributes. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" use="optional" type="sqlDataType" + default="VARCHAR" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The SQL Standard data type for the column + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="size" type="xs:decimal" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The size of the field. E.g. Varchar(size) or Numeric(Size). Note that +while this still supports the original torque use of using a +decimal number (5.2) to indicate the precision +and scale in one attribute. Use of the scale attribute is preferred. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="scale" type="xs:integer" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The scale of the field. E.g.decimal(size, scale) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="default" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The default column value + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="description" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The description of this domain for documentation purposes. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + table element definition + ===================================== --> + <xs:complexType name="tableType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The table element and its relevant attributes. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="option" type="optionType" minOccurs="0" + maxOccurs="unbounded" /> + <xs:element name="column" type="columnType" maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The column element and its relevant attributes + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:choice minOccurs="0" maxOccurs="unbounded" > + <xs:element name="foreign-key" type="foreignKeyType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +Define a foreign key constraint for this table. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="index" type="indexType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines an index for this table. + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="unique" type="uniqueType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +Define a unique value constraint + </xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="id-method-parameter" type="idMethodParameterType"> + </xs:element> + </xs:choice> + </xs:sequence> + <xs:attribute name="name" type="sqlQualifiedNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The table name of the SQL table. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="interface" type="javaQualifiedNameType" + use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The interface attribute specifies an interface that should be referenced in +the implements section of the generated extension class. If this is a fully +qualified class name (i. e. the string contains dots), the interface will +simply be implemented by the extension object. If the interface is a simple +class name (without dots), an empty interface file will be generated in the +extension object package. When this attribute is used, all methods that +normally would return the extension object type will now return the interface +type. This feature allows to use Torque generated classes in the context of +other applications or APIs. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="peerInterface" type="javaQualifiedNameType" + use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The interface attribute specifies an interface that should be referenced in +the implements section of the generated peer class. If this is a fully +qualified class name (i. e. the string contains dots), the interface will +simply be implemented by the peer object. If the interface is a simple +class name (without dots), an empty interface file will be generated in the +peer package. This feature allows to use Torque generated peer classes +in the context of other applications or APIs. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="baseClass" type="javaQualifiedNameType" use="optional"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The fully qualified class that the generated Java table +record objects will extend. This class does not have to extend +org.apache.torque.om.BaseObject. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="basePeer" type="javaQualifiedNameType" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The fully qualified class that the generated Java Peer objects will extend. +Unlike baseClass, basePeer should extend BasePeer at some point in the chain, +i.e. it needs to be the superclass. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="idMethod" use="optional" type="idMethodType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines the id method to automatically generate ids for this table. +This attribute has 3 possible values, they are: + +- idbroker + Torque's software based id broker system +- native + The SQL Server's native autoincrement / identifier process +- none + Don't try to auto assign id numbers + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="abstract" use="optional" type="xs:boolean" + default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Whether or not to generate the class as Abstract or not + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="javaName" type="javaNameType" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +This is the Java class name to use when generating the table. If +this is missing the Java name is generated from the name attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="skipSql" use="optional" type="xs:boolean" + default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Whether or not to skip SQL generation for this reference. Useful for using +Views or creating a "subset" of columns in an existing table. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="description" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +A description of this table. Used for documentation and will be included in +the table generation SQL if the server type supports this. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + column element definition + ===================================== --> + <xs:complexType name="columnType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The column element and its relevant attributes + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="option" type="optionType" minOccurs="0" + maxOccurs="unbounded" /> + <xs:element name="inheritance" type="inheritanceType" minOccurs="0" + maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Define an inheritance mapping of records to class by a key column. See the +inheritance How To document. + </xs:documentation> + </xs:annotation> + </xs:element> + + </xs:sequence> + <xs:attribute name="name" type="sqlNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The column name + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" use="optional" type="sqlDataType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The SQL data type for the column. Is required unless a domain is used. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="size" type="xs:decimal" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The size of the field. E.g. Varchar(size) or Numeric(Size). Note that +while this still supports the original torque use of using a +decimal number (5.2) to indicate the precision +and scale in one attribute. Use of the scale attribute is preferred. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="scale" type="xs:integer" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The scale of the field. E.g.decimal(size, scale) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="default" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The default column value + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="useDatabaseDefaultValue" type="xs:boolean" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Whether to use the database default value if a new object is saved +and the attribute value is equal to the java default value. Default is false. +Has no effect on primitive boolean columns. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="primaryKey" use="optional" + type="xs:boolean" default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Whether this column is part of the table's primary key. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="autoIncrement" use="optional" + type="xs:boolean" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Whether or not to auto-increment this field (true or false, defaults to false) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="required" use="optional" type="xs:boolean" + default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Whether a value is required in this column (NULL ALLOWED) (true or false, +defaults to false) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="javaName" type="javaNameType" + use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The Java property name to use for this column in the record objects. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="javaType" use="optional" + type="javaReturnType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines if the record object property getter / setters will +use objects (e.g. Integer) or primitives (e.g. int), defaults +to database attribute or primitive + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="domain" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The domain reference name to set common settings. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="inheritance" type="inheritanceAttrType" use="optional" + default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The inheritance method used (see inheritance documentation) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="protected" use="optional" + type="xs:boolean" default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +If true, the setters and getters for this property will be protected rather +than public. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="version" use="optional" + type="xs:boolean" default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +If true, this column is used as a version number for optimistic locking. +I.e. for updates, Torque will check that the version number in the database +is equal to the version number of the supplied object +and it will automatically increase the version number of the updated row. +Setting version to true will only work for numeric columns and will produce +code that does not compile if applied to other column types. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="description" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The description of this domain for documentation purposes. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + inheritance element definition + ===================================== --> + <xs:complexType name="inheritanceType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +Define an inheritance mapping of records to class by a key column. See the +inheritance How To document. + </xs:documentation> + </xs:annotation> + <xs:attribute name="key" type="xs:string" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +A value found in the column marked as the inheritance key column + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="class" type="javaNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The class name for the object that will inherit the record values + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="extends" type="javaQualifiedNameType" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The class that the inheritor class will extend + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + foreign-key element definition + ===================================== --> + <xs:complexType name="foreignKeyType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Define a foreign key constraint for this table. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="option" type="optionType" minOccurs="0" + maxOccurs="unbounded" /> + <xs:element name="reference" type="referenceType" maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Define a mapping between a local column containing a foreign key value and +the foreign table column. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="sqlNameType" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The name used to create the foreign key constraint. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="foreignTable" type="sqlQualifiedNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The name of the table that contains the foreign key + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="onDelete" use="optional" type="cascadeType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The action to take when the referenced value in foreignTable is deleted. +Note this is handled by the database server and not Torque code. Will not +work if the DB server does not support this. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="onUpdate" use="optional" type="cascadeType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The action to take when the referenced value in foreignTable is updated. +Note this is handled by the database server and not Torque code. Will not +work if the DB server does not support this. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + reference element definition + ===================================== --> + <xs:complexType name="referenceType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Define a mapping between a local column containing a foreign key value and +the foreign table column. + </xs:documentation> + </xs:annotation> + <xs:attribute name="foreign" type="sqlNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The column in the foreign table that contains the key. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="local" type="sqlNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The column in this table that contains the foreign key. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + index element definition + ===================================== --> + <xs:complexType name="indexType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines an index for this table. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="option" type="optionType" minOccurs="0" + maxOccurs="unbounded" /> + <xs:element name="index-column" type="indexColumnType" + maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Define a column to use in a table index. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="sqlNameType" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The name used in creating this index in the database. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + reference element definition + ===================================== --> + <xs:complexType name="indexColumnType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Define a column to use in a table index. + </xs:documentation> + </xs:annotation> + <xs:attribute name="name" type="sqlNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +A column name to use in this index. Must exist in the table. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + unique element definition + ===================================== --> + <xs:complexType name="uniqueType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +Define a unique value constraint + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="option" type="optionType" minOccurs="0" + maxOccurs="unbounded" /> + <xs:element name="unique-column" type="uniqueColumnType" + maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Specify a column to use in the unique constraint. + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="sqlNameType" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The name to use in defining this constraint. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + unique-column element definition + ===================================== --> + <xs:complexType name="uniqueColumnType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Specify a column to use in the unique constraint. + </xs:documentation> + </xs:annotation> + <xs:attribute name="name" type="sqlNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The name to use in defining this constraint. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + id-method-parameter element definition + ===================================== --> + <xs:complexType name="idMethodParameterType"> + <xs:attribute name="name" type="xs:string" use="optional" + default="default" /> + <xs:attribute name="value" type="xs:string" + use="required" /> + </xs:complexType> + +<!-- ===================================== + view element definition + ===================================== --> + <xs:complexType name="viewType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The view element and its relevant attributes. + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="option" type="optionType" minOccurs="0" + maxOccurs="unbounded" /> + <xs:element name="column" type="viewColumnType" maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The column element and its relevant attributes + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="name" type="sqlNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The name of the SQL view. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="baseClass" type="javaQualifiedNameType" use="optional"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The fully qualified class that the generated Java view +record objects will extend. This class does not have to extend +org.apache.torque.om.BaseObject. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="basePeer" type="javaQualifiedNameType" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The fully qualified class that the generated Java Peer objects will extend. +Unlike baseClass, basePeer should extend BasePeer at some point in the chain, +i.e. it needs to be the superclass. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="abstract" use="optional" type="xs:boolean" + default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Whether or not to generate the class as Abstract or not + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="javaName" type="javaNameType" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +This is the Java class name to use when generating the view. If +this is missing the Java name is generated from the name attribute. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="sqlSuffix" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The remainder of the sql for the view after column definitions. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="createSql" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The complete SQL for creating the view. Overrides all other means +of generating the SQL for view creation. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="skipSql" use="optional" type="xs:boolean" + default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Whether or not to skip SQL generation for this reference. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="description" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +A description of this view. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + +<!-- ===================================== + view column element definition + ===================================== --> + <xs:complexType name="viewColumnType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The column element and its relevant attributes + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="option" type="optionType" minOccurs="0" + maxOccurs="unbounded" /> + <xs:element name="inheritance" type="inheritanceType" minOccurs="0" + maxOccurs="unbounded" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Define an inheritance mapping of records to class by a key column. See the +inheritance How To document. + </xs:documentation> + </xs:annotation> + </xs:element> + + </xs:sequence> + <xs:attribute name="name" type="sqlNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The column name + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="type" use="required" type="sqlDataType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +The SQL Standard data type for the column + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="size" type="xs:decimal" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The size of the field. E.g. Varchar(size) or Numeric(Size). Note that +while this still supports the original torque use of using a +decimal number (5.2) to indicate the precision +and scale in one attribute. Use of the scale attribute is preferred. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="scale" type="xs:integer" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The scale of the field. E.g.decimal(size, scale) + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="javaName" type="javaNameType" + use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The Java property name to use for this column in the record objects. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="javaType" use="optional" + type="javaReturnType" > + <xs:annotation> + <xs:documentation xml:lang="en"> +Defines if the record object property getter / setters will +use objects (e.g. Integer) or primitives (e.g. int), defaults +to database attribute or primitive + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="domain" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The domain reference name to set common settings. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="select" type="sqlQualifiedNameType" use="required" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The sql snippet which contains the value to select. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="protected" use="optional" + type="xs:boolean" default="false" > + <xs:annotation> + <xs:documentation xml:lang="en"> +If true, the setters and getters for this property will be protected rather +than public. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="description" type="xs:string" use="optional" > + <xs:annotation> + <xs:documentation xml:lang="en"> +The description of this column for documentation purposes. + </xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> +<!-- ===================================== + Type definitions for attributes + ===================================== --> + + <xs:simpleType name="sqlDataType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +Standard SQL column data types. + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="BIT" /> + <xs:enumeration value="TINYINT" /> + <xs:enumeration value="SMALLINT" /> + <xs:enumeration value="INTEGER" /> + <xs:enumeration value="BIGINT" /> + <xs:enumeration value="FLOAT" /> + <xs:enumeration value="REAL" /> + <xs:enumeration value="NUMERIC" /> + <xs:enumeration value="DECIMAL" /> + <xs:enumeration value="CHAR" /> + <xs:enumeration value="VARCHAR" /> + <xs:enumeration value="LONGVARCHAR" /> + <xs:enumeration value="DATE" /> + <xs:enumeration value="TIME" /> + <xs:enumeration value="TIMESTAMP" /> + <xs:enumeration value="BINARY" /> + <xs:enumeration value="VARBINARY" /> + <xs:enumeration value="LONGVARBINARY" /> + <xs:enumeration value="NULL" /> + <xs:enumeration value="OTHER" /> + <xs:enumeration value="JAVA_OBJECT" /> + <xs:enumeration value="DISTINCT" /> + <xs:enumeration value="STRUCT" /> + <xs:enumeration value="ARRAY" /> + <xs:enumeration value="BLOB" /> + <xs:enumeration value="CLOB" /> + <xs:enumeration value="REF" /> + <xs:enumeration value="BOOLEANINT" /> + <xs:enumeration value="BOOLEANCHAR" /> + <xs:enumeration value="DOUBLE" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="idMethodType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +A schema type for methods to create ids automatically. + +idbroker = Torque's software based id broker system +native = The SQL Server's native method, depends on database used + (e.g. autoincrement for MySQL, sequence for postgresql...) +none = Don't try to auto assign id numbers + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="idbroker" /> + <xs:enumeration value="native" /> + <xs:enumeration value="none" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="javaReturnType"> + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="object" /> + <xs:enumeration value="primitive" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="cascadeType" > + <xs:restriction base="xs:NMTOKEN"> + <xs:enumeration value="cascade" /> + <xs:enumeration value="setnull" /> + <xs:enumeration value="restrict" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="inheritanceAttrType"> + <xs:restriction base="xs:string"> + <xs:enumeration value="single" /> + <xs:enumeration value="false" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="javaNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +Java identifiers, e.g. [A-Za-z_$]A-Za-z_$0-9]* + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"/> + </xs:simpleType> + + <xs:simpleType name="javaQualifiedNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +Java fully qualified names (e.g. x.y.x) + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"/> + </xs:simpleType> + + <xs:simpleType name="sqlNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +SQL Standard non-delimited identifiers. + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + + <xs:simpleType name="sqlQualifiedNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> +SQL Standard non-delimited identifiers. + </xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string" /> + </xs:simpleType> + +</xs:schema> \ No newline at end of file Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-0.xsd ------------------------------------------------------------------------------ svn:eol-style = native Added: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-1-strict.xsd URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-1-strict.xsd?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-1-strict.xsd (added) +++ db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-1-strict.xsd Fri Jan 10 11:38:13 2020 @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you 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. +--> +<!-- + Torque XML database schema DTD + $Id: database-4-0-strict.xsd 1622915 2014-09-06 19:21:17Z tfischer $ +--> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://db.apache.org/torque/4.1/templates/database" + xmlns="http://db.apache.org/torque/4.1/templates/database" + elementFormDefault="qualified" + version="4.1"> + + <xs:annotation> + <xs:documentation xml:lang="en"> +The XML schema used by version 4.1 and greater of the Apache Software +Foundation Torque project( +<a href="http://db.apache.org/torque">http://db.apache.org/torque</a> ) +to model SQL database information. +This model restricts the available characters in java names and sql names +as compared to the standard database.xsd + </xs:documentation> + </xs:annotation> + + <xs:redefine schemaLocation="http://db.apache.org/torque/torque-4.1/documentation/orm-reference/database-4-1.xsd"> + <xs:simpleType name="javaNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> + Java identifiers, e.g. [A-Za-z_$]A-Za-z_$0-9]* + </xs:documentation> + </xs:annotation> + <xs:restriction base="javaNameType"> + <xs:pattern value="[A-Za-z_$][A-Za-z_$0-9]*" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="javaQualifiedNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> + Java fully qualified names (e.g. x.y.x) + </xs:documentation> + </xs:annotation> + <xs:restriction base="javaQualifiedNameType"> + <xs:pattern + value="([A-Za-z_$][A-Za-z_$0-9]*[.])*[A-Za-z_$][A-Za-z_$0-9]*" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="sqlNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> + SQL Standard non-delimited identifiers. + </xs:documentation> + </xs:annotation> + <xs:restriction base="sqlNameType"> + <xs:pattern value="[A-Za-z$#][A-Za-z_$#0-9]*" /> + </xs:restriction> + </xs:simpleType> + + <xs:simpleType name="sqlQualifiedNameType"> + <xs:annotation> + <xs:documentation xml:lang="en"> + SQL Standard non-delimited identifiers. + </xs:documentation> + </xs:annotation> + <xs:restriction base="sqlQualifiedNameType"> + <xs:pattern value="[A-Za-z$#][A-Za-z_$#0-9]*(\.[A-Za-z$#][A-Za-z_$#0-9]*)?" /> + </xs:restriction> + </xs:simpleType> + </xs:redefine> + +</xs:schema> \ No newline at end of file Propchange: db/torque/torque4/trunk/torque-ant-tasks/src/test/torqueJDBC2SchemaTaskTest/src/main/xsd/database-4-1-strict.xsd ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org