mpoeschl    2002/07/02 09:18:09

  Modified:    src/java/org/apache/torque/adapter DBFactory.java
  Added:       src/templates/sql/load/axion val.vm row.vm
               src/templates/sql/id-table idtable.axion
               src/templates/sql/db-init/axion createdb.vm
               src/templates/sql/base/axion index.vm foreignkey.vm table.vm
                        tablefk.vm unique.vm db.props drop.vm primarykey.vm
                        columns.vm
               src/java/org/apache/torque/adapter DBAxion.java
               profile  axion.profile
  Log:
  add support for axion.tigris.org
  there are some problems to be solved (on both sides)
  the testbed fails at the moment ... database creation works
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-torque/src/templates/sql/load/axion/val.vm
  
  Index: val.vm
  ===================================================================
  #if($column.Column.TorqueType=="VARCHAR" || 
$column.Column.TorqueType=="LONGVARCHAR"|| 
$column.Column.TorqueType=="DATE")'$column.Value'#else$column.Value#end
  
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/load/axion/row.vm
  
  Index: row.vm
  ===================================================================
  INSERT INTO $row.Table.Name (##
  #set ($comma="")#foreach($col in 
$row.ColumnValues)$comma${col.Column.Name}#set($comma=",")#end)
      VALUES (#set ($comma="")#foreach($col in 
$row.ColumnValues)$comma${generator.parse("sql/load/hypersonic/val.vm", "", "column", 
$col)}#set ($comma=",")#end);
      
  
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/id-table/idtable.axion
  
  Index: idtable.axion
  ===================================================================
  #foreach ($tbl in $tables)
  insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES 
($initialID, '$tbl.Name', 1000, 10);
  #set ( $initialID = $initialID + 1 )
  #end
  
  
  
  1.1                  
jakarta-turbine-torque/src/templates/sql/db-init/axion/createdb.vm
  
  Index: createdb.vm
  ===================================================================
  
  
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/base/axion/index.vm
  
  Index: index.vm
  ===================================================================
  #foreach ($index in $table.Indices)
  CREATE #if($index.Unique)UNIQUE#end INDEX $index.Name ON $table.Name 
($index.ColumnList);
  #end
  
  
  
  1.1                  
jakarta-turbine-torque/src/templates/sql/base/axion/foreignkey.vm
  
  Index: foreignkey.vm
  ===================================================================
  #foreach ($fk in $table.ForeignKeys)
  ##    FOREIGN KEY ($fk.LocalColumnNames) REFERENCES $fk.ForeignTableName 
($fk.ForeignColumnNames),
  #end
  
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/base/axion/table.vm
  
  Index: table.vm
  ===================================================================
  
  -----------------------------------------------------------------------------
  -- $table.Name
  -----------------------------------------------------------------------------
  ##$generator.parse("$basepath/drop.vm", "", "table", $tbl)
  CREATE TABLE $table.Name
  (
  #set ( $cols = $generator.parse("$basepath/columns.vm", "", "table", $tbl) )
  #set ( $pk = $generator.parse("$basepath/primarykey.vm", "", "table", $tbl) )
  ##set ( $fk = $generator.parse("$basepath/foreignkey.vm", "", "table", $tbl) )
  #set ( $unique = $generator.parse("$basepath/unique.vm", "", "table", $tbl) )
  #set ( $index = $generator.parse("$basepath/index.vm", "", "table", $tbl) )
  #if($strings.allEmpty([$pk,$fk,$unique,$index]))$strings.chop($cols,2)#else$cols#end
  #if($strings.allEmpty([$fk,$unique,$index]) && 
$pk.length()>0)$strings.chop($pk,2)#else$pk#end
  ##if($strings.allEmpty([$unique,$index]) && $fk.length() 
>0)$strings.chop($fk,2)#else$fk#end
  #if($unique.length()>0)$strings.chop($unique,2)#else$unique#end
  
  );
  
  #if($index.length() > 0)$strings.chop($index,1)#end
  
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/base/axion/tablefk.vm
  
        <<Binary file>>
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/base/axion/unique.vm
  
  Index: unique.vm
  ===================================================================
  #foreach ($unique in $table.Unices)
  ##    UNIQUE ($unique.ColumnList),
  #end
  
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/base/axion/db.props
  
  Index: db.props
  ===================================================================
  # JDBC to Axion mappings.
  
  BIT = BIT
  TINYINT = TINYINT
  SMALLINT = SMALLINT
  INTEGER = INTEGER
  BIGINT = BIGINT
  FLOAT = FLOAT
  REAL = REAL
  DOUBLE = DOUBLE
  NUMERIC = NUMERIC
  DECIMAL = INTEGER
  CHAR = VARCHAR
  VARCHAR = varchar
  LONGVARCHAR = VARCHAR
  DATE = date
  TIME = time
  TIMESTAMP = timestamp
  BINARY = BINARY
  VARBINARY = BINARY
  LONGVARBINARY = LONGVARBINARY
  NULL = NULL
  OTHER = OTHER
  JAVA_OBJECT =
  DISTINCT =
  STRUCT =
  ARRAY =
  BLOB =
  CLOB =
  REF =
  
  AUTOINCREMENT = IDENTITY
  NOTNULL = NOT NULL
  
  primaryKeyInsideTableDirective = true
  indexInsideTableDirective = false
  
  removeNotNullWithAutoIncrement = false
  
  suppressDefaults = true
  
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/base/axion/drop.vm
  
  Index: drop.vm
  ===================================================================
  drop table if exists $table.Name;
  
  
  
  1.1                  
jakarta-turbine-torque/src/templates/sql/base/axion/primarykey.vm
  
  Index: primarykey.vm
  ===================================================================
  #if ($table.hasPrimaryKey())
  ##    PRIMARY KEY($table.printPrimaryKey()),
  #end
  
  
  
  1.1                  jakarta-turbine-torque/src/templates/sql/base/axion/columns.vm
  
  Index: columns.vm
  ===================================================================
  #foreach ($col in $table.Columns)
      #set ( $type = $dbprops.get($col.Type) )
      #set ( $size = $col.printSize() )
      #set ( $default = $col.DefaultSetting )
      #set ( $nullString = $strings.select($col.isNotNull(), 
$dbprops.get("NOTNULL"),"") )
      #set ( $autoIncrement = $strings.select($col.isAutoIncrement(), 
$dbprops.get("AUTOINCREMENT"),"") )
      #set ( $entry = "$col.Name $type $autoIncrement," )
      $strings.sub($strings.collapseSpaces($entry)," ,",",")
  #end
  
  
  
  1.29      +3 -1      
jakarta-turbine-torque/src/java/org/apache/torque/adapter/DBFactory.java
  
  Index: DBFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/adapter/DBFactory.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DBFactory.java    24 Jun 2002 18:12:19 -0000      1.28
  +++ DBFactory.java    2 Jul 2002 16:18:09 -0000       1.29
  @@ -170,6 +170,7 @@
           driverToAdapterMap.put("com.sybase.jdbc.SybDriver", "DBSybase");
           driverToAdapterMap.put("com.sybase.jdbc2.jdbc.SybDriver", "DBSybase");
           driverToAdapterMap.put("weblogic.jdbc.pool.Driver", "DBWeblogic");
  +        driverToAdapterMap.put("org.axiondb.jdbc.AxionDriver", "DBAxion");
   
           // add some short names to be used when drivers are not used
           driverToAdapterMap.put("as400", "DBDB2400");
  @@ -186,6 +187,7 @@
           driverToAdapterMap.put("sapdb", "DBSapDB");
           driverToAdapterMap.put("sybase", "DBSybase");
           driverToAdapterMap.put("weblogic", "DBWeblogic");
  +        driverToAdapterMap.put("axion", "DBAxion");
       }
   
       /**
  
  
  
  1.1                  
jakarta-turbine-torque/src/java/org/apache/torque/adapter/DBAxion.java
  
  Index: DBAxion.java
  ===================================================================
  package org.apache.torque.adapter;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. 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.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Turbine" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
   * ITS 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.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.sql.Connection;
  import java.sql.SQLException;
  
  /**
   * This is used to connect to Hypersonic SQL databases.
   *
   * <a href="http://axion.tigris.org";>http://axion.tigris.org</a>
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Poeschl</a>
   * @version $Id: DBAxion.java,v 1.1 2002/07/02 16:18:09 mpoeschl Exp $
   */
  public class DBAxion extends DB
  {
      /**
       * Constructor.
       */
      protected DBAxion()
      {
      }
  
      /**
       * This method is used to ignore case.
       *
       * @param in The string to transform to upper case.
       * @return The upper case string.
       */
      public String toUpperCase(String in)
      {
          return in;
      }
  
      /**
       * This method is used to ignore case.
       *
       * @param in The string whose case to ignore.
       * @return The string in a case that can be ignored.
       */
      public String ignoreCase(String in)
      {
          return in;
      }
  
      /**
       * @see org.apache.torque.adapter.DB#getIDMethodType()
       */
      public String getIDMethodType()
      {
          return NO_ID_METHOD;
      }
  
      /**
       * @see org.apache.torque.adapter.DB#getIDMethodSQL(Object obj)
       */
      public String getIDMethodSQL(Object obj)
      {
          return null;
      }
  
      /**
       * Locks the specified table.
       *
       * @param con The JDBC connection to use.
       * @param table The name of the table to lock.
       * @exception SQLException No Statement could be created or executed.
       */
      public void lockTable(Connection con, String table) throws SQLException
      {
      }
  
      /**
       * Unlocks the specified table.
       *
       * @param con The JDBC connection to use.
       * @param table The name of the table to unlock.
       * @exception SQLException No Statement could be created or executed.
       */
      public void unlockTable(Connection con, String table) throws SQLException
      {
      }
  }
  
  
  
  1.1                  jakarta-turbine-torque/profile/axion.profile
  
  Index: axion.profile
  ===================================================================
  # location of jar that you will be using for testing
  # so that it can be copied into the dist/lib directory.
  
  torque.testDatabaseJar = ${lib.repo}/axiondb-1.0-dev.jar
  torque.idMethod = idbroker
  torque.defaultDatabase = bookstore
  
  torque.sqlTest.defaultDatabase = sqltest
  torque.sqlTest.databaseUrl = jdbc:axiondb:sqltest:target/test
  
  lib.dir = ../lib
  
  # -------------------------------------------------------------------
  #
  # T O R Q U E  C O N F I G U R A T I O N  F I L E
  #
  # -------------------------------------------------------------------
  
  project = bookstore
  
  # -------------------------------------------------------------------
  #
  #  T A R G E T  D A T A B A S E
  #
  # -------------------------------------------------------------------
  
  database = axion
  
  # -------------------------------------------------------------------
  #
  #  O B J E C T  M O D E L  I N F O R M A T I O N
  #
  # -------------------------------------------------------------------
  # These settings will allow you to customize the way your
  # Peer-based object model is created.
  # -------------------------------------------------------------------
  # addSaveMethod=true adds tracking code to determine how to save objects
  #
  # addGetByNameMethod=true adds methods to get fields by name/position
  #
  # complexObjectModel=true generates an om with collection support
  #
  # addTimeStamp=true puts time stamps in generated files
  #
  # addIntakeRetrievable=implement Intake's Retrievable interface
  # -------------------------------------------------------------------
  
  targetPackage=org.apache.torque.test
  basePrefix=Base
  addSaveMethod=true
  addGetByNameMethod=true
  complexObjectModel=true
  addTimeStamp=true
  addIntakeRetrievable=false
  useManagers=true
  
  # -------------------------------------------------------------------
  #
  #  D A T A B A S E  S E T T I N G S
  #
  # -------------------------------------------------------------------
  # JDBC connection settings. This is used by the JDBCToXML task that
  # will create an XML database schema from JDBC metadata. These
  # settings are also used by the SQL Ant task to initialize your
  # Turbine system with the generated SQL.
  # -------------------------------------------------------------------
  
  createDatabaseUrl = jdbc:axiondb:sqltest:target/test
  buildDatabaseUrl = jdbc:axiondb:sqltest:target/test
  databaseUrl = jdbc:axiondb:sqltest:target/test
  databaseDriver = org.axiondb.jdbc.AxionDriver
  databaseUser = sa
  databasePassword =
  databaseHost = 127.0.0.1
  
  # Tells JDBC task that javaName attribute for the tables and columns
  # should be made same as SQL name.
  sameJavaName=false
  
  # -------------------------------------------------------------------
  #
  #  D O C U M E N T A T I O   S E T T I N G S
  #
  # -------------------------------------------------------------------
  # These settings will allow you to customize the way your schema
  # documentation is created.
  # Valid formats are: html, anakia (for use with jakarta-site2)
  # -------------------------------------------------------------------
  documentationFormat=html
  
  # -------------------------------------------------------------------
  # You should NOT have to edit anything below here.
  # -------------------------------------------------------------------
  
  # -------------------------------------------------------------------------
  # The values for the ID_TABLE_ID column in the ID_TABLE start
  # at 101 for tables used in projects.
  # -------------------------------------------------------------------------
  initialID = 101
  
  # -------------------------------------------------------------------
  #
  #  T E M P L A T E  P A T H
  #
  # -------------------------------------------------------------------
  
  templatePath = ../templates
  
  # -------------------------------------------------------------------
  #
  #  C O N T R O L  T E M P L A T E S
  #
  # -------------------------------------------------------------------
  
  SQLControlTemplate = sql/base/Control.vm
  OMControlTemplate = om/Control.vm
  idTableControlTemplate = sql/id-table/Control.vm
  DataDTDControlTemplate = data/Control.vm
  DataDumpControlTemplate = data/dump/Control.vm
  DataSQLControlTemplate = sql/load/Control.vm
  DocControlTemplate = doc/Control.vm
  
  # -------------------------------------------------------------------
  #
  #  O U T P U T  D I R E C T O R Y
  #
  # -------------------------------------------------------------------
  
  outputDirectory=src
  
  # -------------------------------------------------------------------
  #
  #  S C H E M A  D I R E C T O R Y
  #
  # -------------------------------------------------------------------
  
  schemaDirectory=schema
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to