summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrew C. Oliver <acoliver@apache.org>2002-01-31 02:22:28 +0000
committerAndrew C. Oliver <acoliver@apache.org>2002-01-31 02:22:28 +0000
commit833d29b9e0dac737fb1608740c7582b54d462b5c (patch)
tree38def28b2ff11d77cb76b19b3ca5fba154ed61fa /tools
parent6c234ab6c8d9b392bc93f28edf13136b3c053894 (diff)
downloadpoi-833d29b9e0dac737fb1608740c7582b54d462b5c.tar.gz
poi-833d29b9e0dac737fb1608740c7582b54d462b5c.zip
Initial revision
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352063 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tools')
-rwxr-xr-xtools/.cvsignore1
-rwxr-xr-xtools/bin/ant107
-rwxr-xr-xtools/bin/ant.bat97
-rwxr-xr-xtools/bin/antRun9
-rwxr-xr-xtools/bin/antRun.bat20
-rwxr-xr-xtools/bin/fix-packages.py216
-rwxr-xr-xtools/bin/lcp.bat2
-rwxr-xr-xtools/bin/runant.pl131
-rwxr-xr-xtools/lib/.cvsignore3
-rwxr-xr-xtools/lib/ant-1.4.1-optional.jarbin0 -> 468566 bytes
-rwxr-xr-xtools/lib/ant-1.4.1.jarbin0 -> 417110 bytes
-rw-r--r--tools/lib/jtidy-04aug2000r7-dev.jarbin0 -> 161826 bytes
-rwxr-xr-xtools/lib/junit.jarbin0 -> 117522 bytes
-rw-r--r--tools/lib/xalan-2.2.0.jarbin0 -> 923866 bytes
-rwxr-xr-xtools/resources/Release-Checklist.txt18
-rwxr-xr-xtools/resources/jindent/poi.jin319
-rwxr-xr-xtools/resources/stylesheets/html2xml.xsl153
-rw-r--r--tools/src/ClassAvailable.java246
-rw-r--r--tools/src/JTidyTask.java272
-rw-r--r--tools/src/SitemapTool.java363
-rw-r--r--tools/src/UserInput.java151
-rw-r--r--tools/src/XConfTool.java238
-rwxr-xr-xtools/src/announcement2header.xsl78
-rwxr-xr-xtools/src/announcement2readme.xsl89
-rwxr-xr-xtools/src/announcement2site.xsl92
-rwxr-xr-xtools/src/announcement2txt.xsl174
-rwxr-xr-xtools/src/bugzilla2patchqueue.xsl36
-rwxr-xr-xtools/src/changelog.xsl95
-rwxr-xr-xtools/src/patchqueue2text4dev.xsl70
-rwxr-xr-xtools/src/patchqueue2xdocs.xsl109
30 files changed, 3089 insertions, 0 deletions
diff --git a/tools/.cvsignore b/tools/.cvsignore
new file mode 100755
index 0000000000..d84cd14c25
--- /dev/null
+++ b/tools/.cvsignore
@@ -0,0 +1 @@
+anttasks
diff --git a/tools/bin/ant b/tools/bin/ant
new file mode 100755
index 0000000000..4555bf7089
--- /dev/null
+++ b/tools/bin/ant
@@ -0,0 +1,107 @@
+#! /bin/sh
+
+if [ -f "$HOME/.antrc" ] ; then
+ . $HOME/.antrc
+fi
+
+# Cygwin support. $cygwin _must_ be set to either true or false.
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ *) cygwin=false ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin; then
+ [ -n "$ANT_HOME" ] &&
+ ANT_HOME=`cygpath --unix "$ANT_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+if [ "$ANT_HOME" = "" ] ; then
+ # try to find ANT
+ if [ -d /opt/ant ] ; then
+ ANT_HOME=/opt/ant
+ fi
+
+ if [ -d ${HOME}/opt/ant ] ; then
+ ANT_HOME=${HOME}/opt/ant
+ fi
+
+ ## resolve links - $0 may be a link to ant's home
+ PRG=$0
+ progname=`basename $0`
+
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname $PRG`/$link"
+ fi
+ done
+
+ ANT_HOME=`dirname "$PRG"`/..
+
+fi
+
+if [ "$JAVA_HOME" != "" ] ; then
+ if [ "$JAVACMD" = "" ] ; then
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+else
+ if [ "$JAVACMD" = "" ] ; then
+ JAVACMD=java
+ fi
+fi
+
+# add in the dependency .jar files
+DIRLIBS=${ANT_HOME}/lib/*.jar
+for i in ${DIRLIBS}
+do
+ # if the directory is empty, then it will return the input string
+ # this is stupid, so case for it
+ if [ "$i" != "${DIRLIBS}" ] ; then
+ LOCALCLASSPATH=$LOCALCLASSPATH:"$i"
+ fi
+done
+
+if [ "$CLASSPATH" != "" ] ; then
+ LOCALCLASSPATH=$CLASSPATH:$LOCALCLASSPATH
+fi
+
+if [ "$JAVA_HOME" != "" ] ; then
+ if test -f $JAVA_HOME/lib/tools.jar ; then
+ LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar
+ fi
+
+ if test -f $JAVA_HOME/lib/classes.zip ; then
+ LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip
+ fi
+else
+ echo "Warning: JAVA_HOME environment variable is not set."
+ echo " If build fails because sun.* classes could not be found"
+ echo " you will need to set the JAVA_HOME environment variable"
+ echo " to the installation directory of java."
+fi
+
+# supply JIKESPATH to Ant as jikes.class.path
+if [ "$JIKESPATH" != "" ] ; then
+ if [ "$ANT_OPTS" != "" ] ; then
+ ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH"
+ else
+ ANT_OPTS=-Djikes.class.path=$JIKESPATH
+ fi
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ ANT_HOME=`cygpath --path --windows "$ANT_HOME"`
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
+fi
+
+$JAVACMD -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" $ANT_OPTS org.apache.tools.ant.Main "$@"
diff --git a/tools/bin/ant.bat b/tools/bin/ant.bat
new file mode 100755
index 0000000000..e8f8fd1e80
--- /dev/null
+++ b/tools/bin/ant.bat
@@ -0,0 +1,97 @@
+@echo off
+
+if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
+
+if not "%OS%"=="Windows_NT" goto win9xStart
+:winNTStart
+@setlocal
+
+rem %~dp0 is name of current script under NT
+set DEFAULT_ANT_HOME=%~dp0
+
+rem : operator works similar to make : operator
+set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=%
+
+if %ANT_HOME%a==a set ANT_HOME=%DEFAULT_ANT_HOME%
+set DEFAULT_ANT_HOME=
+
+rem On NT/2K grab all arguments at once
+set ANT_CMD_LINE_ARGS=%*
+goto doneStart
+
+:win9xStart
+rem Slurp the command line arguments. This loop allows for an unlimited number of
+rem agruments (up to the command line limit, anyway).
+
+set ANT_CMD_LINE_ARGS=
+
+:setupArgs
+if %1a==a goto doneStart
+set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
+shift
+goto setupArgs
+
+:doneStart
+rem This label provides a place for the argument list loop to break out
+rem and for NT handling to skip to.
+
+rem find ANT_HOME
+if not "%ANT_HOME%"=="" goto checkJava
+
+rem check for ant in Program Files on system drive
+if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive
+set ANT_HOME=%SystemDrive%\Program Files\ant
+goto checkJava
+
+:checkSystemDrive
+rem check for ant in root directory of system drive
+if not exist "%SystemDrive%\ant" goto noAntHome
+set ANT_HOME=%SystemDrive%\ant
+goto checkJava
+
+:noAntHome
+echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
+goto end
+
+:checkJava
+set _JAVACMD=%JAVACMD%
+set LOCALCLASSPATH="%CLASSPATH%"
+for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i"
+
+if "%JAVA_HOME%" == "" goto noJavaHome
+if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java
+if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\tools.jar"
+if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\classes.zip"
+goto checkJikes
+
+:noJavaHome
+if "%_JAVACMD%" == "" set _JAVACMD=java
+echo.
+echo Warning: JAVA_HOME environment variable is not set.
+echo If build fails because sun.* classes could not be found
+echo you will need to set the JAVA_HOME environment variable
+echo to the installation directory of java.
+echo.
+
+:checkJikes
+if not "%JIKESPATH%" == "" goto runAntWithJikes
+
+:runAnt
+%_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
+goto end
+
+:runAntWithJikes
+%_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH% %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
+
+:end
+set LOCALCLASSPATH=
+set _JAVACMD=
+set ANT_CMD_LINE_ARGS=
+
+if not "%OS%"=="Windows_NT" goto mainEnd
+:winNTend
+@endlocal
+
+:mainEnd
+if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
+
diff --git a/tools/bin/antRun b/tools/bin/antRun
new file mode 100755
index 0000000000..f0a18f1653
--- /dev/null
+++ b/tools/bin/antRun
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+# Args: DIR command
+cd "$1"
+CMD="$2"
+shift
+shift
+
+exec $CMD "$@"
diff --git a/tools/bin/antRun.bat b/tools/bin/antRun.bat
new file mode 100755
index 0000000000..a5484d692b
--- /dev/null
+++ b/tools/bin/antRun.bat
@@ -0,0 +1,20 @@
+@echo off
+
+# Change drive and directory to %1 (Win9X only for NT/2K use "cd /d")
+cd %1
+%1\
+set ANT_RUN_CMD=%2
+shift
+shift
+
+set PARAMS=
+:loop
+if ""%1 == "" goto runCommand
+set PARAMS=%PARAMS% %1
+shift
+goto loop
+
+:runCommand
+rem echo %ANT_RUN_CMD% %PARAMS%
+%ANT_RUN_CMD% %PARAMS%
+
diff --git a/tools/bin/fix-packages.py b/tools/bin/fix-packages.py
new file mode 100755
index 0000000000..5858c77a7e
--- /dev/null
+++ b/tools/bin/fix-packages.py
@@ -0,0 +1,216 @@
+#! /usr/bin/env python
+#
+# Mass string translation for java/xml files (change Wanted re for other files)
+#
+# Author: Peter Donald <donaldp@apache.org>
+#
+# Adapted from fixid.py in python distribution under Tools
+#
+
+import sys
+import re
+import string
+import os
+from stat import *
+import getopt
+
+err = sys.stderr.write
+dbg = err
+out = sys.stdout.write
+
+def usage():
+ progname = sys.argv[0]
+ err('Usage: ' + progname + ' [-s file] ... file-or-directory ...\n')
+ err('\n')
+ err('-s substfile : add a file of substitutions\n')
+ err('\n')
+ err('Each non-empty non-comment line in a substitution file must\n')
+ err('contain exactly two words separated by a | character.\n')
+
+def main():
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], 'crs:')
+ except getopt.error, msg:
+ err('Options error: ' + str(msg) + '\n')
+ usage()
+ sys.exit(2)
+ bad = 0
+ if not args: # No arguments
+ usage()
+ sys.exit(2)
+ for opt, arg in opts:
+ if opt == '-s':
+ addsubst(arg)
+ initre()
+ for arg in args:
+ if os.path.isdir(arg):
+ if recursedown(arg): bad = 1
+ elif os.path.islink(arg):
+ err(arg + ': will not process symbolic links\n')
+ bad = 1
+ else:
+ if fix(arg): bad = 1
+ sys.exit(bad)
+
+# Change this regular expression to select a different set of files
+Wanted = '^[a-zA-Z0-9_\-]+\.(java|xml|xinfo)$'
+def wanted(name):
+ return None <> re.match(Wanted, name)
+
+def recursedown(dirname):
+ dbg('recursedown(' + `dirname` + ')\n')
+ bad = 0
+ try:
+ names = os.listdir(dirname)
+ except os.error, msg:
+ err(dirname + ': cannot list directory: ' + str(msg) + '\n')
+ return 1
+ names.sort()
+ subdirs = []
+ for name in names:
+ if name in (os.curdir, os.pardir): continue
+ fullname = os.path.join(dirname, name)
+ if os.path.islink(fullname): pass
+ elif os.path.isdir(fullname):
+ subdirs.append(fullname)
+ elif wanted(name):
+ if fix(fullname): bad = 1
+ for fullname in subdirs:
+ if recursedown(fullname): bad = 1
+ return bad
+
+def fix(filename):
+ dbg('fix(' + `filename` + ')\n')
+
+ # File replacement mode
+ try:
+ f = open(filename, 'r')
+ except IOError, msg:
+ err(filename + ': cannot open: ' + str(msg) + '\n')
+ return 1
+
+ head, tail = os.path.split(filename)
+ tempname = os.path.join(head, '@' + tail)
+
+ # If we find a match, we rewind the file and start over but
+ # now copy everything to a temp file.
+ lineno = 0
+ g = None
+ while 1:
+ line = f.readline()
+ if not line: break
+ lineno = lineno + 1
+ newline = fixline(line)
+ if newline != line:
+ if g is None:
+ try:
+ g = open(tempname, 'w')
+ except IOError, msg:
+ f.close()
+ err(tempname+': cannot create: '+
+ str(msg)+'\n')
+ return 1
+ f.seek(0)
+ lineno = 0
+ out(filename + ':\n')
+ continue # restart from the beginning
+ out(`lineno` + '\n')
+ out('< ' + line)
+ out('> ' + newline)
+ if g is not None:
+ g.write(newline)
+
+ # End of file
+ f.close()
+ if not g: return 0 # No changes
+
+ # Finishing touch -- move files
+
+ # First copy the file's mode to the temp file
+ try:
+ statbuf = os.stat(filename)
+ os.chmod(tempname, statbuf[ST_MODE] & 07777)
+ except os.error, msg:
+ err(tempname + ': warning: chmod failed (' + str(msg) + ')\n')
+
+ # Then make a backup of the original file as filename~
+ try:
+ os.rename(filename, filename + '~')
+ except os.error, msg:
+ err(filename + ': warning: backup failed (' + str(msg) + ')\n')
+
+ # Now move the temp file to the original file
+ try:
+ os.rename(tempname, filename)
+ except os.error, msg:
+ err(filename + ': rename failed (' + str(msg) + ')\n')
+ return 1
+
+ # Return succes
+ return 0
+
+def initre():
+ global SearcherExpr
+
+ keys = Dict.keys()
+ keyCount = len(keys)
+ i = 0
+ reStr = ""
+ while i < len(keys):
+ if i != 0: reStr = reStr + '|'
+ reStr = reStr + keys[i]
+ i = i + 1
+ SearcherExpr = re.compile( reStr )
+
+def fixline(line):
+ global Program
+## print '-->', `line`
+ i = 0
+
+ while i < len(line):
+ match = SearcherExpr.search(line, i)
+ if match == None: break
+ found = match.group(0)
+ i = match.start()
+ n = len(found)
+ if Dict.has_key(found):
+ subst = Dict[found]
+
+ line = line[:i] + subst + line[i+n:]
+ n = len(subst)
+ i = i + n
+ return line
+
+Dict = {}
+NotInComment = {}
+
+def addsubst(substfile):
+ try:
+ fp = open(substfile, 'r')
+ except IOError, msg:
+ err(substfile + ': cannot read substfile: ' + str(msg) + '\n')
+ sys.exit(1)
+ lineno = 0
+
+ while 1:
+ line = fp.readline()
+ if not line: break
+ lineno = lineno + 1
+ try:
+ i = string.index(line, '#')
+ except string.index_error:
+ i = -1 # Happens to delete trailing \n
+ words = string.split(line[:i],'|')
+ if not words: continue
+ if len(words) <> 2:
+ err(substfile + ':' + `lineno` + ': warning: bad line: ' + line)
+ continue
+ [key, value] = words
+
+## print 'Will replace ', key, ' with ', value
+
+ Dict[key] = value
+
+ fp.close()
+
+main()
diff --git a/tools/bin/lcp.bat b/tools/bin/lcp.bat
new file mode 100755
index 0000000000..8d6b8515ab
--- /dev/null
+++ b/tools/bin/lcp.bat
@@ -0,0 +1,2 @@
+set LOCALCLASSPATH=%1;%LOCALCLASSPATH%
+
diff --git a/tools/bin/runant.pl b/tools/bin/runant.pl
new file mode 100755
index 0000000000..a2cc523e71
--- /dev/null
+++ b/tools/bin/runant.pl
@@ -0,0 +1,131 @@
+#!/usr/bin/perl
+#######################################################################
+#
+# runant.pl
+#
+# wrapper script for invoking ant in a platform with Perl installed
+# this may include cgi-bin invocation, which is considered somewhat daft.
+# (slo: that should be a separate file which can be derived from this
+# and returns the XML formatted output)
+#
+# the code is not totally portable due to classpath and directory splitting
+# issues. oops. (NB, use File::Spec::Functions will help and the code is
+# structured for the catfile() call, but because of perl version funnies
+# the code is not included.
+#
+# created: 2000-8-24
+# last modified: 2000-8-24
+# author: Steve Loughran steve_l@sourceforge.net
+#######################################################################
+#
+# Assumptions:
+#
+# - the "java" executable/script is on the command path
+# - ANT_HOME has been set
+# - target platform uses ":" as classpath separator or perl indicates it is dos/win32
+# - target platform uses "/" as directory separator.
+
+#be fussy about variables
+use strict;
+
+#platform specifics (disabled)
+#use File::Spec::Functions;
+
+#turn warnings on during dev; generates a few spurious uninitialised var access warnings
+#use warnings;
+
+#and set $debug to 1 to turn on trace info
+my $debug=0;
+
+#######################################################################
+#
+# check to make sure environment is setup
+#
+
+my $HOME = $ENV{ANT_HOME};
+if ($HOME eq "")
+ {
+ die "\n\nANT_HOME *MUST* be set!\n\n";
+ }
+
+my $JAVACMD = $ENV{JAVACMD};
+$JAVACMD = "java" if $JAVACMD eq "";
+
+#ISSUE: what java wants to split up classpath varies from platform to platform
+#and perl is not too hot at hinting which box it is on.
+#here I assume ":" 'cept on win32 and dos. Add extra tests here as needed.
+my $s=":";
+if(($^O eq "MSWin32") || ($^O eq "dos"))
+ {
+ $s=";";
+ }
+
+#build up standard classpath
+my $localpath=$ENV{CLASSPATH};
+if ($localpath eq "")
+ {
+ print "warning: no initial classpath\n" if ($debug);
+ $localpath="";
+ }
+
+#add jar files. I am sure there is a perl one liner to do this.
+my $jarpattern="$HOME/lib/*.jar";
+my @jarfiles =glob($jarpattern);
+print "jarfiles=@jarfiles\n" if ($debug);
+my $jar;
+foreach $jar (@jarfiles )
+ {
+ $localpath.="$s$jar";
+ }
+
+#if Java home is defined, look for tools.jar & classes.zip and add to classpath
+my $JAVA_HOME = $ENV{JAVA_HOME};
+if ($JAVA_HOME ne "")
+ {
+ my $tools="$JAVA_HOME/lib/tools.jar";
+ if (-e "$tools")
+ {
+ $localpath .= "$s$tools";
+ }
+ my $classes="$JAVA_HOME/lib/classes.zip";
+ if (-e $classes)
+ {
+ $localpath .= "$s$classes";
+ }
+ }
+else
+ {
+ print "\n\nWarning: JAVA_HOME environment variable is not set.\n".
+ "If the build fails because sun.* classes could not be found\n".
+ "you will need to set the JAVA_HOME environment variable\n".
+ "to the installation directory of java\n";
+ }
+
+#jikes
+my @ANT_OPTS=split $ENV{ANT_OPTS};
+if($ENV{JIKESPATH} ne "")
+ {
+ push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}";
+ }
+
+#construct arguments to java
+
+my @ARGS;
+push @ARGS, "-classpath", "$localpath", "-Dant.home=$HOME";
+push @ARGS, @ANT_OPTS;
+push @ARGS, "org.apache.tools.ant.Main";
+push @ARGS, @ARGV;
+
+print "\n $JAVACMD @ARGS\n\n" if ($debug);
+
+my $returnValue = system $JAVACMD, @ARGS;
+if ($returnValue eq 0)
+ {
+ exit 0;
+ }
+else
+ {
+ # only 0 and 1 are widely recognized as exit values
+ # so change the exit value to 1
+ exit 1;
+ }
diff --git a/tools/lib/.cvsignore b/tools/lib/.cvsignore
new file mode 100755
index 0000000000..eb1aa67684
--- /dev/null
+++ b/tools/lib/.cvsignore
@@ -0,0 +1,3 @@
+xalan-2.2.0-D14.jar
+xerces-1.4.4.jar
+xml-apis.jar
diff --git a/tools/lib/ant-1.4.1-optional.jar b/tools/lib/ant-1.4.1-optional.jar
new file mode 100755
index 0000000000..d6a4b4b627
--- /dev/null
+++ b/tools/lib/ant-1.4.1-optional.jar
Binary files differ
diff --git a/tools/lib/ant-1.4.1.jar b/tools/lib/ant-1.4.1.jar
new file mode 100755
index 0000000000..8ad84e3480
--- /dev/null
+++ b/tools/lib/ant-1.4.1.jar
Binary files differ
diff --git a/tools/lib/jtidy-04aug2000r7-dev.jar b/tools/lib/jtidy-04aug2000r7-dev.jar
new file mode 100644
index 0000000000..a11dfe58ac
--- /dev/null
+++ b/tools/lib/jtidy-04aug2000r7-dev.jar
Binary files differ
diff --git a/tools/lib/junit.jar b/tools/lib/junit.jar
new file mode 100755
index 0000000000..914a5cfa9b
--- /dev/null
+++ b/tools/lib/junit.jar
Binary files differ
diff --git a/tools/lib/xalan-2.2.0.jar b/tools/lib/xalan-2.2.0.jar
new file mode 100644
index 0000000000..8dd6dca254
--- /dev/null
+++ b/tools/lib/xalan-2.2.0.jar
Binary files differ
diff --git a/tools/resources/Release-Checklist.txt b/tools/resources/Release-Checklist.txt
new file mode 100755
index 0000000000..61ebae5824
--- /dev/null
+++ b/tools/resources/Release-Checklist.txt
@@ -0,0 +1,18 @@
+- build distributions
+- sign distributions
+- Generate announcements and HEADER.html
+- upload distributions to correct dir
+- tag CVS
+- generate www pages and upload
+- bump release ID
+- send announcements to announcement@apache.org, announcements@xml.apache.org, announcements@jakarta.apache.org
+- news to newsgroups: comp.lang.java.softwaretools
+- post stories on
+ *) jakarta news page
+ *) theserverside.com
+ *) freshmeat.net
+ *) www.javaworld.com
+ *) www.javalobby.com
+ *) www.jguru.com
+ *) www.slashdot.org
+ (and follow them up)
diff --git a/tools/resources/jindent/poi.jin b/tools/resources/jindent/poi.jin
new file mode 100755
index 0000000000..5b612fe38a
--- /dev/null
+++ b/tools/resources/jindent/poi.jin
@@ -0,0 +1,319 @@
+###
+### Jindent 3.2x property file -- http://www.jindent.de
+###
+### this encapsulates my preferred style, plus project-specific style ...
+###
+### author: Marc Johnson
+###
+
+### General -- Convention
+
+conventionName = ""
+conventionString = ""
+conventionNotePosition = "none"
+blankLinesToSeparateConventionNote = 2
+
+### General -- Jindent Note
+
+jindentNotePosition = "none"
+blankLinesToSeparateJindentNote = 2
+
+### Header/Footer -- Header Template
+
+headerSmartMode = infinite
+headerIdentifyKey = "Copyright (c) 2002 The Apache Software Foundation"
+blankLinesBeforeHeader = 1
+header[00]="/* ===================================================================="
+header[01]=" * The Apache Software License, Version 1.1"
+header[02]=" *"
+header[03]=" * Copyright (c) 2002 The Apache Software Foundation. All rights"
+header[04]=" * reserved."
+header[05]=" *"
+header[06]=" * Redistribution and use in source and binary forms, with or without"
+header[07]=" * modification, are permitted provided that the following conditions"
+header[08]=" * are met:"
+header[09]=" *"
+header[10]=" * 1. Redistributions of source code must retain the above copyright"
+header[11]=" * notice, this list of conditions and the following disclaimer."
+header[12]=" *"
+header[13]=" * 2. Redistributions in binary form must reproduce the above copyright"
+header[14]=" * notice, this list of conditions and the following disclaimer in"
+header[15]=" * the documentation and/or other materials provided with the"
+header[16]=" * distribution."
+header[17]=" *"
+header[18]=" * 3. The end-user documentation included with the redistribution,"
+header[19]=" * if any, must include the following acknowledgment:"
+header[20]=" * "This product includes software developed by the"
+header[21]=" * Apache Software Foundation (http://www.apache.org/).""
+header[22]=" * Alternately, this acknowledgment may appear in the software itself,"
+header[23]=" * if and wherever such third-party acknowledgments normally appear."
+header[24]=" *"
+header[25]=" * 4. The names "Apache" and "Apache Software Foundation" and"
+header[26]=" * "Apache POI" must not be used to endorse or promote products"
+header[27]=" * derived from this software without prior written permission. For"
+header[28]=" * written permission, please contact apache@apache.org."
+header[29]=" *"
+header[30]=" * 5. Products derived from this software may not be called "Apache","
+header[31]=" * "Apache POI", nor may "Apache" appear in their name, without"
+header[32]=" * prior written permission of the Apache Software Foundation."
+header[33]=" *"
+header[34]=" * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED"
+header[35]=" * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES"
+header[36]=" * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE"
+header[37]=" * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR"
+header[38]=" * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,"
+header[39]=" * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT"
+header[40]=" * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF"
+header[41]=" * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND"
+header[42]=" * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,"
+header[43]=" * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT"
+header[44]=" * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF"
+header[45]=" * SUCH DAMAGE."
+header[46]=" * ===================================================================="
+header[47]=" *"
+header[48]=" * This software consists of voluntary contributions made by many"
+header[49]=" * individuals on behalf of the Apache Software Foundation. For more"
+header[50]=" * information on the Apache Software Foundation, please see"
+header[51]=" * <http://www.apache.org/>."
+header[52]=" */"
+blankLinesAfterHeader = 1
+
+### Header/Footer -- Footer Template
+
+footerSmartMode = infinite
+footerIdentifyKey = ""
+blankLinesBeforeFooter = 0
+footer[00] = ""
+blankLinesAfterFooter = 0
+
+### Indentation -- Misc
+
+tabulatorSize = 8
+indentSize = 4
+firstLevelIndent = 0
+indentCaseFromSwitch = true
+labelNewLine = true
+indentLabels = true
+minimumCommentIndent = 3
+indentLeadingsByTabs = false
+indentCommentsByTabs = false
+indentDeclarationsByTabs = false
+indentAssignmentsByTabs = false
+
+### Indentation -- Alignment
+
+alignComments = true
+alignDeclarations = true
+alignAssignments = true
+alignTernaryConditions = false
+alignTernaryExpressions = true
+alignTooLongComments = true
+
+### Braces -- Style
+
+leftBraceNewLineGeneral = true
+rightBraceNewLineGeneral = true
+indentLeftBraceGeneral = 0
+indentRightBraceGeneral = 0
+indentAfterRightBraceGeneral = 0
+cuddleEmptyBracesGeneral = false
+indentCuddledBracesGeneral = 0
+
+leftBraceNewLineClassInterface = true
+rightBraceNewLineClassInterface = true
+indentLeftBraceClassInterface = 0
+indentRightBraceClassInterface = 0
+indentAfterRightBraceClassInterface = 0
+cuddleEmptyBracesClassInterface = false
+indentCuddledBracesClassInterface = 0
+
+leftBraceNewLineMethod = true
+rightBraceNewLineMethod = true
+indentLeftBraceMethod = 0
+indentRightBraceMethod = 0
+indentAfterRightBraceMethod = 0
+cuddleEmptyBracesMethod = false
+indentCuddledBracesMethod = 0
+
+leftBraceNewLineTryCatch = true
+rightBraceNewLineTryCatch = true
+indentLeftBraceTryCatch = 0
+indentRightBraceTryCatch = 0
+indentAfterRightBraceTryCatch = 0
+cuddleEmptyBracesTryCatch = false
+indentCuddledBracesTryCatch = 0
+
+### Braces -- Insert At
+
+insertBracesAtIfElse = true
+insertBracesAtFor = true
+insertBracesAtWhile = true
+insertBracesAtDoWhile = true
+insertParenthesisAtConditions = true
+
+### Braces -- If-Else
+
+singleIfStatementInOneLine = false
+singleElseStatementInOneLine = false
+specialElseIfTreatment = true
+
+### JavaDoc -- Misc
+
+deleteJavaDocComments = false
+formatJavaDocComments = true
+insertMissingJavaDocTags = true
+deleteObsoleteJavaDocTags = false
+createPublicClassInterfaceJavaDocs = true
+createFriendlyClassInterfaceJavaDocs = false
+createPrivateClassInterfaceJavaDocs = false
+createProtectedClassInterfaceJavaDocs = false
+createPublicMethodJavaDocs = false
+createFriendlyMethodJavaDocs = false
+createPrivateMethodJavaDocs = false
+createProtectedMethodJavaDocs = false
+createPublicFieldJavaDocs = false
+createFriendlyFieldJavaDocs = false
+createPrivateFieldJavaDocs = false
+createProtectedFieldJavaDocs = false
+
+### JavaDoc -- Templates
+
+sortExceptionsInTemplates = true
+javaDocMethodTop[00] = "/**"
+javaDocMethodTop[01] = " * Method $objectName$"
+javaDocMethodTop[02] = " *"
+javaDocMethodParamSeparator[00] = " *"
+javaDocMethodParam[00] = " * @param $paramName$"
+javaDocMethodReturn[00] = " *"
+javaDocMethodReturn[01] = " * @return"
+javaDocMethodExceptionSeparator[00] = " *"
+javaDocMethodException[00] = " * @exception $exceptionName$"
+javaDocMethodBottom[00] = " *"
+javaDocMethodBottom[01] = " */"
+javaDocConstructorTop[00] = "/**"
+javaDocConstructorTop[01] = " * Constructor $objectName$"
+javaDocConstructorTop[02] = " *"
+javaDocConstructorParamSeparator[00] = " *"
+javaDocConstructorParam[00] = " * @param $paramName$"
+javaDocConstructorExceptionSeparator[00] = " *"
+javaDocConstructorException[00] = " * @exception $exceptionName$"
+javaDocConstructorBottom[00] = " *"
+javaDocConstructorBottom[01] = " */"
+javaDocClass[00] = "/**"
+javaDocClass[01] = " * Class $objectName$"
+javaDocClass[02] = " *"
+javaDocClass[03] = " *"
+javaDocClass[04] = " * @author"
+javaDocClass[05] = " * @version %I%, %G%"
+javaDocClass[06] = " */"
+javaDocInterface[00] = "/**"
+javaDocInterface[01] = " * Interface $objectName$"
+javaDocInterface[02] = " *"
+javaDocInterface[03] = " *"
+javaDocInterface[04] = " * @author"
+javaDocInterface[05] = " * @version %I%, %G%"
+javaDocInterface[06] = " */"
+javaDocField[00] = "/** Field $objectName$ */"
+
+### Comments -- Format/Delete
+
+deleteBlockComments = false
+deleteSingleLineComments = false
+deleteTrailingComments = false
+deleteEndOfLineComments = false
+formatBlockComments = true
+formatSingleLineComments = true
+formatTrailingComments = true
+formatEndOfLineComments = true
+
+### Comments -- Exceptions
+
+neverIndentFirstColumnComments = true
+neverFormatFirstColumnComments = true
+neverFormatHeader = false
+neverFormatFooter = false
+
+### Separation -- Misc
+
+keepBlankLines = 0
+minLinesToInsertBlankLineInClasses = infinite
+minLinesToInsertBlankLineInMethods = infinite
+
+### Separation -- Separate
+
+separateChunksByComments = false
+allowBreakSeparatedFromCaseBlock = false
+blankLinesBetweenCaseBlocks = 1
+blankLinesBetweenChunks = 0
+comparableImportDepth = 2
+blankLinesToSeparateImports = 1
+blankLinesBetweenClassInterface = 2
+
+### Separation -- Insert Blank Lines
+
+blankLinesAfterDeclarations = 1
+blankLinesAfterMethods = 1
+blankLinesAfterClasses = 1
+blankLinesAfterInterfaces = 1
+blankLinesBeforeJavaDocComments = 1
+blankLinesAfterJavaDocComments = 1
+blankLinesBeforeBlockComments = 1
+blankLinesAfterBlockComments = 0
+blankLinesBeforeSingleLineComments = 1
+blankLinesAfterSingleLineComments = 0
+blankLinesBeforeEndOfLineComments = 1
+blankLinesAfterEndOfLineComments = 0
+blankLinesAfterSwitch = 1
+blankLinesAfterPackage = 1
+blankLinesAfterLastImport = 1
+
+### Whitespaces -- Padding
+
+separateAssignmentOperators = true
+separateConditionalOperators = true
+separateComparisonOperators = true
+separateNumericalOperators = true
+paddingCastParenthesis = true
+paddingParenthesis = false
+paddingBrackets = true
+paddingBraces = true
+
+### Whitespaces -- Space Before
+
+spaceBeforeMethodDeclarationParenthesis = false
+spaceBeforeMethodCallParenthesis = false
+spaceBeforeBrackets = false
+spaceBeforeBracketsInTypes = true
+spaceBeforeStatementParenthesis = true
+spaceBeforeConditionBang = true
+spaceBeforeCaseColon = true
+
+### Whitespaces -- Space After
+
+spaceAfterComma = true
+spaceAfterSemicolon = true
+spaceAfterCasting = true
+
+### Whitespaces -- No Spaces
+
+noSpacesInEmptyForExpressions = true
+
+### Line Wrapping -- Misc
+
+maxFieldElementsPerLine = 0
+wrapLines = true
+wrapBecauseOfComments = true
+wrapLongMethodNames = true
+maxLineLength = 78
+deepIndent = 45
+forceIndent = 8
+forceIndentTolerance = 4
+allowWrappingAfterAssignments = true
+allowWrappingAfterParenthesis = true
+preferWrappingAfterThrows = true
+alwaysWrapThrows = true
+alwaysWrapExtends = true
+alwaysWrapImplements = true
+indentWrappedThrows = 4
+indentWrappedExtends = 4
+indentWrappedImplements = 4
diff --git a/tools/resources/stylesheets/html2xml.xsl b/tools/resources/stylesheets/html2xml.xsl
new file mode 100755
index 0000000000..a40bdd2485
--- /dev/null
+++ b/tools/resources/stylesheets/html2xml.xsl
@@ -0,0 +1,153 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output indent="yes"/>
+ <xsl:param name="stack">bodyroot</xsl:param>
+
+ <xsl:template match="html|HTML">
+ <xsl:text disable-output-escaping="yes">
+ <![CDATA[ <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../dtd/document-v10.dtd"> ]]>
+ </xsl:text>
+ <document>
+ <xsl:apply-templates select = "head" />
+ <xsl:apply-templates select="body"/>
+ </document>
+ </xsl:template>
+
+ <xsl:template match="head|HEAD">
+ <header>
+ <title><xsl:value-of select="title" /><xsl:value-of select="TITLE" /></title>
+ <authors>
+ <person id="AO" name="Andrew C. Oliver" email="acoliver2@users.sourceforge.net"/>
+ </authors>
+ </header>
+ </xsl:template>
+
+ <xsl:template match="body|BODY">
+ <body><s1><xsl:attribute name="title"><xsl:value-of select="'pippo'"></xsl:value-of></xsl:attribute>
+ <xsl:apply-templates select="*"/>
+ </s1>
+ </body>
+ </xsl:template>
+
+
+ <xsl:template match="meta|META"/>
+
+ <xsl:template match="title|TITLE"/>
+
+ <xsl:template match="h1|H1">
+ </xsl:template>
+
+ <xsl:template match="h2|H2">
+ <s2><xsl:attribute name="title"><xsl:value-of select="."></xsl:value-of></xsl:attribute></s2>
+ </xsl:template>
+
+ <xsl:template match="h3|H3">
+ <s2><xsl:attribute name="title"><xsl:value-of select="."></xsl:value-of></xsl:attribute></s2>
+ </xsl:template>
+
+ <xsl:template match="h4|H4">
+ <s2><xsl:attribute name="title"><xsl:value-of select="."></xsl:value-of></xsl:attribute></s2>
+ </xsl:template>
+
+ <xsl:template match="dl|DL">
+ <!--<dl>
+ <xsl:apply-templates select = "dd|DD|dt|DT" />
+ </dl>-->
+ </xsl:template>
+
+ <xsl:template match="dd|DD">
+ <!--<dd>
+ <xsl:apply-templates select = "*" />
+ </dd> -->
+ </xsl:template>
+
+ <xsl:template match="dt|DT">
+ <!--<dt>
+ <xsl:apply-templates select = "*" />
+ </dt>-->
+ </xsl:template>
+
+ <xsl:template match="p|P">
+ <xsl:choose>
+ <xsl:when test="name(parent::node())='li' or name(parent::node())='LI'">
+ <xsl:value-of select = "*" />
+ </xsl:when>
+ <xsl:otherwise>
+ <p>
+ <xsl:value-of select = "*" />
+ </p>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="pre|PRE">
+ <xsl:choose>
+ <xsl:when test="name(parent::node())='li' or name(parent::node())='LI'">
+ <code>
+ <xsl:value-of disable-output-escaping="no" select="." />
+ </code>
+ </xsl:when>
+ <xsl:otherwise>
+ <source>
+ <xsl:value-of disable-output-escaping="no" select="." />
+ </source>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="ul|UL">
+ <ul>
+ <xsl:apply-templates select = "li|LI" />
+ </ul>
+ </xsl:template>
+
+ <xsl:template match="li|LI">
+ <li>
+ <xsl:apply-templates select = "*" />
+ </li>
+ </xsl:template>
+
+ <xsl:template match="ol|OL">
+ <ol>
+ <xsl:apply-templates select = "li|LI" />
+ </ol>
+ </xsl:template>
+
+ <xsl:template match="div|DIV">
+ <xsl:apply-templates select = "*" />
+ </xsl:template>
+
+ <xsl:template match="br|BR">
+ <br/>
+ </xsl:template>
+
+ <xsl:template match="i|I">
+ <em>
+ <xsl:value-of select = "*" />
+ </em>
+ </xsl:template>
+
+ <xsl:template match="b|B">
+ <strong>
+ <xsl:value-of select = "*" />
+ </strong>
+ </xsl:template>
+
+ <xsl:template match="u|U">
+ <em>
+ <xsl:value-of select = "*" />
+ </em>
+ </xsl:template>
+
+ <xsl:template match="a|A">
+ <link><xsl:attribute name="href"><xsl:value-of select="@href" /><xsl:value-of select="@HREF" /></xsl:attribute>
+ <xsl:value-of select = "." />
+ </link>
+ </xsl:template>
+
+ <xsl:template match="img|IMG">
+ <img><xsl:attribute name="src"><xsl:value-of select="@src" /></xsl:attribute></img>
+ </xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/tools/src/ClassAvailable.java b/tools/src/ClassAvailable.java
new file mode 100644
index 0000000000..bec059aeb1
--- /dev/null
+++ b/tools/src/ClassAvailable.java
@@ -0,0 +1,246 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache POI" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache POI", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.io.*;
+
+import java.util.*;
+import java.util.zip.*;
+
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.types.*;
+
+/**
+ * Will set the given property if the requested class is available in the
+ * specified classpath. The found class is not loaded!
+ * This class is heavily based on the available task in the ant package:
+ * @author Stefano Mazzocchi <a href="mailto:stefano@apache.org">stefano@apache.org</a>
+ *
+ * This task searches only in the defined path but not in the parents path
+ * unless explicitly overridden by the value of ${build.sysclasspath}
+ * like the original available task does.
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ * @version CVS $Revision$ $Date$
+ */
+
+public class ClassAvailable
+ extends Task
+{
+
+ /**
+ * A hashtable of zip files opened by the classloader
+ */
+
+ private Hashtable zipFiles = new Hashtable();
+ private String property;
+ private String classname;
+ private Path classpath;
+ private String value = "true";
+
+ public void setClasspath(Path classpath)
+ {
+ createClasspath().append(classpath);
+ }
+
+ public Path createClasspath()
+ {
+ if (this.classpath == null)
+ {
+ this.classpath = new Path(this.project);
+ }
+ return this.classpath.createPath();
+ }
+
+ public void setClasspathRef(Reference r)
+ {
+ createClasspath().setRefid(r);
+ }
+
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public void setClassname(String classname)
+ {
+ if (!"".equals(classname))
+ {
+ this.classname = classname;
+ }
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (property == null)
+ {
+ throw new BuildException("property attribute is required",
+ location);
+ }
+ if (eval())
+ {
+ this.project.setProperty(property, value);
+ }
+ }
+
+ public boolean eval()
+ throws BuildException
+ {
+ if (classname == null)
+ {
+ throw new BuildException(
+ "At least one of (classname|file|resource) is required",
+ location);
+ }
+ if (classpath != null)
+ {
+ classpath.setProject(project);
+ classpath = classpath.concatSystemClasspath("ignore");
+ }
+ if (!findClassInComponents(classname))
+ {
+ log("Unable to load class " + classname + " to set property "
+ + property, Project.MSG_VERBOSE);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Get an inputstream to a given resource in the given file which may
+ * either be a directory or a zip file.
+ *
+ * @param file the file (directory or jar) in which to search for the resource.
+ * @param resourceName the name of the resource for which a stream is required.
+ *
+ * @return a stream to the required resource or null if the resource cannot be
+ * found in the given file object
+ */
+
+ private boolean contains(File file, String resourceName)
+ {
+ try
+ {
+ if (!file.exists())
+ {
+ return false;
+ }
+ if (file.isDirectory())
+ {
+ File resource = new File(file, resourceName);
+
+ if (resource.exists())
+ {
+ return true;
+ }
+ }
+ else
+ {
+
+ // is the zip file in the cache
+ ZipFile zipFile = ( ZipFile ) zipFiles.get(file);
+
+ if (zipFile == null)
+ {
+ zipFile = new ZipFile(file);
+ zipFiles.put(file, zipFile);
+ }
+ ZipEntry entry = zipFile.getEntry(resourceName);
+
+ if (entry != null)
+ {
+ return true;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log("Ignoring Exception " + e.getClass().getName() + ": "
+ + e.getMessage() + " reading resource " + resourceName
+ + " from " + file, Project.MSG_VERBOSE);
+ }
+ return false;
+ }
+
+ /**
+ * Find a class on the given classpath.
+ */
+
+ private boolean findClassInComponents(String name)
+ {
+
+ // we need to search the components of the path to see if we can find the
+ // class we want.
+ final String classname = name.replace('.', '/') + ".class";
+ final String[] list = classpath.list();
+ boolean found = false;
+ int i = 0;
+
+ while ((i < list.length) && (found == false))
+ {
+ final File pathComponent =
+ ( File ) project.resolveFile(list[ i ]);
+
+ found = this.contains(pathComponent, classname);
+ i++;
+ }
+ return found;
+ }
+}
diff --git a/tools/src/JTidyTask.java b/tools/src/JTidyTask.java
new file mode 100644
index 0000000000..ce8f5b3af4
--- /dev/null
+++ b/tools/src/JTidyTask.java
@@ -0,0 +1,272 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache POI" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache POI", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.BufferedInputStream;
+import java.io.OutputStream;
+import java.io.FileOutputStream;
+import java.io.Writer;
+import java.io.PrintWriter;
+import java.io.FileWriter;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import java.util.ArrayList;
+
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.w3c.dom.Element;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.tidy.Tidy;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Task to ask property values to the user. Uses current value as default.
+ *
+ * @author <a href="mailto:barozzi@nicolaken.com">Nicola Ken Barozzi</a>
+ * @created 14 January 2002
+ */
+
+public class JTidyTask
+ extends org.apache.tools.ant.Task
+{
+ private String src;
+ private String dest;
+ private String log;
+ private Tidy tidy;
+ private String warn = "false";
+ private String summary = "false";
+ PrintWriter pw;
+
+ /**
+ * Constructor.
+ */
+
+ public JTidyTask()
+ {
+ super();
+ }
+
+ /**
+ * Initializes the task.
+ */
+
+ public void init()
+ {
+ super.init();
+
+ // Setup an instance of Tidy.
+ tidy = new Tidy();
+ tidy.setXmlOut(true);
+ tidy.setXHTML(true);
+ tidy.setDropFontTags(true);
+ tidy.setLiteralAttribs(true);
+ tidy.setMakeClean(true);
+ tidy.setShowWarnings(Boolean.getBoolean(warn));
+ tidy.setQuiet(!Boolean.getBoolean(summary));
+ }
+
+ /**
+ * Run the task.
+ * @exception org.apache.tools.ant.BuildException The exception raised during task execution.
+ */
+
+ public void execute()
+ throws org.apache.tools.ant.BuildException
+ {
+ try
+ {
+ PrintWriter pw = new PrintWriter(new FileWriter(log));
+
+ tidy.setErrout(pw);
+
+ // Extract the document using JTidy and stream it.
+ BufferedInputStream in =
+ new BufferedInputStream(new FileInputStream(src));
+
+ // FileOutputStream out = new FileOutputStream(dest);
+ PrintWriter out =
+ new PrintWriter(new FileWriter(dest));
+
+ // using null as output to get dom so to remove duplicate attributes
+ org.w3c.dom.Document domDoc = tidy.parseDOM(in, null);
+
+ domDoc.normalize();
+ stripDuplicateAttributes(domDoc, null);
+ org.apache.xml.serialize.OutputFormat format =
+ new org.apache.xml.serialize.OutputFormat();
+
+ format.setIndenting(true);
+ format.setEncoding("ISO-8859-1");
+ format.setPreserveSpace(true);
+ format.setLineSeparator("\n");
+ org.apache.xml.serialize.XMLSerializer serializer =
+ new org.apache.xml.serialize.XMLSerializer(out, format);
+
+ serializer.serialize(domDoc);
+ out.flush();
+ out.close();
+ in.close();
+ pw.flush();
+ pw.close();
+ }
+ catch (IOException ioe)
+ {
+ throw new BuildException(ioe);
+ }
+ }
+
+ public void setSrc(String src)
+ {
+ this.src = src;
+ }
+
+ public void setDest(String dest)
+ {
+ this.dest = dest;
+ }
+
+ public void setLog(String log)
+ {
+ this.log = log;
+ }
+
+ public void setWarn(String warn)
+ {
+ this.warn = warn;
+ }
+
+ public void setSummary(String summary)
+ {
+ this.summary = summary;
+ }
+
+ // using parent because jtidy dom is bugged, cannot get parent or delete child
+ public static void stripDuplicateAttributes(Node node, Node parent)
+ {
+
+ // The output depends on the type of the node
+ switch (node.getNodeType())
+ {
+
+ case Node.DOCUMENT_NODE :
+ {
+ Document doc = ( Document ) node;
+ Node child = doc.getFirstChild();
+
+ while (child != null)
+ {
+ stripDuplicateAttributes(child, node);
+ child = child.getNextSibling();
+ }
+ break;
+ }
+ case Node.ELEMENT_NODE :
+ {
+ Element elt = ( Element ) node;
+ NamedNodeMap attrs = elt.getAttributes();
+ ArrayList nodesToRemove = new ArrayList();
+ int nodesToRemoveNum = 0;
+
+ for (int i = 0; i < attrs.getLength(); i++)
+ {
+ Node a = attrs.item(i);
+
+ for (int j = 0; j < attrs.getLength(); j++)
+ {
+ Node b = attrs.item(j);
+
+ // if there are two attributes with same name
+ if ((i != j)
+ && (a.getNodeName().equals(b.getNodeName())))
+ {
+ nodesToRemove.add(b);
+ nodesToRemoveNum++;
+ }
+ }
+ }
+ for (int i = 0; i < nodesToRemoveNum; i++)
+ {
+ org.w3c.dom.Attr nodeToDelete =
+ ( org.w3c.dom.Attr ) nodesToRemove.get(i);
+ org.w3c.dom.Element nodeToDeleteParent =
+ ( org.w3c.dom
+ .Element ) node; // nodeToDelete.getParentNode();
+
+ nodeToDeleteParent.removeAttributeNode(nodeToDelete);
+ }
+ nodesToRemove.clear();
+ Node child = elt.getFirstChild();
+
+ while (child != null)
+ {
+ stripDuplicateAttributes(child, node);
+ child = child.getNextSibling();
+ }
+ break;
+ }
+ default :
+
+ // do nothing
+ break;
+ }
+ }
+}
diff --git a/tools/src/SitemapTool.java b/tools/src/SitemapTool.java
new file mode 100644
index 0000000000..23a5f7caca
--- /dev/null
+++ b/tools/src/SitemapTool.java
@@ -0,0 +1,363 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache POI" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache POI", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.io.*;
+
+import java.util.*;
+
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.types.*;
+
+/**
+ * Add components to the sitemap
+ *
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ * @version CVS $Revision$ $Date$
+ */
+
+public final class SitemapTool
+ extends Task
+{
+ private String sitemap;
+ private String directory;
+ private String extension;
+
+ public void setSitemap(String sitemap)
+ {
+ this.sitemap = sitemap;
+ }
+
+ public void setDirectory(String directory)
+ {
+ this.directory = directory;
+ }
+
+ public void setExtension(String extension)
+ {
+ this.extension = extension;
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (this.sitemap == null)
+ {
+ throw new BuildException("sitemap attribute is required",
+ location);
+ }
+ if (this.extension == null)
+ {
+ throw new BuildException("extension attribute is required",
+ location);
+ }
+ if (this.directory == null)
+ {
+ throw new BuildException("directory attribute is required",
+ location);
+ }
+ try
+ {
+
+ // process recursive
+ this.process(new File(this.directory), this.extension,
+ this.sitemap);
+ }
+ catch (IOException ioe)
+ {
+ throw new BuildException("IOException: " + ioe);
+ }
+ }
+
+ /**
+ * Scan recursive
+ */
+
+ private void process(final File directoryFile, final String ext,
+ final String sitemapLocation)
+ throws IOException, BuildException
+ {
+ final File[] files = directoryFile.listFiles();
+
+ for (int i = 0; i < files.length; i++)
+ {
+ if (files[ i ].isDirectory() == true)
+ {
+ this.process(files[ i ], ext, sitemapLocation);
+ }
+ else
+ {
+ if (files[ i ].getName().endsWith("." + ext) == true)
+ {
+ System.out.println("Reading: "
+ + files[ i ].getAbsolutePath());
+ final String data =
+ this.load(files[ i ].getAbsolutePath());
+
+ // separate the data by lines
+ final StringTokenizer st = new StringTokenizer(data);
+
+ while (st.hasMoreElements() == true)
+ {
+
+ // now get the properties of a line. These are separated by a "|"
+ final String line =
+ ( String ) st.nextElement();
+ final StringTokenizer prop =
+ new StringTokenizer(line, "|");
+ String category = null;
+ String componentName = null;
+ String className = null;
+ String configuration = null;
+ String label = null;
+ String mimeType = null;
+
+ while (prop.hasMoreElements() == true)
+ {
+ final String property =
+ ( String ) prop.nextElement();
+ final int pos = property.indexOf(":");
+ final String propName =
+ property.substring(0, pos);
+ final String propVal = property.substring(pos
+ + 1);
+
+ if (propName.equals("category"))
+ {
+ category = propVal;
+ }
+ else if (propName.equals("componentName"))
+ {
+ componentName = propVal;
+ }
+ else if (propName.equals("componentClass"))
+ {
+ className = propVal;
+ }
+ else if (propName.equals("configuration"))
+ {
+ configuration = propVal;
+ }
+ else if (propName.equals("label"))
+ {
+ label = propVal;
+ }
+ else if (propName.equals("mimeType"))
+ {
+ mimeType = propVal;
+ }
+ else
+ {
+ throw new BuildException(
+ "Unknown property " + propName
+ + " in file "
+ + files[ i ].getAbsolutePath());
+ }
+ }
+
+ // Test for required values
+ if (category == null)
+ {
+ throw new BuildException(
+ "category property is required in file "
+ + files[ i ].getAbsolutePath(), location);
+ }
+ if (componentName == null)
+ {
+ throw new BuildException(
+ "componentName property is required in file "
+ + files[ i ].getAbsolutePath(), location);
+ }
+ if (className == null)
+ {
+ throw new BuildException(
+ "componentClass property is required in file "
+ + files[ i ].getAbsolutePath(), location);
+ }
+ this.add(sitemapLocation, category, componentName,
+ className, configuration, label, mimeType);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Add entry to sitemap
+ */
+
+ private void add(final String sitemapLocation, final String category,
+ final String componentName, final String className,
+ final String configuration, final String label,
+ final String mimeType)
+ throws IOException
+ {
+ final String data = load(sitemapLocation);
+ final String searchString =
+ new StringBuffer("</map:").append(category).append(">")
+ .toString();
+ final int pos = data.indexOf(searchString);
+ int categoryStartPos =
+ data
+ .indexOf(new StringBuffer("<map:").append(category).append(">")
+ .toString());
+
+ if (categoryStartPos == -1)
+ {
+ categoryStartPos =
+ data
+ .indexOf(new StringBuffer("<map:").append(category)
+ .append(" ").toString());
+ }
+ if ((categoryStartPos != -1) && (categoryStartPos < pos)
+ && (pos != -1))
+ {
+
+ // the category exists, now search if a component
+ // with the name already exists
+ int componentPos =
+ data.substring(categoryStartPos, pos)
+ .indexOf(new StringBuffer("name=\"").append(componentName)
+ .append("\"").toString());
+
+ if (componentPos == -1)
+ {
+ StringBuffer buffer =
+ new StringBuffer(data.substring(0, pos)).append("<map:")
+ .append(category.substring(0, category.length() - 1))
+ .append(" name=\"").append(componentName)
+ .append("\" src=\"").append(className).append("\"")
+ .append(" logger=\"sitemap.")
+ .append(category.substring(0, category.length() - 1))
+ .append('.').append(componentName).append('\"');
+
+ if ((null != mimeType) && (mimeType.length() > 0))
+ {
+ buffer.append(" mime-type=\"").append(mimeType)
+ .append("\"");
+ }
+ if ((null != label) && (label.length() > 0))
+ {
+ buffer.append(" label=\"").append(label).append("\"");
+ }
+ if (null != configuration)
+ {
+ buffer.append(">\n").append(configuration).append("\n")
+ .append("</map:")
+ .append(category.substring(0, category.length() - 1))
+ .append(">\n");
+ }
+ else
+ {
+ buffer.append("/>\n");
+ }
+ buffer.append(data.substring(pos)).toString();
+ this.save(sitemapLocation, buffer.toString());
+ }
+ }
+ }
+
+ /**
+ * Load a file and return the content as a string.
+ */
+
+ public String load(String filename)
+ throws IOException
+ {
+ FileInputStream fis;
+
+ fis = new FileInputStream(filename);
+ int available;
+ byte[] data = null;
+ byte[] tempData;
+ byte[] copyData;
+
+ do
+ {
+ available = 1024;
+ tempData = new byte[ available ];
+ available = fis.read(tempData, 0, available);
+ if (available > 0)
+ {
+ copyData = new byte[ ((data == null) ? 0
+ : data.length) + available ];
+ if (data != null)
+ {
+ System.arraycopy(data, 0, copyData, 0, data.length);
+ }
+ System.arraycopy(tempData, 0, copyData, ((data == null) ? 0
+ : data.length), available);
+ data = copyData;
+ }
+ }
+ while (available > 0);
+ fis.close();
+ return ((data != null) ? new String(data)
+ : "");
+ }
+
+ /**
+ * Save the string to a file
+ */
+
+ public void save(String filename, String data)
+ throws IOException
+ {
+ FileWriter fw = new FileWriter(filename);
+
+ fw.write(data);
+ fw.close();
+ }
+}
diff --git a/tools/src/UserInput.java b/tools/src/UserInput.java
new file mode 100644
index 0000000000..34a75f0ba8
--- /dev/null
+++ b/tools/src/UserInput.java
@@ -0,0 +1,151 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache POI" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache POI", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.IOException;
+
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Task to ask property values to the user. Uses current value as default.
+ *
+ * @author <a href="mailto:barozzi@nicolaken.com">Nicola Ken Barozzi</a>
+ * @created 14 January 2002
+ */
+
+public class UserInput
+ extends org.apache.tools.ant.Task
+{
+ private String question;
+ private String name;
+ private String value;
+
+ /**
+ * Constructor.
+ */
+
+ public UserInput()
+ {
+ super();
+ }
+
+ /**
+ * Initializes the task.
+ */
+
+ public void init()
+ {
+ super.init();
+ question = "?";
+ }
+
+ /**
+ * Run the task.
+ * @exception org.apache.tools.ant.BuildException The exception raised during task execution.
+ */
+
+ public void execute()
+ throws org.apache.tools.ant.BuildException
+ {
+ value = project.getProperty(name);
+ String defaultvalue = value;
+
+ // if the property exists
+ if (value != null)
+ {
+ System.out.println("\n" + question + " [" + value + "] ");
+ BufferedReader reader =
+ new BufferedReader(new InputStreamReader(System.in));
+
+ try
+ {
+ value = reader.readLine();
+ }
+ catch (IOException e)
+ {
+ value = defaultvalue;
+ }
+ if (!value.equals(""))
+ {
+ project.setProperty(name, value);
+ }
+ else
+ {
+ project.setProperty(name, defaultvalue);
+ }
+ }
+ }
+
+ /**
+ * Sets the prompt text that will be presented to the user.
+ * @param prompt String
+ */
+
+ public void addText(String question)
+ {
+ this.question = question;
+ }
+
+ public void setQuestion(String question)
+ {
+ this.question = question;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
diff --git a/tools/src/XConfTool.java b/tools/src/XConfTool.java
new file mode 100644
index 0000000000..becdba9215
--- /dev/null
+++ b/tools/src/XConfTool.java
@@ -0,0 +1,238 @@
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache POI" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache POI", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.io.*;
+
+import java.util.*;
+
+import org.apache.tools.ant.*;
+import org.apache.tools.ant.taskdefs.*;
+import org.apache.tools.ant.types.*;
+
+/**
+ * Add components to the cocoon.xconf
+ * This is only a ugly first shot
+ *
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ * @version CVS $Revision$ $Date$
+ */
+
+public final class XConfTool
+ extends Task
+{
+ private String configuration;
+ private String directory;
+ private String extension;
+
+ public void setConfiguration(String configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public void setDirectory(String directory)
+ {
+ this.directory = directory;
+ }
+
+ public void setExtension(String extension)
+ {
+ this.extension = extension;
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (this.configuration == null)
+ {
+ throw new BuildException("configuration attribute is required",
+ location);
+ }
+ if (this.extension == null)
+ {
+ throw new BuildException("extension attribute is required",
+ location);
+ }
+ if (this.directory == null)
+ {
+ throw new BuildException("directory attribute is required",
+ location);
+ }
+ try
+ {
+
+ // process recursive
+ this.process(new File(this.directory), this.extension,
+ this.configuration);
+ }
+ catch (IOException ioe)
+ {
+ throw new BuildException("IOException: " + ioe);
+ }
+ }
+
+ /**
+ * Scan recursive
+ */
+
+ private void process(final File directoryFile, final String ext,
+ final String configurationLocation)
+ throws IOException, BuildException
+ {
+ final File[] files = directoryFile.listFiles();
+
+ for (int i = 0; i < files.length; i++)
+ {
+ if (files[ i ].isDirectory() == true)
+ {
+ this.process(files[ i ], ext, configurationLocation);
+ }
+ else
+ {
+ if (files[ i ].getName().endsWith("." + ext) == true)
+ {
+ System.out.println("Reading: "
+ + files[ i ].getAbsolutePath());
+ final String newComponent =
+ this.load(files[ i ].getAbsolutePath());
+
+ this.add(configurationLocation, newComponent);
+ }
+ }
+ }
+ }
+
+ /**
+ * Add entry to sitemap
+ */
+
+ private void add(final String configurationLocation,
+ final String newComponent)
+ throws IOException
+ {
+ final String data = load(configurationLocation);
+
+ // first search if component already present:
+ if (data.indexOf(newComponent) == -1)
+ {
+ int pos = data.indexOf("<cocoon");
+
+ if (pos != -1)
+ {
+ pos = data.indexOf(">", pos);
+ if (pos != -1)
+ {
+ StringBuffer buffer =
+ new StringBuffer(data.substring(0, pos + 1))
+ .append("\n\n").append(newComponent)
+ .append(data.substring(pos + 1));
+
+ this.save(configurationLocation, buffer.toString());
+ }
+ }
+ }
+ }
+
+ /**
+ * Load a file and return the content as a string.
+ */
+
+ public String load(String filename)
+ throws IOException
+ {
+ FileInputStream fis;
+
+ fis = new FileInputStream(filename);
+ int available;
+ byte[] data = null;
+ byte[] tempData;
+ byte[] copyData;
+
+ do
+ {
+ available = 1024;
+ tempData = new byte[ available ];
+ available = fis.read(tempData, 0, available);
+ if (available > 0)
+ {
+ copyData = new byte[ ((data == null) ? 0
+ : data.length) + available ];
+ if (data != null)
+ {
+ System.arraycopy(data, 0, copyData, 0, data.length);
+ }
+ System.arraycopy(tempData, 0, copyData, ((data == null) ? 0
+ : data.length), available);
+ data = copyData;
+ }
+ }
+ while (available > 0);
+ fis.close();
+ return ((data != null) ? new String(data)
+ : "");
+ }
+
+ /**
+ * Save the string to a file
+ */
+
+ public void save(String filename, String data)
+ throws IOException
+ {
+ FileWriter fw = new FileWriter(filename);
+
+ fw.write(data);
+ fw.close();
+ }
+}
diff --git a/tools/src/announcement2header.xsl b/tools/src/announcement2header.xsl
new file mode 100755
index 0000000000..c326fa56a7
--- /dev/null
+++ b/tools/src/announcement2header.xsl
@@ -0,0 +1,78 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="html" indent="yes"/>
+
+ <xsl:template match="changes">
+ <xsl:variable name="version" select="@version"/>
+ <xsl:apply-templates select="document(@file,/)/changes/release[attribute::version=string($version)]"/>
+ </xsl:template>
+
+ <xsl:template match="announcement">
+ <style>
+ body { background-color: #FFFFFF }
+ p { font-size: 10pt; font-family: Helvetica, Arial, sans-serif }
+ li,ul { font-size: 10pt; font-family: Helvetica, Arial, sans-serif }
+ div { font-size: 10pt; font-family: Helvetica, Arial, sans-serif; font-style:italic }
+ h1 { font-size: 14pt; font-family: Helvetica, Arial, sans-serif; font-weight: bold }
+ h2 { font-size: 12pt; font-family: Helvetica, Arial, sans-serif; font-weight: bold }
+ h3 { font-size: 10pt; font-family: Helvetica, Arial, sans-serif; font-weight: bold }
+ A:link { color: #0000A0 } /* unvisited link */
+ A:visited { color: #A00000 } /* visited links */
+ A:active { color: #00A000 } /* active links */
+ </style>
+ <h1 align="center"><xsl:value-of select="title"/><xsl:text> Released</xsl:text></h1>
+ <xsl:apply-templates select="abstract"/>
+
+ <xsl:for-each select="project">
+ <h2>About <xsl:value-of select="title"/></h2>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+
+ </xsl:template>
+
+ <xsl:template match="project">
+ <p><xsl:apply-templates select="description"/></p>
+
+ <p>For more information about <xsl:value-of select="title"/>, please go to
+ <a><xsl:attribute name="href"><xsl:value-of select="@site"/></xsl:attribute>
+ <xsl:value-of select="@site"/></a>.</p>
+
+ <!-- print out ChangeLog if present -->
+ <!--
+ <xsl:if test="changes">
+ <h3>ChangeLog for <xsl:value-of select="title"/></h3>
+ <xsl:apply-templates select="changes"/>
+ </xsl:if>
+ -->
+ </xsl:template>
+
+ <xsl:template match="abstract">
+ <div align="center">
+ <xsl:apply-templates/>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="para">
+ <p><xsl:apply-templates/></p>
+ </xsl:template>
+
+ <xsl:template match="ulink">
+ <a href="{@uri}"><xsl:value-of select="."/></a>
+ </xsl:template>
+
+ <xsl:template match="release">
+ <ul>
+ <xsl:for-each select="action">
+ <li>
+ <xsl:value-of select="normalize-space(.)"/>
+ <xsl:if test="@dev">
+ <xsl:text>[</xsl:text><xsl:value-of select="@dev"/><xsl:text>]</xsl:text>
+ </xsl:if>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/src/announcement2readme.xsl b/tools/src/announcement2readme.xsl
new file mode 100755
index 0000000000..63cbdefd07
--- /dev/null
+++ b/tools/src/announcement2readme.xsl
@@ -0,0 +1,89 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="html" indent="yes"/>
+
+ <xsl:template match="changes">
+ <xsl:variable name="version" select="@version"/>
+ <xsl:apply-templates select="document(@file,/)/changes/release[attribute::version=string($version)]"/>
+ </xsl:template>
+
+ <xsl:template match="announcement">
+ <style>
+ body { background-color: #FFFFFF }
+ p { font-size: 10pt; font-family: Helvetica, Arial, sans-serif }
+ li,ul { font-size: 10pt; font-family: Helvetica, Arial, sans-serif }
+ div { font-size: 10pt; font-family: Helvetica, Arial, sans-serif; font-style:italic }
+ h1 { font-size: 14pt; font-family: Helvetica, Arial, sans-serif; font-weight: bold }
+ h2 { font-size: 12pt; font-family: Helvetica, Arial, sans-serif; font-weight: bold }
+ h3 { font-size: 10pt; font-family: Helvetica, Arial, sans-serif; font-weight: bold }
+ A:link { color: #0000A0 } /* unvisited link */
+ A:visited { color: #A00000 } /* visited links */
+ A:active { color: #00A000 } /* active links */
+ </style>
+
+ <a name="sig"><h2>PGP Signatures</h2></a>
+
+ <p>Many of the distribution kits have been digitally signed (using
+ PGP). If so, there will be an accompanying
+ <samp><em>distribution</em>.asc</samp> file in the same directory as
+ the distribution. The PGP keys can be found in the distribution
+ directory at &lt;<a href="http://jakarta.apache.org/builds/jakarta-avalon/release/KEYS">
+ <samp>http://jakarta.apache.org/builds/jakarta-avalon/release/KEYS</samp></a>&gt;.</p>
+
+ <xsl:variable name="filename"><xsl:value-of
+ select="project/downloads/@name"/>-<xsl:value-of
+ select="project/changes/@version"/>-bin.tar.gz</xsl:variable>
+
+ <pre>Always test available signatures, <i>e.g.</i>,
+&gt; pgpk -a KEYS
+&gt; pgpv <xsl:value-of select="$filename"/>.asc
+<i>or</i>,
+&gt; pgp -ka KEYS
+&gt; pgp <xsl:value-of select="$filename"/>.asc
+<i>or</i>,
+&gt; gpg --import KEYS
+&gt; gpg --verify <xsl:value-of select="$filename"/>.asc
+</pre>
+
+ <xsl:for-each select="project">
+ <xsl:if test="downloads">
+ <h2>About <xsl:value-of select="title"/></h2>
+ <xsl:apply-templates select="."/>
+ </xsl:if>
+ </xsl:for-each>
+
+ </xsl:template>
+
+ <xsl:template match="project">
+
+ <p>For more information about <xsl:value-of select="title"/>, please go to
+ <a><xsl:attribute name="href"><xsl:value-of select="@site"/></xsl:attribute>
+ <xsl:value-of select="@site"/></a>.</p>
+
+ <!-- print out ChangeLog if present -->
+ <xsl:if test="changes">
+ <h3>ChangeLog for <xsl:value-of select="title"/></h3>
+ <xsl:apply-templates select="changes"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="ulink">
+ <a href="{@uri}"><xsl:value-of select="."/></a>
+ </xsl:template>
+
+ <xsl:template match="release">
+ <ul>
+ <xsl:for-each select="action">
+ <li>
+ <xsl:value-of select="normalize-space(.)"/>
+ <xsl:if test="@dev">
+ <xsl:text>[</xsl:text><xsl:value-of select="@dev"/><xsl:text>]</xsl:text>
+ </xsl:if>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/src/announcement2site.xsl b/tools/src/announcement2site.xsl
new file mode 100755
index 0000000000..52a41cd9c5
--- /dev/null
+++ b/tools/src/announcement2site.xsl
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:lxslt="http://xml.apache.org/xslt"
+ xmlns:my-ext="ext1"
+ extension-element-prefixes="my-ext"
+>
+
+ <xsl:output method="xml" indent="yes"/>
+ <!--The component and its script are in the lxslt namespace and define the
+ implementation of the extension.-->
+ <lxslt:component prefix="my-ext" elements="timelapse" functions="getdate">
+ <lxslt:script lang="javascript">
+ var month = new Array (
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ );
+
+ function getdate()
+ {
+ var d = new Date();
+ var mo = month[d.getMonth()];
+ var dy = d.getDate();
+ var yr = d.getFullYear();
+ var dateString = dy + " " + mo + " " + yr;
+ return dateString;
+ }
+ </lxslt:script>
+ </lxslt:component>
+
+ <xsl:template match="changes">
+ <xsl:variable name="version" select="@version"/>
+ <xsl:apply-templates select="document(@file,/)/changes/release[attribute::version=string($version)]"/>
+ </xsl:template>
+
+ <xsl:template match="announcement">
+ <h3><xsl:value-of select="my-ext:getdate()"/> - <xsl:value-of select="title"/><xsl:text> Released</xsl:text></h3>
+ <xsl:apply-templates select="abstract"/>
+
+ <xsl:for-each select="project">
+ <p><b>About <xsl:value-of select="title"/>:</b>
+ <xsl:apply-templates select="."/>
+ </p>
+ </xsl:for-each>
+
+ <hr noshade="" size="1"/>
+ </xsl:template>
+
+ <xsl:template match="project">
+ <xsl:apply-templates select="description"/>
+
+ <p>For more information about <xsl:value-of select="title"/>, please go to
+ <a><xsl:attribute name="href"><xsl:value-of select="@site"/></xsl:attribute>
+ <xsl:value-of select="@site"/></a>.</p>
+
+ <!-- ignore changelog for site -->
+ </xsl:template>
+
+ <xsl:template match="abstract">
+ <p><xsl:apply-templates/></p>
+ </xsl:template>
+
+ <xsl:template match="description">
+ <xsl:choose>
+ <xsl:when test="para">
+ <xsl:apply-templates select="para[position()=1]/node()"/>
+ <xsl:apply-templates select="para[position()>1]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="para">
+ <p><xsl:apply-templates/></p>
+ </xsl:template>
+
+ <xsl:template match="ulink">
+ <a href="{@uri}"><xsl:value-of select="."/></a>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/tools/src/announcement2txt.xsl b/tools/src/announcement2txt.xsl
new file mode 100755
index 0000000000..9b03cc12b4
--- /dev/null
+++ b/tools/src/announcement2txt.xsl
@@ -0,0 +1,174 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="text" indent="no"/>
+
+ <xsl:template match="changes">
+ <xsl:variable name="version" select="@version"/>
+ <xsl:apply-templates select="document(@file,/)/changes/release[attribute::version=string($version)]"/>
+ </xsl:template>
+
+ <xsl:template name="print-title">
+ <xsl:param name="title"/>
+<xsl:variable name="text" select="normalize-space($title)"/>
+<xsl:value-of select="$text"/><xsl:text>
+</xsl:text>
+ <xsl:call-template name="line">
+ <xsl:with-param name="len" select="string-length($text)"/>
+ </xsl:call-template>
+ <xsl:text>
+</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="announcement">
+ <text>
+ <xsl:call-template name="print-title">
+ <xsl:with-param name="title"><xsl:value-of select="title"/> Released</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="word-wrap">
+ <xsl:with-param name="text" select="normalize-space(abstract)"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ <xsl:text>
+
+</xsl:text>
+ <xsl:for-each select="project">
+ <xsl:call-template name="print-title">
+ <xsl:with-param name="title">About <xsl:value-of select="title"/></xsl:with-param>
+ </xsl:call-template>
+ <xsl:apply-templates select="."/>
+ <xsl:text>
+
+</xsl:text>
+ </xsl:for-each>
+ </text>
+ </xsl:template>
+
+ <xsl:template match="project">
+ <xsl:choose>
+ <xsl:when test="description/para">
+ <xsl:for-each select="description/para">
+ <xsl:call-template name="word-wrap">
+ <xsl:with-param name="text">
+ <xsl:apply-templates select="."/>
+ </xsl:with-param>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ <xsl:text>
+
+</xsl:text>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="word-wrap">
+ <xsl:with-param name="text">
+ <xsl:apply-templates select="description"/>
+ </xsl:with-param>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ <xsl:text>
+</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>
+For more information about </xsl:text>
+ <xsl:value-of select="title"/>
+ <xsl:text>, please go to
+</xsl:text>
+ <xsl:value-of select="@site"/>
+
+ <!-- print out ChangeLog if present -->
+ <xsl:if test="changes">
+ <xsl:text>
+
+ChangeLog for </xsl:text>
+ <xsl:value-of select="title"/>
+ <xsl:text>
+
+</xsl:text>
+ <xsl:apply-templates select="changes"/>
+ </xsl:if>
+
+ <!-- print out Downloads if present -->
+ <xsl:if test="downloads">
+ <xsl:text>
+Downloads for </xsl:text><xsl:value-of select="title"/> available at
+
+<xsl:value-of select="downloads/@base"/>/latest
+ </xsl:if>
+
+ </xsl:template>
+
+ <xsl:template match="para">
+ <xsl:apply-templates/>
+ <xsl:text>
+</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="ulink">
+ <xsl:value-of select="."/>
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="@uri"/>
+ <xsl:text>)</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="release">
+ <xsl:for-each select="action">
+ <xsl:text>*) </xsl:text>
+ <xsl:call-template name="word-wrap">
+ <xsl:with-param name="text" select="."/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template><xsl:text> </xsl:text>
+ <xsl:if test="@dev">
+ <xsl:text>[</xsl:text><xsl:value-of select="@dev"/><xsl:text>]</xsl:text>
+ </xsl:if>
+ <xsl:text>
+
+</xsl:text>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="line">
+ <xsl:param name="len"/>
+ <xsl:if test="number($len) > 0">
+ <xsl:text>-</xsl:text>
+ <xsl:call-template name="line">
+ <xsl:with-param name="len" select="number($len)-1"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="word-wrap">
+ <xsl:param name="text"/>
+ <xsl:param name="count"/>
+ <xsl:param name="mytext" select="normalize-space($text)"/>
+ <xsl:choose>
+ <xsl:when test="$count > 40">
+ <xsl:text>
+</xsl:text>
+ <xsl:call-template name="word-wrap">
+ <xsl:with-param name="text" select="$mytext"/>
+ <xsl:with-param name="count" select="0"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="not(contains($mytext,' '))">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$mytext"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="word" select="substring-before($mytext,' ')"/>
+ <xsl:variable name="remainder" select="substring-after($mytext,' ')"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$word"/>
+ <xsl:if test="string-length($word) > 0">
+ <xsl:call-template name="word-wrap">
+ <xsl:with-param name="text" select="$remainder"/>
+ <xsl:with-param name="count" select="$count + string-length($word)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/src/bugzilla2patchqueue.xsl b/tools/src/bugzilla2patchqueue.xsl
new file mode 100755
index 0000000000..96e91245a4
--- /dev/null
+++ b/tools/src/bugzilla2patchqueue.xsl
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:html="http://www.w3.org/1999/xhtml">
+<!-- @author <a href="mailto:barozzi@nicolaken.com">Nicola Ken Barozzi</a> -->
+<xsl:template match="html:body">
+ <patch-queue>
+ <xsl:apply-templates/>
+ </patch-queue>
+</xsl:template>
+
+<xsl:template match="html:tr">
+ <xsl:if test="contains(@class,'th')">
+ <bug>
+ <xsl:attribute name="id"><xsl:value-of select="html:td[1]/html:a"/></xsl:attribute>
+ <xsl:attribute name="url">http://nagoya.apache.org/bugzilla/<xsl:value-of select="html:td[1]/html:a/@href"/></xsl:attribute>
+ <xsl:attribute name="severity"><xsl:value-of select="html:td[2]"/></xsl:attribute>
+ <xsl:attribute name="priority"><xsl:value-of select="html:td[3]"/></xsl:attribute>
+ <xsl:attribute name="platform"><xsl:value-of select="html:td[4]"/></xsl:attribute>
+ <xsl:attribute name="owner"><xsl:value-of select="html:td[5]"/></xsl:attribute>
+ <xsl:attribute name="status"><xsl:value-of select="html:td[6]"/></xsl:attribute>
+ <xsl:attribute name="resolution"><xsl:value-of select="html:td[7]"/></xsl:attribute>
+ <xsl:attribute name="summary"><xsl:value-of select="html:td[8]"/></xsl:attribute>
+ </bug>
+ </xsl:if>
+</xsl:template>
+
+
+ <xsl:template match="@*|*|text()|processing-instruction()">
+ <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
+ </xsl:template>
+
+
+
+</xsl:stylesheet>
diff --git a/tools/src/changelog.xsl b/tools/src/changelog.xsl
new file mode 100755
index 0000000000..20f7cf9fb6
--- /dev/null
+++ b/tools/src/changelog.xsl
@@ -0,0 +1,95 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:output indent="yes"/>
+
+ <xsl:param name="module">module</xsl:param>
+ <xsl:param name="cvsweb">cvsweb</xsl:param>
+
+ <xsl:template match="/">
+
+ <html>
+ <head>
+ <link rel="stylesheet" type="text/css" href="../../../../html/javadoc.css" title="Style"></link>
+ </head>
+ <body bgcolor="white">
+ <h1>Change Log</h1>
+
+ <xsl:apply-templates select="changelog/entry">
+ <xsl:sort order="descending" select="date" />
+ </xsl:apply-templates>
+
+ </body>
+ </html>
+
+ </xsl:template>
+
+ <xsl:template match="entry">
+
+ <h2>
+ <xsl:call-template name="escape-return">
+ <xsl:with-param name="string"><xsl:value-of select="msg"/></xsl:with-param>
+ </xsl:call-template>
+ </h2>
+ <p>
+ <b>
+ <xsl:apply-templates select="date"/>
+ by <xsl:value-of disable-output-escaping="yes" select="author"/>
+ </b>
+ </p>
+ <p>
+ <xsl:apply-templates select="file"/>
+ </p>
+ <hr/>
+
+ </xsl:template>
+
+ <xsl:template match="date">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="weekday">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="time">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="file">
+ <br/><a>
+ <xsl:choose>
+ <xsl:when test="string-length(prevrevision) = 0 ">
+ <xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$module" />/<xsl:value-of select="name" />?rev=<xsl:value-of select="revision" />&amp;content-type=text/x-cvsweb-markup</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$module" />/<xsl:value-of select="name" />?r1=<xsl:value-of select="revision" />&amp;r2=<xsl:value-of select="prevrevision"/>&amp;diff_format=h</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="name" />
+ </a>
+ </xsl:template>
+
+ <xsl:template name="escape-return">
+ <xsl:param name="string"/>
+ <!-- must be a better way to define a carrige return -->
+ <xsl:variable name="return"><xsl:text>
+</xsl:text>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($string, $return)">
+ <xsl:value-of select="substring-before($string, $return)"/><br/>
+ <xsl:call-template name="escape-return">
+ <xsl:with-param name="string">
+ <xsl:value-of select="substring-after($string, $return)"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/tools/src/patchqueue2text4dev.xsl b/tools/src/patchqueue2text4dev.xsl
new file mode 100755
index 0000000000..57986547c9
--- /dev/null
+++ b/tools/src/patchqueue2text4dev.xsl
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- @author <a href="mailto:barozzi@nicolaken.com">Nicola Ken Barozzi</a> -->
+ <xsl:output method="text"/>
+
+ <xsl:template match="/">-----------------------------------------------------------
+ This mail is generated automatically using
+ Jakarta Ant. Contents are automatically
+ downloaded from Apache's Bugzilla.
+-----------------------------------------------------------
+ Please do not reply to this mail.
+-----------------------------------------------------------
+
+***********************************************************
+ __ __ __ __ __ __
+ (___ (__) (___ (__) (__) | )
+
+ __ __ _|_ __ |__ ___ __
+ |__) (__( |_, (___ | ) (__/_ __)
+ |
+***********************************************************
+***************** patches in queue: <xsl:value-of select="count(patch-queue/bug)"/> ********************
+***********************************************************
+ <xsl:for-each select="patch-queue/bug">
+-----------------------------------------------------------
+<xsl:value-of select="@id"/>:<xsl:value-of select="@summary"/>
+-----------------------------------------------------------
+<xsl:value-of select="@url"/>
+
+REVIEWER: <xsl:value-of select="@owner"/>
+RESOLUTION: <xsl:value-of select="@resolution"/>
+STATUS: <xsl:value-of select="@status"/>
+
+ </xsl:for-each>
+
+*************************that's it!************************
+
+------------------------patch HOWTO------------------------
+
+Send patches to http://nagoya.apache.org/bugzilla/
+specifying [PATCH] in the summary.
+Bugzilla sends a mail automatically to this list.
+Reviewers will mark it FIXED there when applied.
+Patches not sent to Bugzilla will not be reviewed.
+-----------------------------------------------------------
+This file is generated and updated automatically at least
+once a week, and the data is taken from Bugzilla.
+If you don't find the patch you submitted to bugzilla
+after one week, please notify cocoon-dev@xml.apache.org
+for assistance.
+-----------------------------------------------------------
+There is usually a HEAD branch and a previous-version
+branch that are maintained. Where will the patch go?
+1. If it is a bug fix it should go to both branches
+2. If something is totally new it goes into HEAD scratchpad.
+3. Something in between, but does not break backward
+ compatibility _may_ go into both (and may not)
+4. For everything else, a vote is required so
+ first it may go into HEAD, and then be VOTEd in order
+ to sync this into branch.
+Please note that structural changes have to be VOTEd first.
+ </xsl:template>
+
+ <xsl:template match="@*|*|text()|processing-instruction()">
+ <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tools/src/patchqueue2xdocs.xsl b/tools/src/patchqueue2xdocs.xsl
new file mode 100755
index 0000000000..37194957b0
--- /dev/null
+++ b/tools/src/patchqueue2xdocs.xsl
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!-- @author <a href="mailto:barozzi@nicolaken.com">Nicola Ken Barozzi</a> -->
+
+ <xsl:template match="/">
+
+ <xsl:text disable-output-escaping="yes">
+ <![CDATA[
+ <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN"
+ "dtd/document-v10.dtd">
+ ]]>
+ </xsl:text>
+
+ <document>
+ <header>
+ <title>Patch Queue</title>
+ <authors>
+ <person name="Robin Green" email="greenrd@hotmail.com"/>
+ <person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
+ </authors>
+ </header>
+
+ <body>
+
+ <s1 title="Introduction">
+
+ <p>
+ This is an <strong>informal</strong> list - in chronological order -
+ of some of the noteworthy patches that have been posted
+ to the <link href="mailto:cocoon-dev@xml.apache.org">cocoon-dev</link> mailing list.
+ These patches are not (yet) part of the Apache Cocoon project, but need reviewing for possible
+ inclusion. This system was instituted because, due to the large volume of mail and
+ the lack of time of the committers, some patches tended to get forgotten about. This
+ queue does not guarantee that any patch will be reviewed within a reasonable time frame,
+ but it does at least make them easier to find!
+ </p>
+
+ <p><strong>Reviewers wanted!</strong> - If you have time to review and/or test these patches,
+ we would be grateful for your time. Please post comments to the cocoon-dev mailing lists.
+ </p>
+
+ <p>
+ Before submitting a patch, please read the page on <connect href="contrib.xml">Third-Party
+ Contributions</connect>. The preferred submission method for patches is:
+ </p>
+
+ <ul>
+ <li>Post to cocoon-dev@xml.apache.org</li>
+ <li>Describe the patch, the reason for it and (if necessary) why this is important.</li>
+ <li>Generate the patch in <code>diff -u</code> format from CVS</li>
+ <li>Also generate a documentation patch or new file, if this is something that should be documented.
+ </li>
+ <li>Post as an attachment rather than inline (unless it is trivially small).</li>
+ </ul>
+
+ <p>Following the above guidelines will facilitate your patch being reviewed
+ and applied efficiently.</p>
+
+ </s1>
+
+ <s1 title="Patch Queue">
+
+ <p><strong> [Under Construction] </strong> Archive links will be added later.
+ <strong>Please do not bother the patch submitters/authors</strong> without first reading the
+ relevant post(s) in the <connect href="mail-archives.xml">mailing list archives.</connect>
+ </p>
+
+ <p>Vapourware will not be listed.</p>
+
+ <table>
+ <tr>
+ <th>id<!--and Link--></th>
+ <th>Summary</th>
+ <th>Reviewer</th>
+ <th>Resolution</th>
+ <th>Status</th>
+ </tr>
+ <xsl:for-each select="patch-queue/bug">
+ <tr>
+ <th>
+ <connect>
+ <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
+ <xsl:value-of select="@id"/>
+ </connect>
+ </th>
+ <th><xsl:value-of select="@summary"/></th>
+ <th><xsl:value-of select="@owner"/></th>
+ <th><xsl:value-of select="@resolution"/></th>
+ <th><xsl:value-of select="@status"/></th>
+ </tr>
+ </xsl:for-each>
+ </table>
+
+ <p>See also additional list of patches to be added in <connect href="todo.xml">To Do</connect>.
+ </p>
+
+ </s1>
+ </body>
+ </document>
+
+ </xsl:template>
+
+ <xsl:template match="@*|*|text()|processing-instruction()">
+ <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
+ </xsl:template>
+
+</xsl:stylesheet>