Index: org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java,v retrieving revision 1.18 diff -u -r1.18 EjbJar.java --- org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java 2001/05/17 11:05:47 1.18 +++ org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java 2001/06/19 14:26:04 @@ -161,6 +161,14 @@ * The list of configured DTD locations */ public ArrayList dtdLocations = new ArrayList(); + + /** + * Instance variable that indicates to derive the EJB's jar + * file name from the tag found in the ejb-jar.xml + * descriptor + */ + public boolean useEjbName = false; + }; private Config config = new Config(); @@ -284,8 +292,24 @@ FileSet supportFileSet = new FileSet(); config.supportFileSets.add(supportFileSet); return supportFileSet; + } + + /** + * Set the useejbname attribute. The useejbname attribute will control + * how the final ejb jar file's name is derived. If this attribute is + * set to 'true' then the name of the ejb jar file will be obtained from + * the tag of the ejb-jar.xml deployment descriptor. + */ + public void setUseejbname(boolean useEjbName) { + config.useEjbName = useEjbName; } - + + /** + * Set the srcdir attribute. The source directory is the directory that contains + * the classes that will be added to the EJB jar. Typically this will include the + * home and remote interfaces and the bean class. + * + * /** * Set the srcdir attribute. The source directory is the directory that contains Index: org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java,v retrieving revision 1.7 diff -u -r1.7 DescriptorHandler.java --- org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java 2001/03/14 01:22:21 1.7 +++ org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java 2001/06/19 14:27:39 @@ -85,6 +85,7 @@ private static final String REMOTE_INTERFACE = "remote"; private static final String BEAN_CLASS = "ejb-class"; private static final String PK_CLASS = "prim-key-class"; + private static final String EJB_NAME = "ejb-name"; /** * Instance variable used to store the name of the current element being @@ -105,6 +106,11 @@ */ protected Hashtable ejbFiles = null; + /** + * Instance variable that stores the value found in the element + */ + protected String ejbName = null; + private Hashtable fileDTDs = new Hashtable(); private Hashtable resourceDTDs = new Hashtable(); @@ -187,6 +193,13 @@ } /** + * Getter method that returns the value of the element. + */ + public String getEjbName() { + return ejbName; + } + + /** * SAX parser call-back method that is used to initialize the values of some * instance variables to ensure safe operation. */ @@ -277,6 +290,13 @@ className += ".class"; classFile = new File(srcDir, className); ejbFiles.put(className, classFile); + } + } + + // Get the value of the tag. Only the first occurence. + if (currentElement.equals(EJB_NAME)) { + if ( ejbName == null ) { + ejbName = currentText.trim(); } } } Index: org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java,v retrieving revision 1.17 diff -u -r1.17 GenericDeploymentTool.java --- org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java 2001/05/01 10:31:47 1.17 +++ org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java 2001/06/19 14:29:29 @@ -164,6 +164,13 @@ } /** + * Returns true, if the the EJB's jar files is deriving it's name from the tag of the ejb-jar.xml descriptor. + */ + protected boolean usingEjbName() { + return config.useEjbName; + } + + /** * Setter used to store the suffix for the generated jar file. * @param inString the string to use as the suffix. */ @@ -486,6 +493,11 @@ // Work out what the base name is if (config.baseJarName != null) { baseName = config.baseJarName; + } else if (config.useEjbName) { + if (handler == null) { + handler = getDescriptorHandler(config.srcDir); + } + baseName = handler.getEjbName(); } else { int lastSeparatorIndex = descriptorFileName.lastIndexOf(File.separator); int endBaseName = -1; Index: org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java,v retrieving revision 1.3 diff -u -r1.3 BorlandDeploymentTool.java --- org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java 2001/04/19 14:02:16 1.3 +++ org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java 2001/06/19 14:33:38 @@ -242,7 +242,10 @@ */ protected void addVendorFiles(Hashtable ejbFiles, String baseName) { - File borlandDD = new File(getConfig().descriptorDir,META_DIR+BAS_DD); + // This method assumes that the ejb-jar.xml descriptor and + // the ejb-inprise.xml descriptor are in the same directory. + + File borlandDD = new File(((File)ejbFiles.get(META_DIR+EJB_DD)).getParentFile(), BAS_DD); if (borlandDD.exists()) { log("Borland specific file found "+ borlandDD, Project.MSG_VERBOSE); ejbFiles.put(META_DIR + BAS_DD, borlandDD); Index: org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java,v retrieving revision 1.1 diff -u -r1.1 JbossDeploymentTool.java --- org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java 2001/05/17 11:05:46 1.1 +++ org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java 2001/06/19 14:34:09 @@ -78,17 +78,24 @@ * EJB Jar. */ protected void addVendorFiles(Hashtable ejbFiles, String baseName) { - String ddPrefix = (usingBaseJarName() ? "" : baseName + getConfig().baseNameTerminator); + File jbossDD = null; + if ( usingBaseJarName() ) { + jbossDD = new File(getConfig().descriptorDir, JBOSS_DD); + } else if ( usingEjbName() ) { + // This assumes the ejb-jar.xml and jboss-ejb-jar.xml files are in the same directory + jbossDD = new File(((File) ejbFiles.get(META_DIR + EJB_DD)).getParentFile(), JBOSS_DD); + } else { + jbossDD = new File(getConfig().descriptorDir, baseName + getConfig().baseNameTerminator + JBOSS_DD); + } - File jbossDD = new File(getConfig().descriptorDir, ddPrefix + JBOSS_DD); if (jbossDD.exists()) { ejbFiles.put(META_DIR + JBOSS_DD, jbossDD); } else { log("Unable to locate jboss deployment descriptor. It was expected to be in " + jbossDD.getPath(), Project.MSG_WARN); return; } - - File jbossCMPD = new File(getConfig().descriptorDir, ddPrefix + JBOSS_CMPD); + + File jbossCMPD = new File(jbossDD.getParentFile(), JBOSS_CMPD); if (jbossCMPD.exists()) { ejbFiles.put(META_DIR + JBOSS_CMPD, jbossCMPD); } Index: org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java,v retrieving revision 1.22 diff -u -r1.22 WeblogicDeploymentTool.java --- org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java 2001/04/19 14:36:11 1.22 +++ org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java 2001/06/19 14:34:47 @@ -298,9 +298,16 @@ * EJB Jar. */ protected void addVendorFiles(Hashtable ejbFiles, String baseName) { - String ddPrefix = (usingBaseJarName() ? "" : baseName + getConfig().baseNameTerminator); - File weblogicDD = new File(getConfig().descriptorDir, ddPrefix + WL_DD); + File weblogicDD = null; + if ( usingBaseJarName() ) { + weblogicDD = new File(getConfig().descriptorDir, WL_DD); + } else if ( usingEjbName() ) { + // This assumes the ejb-jar.xml and weblogic-ejb-jar.xml files are in the same directory + weblogicDD = new File(((File) ejbFiles.get(META_DIR + EJB_DD)).getParentFile(), WL_DD); + } else { + weblogicDD = new File(getConfig().descriptorDir, baseName + getConfig().baseNameTerminator + WL_DD); + } if (weblogicDD.exists()) { ejbFiles.put(META_DIR + WL_DD, @@ -317,7 +324,8 @@ log("Please adjust your weblogic descriptor and set newCMP=\"true\" " + "to use the new CMP descriptor inclusion mechanism. ", Project.MSG_VERBOSE); // The the weblogic cmp deployment descriptor - File weblogicCMPDD = new File(getConfig().descriptorDir, ddPrefix + WL_CMP_DD); + // This assumes the weblogic-ejb-jar.xml and weblogic-cmp-rdbms-jar.xml files are in the same directory + File weblogicCMPDD = new File(weblogicDD.getParentFile(), WL_CMP_DD); if (weblogicCMPDD.exists()) { ejbFiles.put(META_DIR + WL_CMP_DD,