git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@474071 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -505,9 +505,9 @@ public class BorlandDeploymentTool extends GenericDeploymentTool | |||
| public void setProcessInputStream(OutputStream param1) throws IOException { } | |||
| /** | |||
| * | |||
| * @param is | |||
| * @exception java.io.IOException | |||
| * Set the output stream of the process. | |||
| * @param is the input stream. | |||
| * @throws IOException if there is an error. | |||
| */ | |||
| public void setProcessOutputStream(InputStream is) throws IOException { | |||
| try { | |||
| @@ -516,7 +516,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool | |||
| while ((javafile = reader.readLine()) != null) { | |||
| if (javafile.endsWith(".java")) { | |||
| String classfile = toClassFile(javafile); | |||
| String key = classfile.substring(getConfig().srcDir.getAbsolutePath().length() + 1); | |||
| String key = classfile.substring( | |||
| getConfig().srcDir.getAbsolutePath().length() + 1); | |||
| genfiles.put(key, new File(classfile)); | |||
| } | |||
| } | |||
| @@ -527,6 +528,11 @@ public class BorlandDeploymentTool extends GenericDeploymentTool | |||
| } | |||
| } | |||
| /** | |||
| * Set the error stream of the process. | |||
| * @param is the input stream. | |||
| * @throws IOException if there is an error. | |||
| */ | |||
| public void setProcessErrorStream(InputStream is) throws IOException { | |||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | |||
| String s = reader.readLine(); | |||
| @@ -41,6 +41,7 @@ public class BorlandGenerateClient extends Task { | |||
| static final String JAVA_MODE = "java"; | |||
| static final String FORK_MODE = "fork"; | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** debug the generateclient task */ | |||
| boolean debug = false; | |||
| @@ -58,13 +59,19 @@ public class BorlandGenerateClient extends Task { | |||
| /** hold the version */ | |||
| int version = BorlandDeploymentTool.BAS; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * Set the version attribute. | |||
| * @param version the value to use. | |||
| */ | |||
| public void setVersion(int version) { | |||
| this.version = version; | |||
| } | |||
| /** | |||
| * Command launching mode: java or fork. | |||
| * @param s the mode to use. | |||
| */ | |||
| public void setMode(String s) { | |||
| mode = s; | |||
| @@ -72,6 +79,7 @@ public class BorlandGenerateClient extends Task { | |||
| /** | |||
| * If true, turn on the debug mode for each of the Borland tools launched. | |||
| * @param debug a <code>boolean</code> value. | |||
| */ | |||
| public void setDebug(boolean debug) { | |||
| this.debug = debug; | |||
| @@ -79,6 +87,7 @@ public class BorlandGenerateClient extends Task { | |||
| /** | |||
| * EJB JAR file. | |||
| * @param ejbfile the file to use. | |||
| */ | |||
| public void setEjbjar(File ejbfile) { | |||
| ejbjarfile = ejbfile; | |||
| @@ -86,6 +95,7 @@ public class BorlandGenerateClient extends Task { | |||
| /** | |||
| * Client JAR file name. | |||
| * @param clientjar the file to use. | |||
| */ | |||
| public void setClientjar(File clientjar) { | |||
| clientjarfile = clientjar; | |||
| @@ -93,6 +103,7 @@ public class BorlandGenerateClient extends Task { | |||
| /** | |||
| * Path to use for classpath. | |||
| * @param classpath the path to use. | |||
| */ | |||
| public void setClasspath(Path classpath) { | |||
| if (this.classpath == null) { | |||
| @@ -104,6 +115,7 @@ public class BorlandGenerateClient extends Task { | |||
| /** | |||
| * Adds path to the classpath. | |||
| * @return a path to be configured as a nested element. | |||
| */ | |||
| public Path createClasspath() { | |||
| if (this.classpath == null) { | |||
| @@ -114,6 +126,7 @@ public class BorlandGenerateClient extends Task { | |||
| /** | |||
| * Reference to existing path, to use as a classpath. | |||
| * @param r the reference to use. | |||
| */ | |||
| public void setClasspathRef(Reference r) { | |||
| createClasspath().setRefid(r); | |||
| @@ -161,7 +174,10 @@ public class BorlandGenerateClient extends Task { | |||
| } // end of else | |||
| } | |||
| /** launch the generate client using java api */ | |||
| /** | |||
| * launch the generate client using java api. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| protected void executeJava() throws BuildException { | |||
| try { | |||
| if (version == BorlandDeploymentTool.BES) { | |||
| @@ -206,7 +222,10 @@ public class BorlandGenerateClient extends Task { | |||
| } | |||
| } | |||
| /** launch the generate client using system api */ | |||
| /** | |||
| * launch the generate client using system api. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| protected void executeFork() throws BuildException { | |||
| if (version == BorlandDeploymentTool.BAS) { | |||
| executeForkV4(); | |||
| @@ -216,7 +235,10 @@ public class BorlandGenerateClient extends Task { | |||
| } | |||
| } | |||
| /** launch the generate client using system api */ | |||
| /** | |||
| * launch the generate client using system api. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| protected void executeForkV4() throws BuildException { | |||
| try { | |||
| @@ -250,7 +272,11 @@ public class BorlandGenerateClient extends Task { | |||
| } | |||
| } | |||
| /** launch the generate client using system api */ | |||
| /** | |||
| * launch the generate client using system api. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| protected void executeForkV5() throws BuildException { | |||
| try { | |||
| log("mode : fork " + BorlandDeploymentTool.BES, Project.MSG_DEBUG); | |||
| @@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; | |||
| import java.io.File; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.Java; | |||
| import org.apache.tools.ant.taskdefs.MatchingTask; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| @@ -40,10 +40,12 @@ public final class DDCreatorHelper { | |||
| */ | |||
| private File generatedFilesDirectory; | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** | |||
| * The descriptor text files for which a serialised descriptor is to be created. | |||
| */ | |||
| String[] descriptors; | |||
| // CheckStyle:VisibilityModifier ON | |||
| /** | |||
| * The main method. | |||
| @@ -75,6 +75,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| */ | |||
| private int parseState = STATE_LOOKING_EJBJAR; | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** | |||
| * Instance variable used to store the name of the current element being | |||
| * processed by the SAX parser. Accessed by the SAX parser call-back methods | |||
| @@ -106,6 +107,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { | |||
| private boolean inEJBRef = false; | |||
| private Hashtable urlDTDs = new Hashtable(); | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** | |||
| * The directory containing the bean classes and interfaces. This is | |||
| @@ -32,23 +32,26 @@ public interface EJBDeploymentTool { | |||
| * | |||
| * @param descriptorFilename the name of the deployment descriptor | |||
| * @param saxParser a SAX parser which can be used to parse the deployment descriptor. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| void processDescriptor(String descriptorFilename, SAXParser saxParser) | |||
| throws BuildException; | |||
| /** | |||
| * Called to validate that the tool parameters have been configured. | |||
| * | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| void validateConfigured() throws BuildException; | |||
| /** | |||
| * Set the task which owns this tool | |||
| * @param task the task. | |||
| */ | |||
| void setTask(Task task); | |||
| /** | |||
| * Configure this tool for use in the ejbjar task. | |||
| * @param config contains configuration state. | |||
| */ | |||
| void configure(EjbJar.Config config); | |||
| } | |||
| @@ -68,6 +68,7 @@ public class EjbJar extends MatchingTask { | |||
| * This state is passed to the deployment tools for configuration | |||
| */ | |||
| static class Config { | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** | |||
| * Stores a handle to the directory under which to search for class | |||
| * files | |||
| @@ -122,6 +123,7 @@ public class EjbJar extends MatchingTask { | |||
| * The dependency analyzer to use to add additional classes to the jar | |||
| */ | |||
| public String analyzer; | |||
| // CheckStyle:VisibilityModifier ON | |||
| } | |||
| /** | |||
| @@ -169,8 +171,11 @@ public class EjbJar extends MatchingTask { | |||
| * @since ant 1.6 | |||
| */ | |||
| public static class CMPVersion extends EnumeratedAttribute { | |||
| /** 1.0 value */ | |||
| public static final String CMP1_0 = "1.0"; | |||
| /** 2.0 value */ | |||
| public static final String CMP2_0 = "2.0"; | |||
| /** {@inheritDoc}. */ | |||
| public String[] getValues() { | |||
| return new String[]{ | |||
| CMP1_0, | |||
| @@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs.optional.ejb; | |||
| import java.io.File; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.Java; | |||
| import org.apache.tools.ant.taskdefs.MatchingTask; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| @@ -152,6 +151,7 @@ public class Ejbc extends MatchingTask { | |||
| * If true, ejbc will keep the | |||
| * intermediate Java files used to build the class files. | |||
| * This can be useful when debugging. | |||
| * @param newKeepgenerated a boolean as a string. | |||
| */ | |||
| public void setKeepgenerated(String newKeepgenerated) { | |||
| keepgenerated = Boolean.valueOf(newKeepgenerated.trim()).booleanValue(); | |||
| @@ -172,6 +172,7 @@ public class Ejbc extends MatchingTask { | |||
| /** | |||
| * Set the classpath to be used for this compilation. | |||
| * @param s the classpath (as a string) to use. | |||
| */ | |||
| public void setClasspath(String s) { | |||
| this.classpath = FileUtils.translatePath(s); | |||
| @@ -57,15 +57,19 @@ public class EjbcHelper { | |||
| */ | |||
| private File sourceDirectory; | |||
| // CheckStyle:VisibilityModifier OFF - bc | |||
| /** | |||
| * The names of the serialised deployment descriptors | |||
| */ | |||
| String[] descriptors; | |||
| // CheckStyle:VisibilityModifier ON | |||
| private boolean keepGenerated; | |||
| /** | |||
| * Command line interface for the ejbc helper task. | |||
| * @param args command line arguments. | |||
| * @throws Exception if there is a problem. | |||
| */ | |||
| public static void main(String[] args) throws Exception { | |||
| EjbcHelper helper = new EjbcHelper(args); | |||
| @@ -143,7 +147,7 @@ public class EjbcHelper { | |||
| primaryKeyClassPath | |||
| = ((EntityDescriptor) dd).getPrimaryKeyClassName(); | |||
| primaryKeyClassPath | |||
| = primaryKeyClassPath.replace('.', '/') + ".java";; | |||
| = primaryKeyClassPath.replace('.', '/') + ".java"; | |||
| } | |||
| File homeInterfaceSource = new File(sourceDirectory, homeInterfacePath); | |||
| @@ -125,6 +125,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| */ | |||
| private DependencyAnalyzer dependencyAnalyzer; | |||
| /** No arg constructor */ | |||
| public GenericDeploymentTool() { | |||
| } | |||
| @@ -314,6 +315,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| * @param logicalFilename A String representing the name, including | |||
| * all relevant path information, that should be stored for the entry | |||
| * being added. | |||
| * @throws BuildException if there is a problem. | |||
| */ | |||
| protected void addFileToJar(JarOutputStream jStream, | |||
| File inputFile, | |||
| @@ -359,6 +361,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| /** | |||
| * Get a descriptionHandler. | |||
| * @param srcDir the source directory. | |||
| * @return a handler. | |||
| */ | |||
| protected DescriptorHandler getDescriptorHandler(File srcDir) { | |||
| DescriptorHandler h = new DescriptorHandler(getTask(), srcDir); | |||
| @@ -378,6 +381,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| * | |||
| * vendor-specific subclasses should override this method to define | |||
| * the vendor-specific locations of the EJB DTDs | |||
| * @param handler no used in this class. | |||
| */ | |||
| protected void registerKnownDTDs(DescriptorHandler handler) { | |||
| // none to register for generic | |||
| @@ -896,7 +900,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||
| * Returns a Classloader object which parses the passed in generic EjbJar classpath. | |||
| * The loader is used to dynamically load classes from javax.ejb.* and the classes | |||
| * being added to the jar. | |||
| * | |||
| * @return a classloader. | |||
| */ | |||
| protected ClassLoader getClassLoaderForBuild() { | |||
| if (classpathLoader != null) { | |||
| @@ -625,14 +625,18 @@ public class IPlanetEjbc { | |||
| * descriptor DTD. | |||
| */ | |||
| public EjbcHandler() { | |||
| /** EJB 1.1 ID */ | |||
| final String PUBLICID_EJB11 = | |||
| "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"; | |||
| /** IPlanet ID */ | |||
| final String PUBLICID_IPLANET_EJB_60 = | |||
| "-//Sun Microsystems, Inc.//DTD iAS Enterprise JavaBeans 1.0//EN"; | |||
| /** EJB 1.1 location */ | |||
| final String DEFAULT_IAS60_EJB11_DTD_LOCATION = | |||
| "ejb-jar_1_1.dtd"; | |||
| /** IAS60 location */ | |||
| final String DEFAULT_IAS60_DTD_LOCATION = | |||
| "IASEjb_jar_1_0.dtd"; | |||
| @@ -142,6 +142,7 @@ public class IPlanetEjbcTask extends Task { | |||
| /** | |||
| * Adds to the classpath used when compiling the EJB stubs and skeletons. | |||
| * @return the class path. | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| @@ -183,6 +184,7 @@ public class IPlanetEjbcTask extends Task { | |||
| /** | |||
| * Does the work. | |||
| * @throws BuildException if there is a problem. | |||
| */ | |||
| public void execute() throws BuildException { | |||
| checkConfiguration(); | |||
| @@ -31,7 +31,7 @@ public class InnerClassFilenameFilter implements FilenameFilter { | |||
| baseClassName = baseclass.substring(0, extidx); | |||
| } | |||
| public boolean accept (File Dir, String filename) { | |||
| public boolean accept(File Dir, String filename) { | |||
| if ((filename.lastIndexOf(".") != filename.lastIndexOf(".class")) | |||
| || (filename.indexOf(baseClassName + "$") != 0)) { | |||
| return false; | |||
| @@ -233,12 +233,17 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| * Sets the weblogic.StdoutSeverityLevel to use when running the JVM that | |||
| * executes ejbc; optional. Set to 16 to avoid the warnings about EJB Home and | |||
| * Remotes being in the classpath | |||
| * @param jvmDebugLevel the value to use. | |||
| */ | |||
| public void setJvmDebugLevel(Integer jvmDebugLevel) { | |||
| this.jvmDebugLevel = jvmDebugLevel; | |||
| } | |||
| /** | |||
| * Get the debug level. | |||
| * @return the jvm debug level (may be null). | |||
| */ | |||
| public Integer getJvmDebugLevel() { | |||
| return jvmDebugLevel; | |||
| } | |||
| @@ -303,13 +308,17 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| * featured in weblogic 6 has, however, been deprecated in version 7. When | |||
| * using with version 7 this attribute should be set to | |||
| * "weblogic.ejbc" to avoid the deprecation warning. | |||
| * @param ejbcClass the name of the class to use. | |||
| */ | |||
| public void setEjbcClass(String ejbcClass) { | |||
| this.ejbcClass = ejbcClass; | |||
| } | |||
| /** Get the ejbc compiler class */ | |||
| /** | |||
| * Get the ejbc compiler class. | |||
| * @return the name of the ejbc compiler class. | |||
| */ | |||
| public String getEjbcClass() { | |||
| return ejbcClass; | |||
| } | |||
| @@ -354,6 +363,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| /** | |||
| * Set the value of the oldCMP scheme. This is an antonym for newCMP | |||
| * @ant.attribute ignore="true' | |||
| * @param oldCMP a <code>boolean</code> value. | |||
| */ | |||
| public void setOldCMP(boolean oldCMP) { | |||
| this.newCMP = !oldCMP; | |||
| @@ -370,6 +380,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| * prefix. Under this scheme the name of the CMP descriptor does not match | |||
| * the name actually used in the main weblogic EJB descriptor. Also, | |||
| * descriptors which contain multiple CMP references could not be used. | |||
| * @param newCMP a <code>boolean</code> value. | |||
| */ | |||
| public void setNewCMP(boolean newCMP) { | |||
| this.newCMP = newCMP; | |||
| @@ -379,6 +390,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| /** | |||
| * Do not EJBC the jar after it has been put together; | |||
| * optional, default false | |||
| * @param noEJBC a <code>boolean</code> value. | |||
| */ | |||
| public void setNoEJBC(boolean noEJBC) { | |||
| this.noEJBC = noEJBC; | |||
| @@ -646,6 +658,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| /** | |||
| * Called to validate that the tool parameters have been configured. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| public void validateConfigured() throws BuildException { | |||
| super.validateConfigured(); | |||
| @@ -836,6 +849,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| try { | |||
| genericJar.close(); | |||
| } catch (IOException closeException) { | |||
| // empty | |||
| } | |||
| } | |||
| @@ -843,6 +857,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| try { | |||
| wlJar.close(); | |||
| } catch (IOException closeException) { | |||
| // empty | |||
| } | |||
| } | |||
| @@ -850,6 +865,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| try { | |||
| newJarStream.close(); | |||
| } catch (IOException closeException) { | |||
| // empty | |||
| } | |||
| try { | |||
| @@ -875,6 +891,8 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| * Jar File passed to it. | |||
| * | |||
| * @param classjar java.io.File representing jar file to get classes from. | |||
| * @return the classloader for the jarfile. | |||
| * @throws IOException if there is a problem. | |||
| */ | |||
| protected ClassLoader getClassLoaderFromJar(File classjar) throws IOException { | |||
| Path lookupPath = new Path(getTask().getProject()); | |||
| @@ -890,4 +908,3 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
| return getTask().getProject().createClassLoader(lookupPath); | |||
| } | |||
| } | |||
| @@ -90,7 +90,7 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool { | |||
| /** | |||
| * Called to validate that the tool parameters have been configured. | |||
| * | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| public void validateConfigured() throws BuildException { | |||
| super.validateConfigured(); | |||
| @@ -309,7 +309,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| * Decide, wether ejbdeploy should be called or not; | |||
| * optional, default true. | |||
| * | |||
| * @param ejbdeploy | |||
| * @param ejbdeploy a <code>boolean</code> value. | |||
| */ | |||
| public void setEjbdeploy(boolean ejbdeploy) { | |||
| this.ejbdeploy = ejbdeploy; | |||
| @@ -361,7 +361,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| } | |||
| /* {@inheritDoc}. */ | |||
| /** {@inheritDoc}. */ | |||
| protected DescriptorHandler getDescriptorHandler(File srcDir) { | |||
| DescriptorHandler handler = new DescriptorHandler(getTask(), srcDir); | |||
| // register all the DTDs, both the ones that are known and | |||
| @@ -381,6 +381,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| /** | |||
| * Get a description handler. | |||
| * @param srcDir the source directory. | |||
| * @return the handler. | |||
| */ | |||
| protected DescriptorHandler getWebsphereDescriptorHandler(final File srcDir) { | |||
| DescriptorHandler handler = | |||
| @@ -639,6 +640,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| /** | |||
| * Called to validate that the tool parameters have been configured. | |||
| * @throws BuildException if there is an error. | |||
| */ | |||
| public void validateConfigured() throws BuildException { | |||
| super.validateConfigured(); | |||
| @@ -676,6 +678,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| * @param genericJarFile java.io.File The generic jar file. | |||
| * @param websphereJarFile java.io.File The websphere jar file to check to | |||
| * see if it needs to be rebuilt. | |||
| * @return true if a rebuild is required. | |||
| */ | |||
| protected boolean isRebuildRequired(File genericJarFile, File websphereJarFile) { | |||
| boolean rebuild = false; | |||
| @@ -835,6 +838,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| try { | |||
| genericJar.close(); | |||
| } catch (IOException closeException) { | |||
| // Ignore | |||
| } | |||
| } | |||
| @@ -842,6 +846,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| try { | |||
| wasJar.close(); | |||
| } catch (IOException closeException) { | |||
| // Ignore | |||
| } | |||
| } | |||
| @@ -849,6 +854,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| try { | |||
| newJarStream.close(); | |||
| } catch (IOException closeException) { | |||
| // Ignore | |||
| } | |||
| try { | |||
| @@ -869,6 +875,8 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { | |||
| * Jar File passed to it. | |||
| * | |||
| * @param classjar java.io.File representing jar file to get classes from. | |||
| * @return a classloader for the jar file. | |||
| * @throws IOException if there is an error. | |||
| */ | |||
| protected ClassLoader getClassLoaderFromJar(File classjar) throws IOException { | |||
| Path lookupPath = new Path(getTask().getProject()); | |||