Hi,

The iPlanet ejbc task does not seem to handle the case where you have a
primary key class as a part of your EJB. 

The primary key class does not get added to the list of files to be
added to the ejb-jar file.

For general use in iPlanet this is fine, since iPlanet does not require
the primary key class for an EJB and if one is not present it assumes a
simple String key. However, if you have a non-String key or a multi-part
key, you need the primary key class.

The GenericDeploymentTool class handles the primary key class, but the
IPlanetDeploymentTool class which overrides the generic one does not.


Index: 
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java,v
retrieving revision 1.3
diff -u -r1.3 IPlanetEjbc.java
--- 
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
    2001/11/27 18:04:52     1.3
+++ 
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
    2001/12/28 14:37:18
@@ -878,6 +878,8 @@
                 currentEjb.setRemote(value);
             } else if (currentLoc.equals(base + "\\ejb-class")) {
                 currentEjb.setImplementation(value);
+            } else if (currentLoc.equals(base + "\\prim-key-class")) {
+                currentEjb.setPrimaryKey(value);
             } else if (currentLoc.equals(base + "\\session-type")) {
                 currentEjb.setBeantype(value);
             } else if (currentLoc.equals(base + "\\persistence-type")) {
@@ -927,6 +929,7 @@
         private Classname  home;              // EJB's home interface name
         private Classname  remote;            // EJB's remote interface name
         private Classname  implementation;      // EJB's implementation class
+        private Classname  primaryKey;        // EJB's primary key class
         private String  beantype = "entity";  // or "stateful" or "stateless"
         private boolean cmp       = false;      // Does this EJB support CMP?
         private boolean iiop      = false;      // Does this EJB support IIOP?
@@ -1004,6 +1007,18 @@
             return implementation;
         }
 
+        public void setPrimaryKey(String primaryKey) {
+            setPrimaryKey(new Classname(primaryKey));
+        }
+
+        public void setPrimaryKey(Classname primaryKey) {
+            this.primaryKey = primaryKey;
+        }
+
+        public Classname getPrimaryKey() {
+            return primaryKey;
+        }
+
         public void setBeantype(String beantype) {
             this.beantype = beantype.toLowerCase();
         }
@@ -1158,6 +1173,7 @@
             File remoteFile;     // File for the remote interface class
             File homeFile;       // File for the home interface class
             File implFile;       // File for the EJB implementation class
+            File pkFile;         // File for the EJB primary key class
 
             /* Check the timestamp on the remote interface */
             remoteFile = remote.getClassFile(buildDir);
@@ -1181,6 +1197,22 @@
             }
             latestModified = Math.max(latestModified, modified);
 
+            /* Check the timestamp of the primary key class */
+            if (primaryKey != null) {
+                pkFile = primaryKey.getClassFile(buildDir);
+                modified = pkFile.lastModified();
+                if (modified == -1) {
+                    System.out.println("The class "
+                                    + primaryKey.getQualifiedClassName() + 
"couldn't be "
+                                    + "found on the classpath");
+                    return -1;
+                }
+                latestModified = Math.max(latestModified, modified);
+            }
+            else {
+                pkFile = null;
+            }
+
             /* Check the timestamp on the EJB implementation class.
              *
              * Note that if ONLY the implementation class has changed, it's not
@@ -1211,6 +1243,12 @@
             pathToFile = pathToFile.replace('.', File.separatorChar) + 
".class";
             ejbFiles.put(pathToFile, implFile);
 
+            if (pkFile != null) {
+                pathToFile = primaryKey.getQualifiedClassName();
+                pathToFile = pathToFile.replace('.', File.separatorChar) + 
".class";
+                ejbFile.put(pathToFile, pkFile);
+            }
+
             return latestModified;
         }
 
@@ -1323,6 +1361,7 @@
                         + "\n\r              home:      " + home
                         + "\n\r              remote:    " + remote
                         + "\n\r              impl:      " + implementation
+                        + "\n\r              primaryKey: " + primaryKey
                         + "\n\r              beantype:  " + beantype
                         + "\n\r              cmp:       " + cmp
                         + "\n\r              iiop:      " + iiop

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

Reply via email to