bodewig 2003/05/06 08:19:17
Modified: . WHATSNEW build.xml
docs/manual/Integration VAJAntTool.html
src/main/org/apache/tools/ant/taskdefs/optional/ide
VAJExport.java VAJImport.java VAJLoad.java
VAJLocalUtil.java VAJRemoteUtil.java VAJTask.java
VAJToolsServlet.java
Log:
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>
Revision Changes Path
1.409 +16 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.408
retrieving revision 1.409
diff -u -r1.408 -r1.409
--- WHATSNEW 2 May 2003 14:44:53 -0000 1.408
+++ WHATSNEW 6 May 2003 15:19:15 -0000 1.409
@@ -30,6 +30,10 @@
of the older ORO Netcomponents version. See
<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:
-----------
* Filter readers were not handling line endings properly. Bugzilla
@@ -115,6 +119,11 @@
* Setting filesonly to true in <zip> and related tasks would cause the
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:
--------------
* Six new Clearcase tasks added.
@@ -285,6 +294,13 @@
* <stcheckout> has a new attribute "converteol" that can be used to
control the automatic line-end conversion performed on ASCII files.
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
===================================
1.375 +0 -9 ant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/ant/build.xml,v
retrieving revision 1.374
retrieving revision 1.375
diff -u -r1.374 -r1.375
--- build.xml 28 Apr 2003 12:22:29 -0000 1.374
+++ build.xml 6 May 2003 15:19:16 -0000 1.375
@@ -249,9 +249,6 @@
<selector id="needs.antlr">
<filename name="${optional.package}/ANTLR*"/>
</selector>
- <selector id="needs.servletapi">
- <filename name="${optional.package}/ide/VAJ*Servlet*"/>
- </selector>
<selector id="needs.jmf">
<filename name="${optional.package}/sound/*"/>
</selector>
@@ -403,10 +400,6 @@
classname="org.apache.env.Which"
classpathref="classpath"/>
- <available property="servlet.present"
- classname="javax.servlet.Servlet"
- classpathref="classpath"/>
-
<available property="xerces.present"
classname="org.apache.xerces.parsers.SAXParser"
classpathref="classpath"/>
@@ -587,7 +580,6 @@
<selector refid="needs.starteam" unless="starteam.present"/>
<selector refid="needs.vaj" unless="vaj.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.jai" unless="jai.present"/>
<selector refid="needs.jdepend" unless="jdepend.present"/>
@@ -755,7 +747,6 @@
<selector refid="needs.starteam"/>
<selector refid="needs.vaj"/>
<selector refid="needs.antlr"/>
- <selector refid="needs.servletapi"/>
<selector refid="needs.jmf"/>
<selector refid="needs.jai"/>
<selector refid="needs.jdepend"/>
1.18 +63 -54 ant/docs/manual/Integration/VAJAntTool.html
Index: VAJAntTool.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/Integration/VAJAntTool.html,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- VAJAntTool.html 16 Apr 2003 03:38:43 -0000 1.17
+++ VAJAntTool.html 6 May 2003 15:19:17 -0000 1.18
@@ -12,8 +12,12 @@
<LI>Wolf Siberski
(siberski at kbs.uni-hannover.de)
<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:[EMAIL PROTECTED]">[EMAIL PROTECTED]</A>)</LI>
+ <LI>Fran�ois Rey
+ (<A href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</A>)</LI></UL>
+Version 1.2.1 - 2003/01/16<br>
<hr>
<h2>Table of Contents</H2>
<ul>
@@ -48,6 +52,14 @@
<H3>What's new</H3>
<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">
<td valign="top">2001/06/14</TD>
<td valign="top">
<UL>
@@ -97,14 +109,20 @@
<td valign="top"><b>Attribute</B></TD>
<td valign="top"><b>Description</B></TD>
<td align="middle" valign="top"><b>Required</B></TD></TR>
- <tr>
+ <tr>
<td valign="top">remote</TD>
<td valign="top">
<P>name and port of a remote tool server. (format:
<servername>:<port no>).<BR>If this
attribute is set, the tasks will be executed on the specified tool
server. </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>
<h4>vajproject</H4>
@@ -121,13 +139,17 @@
<td valign="top" align="middle">yes</TD></TR>
<tr>
<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>
</TABLE>
<h3>Example</H3>
<pre><vajload remote="localhost:32767">
- <vajproject name="My Testcases" version="1.7beta"/>
+ <vajproject name="My App" version="*"/>
+ <vajproject name="My Testcases" version="**"/>
<vajproject name="JUnit" version="3.2"/>
</vajload>
</PRE>
@@ -191,7 +213,13 @@
<servername>:<port no>).<BR>If this
attribute is set, the tasks will be executed on the specified tool
server. </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>
@@ -258,7 +286,7 @@
<td valign="top"><b>Description</B></TD>
<td align="middle" valign="top"><b>Required</B></TD></TR>
<tr>
- <td valign="top">vajProject</TD>
+ <td valign="top">project</TD>
<td valign="top">imported files are added to this VAJ
project</TD>
<td valign="top" align="middle">yes</TD></TR>
@@ -283,7 +311,13 @@
<servername>:<port no>).<BR>If this
attribute is set, the tasks will be executed on the specified tool
server. </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>
@@ -313,34 +347,16 @@
<hr>
<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
install directory. If You have installed it elsewhere, adapt the pathes
below.
<h3>Plugin</H3>
<ul>
- <li>install the Visual Age IDE Tools (via File->Quick
- Start-> Add feature->'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>
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>
- 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>.
<li>if you want to access this help from the Workbench, create the
@@ -351,9 +367,7 @@
<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
'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>
<UL>
<LI>
@@ -372,25 +386,11 @@
<td valign="top">
<PRE>servlet.vajload.code=org.apache.tools.ant.taskdefs.optional.ide.VAJLoadServlet
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
Window->Options..., then choose 'Remote Access To Tool API') as shown in
the following picture:</LI></UL>
@@ -460,6 +460,10 @@
<BR>.../org/apache/tools/ant/taskdefs/defaults.properties is
missing. Make sure that you import/export not only java/class files, but also
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
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
@@ -551,9 +555,14 @@
<td valign="top">1.2</TD>
<td valign="top">2001/07/02</TD>
<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>
-<center>Copyright &#copy 2001-2003 Apache Software
+<center>Copyright © 2001-2003 Apache Software
Foundation. All rights Reserved.</CENTER>
</body>
</html>
1.11 +79 -17
ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java
Index: VAJExport.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- VAJExport.java 10 Feb 2003 14:14:06 -0000 1.10
+++ VAJExport.java 6 May 2003 15:19:17 -0000 1.11
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -68,23 +68,77 @@
* their respective package 'dir's.
* Example:
* <blockquote>
- * <vajexport destdir="C:/builddir/source">
- * <include name="/MyVAProject/org/foo/subsystem1/**" />
- * <exclude name="/MyVAProject/org/foo/subsystem1/test/**"/>
- * </vajexport>
+ * <vajexport destdir="C:/builddir/source">
+ * <include name="/MyVAProject/org/foo/subsystem1/**"
/>
+ * <exclude
name="/MyVAProject/org/foo/subsystem1/test/**"/>
+ * </vajexport>
* </blockquote>
* exports all packages in the project MyVAProject which start with
* 'org.foo.subsystem1' except of these starting with
* '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/**,
+ * Java class libraries/**, Sun class
libraries/**,
+ * JSP Page Compile Generated Code/**, Visual
Age*/**</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: <servername> : <port no>)</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 Martin Landers, Beck et al. projects
*/
public class VAJExport extends VAJTask {
@@ -123,12 +177,20 @@
}
// 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());
+ }
+ }
}
/**
1.19 +48 -29
ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java
Index: VAJImport.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- VAJImport.java 10 Feb 2003 14:14:07 -0000 1.18
+++ VAJImport.java 6 May 2003 15:19:17 -0000 1.19
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -82,7 +82,7 @@
* created in the repository and automatically loaded into the Workspace.
* There has to be at least one nested FileSet element.
* </p>
- * <p>There are attributes to choose which items to export:
+ * <p>Parameters:
* <table border="1" cellpadding="2" cellspacing="0">
* <tr>
* <td valign="top"><b>Attribute</b></td>
@@ -110,9 +110,22 @@
* <td valign="top">import class files, defaults to "no"</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: <servername> : <port no>)</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 Glenn McAllister, inspired by a similar task written by Peter
Kelley
+ * @author Martin Landers, Beck et al. projects
*/
public class VAJImport extends VAJTask {
protected Vector filesets = new Vector();
@@ -124,6 +137,25 @@
/**
+ * 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.
*/
public void setProject(String projectName) {
@@ -182,8 +214,16 @@
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 @@
* Workspace.
*/
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) {
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(),
includes, excludes,
1.6 +48 -10
ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java
Index: VAJLoad.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- VAJLoad.java 10 Feb 2003 14:14:07 -0000 1.5
+++ VAJLoad.java 6 May 2003 15:19:17 -0000 1.6
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,21 +54,51 @@
package org.apache.tools.ant.taskdefs.optional.ide;
-
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:
- * <blockquote>
- * <vajload>
- * <project name="MyVAProject" version="2.1"/>
- * <project name="Apache Xerces" version="1.2.0"/>
- * </vajload>
+ * <blockquote>
+ * <vajload>
+ * <project name="MyVAProject" version="*"/>
+ * <project name="Apache Xerces"
version="1.2.0"/>
+ * <project name="Brand New Stuff"
version="**"/>
+ * </vajload>
* </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: <servername> : <port no>)</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 Martin Landers, Beck et al. projects
*/
public class VAJLoad extends VAJTask {
@@ -78,7 +108,15 @@
* Load specified projects.
*/
public void execute() {
- getUtil().loadProjects(projectDescriptions);
+ try {
+ getUtil().loadProjects(projectDescriptions);
+ } catch (BuildException ex) {
+ if (haltOnError) {
+ throw ex;
+ } else {
+ log(ex.toString());
+ }
+ }
}
/**
1.12 +54 -4
ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java
Index: VAJLocalUtil.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- VAJLocalUtil.java 10 Feb 2003 14:14:07 -0000 1.11
+++ VAJLocalUtil.java 6 May 2003 15:19:17 -0000 1.12
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -64,6 +64,7 @@
import com.ibm.ivj.util.base.Type;
import com.ibm.ivj.util.base.Workspace;
import java.io.File;
+import java.util.Date;
import java.util.Enumeration;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
@@ -75,6 +76,7 @@
* wraps IvjExceptions into BuildExceptions
*
* @author Wolf Siberski, TUI Infotec GmbH
+ * @author Martin Landers, Beck et al. projects
*/
abstract class VAJLocalUtil implements VAJUtil{
// singleton containing the VAJ workspace
@@ -194,10 +196,17 @@
e.hasMoreElements();) {
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 {
- 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();
} catch (IvjException ex) {
throw createBuildException("Project '" + d.getName()
@@ -264,6 +273,47 @@
}
return pe;
+ } catch (IvjException e) {
+ throw createBuildException("VA Exception occured: ", e);
+ }
+
+ }
+
+ /**
+ * 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);
}
1.8 +6 -4
ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java
Index: VAJRemoteUtil.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- VAJRemoteUtil.java 10 Feb 2003 14:14:07 -0000 1.7
+++ VAJRemoteUtil.java 6 May 2003 15:19:17 -0000 1.8
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -61,6 +61,7 @@
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.net.URLEncoder;
import java.util.Enumeration;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
@@ -71,6 +72,7 @@
* wraps IvjExceptions into BuildExceptions
*
* @author Wolf Siberski, TUI Infotec GmbH
+ * @author Martin Landers, Beck et al. projects
*/
class VAJRemoteUtil implements VAJUtil{
// calling task
@@ -139,7 +141,7 @@
boolean includeSources,
boolean useDefaultExcludes) {
String result =
VAJToolsServlet.DIR_PARAM + "="
- + dir.getAbsolutePath().replace('\\', '/') + "&"
+ + URLEncoder.encode(dir.getAbsolutePath()) + "&"
+ VAJToolsServlet.CLASSES_PARAM + "=" + includeClasses + "&"
+ VAJToolsServlet.RESOURCES_PARAM + "=" + includeResources + "&"
+ VAJToolsServlet.SOURCES_PARAM + "=" + includeSources + "&"
@@ -148,13 +150,13 @@
if (includePatterns != null) {
for (int i = 0; i < includePatterns.length; i++){
result = result + "&" + VAJExportServlet.INCLUDE_PARAM + "="
- + includePatterns[i].replace(' ', '+').replace('\\',
'/');
+ + URLEncoder.encode(includePatterns[i]);
}
}
if (excludePatterns != null) {
for (int i = 0; i < excludePatterns.length; i++){
result = result + "&" + VAJExportServlet.EXCLUDE_PARAM + "="
- + excludePatterns[i].replace(' ', '+').replace('\\',
'/');
+ + URLEncoder.encode(excludePatterns[i]);
}
}
1.7 +15 -1
ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java
Index: VAJTask.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- VAJTask.java 10 Feb 2003 14:14:07 -0000 1.6
+++ VAJTask.java 6 May 2003 15:19:17 -0000 1.7
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -59,6 +59,7 @@
* attributes (remoteServer) and util methods
*
* @author: Wolf Siberski
+ * @author: Martin Landers, Beck et al. projects
*/
import org.apache.tools.ant.Task;
@@ -79,6 +80,8 @@
// holds the appropriate VAJUtil implementation
private VAJUtil util = null;
+ // checks if this task throws BuildException on error
+ protected boolean haltOnError = true;
/**
* returns the VAJUtil implementation
@@ -102,5 +105,16 @@
*/
public void setRemote(String 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;
}
}
1.12 +5 -7
ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java
Index: VAJToolsServlet.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- VAJToolsServlet.java 10 Feb 2003 14:14:07 -0000 1.11
+++ VAJToolsServlet.java 6 May 2003 15:19:17 -0000 1.12
@@ -1,7 +1,7 @@
/*
* 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.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,13 +54,11 @@
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 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.util.StringUtils;