Coverage report

  %line %branch
org.apache.torque.engine.platform.PlatformDefaultImpl
95% 
100% 

 1  
 package org.apache.torque.engine.platform;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2005 The Apache Software Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License")
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.util.Hashtable;
 20  
 import java.util.Iterator;
 21  
 import java.util.Map;
 22  
 
 23  
 import org.apache.torque.engine.database.model.Domain;
 24  
 import org.apache.torque.engine.database.model.SchemaType;
 25  
 
 26  
 
 27  
 /**
 28  
  * Default implementation for the Platform interface.
 29  
  *
 30  
  * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
 31  
  * @version $Id: PlatformDefaultImpl.java 239626 2005-08-24 12:19:51Z henning $
 32  
  */
 33  
 public class PlatformDefaultImpl implements Platform
 34  
 {
 35  
     private Map schemaDomainMap;
 36  
 
 37  
     /**
 38  
      * Default constructor.
 39  
      */
 40  
     public PlatformDefaultImpl()
 41  15
     {
 42  15
         initialize();
 43  15
     }
 44  
 
 45  
     private void initialize()
 46  
     {
 47  15
         schemaDomainMap = new Hashtable(30);
 48  15
         Iterator iter = SchemaType.iterator();
 49  465
         while (iter.hasNext())
 50  
         {
 51  450
             SchemaType type = (SchemaType) iter.next();
 52  450
             schemaDomainMap.put(type, new Domain(type));
 53  
         }
 54  15
         schemaDomainMap.put(SchemaType.BOOLEANCHAR,
 55  
                 new Domain(SchemaType.BOOLEANCHAR, "CHAR"));
 56  15
         schemaDomainMap.put(SchemaType.BOOLEANINT,
 57  
                 new Domain(SchemaType.BOOLEANINT, "INTEGER"));
 58  15
     }
 59  
 
 60  
     protected void setSchemaDomainMapping(Domain domain)
 61  
     {
 62  100
         schemaDomainMap.put(domain.getType(), domain);
 63  100
     }
 64  
 
 65  
     /**
 66  
      * @see Platform#getMaxColumnNameLength()
 67  
      */
 68  
     public int getMaxColumnNameLength()
 69  
     {
 70  33
         return 64;
 71  
     }
 72  
 
 73  
     /**
 74  
      * @see Platform#getNativeIdMethod()
 75  
      */
 76  
     public String getNativeIdMethod()
 77  
     {
 78  10
         return Platform.IDENTITY;
 79  
     }
 80  
 
 81  
     /**
 82  
      * @see Platform#getDomainForJdbcType(SchemaType)
 83  
      */
 84  
     public Domain getDomainForSchemaType(SchemaType jdbcType)
 85  
     {
 86  3448
         return (Domain) schemaDomainMap.get(jdbcType);
 87  
     }
 88  
 
 89  
     /**
 90  
      * @return Only produces a SQL fragment if null values are
 91  
      * disallowed.
 92  
      * @see Platform#getNullString(boolean)
 93  
      */
 94  
     public String getNullString(boolean notNull)
 95  
     {
 96  
         // TODO: Check whether this is true for all DBs.  Also verify
 97  
         // the old Sybase templates.
 98  42
         return (notNull ? "NOT NULL" : "");
 99  
     }
 100  
 
 101  
     /**
 102  
      * @see Platform#getAutoIncrement()
 103  
      */
 104  
     public String getAutoIncrement()
 105  
     {
 106  6
         return "IDENTITY";
 107  
     }
 108  
 
 109  
     /**
 110  
      * @see Platform#hasScale(String)
 111  
      * TODO collect info for all platforms
 112  
      */
 113  
     public boolean hasScale(String sqlType)
 114  
     {
 115  0
         return true;
 116  
     }
 117  
 
 118  
     /**
 119  
      * @see Platform#hasSize(String)
 120  
      * TODO collect info for all platforms
 121  
      */
 122  
     public boolean hasSize(String sqlType)
 123  
     {
 124  33
         return true;
 125  
     }
 126  
 
 127  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.