diff --git a/docs/manual/OptionalTasks/BorlandEJBTasks.html b/docs/manual/OptionalTasks/BorlandEJBTasks.html new file mode 100644 index 000000000..79aaf7e0a --- /dev/null +++ b/docs/manual/OptionalTasks/BorlandEJBTasks.html @@ -0,0 +1,100 @@ + + +
+ +The BorlandDeployTool is a vendor specifc nested element for the Ejbjar optionaltask. +
BorlandDeploymentTool is dedicated to the Borland Application Server 4.5. It + generates and compiles the stubs and skeletons for all ejb described into the + Deployement Descriptor, builds the jar file including the support files and + verify whether the produced jar is valid or not. +
| Attribute | +Description | +Required | +
| destdir | +The base directory into which the generated borland + ready jar files are deposited | +yes | +
| debug | +If true, turn on the debug mode for each borland + tools (java2iiop, iastool ...) default = false | +no | +
| verify | +If true, turn on the verification at the end + of the jar production (default = false) | +no | +
| verifyargs | +extra parameter for verify command | +no | +
| suffix | +String value appended to the basename of the + deployment descriptor to create the filename of the Borland EJB jar file. | +No, defaults to '-ejb.jar'. | +
| basdtd | +Deprecated. Defines the location of the
+ weblogic-ejb-jar DTD which covers the Borland specific deployment descriptors.
+ This should not be necessary if you have borland in your classpath. If you
+ do not, you should use a nested |
+ no | +
| ejbdtd | +Deprecated. Defines the location of the
+ ejb-jar DTD in the weblogic class hierarchy. This should not be necessary
+ if you have weblogic in your classpath. If you do not, you should use a
+ nested |
+ no | +
| generateclient | +If true, turn on the generation of the corresponding + ejbjar (default = false) | +no | +
The following build.xml snippit is an example of how to use Borland element + into the ejbjar task +
<ejbjar srcdir="${build.classes}" basejarname="vsmp" descriptordir="${rsc.dir}/hrmanager">
+ <borland destdir="lib" verify="on" generateclient="on">
+ <classpath refid="classpath" />
+ </borland>
+ <include name="**\ejb-jar.xml"/>
+ <support dir="${build.classes}">
+ <include name="demo\*.class"/>
+ <include name="demo\helper\*.class"/>
+ </support>
+ </ejbjar>
+The borland element will generate into the lib dir an ejb jar file using the deployment descriptor placed into the ${rsc.dir}/hrmanager directory.
+The verify phase is turned on and the generate client phase as well.
+
+
+Copyright © 2000,2001 Apache Software Foundation. All rights +Reserved.
+ + + + diff --git a/docs/manual/OptionalTasks/BorlandGenerateClient.html b/docs/manual/OptionalTasks/BorlandGenerateClient.html new file mode 100644 index 000000000..2ee61c31d --- /dev/null +++ b/docs/manual/OptionalTasks/BorlandGenerateClient.html @@ -0,0 +1,56 @@ + + + + +The BorlandGenerateClient is a task dedicated to Borland Application Server + v 4.5. It offers to generate the client jar file corresponding to an ejb jar + file. +
| Attribute | +Description | +Required | +
| ejbjar | +ejb jar file | +yes | +
| debug | +If true, turn on the debug mode for each borland + tools (java2iiop, iastool ...) default = false | +no | +
| clientjar | +client jar file name. If missing the client jar + file name is build using the ejbjar file name: ejbjar = hellobean-ejb.jar + => hellobean-ejbclient.jar | +no | +
The following build.xml snippit is an example of how to use Borland element + into the ejbjar task +
.... +<generateclient ejbjar="lib/secutest-ejb.jar" clientjar="lib/client.jar" debug="true"/> +.... ++
+ +
Copyright © 2000,2001 Apache Software Foundation. All rights +Reserved.
+ + + + diff --git a/docs/manual/OptionalTasks/ejb.html b/docs/manual/OptionalTasks/ejb.html index 3527a3e8d..1282fb3eb 100644 --- a/docs/manual/OptionalTasks/ejb.html +++ b/docs/manual/OptionalTasks/ejb.html @@ -35,12 +35,16 @@ to support additional EJB Servers.| Task | Application Servers | |
| ddcreator | Weblogic 4.5.1 | |
| ejbc | Weblogic 4.5.1 | |
| wlrun | Weblogic 4.5.1, 5.1 & 6.0 | |
| wlstop | Weblogic 4.5.1, 5.1 & 6.0 | |
| ejbjar | Weblogic 5.1 & 6.0 | |
| Task | Application Servers | |
| blgenclient | Borland Application Server 4.5 | |
| ddcreator | Weblogic 4.5.1 | |
| ejbc | Weblogic 4.5.1 | |
| ejbjar | Nested Elements | |
| weblogic | Weblogic 5.1 & 6.0 | |
| borland | Borland Application Server 4.5 | |
| wlrun | Weblogic 4.5.1, 5.1 & 6.0 | |
| wlstop | Weblogic 4.5.1, 5.1 & 6.0 | |
The weblogic element is used to control the weblogic.ejbc compiler for
diff --git a/src/main/org/apache/tools/ant/taskdefs/defaults.properties b/src/main/org/apache/tools/ant/taskdefs/defaults.properties
index db7569b10..2a1289672 100644
--- a/src/main/org/apache/tools/ant/taskdefs/defaults.properties
+++ b/src/main/org/apache/tools/ant/taskdefs/defaults.properties
@@ -94,6 +94,7 @@ sound=org.apache.tools.ant.taskdefs.optional.sound.SoundTask
junitreport=org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator
vsslabel=org.apache.tools.ant.taskdefs.optional.vss.MSVSSLABEL
vsshistory=org.apache.tools.ant.taskdefs.optional.vss.MSVSSHISTORY
+blgenclient=org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient
# deprecated ant tasks (kept for back compatibility)
javadoc2=org.apache.tools.ant.taskdefs.Javadoc
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
index 0c21cabf2..30aa3723b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
@@ -52,6 +52,7 @@
*
@@ -98,6 +100,7 @@ import org.xml.sax.*; * </support> * </ejbjar> *+ * @author Benoit Moussaud * */ public class BorlandDeploymentTool extends GenericDeploymentTool @@ -125,7 +128,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool protected static final String VERIFY = "com.inprise.ejb.util.Verify"; /** Instance variable that stores the suffix for the borland jarfile. */ - private String jarSuffix = ".jar"; + private String jarSuffix = "-ejb.jar"; /** Instance variable that stores the location of the borland DTD file. */ private String borlandDTD; @@ -137,6 +140,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool /** Instance variable that determines whether the debug mode is on */ private boolean java2iiopdebug = false; + /** Instance variable that determines whetger the client jar file is generated */ + private boolean generateclient = false; /** Instance variable that determines whether it is necessary to verify the produced jar */ private boolean verify = true; private String verifyArgs = ""; @@ -156,7 +161,6 @@ public class BorlandDeploymentTool extends GenericDeploymentTool } - /** * Setter used to store the suffix for the generated borland jar file. * @param inString the string to use as the suffix. @@ -168,9 +172,9 @@ public class BorlandDeploymentTool extends GenericDeploymentTool /** * sets some additional args to send to verify command + * @param args addtions command line parameters */ - public void setVerifyArgs(String args) - { + public void setVerifyArgs(String args) { this.verifyArgs = args; } @@ -193,28 +197,35 @@ public class BorlandDeploymentTool extends GenericDeploymentTool this.ejb11DTD = inString; } + /** + * setter used to store whether the task will include the generate client task. + * (see : BorlandGenerateClient task) + */ + public void setGenerateclient(boolean b) { + this.generateclient = b; + } + protected void registerKnownDTDs(DescriptorHandler handler) { handler.registerDTD(PUBLICID_EJB11, DEFAULT_BAS45_EJB11_DTD_LOCATION); } protected DescriptorHandler getBorlandDescriptorHandler(final File srcDir) { - DescriptorHandler handler = - new DescriptorHandler(getTask(), srcDir) { - protected void processElement() { - if (currentElement.equals("type-storage")) { - // Get the filename of vendor specific descriptor - String fileNameWithMETA = currentText; - //trim the META_INF\ off of the file name - String fileName = fileNameWithMETA.substring(META_DIR.length(), - fileNameWithMETA.length() ); - File descriptorFile = new File(srcDir, fileName); - - ejbFiles.put(fileNameWithMETA, descriptorFile); - } - } + DescriptorHandler handler = + new DescriptorHandler(getTask(), srcDir) { + protected void processElement() { + if (currentElement.equals("type-storage")) { + // Get the filename of vendor specific descriptor + String fileNameWithMETA = currentText; + //trim the META_INF\ off of the file name + String fileName = fileNameWithMETA.substring(META_DIR.length(), + fileNameWithMETA.length() ); + File descriptorFile = new File(srcDir, fileName); + + ejbFiles.put(fileNameWithMETA, descriptorFile); + } + } }; - handler.registerDTD(PUBLICID_BORLAND_EJB, borlandDTD == null ? DEFAULT_BAS_DTD_LOCATION : borlandDTD); @@ -232,35 +243,30 @@ public class BorlandDeploymentTool extends GenericDeploymentTool protected void addVendorFiles(Hashtable ejbFiles, String baseName) { File borlandDD = new File(getConfig().descriptorDir,META_DIR+BAS_DD); - if (borlandDD.exists()) - { + if (borlandDD.exists()) { log("Borland specific file found "+ borlandDD, Project.MSG_VERBOSE); ejbFiles.put(META_DIR + BAS_DD, borlandDD); } - else - { + else { log("Unable to locate borland deployment descriptor. It was expected to be in " + borlandDD.getPath(), Project.MSG_WARN); return; } - } /** * Get the vendor specific name of the Jar that will be output. The modification date * of this jar will be checked against the dependent bean classes. */ - File getVendorOutputJarFile(String baseName) - { - return new File(getDestDir(), baseName + jarSuffix); + File getVendorOutputJarFile(String baseName) { + return new File(getDestDir(), baseName + jarSuffix); } /** * Verify the produced jar file by invoking the Borland verify tool * @param sourceJar java.io.File representing the produced jar file */ - private void verifyBorlandJar(File sourceJar) - { + private void verifyBorlandJar(File sourceJar) { org.apache.tools.ant.taskdefs.Java javaTask = null; log("verify "+sourceJar,Project.MSG_INFO); try { @@ -283,14 +289,39 @@ public class BorlandDeploymentTool extends GenericDeploymentTool log("Calling "+VERIFY+" for " + sourceJar.toString(), Project.MSG_VERBOSE); javaTask.execute(); } - catch (Exception e) - { + catch (Exception e) { //TO DO : delete the file if it is not a valid file. String msg = "Exception while calling "+VERIFY+" Details: " + e.toString(); throw new BuildException(msg, e); } + } + /** + * Generate the client jar corresponding to the jar file passed as paremeter + * the method uses the BorlandGenerateClient task. + * @param sourceJar java.io.File representing the produced jar file + */ + private void generateClient(File sourceJar) { + getTask().getProject().addTaskDefinition("internal_bas_generateclient", + org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class); + org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null; + log("generate client for "+sourceJar,Project.MSG_INFO); + try { + String args = verifyArgs; + args += " "+sourceJar.getPath(); + + gentask = (BorlandGenerateClient) getTask().getProject().createTask("internal_bas_generateclient"); + gentask.setEjbjar(sourceJar); + gentask.setDebug(java2iiopdebug); + gentask.setTaskName("generate client"); + gentask.execute(); + } + catch (Exception e) { + //TO DO : delete the file if it is not a valid file. + String msg = "Exception while calling "+VERIFY+" Details: " + e.toString(); + throw new BuildException(msg, e); + } } /** @@ -299,16 +330,17 @@ public class BorlandDeploymentTool extends GenericDeploymentTool * @param ithomes : iterator on home class * @param files : file list , updated by the adding generated files */ - private void buildBorlandStubs(Iterator ithomes,Hashtable files ) - { + private void buildBorlandStubs(Iterator ithomes,Hashtable files ) { org.apache.tools.ant.taskdefs.ExecTask execTask = null; - File java2iiopOut = new File("java2iiop.log"); - try - { + //File java2iiopOut = new File("java2iiop.log"); + File java2iiopOut = null; + try { + java2iiopOut = File.createTempFile("java2iiop","log"); + log(" iiop log file : "+ java2iiopOut ,Project.MSG_DEBUG); + execTask = (ExecTask) getTask().getProject().createTask("exec"); execTask.setOutput(java2iiopOut); - if ( java2iiopdebug ) - { + if ( java2iiopdebug ) { execTask.createArg().setValue("-VBJdebug"); } // end of if () @@ -319,14 +351,15 @@ public class BorlandDeploymentTool extends GenericDeploymentTool execTask.createArg().setPath(getCombinedClasspath()); //list file execTask.createArg().setValue("-list_files"); + //no TIE classes + execTask.createArg().setValue("-no_tie"); //root dir execTask.createArg().setValue("-root_dir"); execTask.createArg().setValue(getConfig().srcDir.getAbsolutePath()); //compiling order execTask.createArg().setValue("-compile"); //add the home class - while ( ithomes.hasNext()) - { + while ( ithomes.hasNext()) { execTask.createArg().setValue(ithomes.next().toString()); } // end of while () log("Calling java2iiop",Project.MSG_VERBOSE); @@ -338,15 +371,12 @@ public class BorlandDeploymentTool extends GenericDeploymentTool throw new BuildException(msg, e); } - try - { + try { FileReader fr = new FileReader(java2iiopOut); LineNumberReader lnr = new LineNumberReader(fr); String javafile; - while ( ( javafile = lnr.readLine()) != null) - { - if ( javafile.endsWith(".java") ) - { + while ( ( javafile = lnr.readLine()) != null) { + if ( javafile.endsWith(".java") ) { String classfile = toClassFile(javafile); String key = classfile.substring(getConfig().srcDir.getAbsolutePath().length()+1); @@ -357,11 +387,13 @@ public class BorlandDeploymentTool extends GenericDeploymentTool } // end of while () lnr.close(); } - catch(Exception e) - { + catch(Exception e) { String msg = "Exception while parsing java2iiop output. Details: " + e.toString(); throw new BuildException(msg, e); } + + //delete the output , only if all is succesfull + java2iiopOut.delete(); } /** @@ -369,16 +401,14 @@ public class BorlandDeploymentTool extends GenericDeploymentTool * filenames/java.io.Files in the Hashtable stored on the instance variable * ejbFiles. */ - protected void writeJar(String baseName, File jarFile, Hashtable files, - String publicId) throws BuildException { + protected void writeJar(String baseName, File jarFile, Hashtable files, String publicId) + throws BuildException { //build the home classes list. Vector homes = new Vector(); Iterator it = files.keySet().iterator(); - while ( it.hasNext()) - { + while ( it.hasNext()) { String clazz = (String) it.next(); - if ( clazz.endsWith("Home.class") ) - { + if ( clazz.endsWith("Home.class") ) { //remove .class extension String home = toClass(clazz); homes.add(home); @@ -390,19 +420,20 @@ public class BorlandDeploymentTool extends GenericDeploymentTool super.writeJar(baseName, jarFile, files, publicId); - if ( verify ) - { + if ( verify ) { verifyBorlandJar(jarFile); } // end of if () - + + if ( generateclient) { + generateClient(jarFile); + } // end of if () } /** * convert a class file name : A/B/C/toto.class * into a class name: A.B.C.toto */ - protected String toClass(String filename) - { + private String toClass(String filename) { //remove the .class String classname = filename.substring(0,filename.lastIndexOf(".class")); classname = classname.replace('\\','.'); @@ -413,8 +444,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool * convert a file name : A/B/C/toto.java * into a class name: A/B/C/toto.class */ - protected String toClassFile(String filename) - { + private String toClassFile(String filename) { //remove the .class String classfile = filename.substring(0,filename.lastIndexOf(".java")); classfile = classfile+".class"; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java new file mode 100644 index 000000000..69f58f0a3 --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java @@ -0,0 +1,172 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + *