antoine 2003/05/29 08:35:26
Modified: docs/manual/OptionalTasks ejb.html
src/main/org/apache/tools/ant/taskdefs/optional/ejb
EjbJar.java JbossDeploymentTool.java
. WHATSNEW
Log:
Adds functionality that makes jboss element look for jbosscmp-jdbc.xml
descriptor if ejbjar has cmpversion="2.0" set
PR: 14709
Submitted by: Rob van Oostrum (rvanoo at xs4all dot nl)
Revision Changes Path
1.34 +21 -3 ant/docs/manual/OptionalTasks/ejb.html
Index: ejb.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/OptionalTasks/ejb.html,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ejb.html 19 Mar 2003 13:49:18 -0000 1.33
+++ ejb.html 29 May 2003 15:35:25 -0000 1.34
@@ -19,6 +19,7 @@
<li>Conor MacNeill</li>
<li>Cyrille Morvan (<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>)</li>
<li>Greg Nelson (<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>)</li>
+ <li>Rob van Oostrum(<a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>)</li>
</ul>
<p>Version @VERSION@<br>
@@ -717,6 +718,13 @@
<td valign="top" align="center">Yes</td>
</tr>
<tr>
+ <td valign="top">cmpversion</td>
+ <td valign="top">Either <code>1.0</code> or <code>2.0</code>.<br/>
+ Default is <code>1.0</code>.<br/>
+ A CMP 2.0 implementation exists currently only for JBoss.</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
<td valign="top">naming</td>
<td valign="top">Controls the naming convention used to name generated
EJB jars. Please refer to the description above.</td>
@@ -844,8 +852,18 @@
<h3><a name="ejbjar_jboss">Jboss element</a></h3>
<p>The jboss element searches for the JBoss specific deployment descriptors
and adds them
-to the final ejb jar file. JBoss has two deployment descriptors jboss.xml
and jaws.xml
-(for container manager persistence only). The JBoss server uses hot
deployment and does
+to the final ejb jar file. JBoss has two deployment descriptors:
+<ul><li>jboss.xml</li>
+<li>for container manager persistence:<br/>
+<table border="1">
+<tr><td><b>CMP version</b></td><td><b>File name</b></td></tr>
+<tr><td>CMP 1.0</td><td>jaws.xml</td></tr>
+<tr><td>CMP 2.0</td><td>jbosscmp-jdbc.xml</td></tr>
+</table>
+</li>
+</ul>
+<br/>
+. The JBoss server uses hot deployment and does
not require compilation of additional stubs and skeletons.</p>
<table border="1" cellpadding="2" cellspacing="0">
1.40 +54 -3
ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java
Index: EjbJar.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- EjbJar.java 10 Feb 2003 14:13:49 -0000 1.39
+++ EjbJar.java 29 May 2003 15:35:25 -0000 1.40
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -91,7 +91,8 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Tim Fennell</a>
* @author Conor MacNeill
- */
+ * @author <a href="mailto:[EMAIL PROTECTED]">Rob van Oostrum</a>
+ * */
public class EjbJar extends MatchingTask {
/**
@@ -202,6 +203,21 @@
}
/**
+ * CMP versions supported
+ * valid CMP versions are 1.0 and 2.0
+ * @since ant 1.6
+ */
+ public static class CMPVersion extends EnumeratedAttribute {
+ public static final String CMP1_0 = "1.0";
+ public static final String CMP2_0 = "2.0";
+ public String[] getValues() {
+ return new String[]{
+ CMP1_0,
+ CMP2_0,
+ };
+ }
+ }
+ /**
* The config which is built by this task and used by the various
deployment
* tools to access the configuration of the ejbjar task
*/
@@ -219,10 +235,12 @@
/** Instance variable that stores the suffix for the generated jarfile.
*/
private String genericJarSuffix = "-generic.jar";
+ /** Instance variable that stores the CMP version for the jboss jarfile.
*/
+ private String cmpVersion = CMPVersion.CMP1_0;
+
/** The list of deployment tools we are going to run. */
private ArrayList deploymentTools = new ArrayList();
-
/**
* Add a deployment tool to the list of deployment tools that will be
* processed
@@ -444,6 +462,15 @@
}
}
+ /**
+ * Gets the destination directory.
+ *
+ * @return destination directory
+ * @since ant 1.6
+ */
+ public File getDestdir() {
+ return this.destDir;
+ }
/**
* Set the destination directory. The EJB jar files will be written into
@@ -460,6 +487,29 @@
}
/**
+ * Gets the CMP version.
+ *
+ * @return CMP version
+ * @since ant 1.6
+ */
+ public String getCmpversion() {
+ return this.cmpVersion;
+ }
+
+ /**
+ * Sets the CMP version.
+ *
+ * @param version CMP version.
+ * Must be either <code>1.0</code> or <code>2.0</code>.<br/>
+ * Default is <code>1.0</code>.<br/>
+ * Initially, only the JBoss implementation does something specific for
CMP 2.0.<br/>
+ * @since ant 1.6
+ */
+ public void setCmpversion( CMPVersion version ) {
+ this.cmpVersion = version.getValue();
+ }
+
+ /**
* Set the classpath to use when resolving classes for inclusion in the
jar.
*
* @param classpath the classpath to use.
@@ -599,6 +649,7 @@
throw new BuildException(msg, pce);
}
} // end of execute()
+
}
1.11 +29 -5
ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java
Index: JbossDeploymentTool.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JbossDeploymentTool.java 17 Feb 2003 09:07:34 -0000 1.10
+++ JbossDeploymentTool.java 29 May 2003 15:35:25 -0000 1.11
@@ -55,6 +55,7 @@
import java.io.File;
import java.util.Hashtable;
+import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
/**
@@ -63,12 +64,14 @@
* compilation.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Austin</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Rob van Oostrum</a>
* @version 1.0
* @see EjbJar#createJboss
*/
public class JbossDeploymentTool extends GenericDeploymentTool {
protected static final String JBOSS_DD = "jboss.xml";
- protected static final String JBOSS_CMPD = "jaws.xml";
+ protected static final String JBOSS_CMP10D = "jaws.xml";
+ protected static final String JBOSS_CMP20D = "jbosscmp-jdbc.xml";
/** Instance variable that stores the suffix for the jboss jarfile. */
private String jarSuffix = ".jar";
@@ -93,10 +96,17 @@
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);
+ String descriptorFileName = JBOSS_CMP10D;
+ if ( EjbJar.CMPVersion.CMP2_0.equals( getParent().getCmpversion() )
) {
+ descriptorFileName = JBOSS_CMP20D;
+ }
+ File jbossCMPD = new File(getConfig().descriptorDir, ddPrefix +
descriptorFileName);
+
if (jbossCMPD.exists()) {
- ejbFiles.put(META_DIR + JBOSS_CMPD, jbossCMPD);
+ ejbFiles.put(META_DIR + descriptorFileName, jbossCMPD);
+ } else {
+ log("Unable to locate jboss cmp descriptor. It was expected to
be in " + jbossCMPD.getPath(), Project.MSG_WARN);
+ return;
}
}
@@ -105,6 +115,20 @@
* of this jar will be checked against the dependent bean classes.
*/
File getVendorOutputJarFile(String baseName) {
- return new File(getDestDir(), baseName + jarSuffix);
+ return new File( getParent().getDestdir(), baseName + jarSuffix);
+ }
+
+ /**
+ * Called to validate that the tool parameters have been configured.
+ *
+ * @throws BuildException If the Deployment Tool's configuration isn't
+ * valid
+ * @since ant 1.6
+ */
+ public void validateConfigured() throws BuildException {
+ }
+
+ private EjbJar getParent() {
+ return ( EjbJar ) this.getTask();
}
}
1.432 +6 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.431
retrieving revision 1.432
diff -u -r1.431 -r1.432
--- WHATSNEW 28 May 2003 20:58:03 -0000 1.431
+++ WHATSNEW 29 May 2003 15:35:26 -0000 1.432
@@ -389,6 +389,12 @@
* <junit>'s nested <formatter> elements now support if/unless clauses.
+* <ejbjar>
+ cmpversion attribute added
+ jboss element will look for jbosscmp-jdbc.xml descriptor
+ if ejbjar has cmpversion="2.0" set
+ Bugzilla Reports 14707 and 14709.
+
Changes from Ant 1.5.2 to Ant 1.5.3
===================================