Browse Source

Big VAJ changes, in particular if they have ever worked for anybody,

they probably won't do so any longer.

Make the servlets work by using IBM's servlet classes
PR: 10016

URL-encoding in <vaj*port> didn't work properly.

The VAJ tasks now support a haltonfailure attribute to conditionally
keep building even if they fail.

It is now possible to use the latest (versioned or unversioned)
edition in <vajload> by using special wildcard characters.
PR: 2236.

Submitted by:	Martin Landers <landers at in dot tum dot de>
                Francois Rey <francois dot rey at capco dot com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274553 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
7cd7c4e5f8
10 changed files with 334 additions and 135 deletions
  1. +16
    -0
      WHATSNEW
  2. +0
    -9
      build.xml
  3. +63
    -54
      docs/manual/Integration/VAJAntTool.html
  4. +79
    -17
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java
  5. +48
    -29
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java
  6. +48
    -10
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java
  7. +54
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java
  8. +6
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java
  9. +15
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java
  10. +5
    -7
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java

+ 16
- 0
WHATSNEW View File

@@ -30,6 +30,10 @@ Changes that could break older environments:
of the older ORO Netcomponents version. See of the older ORO Netcomponents version. See
<http://jakarta.apache.org/commons/net/index.html>. <http://jakarta.apache.org/commons/net/index.html>.


* If the Visual Age tasks used to work for you, they may stop doing so
now - and we'd like to know about it. The current set of tasks is
supposed to work with any version of VAJ starting with 3.0.

Fixed bugs: Fixed bugs:
----------- -----------
* Filter readers were not handling line endings properly. Bugzilla * Filter readers were not handling line endings properly. Bugzilla
@@ -115,6 +119,11 @@ Fixed bugs:
* Setting filesonly to true in <zip> and related tasks would cause the * Setting filesonly to true in <zip> and related tasks would cause the
archives to be always recreated. Bugzilla Report 19449. archives to be always recreated. Bugzilla Report 19449.


* The Visual Age for Java tasks didn't work (at least for versions 3.0
and higher). Bugzilla Report 10016.

* URL-encoding in <vaj*port> didn't work properly.

Other changes: Other changes:
-------------- --------------
* Six new Clearcase tasks added. * Six new Clearcase tasks added.
@@ -286,6 +295,13 @@ Other changes:
control the automatic line-end conversion performed on ASCII files. control the automatic line-end conversion performed on ASCII files.
Bugzilla Report 18884. Bugzilla Report 18884.


* The VAJ tasks now support a haltonfailure attribute to conditionally
keep building even if they fail.

* It is now possible to use the latest (versioned or unversioned) edition
in <vajload> by using special wildcard characters. Also fixes
Bugzilla Report 2236.

Changes from Ant 1.5.2 to Ant 1.5.3 Changes from Ant 1.5.2 to Ant 1.5.3
=================================== ===================================




+ 0
- 9
build.xml View File

@@ -249,9 +249,6 @@
<selector id="needs.antlr"> <selector id="needs.antlr">
<filename name="${optional.package}/ANTLR*"/> <filename name="${optional.package}/ANTLR*"/>
</selector> </selector>
<selector id="needs.servletapi">
<filename name="${optional.package}/ide/VAJ*Servlet*"/>
</selector>
<selector id="needs.jmf"> <selector id="needs.jmf">
<filename name="${optional.package}/sound/*"/> <filename name="${optional.package}/sound/*"/>
</selector> </selector>
@@ -403,10 +400,6 @@
classname="org.apache.env.Which" classname="org.apache.env.Which"
classpathref="classpath"/> classpathref="classpath"/>


<available property="servlet.present"
classname="javax.servlet.Servlet"
classpathref="classpath"/>

<available property="xerces.present" <available property="xerces.present"
classname="org.apache.xerces.parsers.SAXParser" classname="org.apache.xerces.parsers.SAXParser"
classpathref="classpath"/> classpathref="classpath"/>
@@ -587,7 +580,6 @@
<selector refid="needs.starteam" unless="starteam.present"/> <selector refid="needs.starteam" unless="starteam.present"/>
<selector refid="needs.vaj" unless="vaj.present"/> <selector refid="needs.vaj" unless="vaj.present"/>
<selector refid="needs.antlr" unless="antlr.present"/> <selector refid="needs.antlr" unless="antlr.present"/>
<selector refid="needs.servletapi" unless="servlet.present"/>
<selector refid="needs.jmf" unless="jmf.present"/> <selector refid="needs.jmf" unless="jmf.present"/>
<selector refid="needs.jai" unless="jai.present"/> <selector refid="needs.jai" unless="jai.present"/>
<selector refid="needs.jdepend" unless="jdepend.present"/> <selector refid="needs.jdepend" unless="jdepend.present"/>
@@ -755,7 +747,6 @@
<selector refid="needs.starteam"/> <selector refid="needs.starteam"/>
<selector refid="needs.vaj"/> <selector refid="needs.vaj"/>
<selector refid="needs.antlr"/> <selector refid="needs.antlr"/>
<selector refid="needs.servletapi"/>
<selector refid="needs.jmf"/> <selector refid="needs.jmf"/>
<selector refid="needs.jai"/> <selector refid="needs.jai"/>
<selector refid="needs.jdepend"/> <selector refid="needs.jdepend"/>


+ 63
- 54
docs/manual/Integration/VAJAntTool.html View File

@@ -12,8 +12,12 @@
<LI>Wolf Siberski <LI>Wolf Siberski
(siberski at kbs.uni-hannover.de) (siberski at kbs.uni-hannover.de)
<LI>Christoph Wilhelms <LI>Christoph Wilhelms
(christoph.wilhelms at tui.de)</LI></UL>
Version 1.2 - 2001/06/14<br>
(christoph.wilhelms at tui.de)</LI>
<LI>Martin Landers
(<A href="mailto:martin.landers@bea.de">martin.landers@bea.de</A>)</LI>
<LI>François Rey
(<A href="mailto:francois.rey@capco.com">francois.rey@capco.com</A>)</LI></UL>
Version 1.2.1 - 2003/01/16<br>
<hr> <hr>
<h2>Table of Contents</H2> <h2>Table of Contents</H2>
<ul> <ul>
@@ -47,6 +51,14 @@ viewed in a logging window. Concluding: This tool provides decent deployment
support VAJ has not (out of the box).</P> support VAJ has not (out of the box).</P>
<H3>What's new</H3> <H3>What's new</H3>
<table cellpadding="2" cellspacing="2" border="0" width="500"> <table cellpadding="2" cellspacing="2" border="0" width="500">
<tr valign="top">
<td valign="top">2003/01/16</TD>
<td valign="top">
<UL>
<LI>Now works outside of VAJ.
<LI>Added attribute haltonerror, "*" and "**" version qualifiers.
<LI>Amended documentation (this file) accordingly.
</LI></UL></TD></TR>
<tr valign="top"> <tr valign="top">
<td valign="top">2001/06/14</TD> <td valign="top">2001/06/14</TD>
<td valign="top"> <td valign="top">
@@ -97,14 +109,20 @@ workspace.</P>
<td valign="top"><b>Attribute</B></TD> <td valign="top"><b>Attribute</B></TD>
<td valign="top"><b>Description</B></TD> <td valign="top"><b>Description</B></TD>
<td align="middle" valign="top"><b>Required</B></TD></TR> <td align="middle" valign="top"><b>Required</B></TD></TR>
<tr>
<tr>
<td valign="top">remote</TD> <td valign="top">remote</TD>
<td valign="top"> <td valign="top">
<P>name and port of a remote tool server. (format: <P>name and port of a remote tool server. (format:
&lt;servername&gt;:&lt;port no&gt;).<BR>If this &lt;servername&gt;:&lt;port no&gt;).<BR>If this
attribute is set, the tasks will&nbsp;be executed on the specified tool attribute is set, the tasks will&nbsp;be executed on the specified tool
server.&nbsp;</P></TD> server.&nbsp;</P></TD>
<td valign="top" align="middle">no</TD></TR></TABLE>
<td valign="top" align="middle">no</TD></TR>
<tr>
<td valign="top">haltonerror</B></TD>
<td valign="top">
<P>Stop the build process if an error occurs,
(default: "yes")</P></TD>
<td align="middle" valign="top">no</TD></TR></TABLE>


<h3>Parameters specified as nested elements</H3> <h3>Parameters specified as nested elements</H3>
<h4>vajproject</H4> <h4>vajproject</H4>
@@ -121,13 +139,17 @@ workspace.</P>
<td valign="top" align="middle">yes</TD></TR> <td valign="top" align="middle">yes</TD></TR>
<tr> <tr>
<td valign="top">version</TD> <td valign="top">version</TD>
<td valign="top">name of the requested version</TD>
<td valign="top"><P>name of the requested version,
or one of the special qualifiers "*" or "**"<BR>
"*" loads the latest <b>versioned</b> edition of the project<BR>
"**" will load the latest version (including open editions)</P></TD>
<td valign="top" align="middle">yes</TD></TR> <td valign="top" align="middle">yes</TD></TR>
</TABLE> </TABLE>


<h3>Example</H3> <h3>Example</H3>
<pre>&lt;vajload remote="localhost:32767"&gt; <pre>&lt;vajload remote="localhost:32767"&gt;
&lt;vajproject name="My Testcases" version="1.7beta"/&gt;
&lt;vajproject name="My App" version="*"/&gt;
&lt;vajproject name="My Testcases" version="**"/&gt;
&lt;vajproject name="JUnit" version="3.2"/&gt; &lt;vajproject name="JUnit" version="3.2"/&gt;
&lt;/vajload&gt; &lt;/vajload&gt;
</PRE> </PRE>
@@ -191,7 +213,13 @@ files</TD>
&lt;servername&gt;:&lt;port no&gt;).<BR>If this &lt;servername&gt;:&lt;port no&gt;).<BR>If this
attribute is set, the tasks will&nbsp;be executed on the specified tool attribute is set, the tasks will&nbsp;be executed on the specified tool
server.&nbsp;</P></TD> server.&nbsp;</P></TD>
<td valign="top" align="middle">no</TD></TR></TABLE>
<td valign="top" align="middle">no</TD></TR>
<tr>
<td valign="top">haltonerror</B></TD>
<td valign="top">
<P>Stop the build process if an error occurs,
(default: "yes")</P></TD>
<td align="middle" valign="top">no</TD></TR></TABLE>


<h3>Parameters specified as nested elements</H3> <h3>Parameters specified as nested elements</H3>


@@ -258,7 +286,7 @@ from the file system into VAJ. These imports can be specified with a fileset.
<td valign="top"><b>Description</B></TD> <td valign="top"><b>Description</B></TD>
<td align="middle" valign="top"><b>Required</B></TD></TR> <td align="middle" valign="top"><b>Required</B></TD></TR>
<tr> <tr>
<td valign="top">vajProject</TD>
<td valign="top">project</TD>
<td valign="top">imported files are added to this VAJ <td valign="top">imported files are added to this VAJ
project</TD> project</TD>
<td valign="top" align="middle">yes</TD></TR> <td valign="top" align="middle">yes</TD></TR>
@@ -283,7 +311,13 @@ from the file system into VAJ. These imports can be specified with a fileset.
&lt;servername&gt;:&lt;port no&gt;).<BR>If this &lt;servername&gt;:&lt;port no&gt;).<BR>If this
attribute is set, the tasks will&nbsp;be executed on the specified tool attribute is set, the tasks will&nbsp;be executed on the specified tool
server.&nbsp;</P></TD> server.&nbsp;</P></TD>
<td valign="top" align="middle">no</TD></TR></TABLE>
<td valign="top" align="middle">no</TD></TR>
<tr>
<td valign="top">haltonerror</B></TD>
<td valign="top">
<P>Stop the build process if an error occurs,
(default: "yes")</P></TD>
<td align="middle" valign="top">no</TD></TR></TABLE>


<h3>Parameters specified as nested elements</H3> <h3>Parameters specified as nested elements</H3>


@@ -313,34 +347,16 @@ from the VAJ Tools menu (see <A href="#usage">Usage</A>).


<hr> <hr>
<h2><a name="installation"></A>Installation</H2> <h2><a name="installation"></A>Installation</H2>
<p>At the moment the installation has it's rough edges. If something
described below doesn't work for You, it's probably not Your fault
but incomplete/wrong instructions. In this case, please contact one
of the <A href="#authors">authors</A>.</P>
<p>We assume <CODE>C:\IBMVJava</CODE> as VAJ <p>We assume <CODE>C:\IBMVJava</CODE> as VAJ
install directory. If You have installed it elsewhere, adapt the pathes below. install directory. If You have installed it elsewhere, adapt the pathes below.
<h3>Plugin</H3> <h3>Plugin</H3>
<ul> <ul>
<li>install the Visual Age IDE Tools (via File-&gt;Quick
Start-&gt; Add feature-&gt;'IBM IDE Utility class libraries'
<li>import an appropriate XML parser to VAJ (we use Xerces
1.2.0 and are happy with it). Unfortunately the XML parser delivered with VAJ
(in the project 'IBM XML Parser for Java') doesn't work with Ant. You have to
remove that project (temporarily) from the workspace before importing another
XML implementation.

<li>import the Ant sources <STRONG>and </STRONG> resources into VAJ.
<li>Create the directory <CODE> <li>Create the directory <CODE>
C:\IBMVJava\ide\tools\org-apache-tools-ant</CODE>. C:\IBMVJava\ide\tools\org-apache-tools-ant</CODE>.
<li>export the Ant and XML parser class and resource files
into this directory. Be sure to select class files <STRONG>and</STRONG>
resources. Sources don't have to
be exported. Some optional tasks have errors and can't be exported when You
don't have the necessary packages in Your workspace (e.g. junit task, ejbc
task). If You need this tasks either import these packages into VAJ, too, or
copy the .class files directly from the binary distribution.
<li>Expand in that directory all the jars contained in the <code>lib</CODE>
directory of your Ant installation.
<li>copy <CODE>default.ini</CODE> (in <CODE> <li>copy <CODE>default.ini</CODE> (in <CODE>
ant\src\...\taskdefs\optional\ide</CODE>) to <CODE>
org\apache\tools\ant\taskdefs\optional\ide</CODE>) to <CODE>
C:\IBMVJava\ide\tools\org-apache-tools-ant\default.ini</CODE>. C:\IBMVJava\ide\tools\org-apache-tools-ant\default.ini</CODE>.


<li>if you want to access this help from the Workbench, create the <li>if you want to access this help from the Workbench, create the
@@ -351,9 +367,7 @@ install directory. If You have installed it elsewhere, adapt the pathes below.
<li>VAJ has to be restarted to recognize the new tool. <li>VAJ has to be restarted to recognize the new tool.
<li>Now if You open the context menu of a project, You should see the entry <li>Now if You open the context menu of a project, You should see the entry
'Ant Build' in the Tools submenu (see <A href="#usage">Usage</A>). 'Ant Build' in the Tools submenu (see <A href="#usage">Usage</A>).
<li>Make sure the tool works as expected. Now You can
remove Ant and the imported XML parser from Your workspace (and optionally add
the IBM parser again). </LI></UL>
<li>Make sure the tool works as expected. </LI></UL>
<h3>Servlets for Remote Tool Access</H3> <h3>Servlets for Remote Tool Access</H3>
<UL> <UL>
<LI> <LI>
@@ -372,25 +386,11 @@ install directory. If You have installed it elsewhere, adapt the pathes below.
<td valign="top"> <td valign="top">
<PRE>servlet.vajload.code=org.apache.tools.ant.taskdefs.optional.ide.VAJLoadServlet <PRE>servlet.vajload.code=org.apache.tools.ant.taskdefs.optional.ide.VAJLoadServlet
servlet.vajexport.code=org.apache.tools.ant.taskdefs.optional.ide.VAJExportServlet servlet.vajexport.code=org.apache.tools.ant.taskdefs.optional.ide.VAJExportServlet
servlet.vajimport.code=org.apache.tools.ant.taskdefs.optional.ide.VAJImportServletName<PRE> </PRE></PRE></TD></TR></TABLE>
<LI>export the following classes from the package
<CODE>org.apache.tools.ant</CODE>
to <CODE>C:\IBMVJava\ide\tools\com-ibm-ivj-toolserver\servlets\</CODE>:<BR>
<CODE>BuildException<BR>
DirectoryScanner<BR>
FileScanner<BR>
Location</CODE>
<LI>export the following classes from the package
<CODE>org.apache.tools.ant.taksdefs.optional.ide</CODE>
to <CODE>C:\IBMVJava\ide\tools\com-ibm-ivj-toolserver\servlets\</CODE>:<BR>
<CODE>VAJUtil<BR>
VAJExportServlet<BR>
VAJImportServlet<BR>
VAJLoadServlet<BR>
VAJLocalUtil<BR>
VAJProjectDescription<BR>
VAJToolsServlet<BR>
VAJWorkspaceScanner</CODE>
servlet.vajimport.code=org.apache.tools.ant.taskdefs.optional.ide.VAJImportServletName<PRE>
</TD></TR></TABLE>
<LI>Expand the Ant libraries (<code>ant.jar</CODE> and <code>optional.jar</CODE>
contained in the <code>lib</CODE> directory of your Ant installation) to the directory
<code>C:\IBMVJava\ide\tools\com-ibm-ivj-toolserver\servlets\</CODE>.
<LI>configure the Remote Access (via <LI>configure the Remote Access (via
Window-&gt;Options..., then choose 'Remote Access To Tool API') as shown in Window-&gt;Options..., then choose 'Remote Access To Tool API') as shown in
the following picture:</LI></UL> the following picture:</LI></UL>
@@ -460,6 +460,10 @@ files. This messsage appears if the file
<BR>.../org/apache/tools/ant/taskdefs/defaults.properties is <BR>.../org/apache/tools/ant/taskdefs/defaults.properties is
missing. Make sure that you import/export not only java/class files, but also missing. Make sure that you import/export not only java/class files, but also
all resource files when importing/exporting Ant.</P> all resource files when importing/exporting Ant.</P>
<P><STRONG>Q: If I try to re-load a build
file, I get the error "XML parser factory has not been configured correctly". Why?</STRONG><br>
A: Make sure the META-INF/services directory of the <code>xercesImpl.jar</CODE> has also been expanded
into the <CODE>C:\IBMVJava\ide\tools\org-apache-tools-ant</CODE> directory.</P>
<P><STRONG>Q: I want to load, export <P><STRONG>Q: I want to load, export
and build more then one Visual Age project to one jar! How to?</STRONG><br> and build more then one Visual Age project to one jar! How to?</STRONG><br>
A: The VA tasks are able to load and export several A: The VA tasks are able to load and export several
@@ -551,9 +555,14 @@ JDK independent by now.
<td valign="top">1.2</TD> <td valign="top">1.2</TD>
<td valign="top">2001/07/02</TD> <td valign="top">2001/07/02</TD>
<td valign="top"> <td valign="top">
<P>Added documentation of new remote feature.<BR>Minor corrections.</P></TD></TR></TABLE>
<P>Added documentation of new remote feature.<BR>Minor corrections.</P></TD></TR>
<tr valign="top">
<td valign="top">1.2.1</TD>
<td valign="top">2003/01/16</TD>
<td valign="top">
<P>Added documentation for haltonerror, "*" and "**" version qualifiers.</P></TD></TR></TABLE>
<hr> <hr>
<center>Copyright &amp;#copy 2001-2003 Apache Software
<center>Copyright &copy 2001-2003 Apache Software
Foundation. All rights Reserved.</CENTER> Foundation. All rights Reserved.</CENTER>
</body> </body>
</html> </html>


+ 79
- 17
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -68,23 +68,77 @@ import org.apache.tools.ant.types.PatternSet;
* their respective package 'dir's. * their respective package 'dir's.
* Example: * Example:
* <blockquote> * <blockquote>
* &lt;vajexport destdir="C:/builddir/source">
* &nbsp;&lt;include name="/MyVAProject/org/foo/subsystem1/**" />
* &nbsp;&lt;exclude name="/MyVAProject/org/foo/subsystem1/test/**"/>
* &lt;/vajexport>
* &lt;vajexport destdir=&quot;C:/builddir/source&quot;&gt;
* &nbsp;&lt;include name=&quot;/MyVAProject/org/foo/subsystem1/**&quot; /&gt;
* &nbsp;&lt;exclude name=&quot;/MyVAProject/org/foo/subsystem1/test/**&quot;/&gt;
* &lt;/vajexport&gt;
* </blockquote> * </blockquote>
* exports all packages in the project MyVAProject which start with * exports all packages in the project MyVAProject which start with
* 'org.foo.subsystem1' except of these starting with * 'org.foo.subsystem1' except of these starting with
* 'org.foo.subsystem1.test'. * 'org.foo.subsystem1.test'.
* *
* There are flags to choose which items to export:
* exportSources: export Java sources
* exportResources: export project resources
* exportClasses: export class files
* exportDebugInfo: export class files with debug info (use with exportClasses)
* default is exporting Java files and resources.
* <p>Parameters:
* <table border="1" cellpadding="2" cellspacing="0">
* <tr>
* <td valign="top"><b>Attribute</b></td>
* <td valign="top"><b>Description</b></td>
* <td align="center" valign="top"><b>Required</b></td>
* </tr>
* <tr>
* <td valign="top">destdir</td>
* <td valign="top">location to store the exported files</td>
* <td align="center" valign="top">Yes</td>
* <tr>
* <td valign="top">exportSources</td>
* <td valign="top">export Java sources, defaults to "yes"</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">exportResources</td>
* <td valign="top">export resource files, defaults to "yes"</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">exportClasses</td>
* <td valign="top">export class files, defaults to "no"</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">exportDebugInfo</td>
* <td valign="top">include debug info in exported class files,
* defaults to "no"</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">defaultexcludes</td>
* <td valign="top">use default excludes when exporting,
* defaults to "yes".
* Default excludes are: IBM&#x2f;**,
* Java class libraries&#x2f;**, Sun class libraries&#x2f;**,
* JSP Page Compile Generated Code&#x2f;**, Visual Age*&#x2f;**</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">overwrite</td>
* <td valign="top">overwrite existing files, defaults to "yes"</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">remote</td>
* <td valign="top">remote tool server to run this command against
* (format: &lt;servername&gt; : &lt;port no&gt;)</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">haltonerror</td>
* <td valign="top">stop the build process if an error occurs,
* defaults to "yes"</td>
* <td align="center" valign="top">No</td>
* </tr>
* </table>
* *
* @author Wolf Siberski, TUI Infotec GmbH * @author Wolf Siberski, TUI Infotec GmbH
* @author Martin Landers, Beck et al. projects
*/ */


public class VAJExport extends VAJTask { public class VAJExport extends VAJTask {
@@ -123,12 +177,20 @@ public class VAJExport extends VAJTask {
} }


// delegate the export to the VAJUtil object. // delegate the export to the VAJUtil object.
getUtil().exportPackages(destDir,
patternSet.getIncludePatterns(getProject()),
patternSet.getExcludePatterns(getProject()),
exportClasses, exportDebugInfo,
exportResources, exportSources,
useDefaultExcludes, overwrite);
try {
getUtil().exportPackages(destDir,
patternSet.getIncludePatterns(getProject()),
patternSet.getExcludePatterns(getProject()),
exportClasses, exportDebugInfo,
exportResources, exportSources,
useDefaultExcludes, overwrite);
} catch (BuildException ex) {
if (haltOnError) {
throw ex;
} else {
log(ex.toString());
}
}
} }


/** /**


+ 48
- 29
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -82,7 +82,7 @@ import org.apache.tools.ant.types.FileSet;
* created in the repository and automatically loaded into the Workspace. * created in the repository and automatically loaded into the Workspace.
* There has to be at least one nested FileSet element. * There has to be at least one nested FileSet element.
* </p> * </p>
* <p>There are attributes to choose which items to export:
* <p>Parameters:
* <table border="1" cellpadding="2" cellspacing="0"> * <table border="1" cellpadding="2" cellspacing="0">
* <tr> * <tr>
* <td valign="top"><b>Attribute</b></td> * <td valign="top"><b>Attribute</b></td>
@@ -110,9 +110,22 @@ import org.apache.tools.ant.types.FileSet;
* <td valign="top">import class files, defaults to "no"</td> * <td valign="top">import class files, defaults to "no"</td>
* <td align="center" valign="top">No</td> * <td align="center" valign="top">No</td>
* </tr> * </tr>
* <tr>
* <td valign="top">remote</td>
* <td valign="top">remote tool server to run this command against
* (format: &lt;servername&gt; : &lt;port no&gt;)</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">haltonerror</td>
* <td valign="top">stop the build process if an error occurs,
* defaults to "yes"</td>
* <td align="center" valign="top">No</td>
* </tr>
* </table> * </table>
* *
* @author Glenn McAllister, inspired by a similar task written by Peter Kelley * @author Glenn McAllister, inspired by a similar task written by Peter Kelley
* @author Martin Landers, Beck et al. projects
*/ */
public class VAJImport extends VAJTask { public class VAJImport extends VAJTask {
protected Vector filesets = new Vector(); protected Vector filesets = new Vector();
@@ -123,6 +136,25 @@ public class VAJImport extends VAJTask {
protected boolean useDefaultExcludes = true; protected boolean useDefaultExcludes = true;




/**
* Extended DirectoryScanner that has accessors for the
* includes and excludes fields.
*
* This is kindof a hack to get includes and excludes
* from the directory scanner. In order to keep
* the URLs short we only want to send the patterns to the
* remote tool server and let him figure out the files.
*
* This replaces the former reflection hack that
* didn't compile for old JDKs.
*
* @see VAJImport#importFileSet(FileSet)
*/
private static class LocalDirectoryScanner extends DirectoryScanner {
public String[] getIncludes() { return includes; }
public String[] getExcludes() { return excludes; }
}

/** /**
* The VisualAge for Java Project name to import into. * The VisualAge for Java Project name to import into.
*/ */
@@ -182,8 +214,16 @@ public class VAJImport extends VAJTask {
throw new BuildException("The VisualAge for Java Project name is required!"); throw new BuildException("The VisualAge for Java Project name is required!");
} }


for (Enumeration e = filesets.elements(); e.hasMoreElements();) {
importFileset((FileSet) e.nextElement());
try {
for (Enumeration e = filesets.elements(); e.hasMoreElements();) {
importFileset((FileSet) e.nextElement());
}
} catch (BuildException ex) {
if (haltOnError) {
throw ex;
} else {
log(ex.toString());
}
} }
} }


@@ -192,35 +232,14 @@ public class VAJImport extends VAJTask {
* Workspace. * Workspace.
*/ */
protected void importFileset(FileSet fileset) { protected void importFileset(FileSet fileset) {
DirectoryScanner ds = fileset.getDirectoryScanner(this.getProject());
LocalDirectoryScanner ds = new LocalDirectoryScanner();
fileset.setupDirectoryScanner(ds, this.getProject());
if (ds.getIncludedFiles().length == 0) { if (ds.getIncludedFiles().length == 0) {
return; return;
} }


String[] includes = null;
String[] excludes = null;

// Hack to get includes and excludes. We could also use getIncludedFiles,
// but that would result in very long HTTP-requests.
// Therefore we want to send the patterns only to the remote tool server
// and let him figure out the files.
try {
Class directoryScanner = ds.getClass();

Field includesField = directoryScanner.getDeclaredField("includes");
includesField.setAccessible(true);
includes = (String[]) includesField.get(ds);

Field excludesField = directoryScanner.getDeclaredField("excludes");
excludesField.setAccessible(true);
excludes = (String[]) excludesField.get(ds);
} catch (NoSuchFieldException nsfe) {
throw new BuildException(
"DirectoryScanner.includes or .excludes missing" + nsfe.getMessage());
} catch (IllegalAccessException iae) {
throw new BuildException(
"Access to DirectoryScanner.includes or .excludes not allowed");
}
String[] includes = ds.getIncludes();
String[] excludes = ds.getExcludes();


getUtil().importFiles(importProject, ds.getBasedir(), getUtil().importFiles(importProject, ds.getBasedir(),
includes, excludes, includes, excludes,


+ 48
- 10
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -54,21 +54,51 @@


package org.apache.tools.ant.taskdefs.optional.ide; package org.apache.tools.ant.taskdefs.optional.ide;



import java.util.Vector; import java.util.Vector;
import org.apache.tools.ant.BuildException;


/** /**
* Load specific project versions into the Visual Age for Java workspace.
* Each project and version name has to be specified completely.
* Load project versions into the Visual Age for Java workspace.
* Each project is identified by its name and a version qualifier.
* Allowed qualifiers are:
* <ul>
* <li>Any valid Visual Age version name</li>
* <li>* (loads the latest <b>versioned</b> edition)</li>
* <li>** (loads the latest edition, including open editions)</li>
* </ul>
* Example: * Example:
* <blockquote>
* &lt;vajload>
* &nbsp;&lt;project name="MyVAProject" version="2.1"/>
* &nbsp;&lt;project name="Apache Xerces" version="1.2.0"/>
* &lt;/vajload>
* <blockquote>
* &lt;vajload&gt;
* &nbsp;&lt;project name=&quot;MyVAProject&quot; version=&quot;*&quot;/&gt;
* &nbsp;&lt;project name=&quot;Apache Xerces&quot; version=&quot;1.2.0&quot;/&gt;
* &nbsp;&lt;project name=&quot;Brand New Stuff&quot; version=&quot;**&quot;/&gt;
* &lt;/vajload&gt;
* </blockquote> * </blockquote>
* *
* <p>Parameters:</p>
* <table border="1" cellpadding="2" cellspacing="0">
* <tr>
* <td valign="top"><b>Attribute</b></td>
* <td valign="top"><b>Description</b></td>
* <td align="center" valign="top"><b>Required</b></td>
* </tr>
* <tr>
* <td valign="top">remote</td>
* <td valign="top">remote tool server to run this command against
* (format: &lt;servername&gt; : &lt;port no&gt;)</td>
* <td align="center" valign="top">No</td>
* </tr>
* <tr>
* <td valign="top">haltonerror</td>
* <td valign="top">stop the build process if an error occurs,
* defaults to "yes"</td>
* <td align="center" valign="top">No</td>
* </tr>
* </table>
* </p>
*
* @author Wolf Siberski, TUI Infotec GmbH * @author Wolf Siberski, TUI Infotec GmbH
* @author Martin Landers, Beck et al. projects
*/ */


public class VAJLoad extends VAJTask { public class VAJLoad extends VAJTask {
@@ -78,7 +108,15 @@ public class VAJLoad extends VAJTask {
* Load specified projects. * Load specified projects.
*/ */
public void execute() { public void execute() {
getUtil().loadProjects(projectDescriptions);
try {
getUtil().loadProjects(projectDescriptions);
} catch (BuildException ex) {
if (haltOnError) {
throw ex;
} else {
log(ex.toString());
}
}
} }


/** /**


+ 54
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -64,6 +64,7 @@ import com.ibm.ivj.util.base.ToolEnv;
import com.ibm.ivj.util.base.Type; import com.ibm.ivj.util.base.Type;
import com.ibm.ivj.util.base.Workspace; import com.ibm.ivj.util.base.Workspace;
import java.io.File; import java.io.File;
import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Vector; import java.util.Vector;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
@@ -75,6 +76,7 @@ import org.apache.tools.ant.DirectoryScanner;
* wraps IvjExceptions into BuildExceptions * wraps IvjExceptions into BuildExceptions
* *
* @author Wolf Siberski, TUI Infotec GmbH * @author Wolf Siberski, TUI Infotec GmbH
* @author Martin Landers, Beck et al. projects
*/ */
abstract class VAJLocalUtil implements VAJUtil{ abstract class VAJLocalUtil implements VAJUtil{
// singleton containing the VAJ workspace // singleton containing the VAJ workspace
@@ -194,10 +196,17 @@ abstract class VAJLocalUtil implements VAJUtil{
e.hasMoreElements();) { e.hasMoreElements();) {
VAJProjectDescription d = (VAJProjectDescription) e.nextElement(); VAJProjectDescription d = (VAJProjectDescription) e.nextElement();


ProjectEdition pe = findProjectEdition(d.getName(), d.getVersion());
ProjectEdition pe;
if (d.getVersion().equals("*"))
pe = findLatestProjectEdition(d.getName(), false);
else if (d.getVersion().equals("**"))
pe = findLatestProjectEdition(d.getName(), true);
else
pe = findProjectEdition(d.getName(), d.getVersion());
try { try {
log("Loading '" + d.getName() + "', Version '" + d.getVersion()
+ "', into Workspace", MSG_VERBOSE);
log("Loading '" + pe.getName() + "', Version '" +
((pe.getVersionName() != null)?pe.getVersionName():"("+pe.getVersionStamp()+ ")")+
"' into Workspace", MSG_VERBOSE);
pe.loadIntoWorkspace(); pe.loadIntoWorkspace();
} catch (IvjException ex) { } catch (IvjException ex) {
throw createBuildException("Project '" + d.getName() throw createBuildException("Project '" + d.getName()
@@ -270,6 +279,47 @@ abstract class VAJLocalUtil implements VAJUtil{


} }


/**
* Finds the latest project edition in the repository.
*
* @param name project name
* @param includeOpenEditions include open/scratch editions in the search?
* @return com.ibm.ivj.util.base.ProjectEdition the specified edition
*/
private ProjectEdition findLatestProjectEdition(
String name,
boolean includeOpenEditions) {
try {
ProjectEdition[] editions = null;
editions = getWorkspace().getRepository().getProjectEditions(name);
if (editions == null) {
throw new BuildException("Project " + name + " doesn't exist");
}

// find latest (versioned) project edition by date
ProjectEdition pe = null;
Date latestStamp = new Date(0); // Let's hope there are no projects older than the epoch ;-)
for (int i = 0; i < editions.length; i++) {
if (!includeOpenEditions && !editions[i].isVersion())
continue;
if (latestStamp.before(editions[i].getVersionStamp())) {
latestStamp = editions[i].getVersionStamp();
pe = editions[i];
}
}

if (pe == null) {
throw new BuildException("Can't determine latest edition for project " + name);
}
log("Using version " + ((pe.getVersionName() != null)?pe.getVersionName():"("+pe.getVersionStamp()+ ")") +
" of " + pe.getName(), MSG_INFO);
return pe;
} catch (IvjException e) {
throw createBuildException("VA Exception occured: ", e);
}

}





//----------------------------------------------------------- //-----------------------------------------------------------


+ 6
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -61,6 +61,7 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Vector; import java.util.Vector;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
@@ -71,6 +72,7 @@ import org.apache.tools.ant.Task;
* wraps IvjExceptions into BuildExceptions * wraps IvjExceptions into BuildExceptions
* *
* @author Wolf Siberski, TUI Infotec GmbH * @author Wolf Siberski, TUI Infotec GmbH
* @author Martin Landers, Beck et al. projects
*/ */
class VAJRemoteUtil implements VAJUtil{ class VAJRemoteUtil implements VAJUtil{
// calling task // calling task
@@ -139,7 +141,7 @@ class VAJRemoteUtil implements VAJUtil{
boolean includeSources, boolean useDefaultExcludes) { boolean includeSources, boolean useDefaultExcludes) {
String result = String result =
VAJToolsServlet.DIR_PARAM + "=" VAJToolsServlet.DIR_PARAM + "="
+ dir.getAbsolutePath().replace('\\', '/') + "&"
+ URLEncoder.encode(dir.getAbsolutePath()) + "&"
+ VAJToolsServlet.CLASSES_PARAM + "=" + includeClasses + "&" + VAJToolsServlet.CLASSES_PARAM + "=" + includeClasses + "&"
+ VAJToolsServlet.RESOURCES_PARAM + "=" + includeResources + "&" + VAJToolsServlet.RESOURCES_PARAM + "=" + includeResources + "&"
+ VAJToolsServlet.SOURCES_PARAM + "=" + includeSources + "&" + VAJToolsServlet.SOURCES_PARAM + "=" + includeSources + "&"
@@ -148,13 +150,13 @@ class VAJRemoteUtil implements VAJUtil{
if (includePatterns != null) { if (includePatterns != null) {
for (int i = 0; i < includePatterns.length; i++){ for (int i = 0; i < includePatterns.length; i++){
result = result + "&" + VAJExportServlet.INCLUDE_PARAM + "=" result = result + "&" + VAJExportServlet.INCLUDE_PARAM + "="
+ includePatterns[i].replace(' ', '+').replace('\\', '/');
+ URLEncoder.encode(includePatterns[i]);
} }
} }
if (excludePatterns != null) { if (excludePatterns != null) {
for (int i = 0; i < excludePatterns.length; i++){ for (int i = 0; i < excludePatterns.length; i++){
result = result + "&" + VAJExportServlet.EXCLUDE_PARAM + "=" result = result + "&" + VAJExportServlet.EXCLUDE_PARAM + "="
+ excludePatterns[i].replace(' ', '+').replace('\\', '/');
+ URLEncoder.encode(excludePatterns[i]);
} }
} }




+ 15
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -59,6 +59,7 @@ package org.apache.tools.ant.taskdefs.optional.ide;
* attributes (remoteServer) and util methods * attributes (remoteServer) and util methods
* *
* @author: Wolf Siberski * @author: Wolf Siberski
* @author: Martin Landers, Beck et al. projects
*/ */
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;


@@ -79,6 +80,8 @@ public class VAJTask extends Task {
// holds the appropriate VAJUtil implementation // holds the appropriate VAJUtil implementation
private VAJUtil util = null; private VAJUtil util = null;


// checks if this task throws BuildException on error
protected boolean haltOnError = true;


/** /**
* returns the VAJUtil implementation * returns the VAJUtil implementation
@@ -103,4 +106,15 @@ public class VAJTask extends Task {
public void setRemote(String remoteServer) { public void setRemote(String remoteServer) {
this.remoteServer = remoteServer; this.remoteServer = remoteServer;
} }

/**
* Flag to control behaviour in case of VAJ errors.
* If this attribute is set errors will be ignored
* (no BuildException will be thrown) otherwise
* VAJ errors will be wrapped into a BuildException and
* stop the build.
*/
public void setHaltonerror(boolean newHaltOnError) {
haltOnError = newHaltOnError;
}
} }

+ 5
- 7
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java View File

@@ -1,7 +1,7 @@
/* /*
* The Apache Software License, Version 1.1 * The Apache Software License, Version 1.1
* *
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved. * reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -54,13 +54,11 @@


package org.apache.tools.ant.taskdefs.optional.ide; package org.apache.tools.ant.taskdefs.optional.ide;




import com.ibm.ivj.toolserver.servletclasses.servlet.ServletException;
import com.ibm.ivj.toolserver.servletclasses.servlet.http.HttpServlet;
import com.ibm.ivj.toolserver.servletclasses.servlet.http.HttpServletRequest;
import com.ibm.ivj.toolserver.servletclasses.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.util.StringUtils; import org.apache.tools.ant.util.StringUtils;




Loading…
Cancel
Save