Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

DatabaseBackendSchemaConstants.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Nicolas Modrzyk.
00022  * Contributor(s): 
00023  */
00024 
00025 package org.objectweb.cjdbc.controller.backend;
00026 
00027 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags;
00028 
00029 /**
00030  * Mapping for dynamic schema gathering and validation
00031  * 
00032  * @author <a href="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
00033  */
00034 public abstract class DatabaseBackendSchemaConstants
00035 {
00036   /** Static level no dynamic schema */
00037   public static final int DynamicPrecisionStatic     = 0;
00038   /** Table level for dynamic schema */
00039   public static final int DynamicPrecisionTable      = 1;
00040   /** Column level for dynamic schema */
00041   public static final int DynamicPrecisionColumn     = 2;
00042   /** procedures names level for dynamic schema */
00043   public static final int DynamicPrecisionProcedures = 3;
00044   /** All level for dynamic schema, procedures parameters are retrieved */
00045   public static final int DynamicPrecisionAll        = 4;
00046 
00047   /**
00048    * Get the dynamic schema level from string to int
00049    * 
00050    * @param stringLevel as a string from <code>DatabaseXmlTags</code>
00051    * @return an int
00052    */
00053   public static int getDynamicSchemaLevel(String stringLevel)
00054   {
00055     if (stringLevel.equalsIgnoreCase(DatabasesXmlTags.VAL_static))
00056       return DynamicPrecisionStatic;
00057     else if (stringLevel.equalsIgnoreCase(DatabasesXmlTags.VAL_table))
00058       return DynamicPrecisionTable;
00059     else if (stringLevel.equalsIgnoreCase(DatabasesXmlTags.VAL_column))
00060       return DynamicPrecisionColumn;
00061     else if (stringLevel.equalsIgnoreCase(DatabasesXmlTags.VAL_procedures))
00062       return DynamicPrecisionProcedures;
00063     else if (stringLevel.equalsIgnoreCase(DatabasesXmlTags.VAL_all))
00064       return DynamicPrecisionAll;
00065     else
00066       throw new IllegalArgumentException("Invalid dynamic precision "
00067           + stringLevel);
00068   }
00069 
00070   /**
00071    * Get the dynamic schema level from int to string
00072    * 
00073    * @param intLevel as an int
00074    * @return string taken from <code>DatabaseXmlTags</code>
00075    */
00076   public static String getDynamicSchemaLevel(int intLevel)
00077   {
00078     switch (intLevel)
00079     {
00080       case DynamicPrecisionStatic :
00081         return DatabasesXmlTags.VAL_static;
00082       case DynamicPrecisionTable :
00083         return DatabasesXmlTags.VAL_table;
00084       case DynamicPrecisionColumn :
00085         return DatabasesXmlTags.VAL_column;
00086       case DynamicPrecisionProcedures :
00087         return DatabasesXmlTags.VAL_procedures;
00088       case DynamicPrecisionAll :
00089         return DatabasesXmlTags.VAL_all;
00090       default :
00091         return DatabasesXmlTags.VAL_all;
00092     }
00093   }
00094 }

Generated on Mon Apr 11 22:01:31 2005 for C-JDBC by  doxygen 1.3.9.1