[cvs] Expresso commit by mtraum: removed depreciations and organize imports

JCorporate Ltd jcorp at jcorp2.servlets.net
Mon Oct 11 23:50:14 PDT 2004


Log Message:
-----------
removed depreciations and organize imports

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj:
        Schema.java

Revision Data
-------------
Index: Schema.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/Schema.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/Schema.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/Schema.java -u -r1.43 -r1.44
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/Schema.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/Schema.java
@@ -64,11 +64,21 @@
 
 package com.jcorporate.expresso.core.dbobj;
 
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+
 import com.jcorporate.expresso.core.controller.Controller;
 import com.jcorporate.expresso.core.controller.ControllerException;
 import com.jcorporate.expresso.core.db.DBException;
-import com.jcorporate.expresso.core.db.TableCreator;
-import com.jcorporate.expresso.core.db.TypeMapper;
 import com.jcorporate.expresso.core.i18n.Messages;
 import com.jcorporate.expresso.core.job.Job;
 import com.jcorporate.expresso.core.misc.ConfigContext;
@@ -87,13 +97,6 @@
 import com.jcorporate.expresso.kernel.util.FastStringBuffer;
 import com.jcorporate.expresso.services.controller.RegistrationFactory;
 import com.jcorporate.expresso.services.dbobj.Setup;
-import com.jcorporate.expresso.services.html.HtmlException;
-import com.jcorporate.expresso.services.html.Page;
-import com.jcorporate.expresso.services.html.ReportPage;
-import org.apache.log4j.Logger;
-
-import java.net.URL;
-import java.util.*;
 
 
 /**
@@ -185,51 +188,6 @@
     } /* Schema() */
 
     /**
-     * Get the ExpressoToSQL Map
-     *
-     * @param dataContext The database context to retrieve the values for.
-     * @return A hashtable getting this context's ExpressoToSQL maps.
-     * @deprecated Use TypeMapper.getInstance(dbKey).getExpressoToSQLMap() instead
-     */
-    public static Hashtable getExpressoToSQLMap(String dataContext) {
-        try {
-            return new Hashtable(TypeMapper.getInstance(dataContext).getExpressoToSQLMap());
-        } catch (DBException ex) {
-            log.error("Error getting Expresso To SQL Map", ex);
-            return null;
-        }
-    } /* getExpressoToSQLMap(String) */
-
-
-    /**
-     * Return a java.sql.Types integer that maps to the field type listed
-     * @param dataContext the data context to retrieve
-     * @param fieldType the type of the field to map.
-     * @return a DoubleOrderedMap containing all the type mappings for this context
-     * @throws DBException if there was an error initializing the ExpressoToSQL maps.
-     * @deprecated Use TypeMapper.getInstance(dbKey).getJavaSQLType(fieldType) instead
-     */
-    public static synchronized int getJavaSQLType(String dataContext, String fieldType) throws DBException {
-        return TypeMapper.getInstance(dataContext).getJavaSQLType(fieldType);
-    }
-
-    /**
-     * Get the SQL to Database type Map
-     *
-     * @param  dataContext The database context to retrieve the values for.
-     * @return A hashtable getting this context's SqlToDB map.
-     * @deprecated Use TypeMapper.getInstance(dbKey).getSQLToDBMap(fieldType) instead
-     */
-    public static Hashtable getSQLToDBMap(String dataContext) {
-        try {
-            return new Hashtable(TypeMapper.getInstance(dataContext).getSQLToDBMap());
-        } catch (DBException ex) {
-            log.error("Error getting SQL to DB Map", ex);
-            return null;
-        }
-    } /* getSQLToDBMap(String) */
-
-    /**
      * Method to add a dbobject to the list of dbobjects in this schema
      * @param dbobjectClass the class name of the DBObject that you want to add.
      *
@@ -343,34 +301,6 @@
     }
 
     /**
-     * Add a new Controller object to this schema
-     *
-     * @param    oneController    New transaction object to add as a member to this
-     *                        schema
-     * @throws    DBException If the object cannot be added
-     * @deprecated See the addController(Class) method instead
-     */
-    public synchronized void add(Controller oneController)
-            throws DBException {
-        addController(oneController.getClass().getName(), "default");
-    } /* add(Controller) */
-
-
-    /**
-     * Add a new ReportPage to this schema
-     *
-     * @param    oneReport    A new ReportPage object to add as a member of this
-     *                        Schema
-     * @throws    DBException If the object cannot be added
-     * @deprecated See addReportPage(String) method instead
-     */
-    public synchronized void add(ReportPage oneReport)
-            throws DBException {
-        addReportPage(oneReport.getClass().getName());
-    } /* add(ReportPage) */
-
-
-    /**
      * Add a new report page to the schema.
      * @param reportClass the class of the report.  Usually obtained by typing
      * out the class name and adding ".class" at the end.  Example:
@@ -393,44 +323,19 @@
     }
 
     /**
-     * Add a new ReportPage to this schema
-     *
-     * @param reportClassName The class name of a "ReportPage" object that is
-     *          part of this schema
-     * @param categoryName the navigation category to add this report page to.
-     * @deprecated  Since Expresso 5.3 Category is no longer supported
-     */
-    public synchronized void addReportPage(String reportClassName,
-                                           String categoryName) {
-        addReportPage(reportClassName);
-    } /* addReportPage(String) */
-
-    /**
      * Add a new Job object to this schema
      *
      * @param    oneJob    New job object to add as a member to this
      *                        schema
      * @throws    DBException If the object cannot be added
+     * 
+     * @deprecated See the addJob(Class) method instead since Expresso 5.6
      */
     public synchronized void add(Job oneJob)
             throws DBException {
         getDef().addJob(oneJob.getClass().getName());
     } /* add(Job) */
 
-
-    /**
-     * method of adding a job to the default category.  Call by
-     * writing:
-     * <code>addController(&quot;your.class.here.<b>class</b>&quot;);
-     * @param c the class of the controller that you want to add.  If you mis-type
-     * your controller name, the compiler will catch it at compile time.
-     * @param unused
-     * @deprecated Categories are no longer supported since Expresso 5.3
-     */
-    protected synchronized void addJob(Class c, String unused) {
-        getDef().addJob(c.getName());
-    }
-
     /**
      * method of adding a job to the specified category.  Call by
      * writing:
@@ -443,55 +348,6 @@
     }
 
     /**
-     * Add a job to the default category
-     * @param jobClassName the Job classname to use.
-     * @deprecated Use addJob(class) instead
-     */
-    public synchronized void addJob(String jobClassName) {
-        StringUtil.assertNotBlank(jobClassName,
-                "Job class name may not be blank");
-        getDef().addJob(jobClassName);
-    }
-
-    /**
-     * Add a new Job object to this Schema
-     *
-     * @param jobClassName the Job classname to use.
-     * @param unused
-     * @deprecated Categories are no longer supported since Expresso 5.3
-     */
-    public synchronized void addJob(String jobClassName, String unused) {
-        getDef().addJob(jobClassName);
-    } /* addJob(String) */
-
-    /**
-     * Adds a Servlet to the schema.
-     *
-     * @deprecated See addServlet(Class) method instead
-     * @param   oneServlet An instantiated Servlet to use
-     * @throws  DBException If there's an error adding the servlet to the schema
-     * @deprecated use addServlet(Class) instead
-     */
-    public synchronized void add(StdServlet oneServlet)
-            throws DBException {
-        getDef().addServlet(oneServlet.getClass().getName());
-    } /* add(StdServlet) */
-
-
-    /**
-     * New method of adding a servlet to the default category.  Call by
-     * writing:
-     * <code>addController(&quot;your.class.here.<b>class</b>&quot;);
-     * @param c the class of the controller that you want to add.  If you mis-type
-     * your controller name, the compiler will catch it at compile time.
-     * @param unused
-     * @deprecated category name parameter is no longer supported
-     */
-    protected synchronized void addServlet(Class c, String unused) {
-        getDef().addJob(c.getName());
-    }
-
-    /**
      * New method of adding a servlet to the specified category.  Call by
      * writing:
      * <code>addController(&quot;your.class.here.<b>class</b>&quot;);
@@ -503,70 +359,6 @@
     }
 
     /**
-     * Adds a servlet to this schema
-     * @param servletClassName The class name of the servlet to add.
-     * @deprecated use addServlet(Class) instead
-     */
-    public synchronized void addServlet(String servletClassName) {
-        StringUtil.assertNotBlank(servletClassName,
-                "Servlet class name may not be blank");
-        getDef().addServlet(servletClassName);
-    }
-
-    /**
-     * Add a StdServlet object to this Schema
-     *
-     * @param   servletClassName The name of the servlet class to add
-     * @param unused
-     * @deprecated since Expresso 5.3  category name is not supported
-     */
-    public synchronized void addServlet(String servletClassName,
-                                        String unused) {
-        StringUtil.assertNotBlank(servletClassName,
-                "Servlet class name may not be blank");
-        getDef().addServlet(servletClassName);
-    } /* addServlet(String) */
-
-    /**
-     * Add a new DBObject to this schema
-     *
-     * @param    oneMember    New database object to add as a member to this
-     *                        schema
-     * @throws    DBException If the object cannot be added
-     * @deprecated See the addDBObject(Class) method instead Since Expresso 5.0
-     */
-    public synchronized void add(DBObject oneMember)
-            throws DBException {
-        addDBObject(oneMember.getClass().getName(), null, "default");
-    } /* add(DBObject) */
-
-
-    /**
-     * No longer does anything... simply here for folks that still have legacy
-     * code
-     * @param string1 No-op
-     * @param string2 No-op
-     * @deprecated since Expresso 5.1
-     */
-    public void addCategory(String string1, String string2) {
-        return;
-    }
-
-    /**
-     * Add a new DBObject to this schema with an explicit otherDB Mapping
-     *
-     * @param    oneMember    New database object to add as a member to this
-     *                        schema
-     * @param otherDBName The other db context that this data object should be mapped to
-     * @throws    DBException If the object cannot be added
-     * @deprecated See the addDBObject(String) method instead since Expresso 5.3
-     */
-    public synchronized void add(DBObject oneMember, String otherDBName)
-            throws DBException {
-        addDBObject(oneMember.getClass().getName(), otherDBName, "default");
-    } /* add(DBObject) */
-
-    /**
      * Add a new setup value to this schema
      *
      * @param    schemaClass    Class name of this schema
@@ -629,24 +421,6 @@
         addSetup(getClass().getName(), setupCode, descrip, defaultValue);
     }
 
-
-    /**
-     * Try to do a search on each DBObject member - if we fail
-     * we know the table does not exist. Create it
-     *
-     * @param   dbName The database context to create the tables.
-     * @throws    DBException If the create process fails
-     * @return A Vector containing the created dbObjects
-     * @deprecated Use TableCreator.getInstance().createAsNeeded(this,dbName);
-     * @see com.jcorporate.expresso.core.db.TableCreator
-     */
-    public Vector createAsNeeded(String dbName)
-            throws DBException {
-
-        return TableCreator.getInstance().createAsNeeded(this, dbName);
-    } /* createAsNeeded(String) */
-
-
     /**
      * Return the list of configuration values required by this schema
      *
@@ -683,35 +457,6 @@
     } /* getConfig() */
 
     /**
-     * Return an enumeration of the Controller objects that are members of this
-     * schema. We only store a list of the names of the objects, so they must
-     * each be instantiated first.
-     * @deprecated  Since Expresso 5.3 use getControllerList() instead.
-     * @return Enumeration List of Controller objects that belong to
-     * this schema
-     */
-    public Enumeration getControllers() {
-        Vector theControllers = new Vector(4);
-        String oneControllerName = null;
-        Controller oneController = null;
-
-        for (Iterator ee = getDef().getControllers(); ee.hasNext();) {
-            oneControllerName = (String) ee.next();
-
-            try {
-                oneController = ConfigManager.getControllerFactory().getController(oneControllerName);
-                theControllers.addElement(oneController);
-            } catch (Exception e) {
-                log.error("Unable to instantiate controller '" +
-                        oneControllerName + "'", e);
-            }
-        } /* for each controller listed */
-
-
-        return theControllers.elements();
-    } /* getControllers() */
-
-    /**
      * Return a list of the Controller objects that are members of this
      * schema. Controllers are instantiated if not already cached.  However, since ControllerFactory caches
      * the instances, performance of calls after the initial call is faster
@@ -1009,29 +754,6 @@
     }
 
     /**
-     * Perform any additional setup/intialize functions required
-     * by this schema. This is where applications can set up default
-     * values for lookup tables, reference values, etc.
-     * Subclass does not extend this method if it is not needed.
-     *
-     * @param    myPage    The HTML to output in-progress messages to
-     * @param   dbName The database context to execute this process against.
-     * @throws  DBException If there's a database communication error
-     * @throws  HtmlException If your system puts mal-formed HTML into the Page
-     * element.
-     * @deprecated since Expresso 5.1 use otherSetup(InstallLog,String) instead
-     */
-    public synchronized void otherSetup(Page myPage, String dbName)
-            throws DBException, HtmlException {
-
-        // To maintain backwards compatibility, if the subclass does not
-        // implement this signature, simply call the one without the "Page"
-        // parameter
-        otherSetup(dbName);
-    } /* otherSetup(Page, String) */
-
-
-    /**
      * preferable way of performaing other setup.  Utilizes the context independant
      * logging system.
      * @param installLog the InstallLog implementation that the setup process
@@ -1190,55 +912,6 @@
         return Messages.getStringByPath(getMessageBundlePath(), language,
                 country, stringCode, args);
     } /* getString(String) */
-
-    /**
-     * Create the table needed by this DB Object in the database. Assumes it is
-     * not there already. This method is used by the Schema object when called
-     * from the DBCreate servlet to initialize a database to match the defined
-     * DB objects in a schema.
-     *
-     * @param   dbObj The Instantiated Database Object to check against.
-     * @throws    DBException If there's an error creating the table with the
-     * database
-     * @deprecated Use TableCreator.getInstance().createTable(DBObj) instead
-     * @see com.jcorporate.expresso.core.db.TableCreator
-     */
-    public synchronized void createTable(DBObject dbObj)
-            throws DBException {
-        TableCreator.getInstance().createTable(dbObj);
-    } /* createTable(DBObject) */
-
-
-    /**
-     * Map a type used in Expresso to an appropriate database-specific type,
-     * utilizing the default type mapping followed by the custom type
-     * mapping(s) for this context (if any)
-     *
-     * @param   dbName  The database context to check against.
-     * @param   expressoType The java.sql datatype to check against.
-     * @throws  DBException If there's an getting the datatype.
-     * @return The appropriate datatype for this database context.
-     * @deprecated use TypeMapper.getInstance(dbName).getTypeForDB(String) instead
-     */
-    public static String typeForDB(String dbName, String expressoType)
-            throws DBException {
-
-        return TypeMapper.getInstance(dbName).getTypeForDB(expressoType);
-    } /* typeForDB(String, String) */
-
-    /**
-     * Map a type used in SQL to an appropriate expresso-specific type
-     *
-     * @param   dbName  The database context to check against.
-     * @param   sqlType The java.sql datatype to check against.
-     * @throws  DBException If there's an getting the datatype.
-     * @return The appropriate datatype from this database context.
-     * @deprecated use TypeMapper.getInstance(dbName).getTypeForExpresso(int) instead
-     */
-    public static String typeForExpresso(String dbName, int sqlType)
-            throws DBException {
-        return TypeMapper.getInstance(dbName).getTypeForExpresso(sqlType);
-    } /* typeForExpresso(String, int) */
 
     /**
      * <p>Method to return the current version number of an application Schema.


More information about the cvs mailing list