Bug 40475

Summary: [PATCH] Eliminate hardcoded database vendor type enumeration in WebSphereDeploymentTool.java
Product: Ant Reporter: Mark DePalma <mark_depalma>
Component: Optional TasksAssignee: Ant Notifications List <notifications>
Status: RESOLVED FIXED    
Severity: normal Keywords: PatchAvailable
Priority: P3    
Version: 1.7.0Beta1   
Target Milestone: 1.7.0   
Hardware: All   
OS: All   

Description Mark DePalma 2006-09-11 22:12:26 UTC
The dbVendor field of WebSphereDeploymentTool is currently assigned via a setter
function that takes a member of an enumeration as a parameter.  The problem is
that the enumeration is currently out of date and does not include the latest
codes in WAS 5.1 let alone WAS 6, which eliminates the possibility of database
specific deployment.  Since this is the kind of thing that IBM changes with each
WAS release, I recommend eliminating the enumeration and passing in a String
instead.  If necessary, users can easily determine the available database type
codes by running EJBDeploy -help from the command line.  I've included diff -u
output below that resolves the problem in my environment.

Mark

--- WebsphereDeploymentTool.java	2006-09-11 17:19:58.421875000 -0400
+++ WebsphereDeploymentTool-new.java	2006-09-11 15:13:36.750000000 -0400
@@ -59,19 +59,6 @@
  *
  */
 public class WebsphereDeploymentTool extends GenericDeploymentTool {
-    /**
-     * Enumerated attribute with the values for the database vendor types
-     *
-     */
-    public static class DBVendor extends EnumeratedAttribute {
-        public String[] getValues() {
-            return new String[]{
-                "SQL92", "SQL99", "DB2UDBWIN_V71", "DB2UDBOS390_V6",
"DB2UDBAS400_V4R5",
-                "ORACLE_V8", "INFORMIX_V92", "SYBASE_V1192", "MSSQLSERVER_V7",
"MYSQL_V323"
-                };
-        }
-    }
-
 
     public static final String PUBLICID_EJB11
          = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
@@ -160,18 +147,18 @@
 
 
     /** Sets the DB Vendor for the Entity Bean mapping ; optional.
-     * Valid options are for example:
-     * <ul>
-     * <li>SQL92</li> <li>SQL99</li> <li>DB2UDBWIN_V71</li>
-     * <li>DB2UDBOS390_V6</li> <li>DB2UDBAS400_V4R5</li> <li>ORACLE_V8</li>
-     * <li>INFORMIX_V92</li> <li>SYBASE_V1192</li> <li>MYSQL_V323</li>
-     * </ul>
+     * Valid options can be obtained by running the following command:
+     *
+     * <WAS_HOME>/bin/EJBDeploy.[sh/bat] -help:
+     *
      * This is also used to determine the name of the Map.mapxmi and
-     * Schema.dbxmi files, for example Account-DB2UDBWIN_V71-Map.mapxmi
-     * and Account-DB2UDBWIN_V71-Schema.dbxmi.
+     * Schema.dbxmi files, for example Account-DB2UDB_V81-Map.mapxmi
+     * and Account-DB2UDB_V81-Schema.dbxmi.
+     *
+     * @param dbVendor database vendor type
      */
-    public void setDbvendor(DBVendor dbvendor) {
-        this.dbVendor = dbvendor.getValue();
+    public void setDbvendor(String dbvendor) {
+        this.dbVendor = dbvendor;
     }
Comment 1 Antoine Levy-Lambert 2006-09-13 01:37:32 UTC
Patch submitted, thanks.