This commit was manufactured by cvs2svn to create tag
'GROOVY_1_0_BETA_5'.
git-svn-id: http://svn.codehaus.org/groovy/tags/GROOVY_1_0_BETA_5@1177 a5544e8c-8a19-0410-ba12-f9af4593a198
diff --git a/CVSROOT/checkoutlist b/CVSROOT/checkoutlist
deleted file mode 100644
index a7276c5..0000000
--- a/CVSROOT/checkoutlist
+++ /dev/null
@@ -1,16 +0,0 @@
-# The "checkoutlist" file is used to support additional version controlled
-# administrative files in $CVSROOT/CVSROOT, such as template files.
-#
-# The first entry on a line is a filename which will be checked out from
-# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
-# The remainder of the line is an error message to use if the file cannot
-# be checked out.
-#
-# File format:
-#
-# [<whitespace>]<filename><whitespace><error message><end-of-line>
-#
-# comment lines begin with '#'
-passwd
-log_accum.conf
-damagecontrol-groovy.conf
\ No newline at end of file
diff --git a/CVSROOT/commitinfo b/CVSROOT/commitinfo
deleted file mode 100644
index b19e7b7..0000000
--- a/CVSROOT/commitinfo
+++ /dev/null
@@ -1,15 +0,0 @@
-# The "commitinfo" file is used to control pre-commit checks.
-# The filter on the right is invoked with the repository and a list
-# of files to check. A non-zero exit of the filter program will
-# cause the commit to be aborted.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being committed to, relative
-# to the $CVSROOT. For the first match that is found, then the remainder
-# of the line is the name of the filter to run.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/damagecontrol-groovy.conf b/CVSROOT/damagecontrol-groovy.conf
deleted file mode 100644
index 623fc62..0000000
--- a/CVSROOT/damagecontrol-groovy.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-project_name: Groovy
-scm_spec: ":ext:dcontrol@localhost:/home/projects/groovy/scm:groovy/groovy-core"
-build_command_line: "maven dc"
-nag_email: groovy-dev@groovy.codehaus.org
-...
\ No newline at end of file
diff --git a/CVSROOT/editinfo b/CVSROOT/editinfo
deleted file mode 100644
index d78886c..0000000
--- a/CVSROOT/editinfo
+++ /dev/null
@@ -1,21 +0,0 @@
-# The "editinfo" file is used to allow verification of logging
-# information. It works best when a template (as specified in the
-# rcsinfo file) is provided for the logging procedure. Given a
-# template with locations for, a bug-id number, a list of people who
-# reviewed the code before it can be checked in, and an external
-# process to catalog the differences that were code reviewed, the
-# following test can be applied to the code:
-#
-# Making sure that the entered bug-id number is correct.
-# Validating that the code that was reviewed is indeed the code being
-# checked in (using the bug-id number or a seperate review
-# number to identify this particular code set.).
-#
-# If any of the above test failed, then the commit would be aborted.
-#
-# Actions such as mailing a copy of the report to each reviewer are
-# better handled by an entry in the loginfo file.
-#
-# One thing that should be noted is the the ALL keyword is not
-# supported. There can be only one entry that matches a given
-# repository.
diff --git a/CVSROOT/log_accum.conf b/CVSROOT/log_accum.conf
deleted file mode 100644
index 6343eb0..0000000
--- a/CVSROOT/log_accum.conf
+++ /dev/null
@@ -1,83 +0,0 @@
-# The "log_accum.conf" file overrides the the defaults hard-coded in
-# the "log_accum.pl" script allowing admins to setup the log_accum.pl
-# once as executable, but not writable. Each project can then have
-# it's own "log_accum.conf" to configure the behaviour of their own
-# cvs commit messages.
-
-
-# MAIL TO
-#
-# When set, specifies the email address(es) to
-# receive commit messages. When left unset, the
-# script will attempt to guess the correct
-# mailing list using the repository name and
-# the MLISTHOST option.
-#
-MAIL_TO = scm@groovy.codehaus.org
-
-# MAIL FROM
-#
-# When set, specifies the email address that
-# all commit messages will be sent from.
-# Very usefull for setting up a "no reply"
-# address for commit messages.
-#
-# When not set, the script will guess the sender's
-# address by prefixing the cvs user's name to the
-# MLISTHOST option.
-#
-#MAIL_FROM = noreply@codehaus.org
-
-# MAIL HOST ADDRESS
-#
-# The host address to use when guessing either
-# the TO or FROM addresses.
-#MLISTHOST = codehaus.org
-
-# X-SENDER EMAIL HEADER
-#
-# When specified, adds an X-Sender header to the
-# emails sent so that users can use it to more
-# easily filter out cvs messages. This is very
-# nice for when there is no mailing list
-# dedicated to cvs commit messages.
-#
-XSENDER = Groovy-CVS
-
-# REPLY-TO EMAIL ADDRESS
-#
-# When REPLYTO is set an SMTP "Reply-To" email
-# header will be added. This is very useful
-# for keeping development discussion on a
-# dev list even when cvs messages go a cvs list.
-#
-REPLYTO = dev@groovy.codehaus.org
-
-# SUBJECT PREFIX
-#
-# This text, plus a space, will be prepended
-# to the subject line of the commit message.
-# When the option specified with no value, no
-# prefix will be used.
-#
-SUBJECT_PREFIX =
-
-# MESSAGE SIZE LIMIT
-#
-# If the delta info exceeds this threshold, no diff will be
-# mailed/logged; as a replacement for this, URLs pointing
-# to the corresponding ViewCVS diffs will be constructed and
-# included in the mail/log message.
-#
-# 0 = no treshold, unlimited diffs
-# x = maximum size of the diff in kb
-#
-#SIZELIMIT = 100;
-
-# VIEWCVS URL
-#
-# Specify here the URL to ViewCVS (without trailing slash!)
-# If left unset, the script will attempt to guess the correct
-# value.
-#
-VIEWCVS = "http://cvs.groovy.codehaus.org/groovy";
diff --git a/CVSROOT/modules b/CVSROOT/modules
deleted file mode 100644
index cb9e9ef..0000000
--- a/CVSROOT/modules
+++ /dev/null
@@ -1,26 +0,0 @@
-# Three different line formats are valid:
-# key -a aliases...
-# key [options] directory
-# key [options] directory files...
-#
-# Where "options" are composed of:
-# -i prog Run "prog" on "cvs commit" from top-level of module.
-# -o prog Run "prog" on "cvs checkout" of module.
-# -e prog Run "prog" on "cvs export" of module.
-# -t prog Run "prog" on "cvs rtag" of module.
-# -u prog Run "prog" on "cvs update" of module.
-# -d dir Place module in directory "dir" instead of module name.
-# -l Top-level directory only -- do not recurse.
-#
-# NOTE: If you change any of the "Run" options above, you'll have to
-# release and re-checkout any working directories of these modules.
-#
-# And "directory" is a path to a directory relative to $CVSROOT.
-#
-# The "-a" option specifies an alias. An alias is interpreted as if
-# everything on the right of the "-a" had been typed on the command line.
-#
-# You can encode a module within a module by using the special '&'
-# character to interpose another module into the current module. This
-# can be useful for creating a module that consists of many directories
-# spread out over the entire source repository.
diff --git a/CVSROOT/notify b/CVSROOT/notify
deleted file mode 100644
index 74ae6f9..0000000
--- a/CVSROOT/notify
+++ /dev/null
@@ -1,12 +0,0 @@
-# The "notify" file controls where notifications from watches set by
-# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
-# a regular expression which is tested against the directory that the
-# change is being made to, relative to the $CVSROOT. If it matches,
-# then the remainder of the line is a filter program that should contain
-# one occurrence of %s for the user to notify, and information on its
-# standard input.
-#
-# "ALL" or "DEFAULT" can be used in place of the regular expression.
-#
-# For example:
-#ALL mail -s "CVS notification" %s
diff --git a/CVSROOT/rcsinfo b/CVSROOT/rcsinfo
deleted file mode 100644
index 49e59f4..0000000
--- a/CVSROOT/rcsinfo
+++ /dev/null
@@ -1,13 +0,0 @@
-# The "rcsinfo" file is used to control templates with which the editor
-# is invoked on commit and import.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being made to, relative to the
-# $CVSROOT. For the first match that is found, then the remainder of the
-# line is the name of the file that contains the template.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/taginfo b/CVSROOT/taginfo
deleted file mode 100644
index 274a46d..0000000
--- a/CVSROOT/taginfo
+++ /dev/null
@@ -1,20 +0,0 @@
-# The "taginfo" file is used to control pre-tag checks.
-# The filter on the right is invoked with the following arguments:
-#
-# $1 -- tagname
-# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
-# $3 -- repository
-# $4-> file revision [file revision ...]
-#
-# A non-zero exit of the filter program will cause the tag to be aborted.
-#
-# The first entry on a line is a regular expression which is tested
-# against the directory that the change is being committed to, relative
-# to the $CVSROOT. For the first match that is found, then the remainder
-# of the line is the name of the filter to run.
-#
-# If the repository name does not match any of the regular expressions in this
-# file, the "DEFAULT" line is used, if it is specified.
-#
-# If the name "ALL" appears as a regular expression it is always used
-# in addition to the first matching regex or "DEFAULT".
diff --git a/CVSROOT/verifymsg b/CVSROOT/verifymsg
deleted file mode 100644
index 86f747c..0000000
--- a/CVSROOT/verifymsg
+++ /dev/null
@@ -1,21 +0,0 @@
-# The "verifymsg" file is used to allow verification of logging
-# information. It works best when a template (as specified in the
-# rcsinfo file) is provided for the logging procedure. Given a
-# template with locations for, a bug-id number, a list of people who
-# reviewed the code before it can be checked in, and an external
-# process to catalog the differences that were code reviewed, the
-# following test can be applied to the code:
-#
-# Making sure that the entered bug-id number is correct.
-# Validating that the code that was reviewed is indeed the code being
-# checked in (using the bug-id number or a seperate review
-# number to identify this particular code set.).
-#
-# If any of the above test failed, then the commit would be aborted.
-#
-# Actions such as mailing a copy of the report to each reviewer are
-# better handled by an entry in the loginfo file.
-#
-# One thing that should be noted is the the ALL keyword is not
-# supported. There can be only one entry that matches a given
-# repository.
diff --git a/groovy/groovy-native/README b/groovy/groovy-native/README
deleted file mode 100644
index 9049c27..0000000
--- a/groovy/groovy-native/README
+++ /dev/null
@@ -1,120 +0,0 @@
-This is a proof-of-concept for compiling Groovy to native code.
-
-Goals:
- - Better performance / reduced overheads (cpu, memory, start-up time).
- - Appealing alternative to Perl/Python/Ruby/shell-scripts.
- - Simple install (src tarball, RPM, dpkg, windows installer, OS-X whatever).
- - No JVM required.
- - Ability to use Groovy to access less Javaish libraries (POSIXy stuff, MFC, .NET).
- - Ability to use Groovy (and Java) objects from other languages (C, C++, Perl, Python, Ruby, .NET, etc)
-
-WARNING: This is an experiment. It's a proof-of-concept. It probably won't work. But maybe it will.
-
-The first attempt at this package uses the GNU GCJ compiler. This is built on top of GCC and is
-available for UNIXy platforms (including Linux and OS-X) and Windows (with Cygwin).
-
-These are the first set of goals for the experiment.
-
-
-
-*** Goal 1 : Native standalone executable of .groovy file.
-[Complete]
-
-The existing Groovy compiler (running on a JVM) can compile .groovy files to .class files.
-GCJ can then compile these .class files to .o binary objects.
-GCJ can link these objects (together with a native version of the Groovy runtime library) into a
-native executable.
-
-The challenge is building the native runtime library. In particular, identifying if the runtime
-byte-code generation, custom class-loaders and dynamic proxies will cause problems when moved to
-native code.
-
-Certain features of the Groovy language may be excluded to meet this goal and a JVM is still
-required at build time.
-
-
-
-*** Goal 2 : Native Groovy libraries.
-[In progress]
-
-Compile a collection of .groovy files into a .so that can be linked to from other Groovy or native
-libraries.
-
-Provide samples for Groovy, C and C++ apps all linking to another Groovy library.
-
-
-
-*** Goal 3 : Native .groovy compiler.
-[Not started]
-
-The actual Groovy compiler should be native (as well as the runtime) allowing Groovy to be developed
-entirely without a JVM present.
-
-
-
-*** Goal 4 : Usable tool set.
-[In progress]
-
-A set of simple wrapper tools should be provided for common features:
- - Compiling and linking a Groovy library or standalone executable.
- - JIT style interpreter (like Python) that runs a Groovy script directly by recompiling if necessary.
- - #!/usr/local/bin/groovy style declaration for scripts allowing direct invocation.
-
-
-
-*** Goal 5 : Runtime interpreter.
-[Not started]
-
-Allow Groovy snippets to be evaluated dynamically at runtime (the functionality of GroovyClassLoader).
-This could get tricky.
-
-
-
-*** Goal 6 : Complete language features.
-[Not started]
-
-Get all the unit tests running on the native Groovy. This excludes Java specific extras such as JMS
-and Servlets.
-
-
-
-*** Goal 7 : Installation bundle.
-[Not started]
-
-Provide a UNIX installation bundle that contains scripts and instructions for getting native Groovy
-running on a machine.
-
-
-
-*** Goal 8 : Optimizations.
-[Not started]
-
-Profile code to see how it can be made snappier. Especially important is the startup time. A plain
-GCJ compiled Java file starts within <50ms, whereas Groovy is taking much longer.
-
-
-
-*** Goal 9 : Provide Groovy with simple access to native libraries.
-[Not started]
-
-Extend the Groovy library and build tools to allow easy access to code outside of Groovy/Java from
-Groovy classes.
-
-Something like:
-
-import ncurses // use libncurses/ncurses.h
-class Thingy {
- void doStuff(name) {
- ncurses.printw("Hello ${name}") // print string
- ncurses.refresh() // display it on screen
- ncurses.getch() // wait for key press
- }
-}
-
-
-
-
-
-
-
-- Joe Walnes <joe@thoughtworks.net>
diff --git a/groovy/groovy-native/examples/001-standalone-executable/README b/groovy/groovy-native/examples/001-standalone-executable/README
deleted file mode 100644
index fefdd4d..0000000
--- a/groovy/groovy-native/examples/001-standalone-executable/README
+++ /dev/null
@@ -1,15 +0,0 @@
-Read README in parent directory first. And read the README in the grand-parent directory
-before that! Seriously, it's important!
-
-
-
-This demo simply compiles a single Simple.groovy class into a native executable that can
-be invoked using ./Simple
-
-Steps:
- * Read the other README files.
- * ./build.sh
- * ./Simple
-
-
-- Joe Walnes <joe@thoughtworks.net>
diff --git a/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy b/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy
deleted file mode 100644
index b67e0d3..0000000
--- a/groovy/groovy-native/examples/001-standalone-executable/Simple.groovy
+++ /dev/null
@@ -1,19 +0,0 @@
-class Simple {
- doSomething() {
- data = ["name": "James", "location": "London"]
- for (e in data) {
- println("entry ${e.key} is ${e.value}")
- }
- }
-
- closureExample(collection) {
- collection.each { println("value ${it}") }
- }
-
- static void main(args) {
- values = [1, 2, 3, "abc", "moo"]
- foo = new Simple()
- foo.closureExample(values)
- foo.doSomething()
- }
-}
diff --git a/groovy/groovy-native/examples/001-standalone-executable/build.sh b/groovy/groovy-native/examples/001-standalone-executable/build.sh
deleted file mode 100644
index e1ca0b1..0000000
--- a/groovy/groovy-native/examples/001-standalone-executable/build.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-$GROOVY_HOME/bin/groovyc Simple.groovy
-CLASSPATH=../../libgroovy/libgroovy.jar gcj --main=Simple -o Simple -L../../libgroovy -lgroovy *.class
-rm -rf *.class
-
diff --git a/groovy/groovy-native/examples/README b/groovy/groovy-native/examples/README
deleted file mode 100644
index a01ddda..0000000
--- a/groovy/groovy-native/examples/README
+++ /dev/null
@@ -1,16 +0,0 @@
-These are the examples for libgroovy. If you don't know what I'm talking about, read
-the README in the parent directory.
-
-Before running any of the examples:
- * Build libgroovy (instructions in libgroovy directory).
- * Set GROOVY_HOME to wherever Groovy may reside.
- * Append the libgroovy directory to LD_LIBRARY_PATH if not already present.
-
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/groovy-native/libgroovy
-
-The example directory names are prefixed with a number so you can step through the
-examples in a logical order.
-
-
-- Joe Walnes <joe@thoughtworks.net>
-
diff --git a/groovy/groovy-native/libgroovy/README b/groovy/groovy-native/libgroovy/README
deleted file mode 100644
index 0314b9d..0000000
--- a/groovy/groovy-native/libgroovy/README
+++ /dev/null
@@ -1,59 +0,0 @@
-See README in parent directory before reading on.
-
-Okay, so now you know what this is all about.
-
-
-
-*** Introduction
-
-libgroovy is the core native Groovy library for runtime use. Any Groovy application
-requires this library (and the standard libgcj libraries) to run.
-
-libgroovy only contains a subset of the standard Groovy library. Currently it only
-runs basic Groovy scripts.
-
-You may notice that there are no actual source files here. This is because libgroovy
-is built from the Java source files from Groovy. The source files for the Java ASM
-library are also required.
-
-
-
-*** Building the library.
-
-This library currently only compiles on UNIX.
-
-You need:
- - JDK.
- - GCJ.
- - The Java source for Groovy and ASM.
- - Bash.
-
-Edit build.sh and set the appropriate variables at the top of the script.
-
-./build.sh
-(may take some time and generate a collection of warnings - but hopefully no errors).
-
-If all goes to plan, you should end up with libgroovy.so and libgroovy.jar in the current
-directory.
-
-
-
-*** Notes on how the library is built.
-
-The stripped down library only tries to compile the classes listed in groovy-src and asm-src.
-
-Certain tweaks needed to be made to get the source to compile as GCJ only partially supports
-the J2SE1.4 library. Rather than modify the Groovy source, build.sh patches the source using
-patch.diff to get the code to compile (although nobbling some features in doing so).
-
-
-
-*** How to use the library.
-
-Coming soon. In the mean time, look at one of the examples.
-
-
-
-- Joe Walnes <joe@thoughtworks.net>
-
-
diff --git a/groovy/groovy-native/libgroovy/asm-src b/groovy/groovy-native/libgroovy/asm-src
deleted file mode 100644
index e89f128..0000000
--- a/groovy/groovy-native/libgroovy/asm-src
+++ /dev/null
@@ -1,10 +0,0 @@
-org/objectweb/asm/ClassVisitor.java
-org/objectweb/asm/ClassWriter.java
-org/objectweb/asm/CodeVisitor.java
-org/objectweb/asm/Constants.java
-org/objectweb/asm/CodeWriter.java
-org/objectweb/asm/Edge.java
-org/objectweb/asm/Item.java
-org/objectweb/asm/Label.java
-org/objectweb/asm/Type.java
-org/objectweb/asm/ByteVector.java
diff --git a/groovy/groovy-native/libgroovy/build.sh b/groovy/groovy-native/libgroovy/build.sh
deleted file mode 100644
index fd1be84..0000000
--- a/groovy/groovy-native/libgroovy/build.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-
-# Ensure these paths are correct
-
-#JAVA_HOME=/usr/local/java
-GROOVY_HOME=~/groovy-1.0-beta-2
-GROOVY_SRC=$GROOVY_HOME/src/main
-ASM_SRC=~/ASM/dev/src
-
-# End of paths
-
-
-
-
-BUILD_DIR=build
-LIB_NAME=groovy
-
-rm -rf $BUILD_DIR lib$LIB_NAME.{jar,so}
-mkdir -p $BUILD_DIR
-
-BASE_DIR=`pwd`
-cd $BUILD_DIR
-BUILD_DIR=`pwd`
-cd $BASE_DIR
-
-# Copy mimimum required source files to temp directory
-(cd $GROOVY_SRC && cp --parents `grep -v '#' $BASE_DIR/groovy-src` $BUILD_DIR)
-(cd $ASM_SRC && cp --parents `grep -v '#' $BASE_DIR/asm-src` $BUILD_DIR)
-
-# Patch the source files
-patch --silent -f -p0 -d $BUILD_DIR < patch.diff
-
-# .java -> .class
-find $BUILD_DIR -name \*.java | xargs gcj -C
-
-# .class -> .jar
-jar -cf lib$LIB_NAME.jar -C $BUILD_DIR .
-
-# .class -> .so
-gcj -shared -o lib$LIB_NAME.so lib$LIB_NAME.jar
-
-# clean up
-rm -rf $BUILD_DIR
-
diff --git a/groovy/groovy-native/libgroovy/groovy-src b/groovy/groovy-native/libgroovy/groovy-src
deleted file mode 100644
index 0030e97..0000000
--- a/groovy/groovy-native/libgroovy/groovy-src
+++ /dev/null
@@ -1,128 +0,0 @@
-groovy/lang/Closure.java
-groovy/lang/ClosureException.java
-groovy/lang/GString.java
-groovy/lang/GroovyClassLoader.java
-groovy/lang/GroovyLog.java
-groovy/lang/GroovyObject.java
-groovy/lang/GroovyObjectSupport.java
-groovy/lang/GroovyShell.java
-groovy/lang/IntRange.java
-groovy/lang/MetaClass.java
-groovy/lang/MetaClassRegistry.java
-groovy/lang/NonEmptySequence.java
-groovy/lang/ObjectRange.java
-groovy/lang/Range.java
-groovy/lang/Reference.java
-groovy/lang/Script.java
-groovy/lang/ScriptContext.java
-groovy/lang/Sequence.java
-groovy/lang/Tuple.java
-groovy/util/Bitwise.java
-groovy/util/BuilderSupport.java
-groovy/util/ClosureComparator.java
-groovy/util/IndentPrinter.java
-groovy/util/MapEntry.java
-groovy/util/Node.java
-groovy/util/NodeBuilder.java
-groovy/util/NodePrinter.java
-groovy/util/OrderBy.java
-org/codehaus/groovy/GroovyException.java
-org/codehaus/groovy/ast/ASTNode.java
-org/codehaus/groovy/ast/ClassNode.java
-org/codehaus/groovy/ast/CodeVisitorSupport.java
-org/codehaus/groovy/ast/CompileUnit.java
-org/codehaus/groovy/ast/ConstructorNode.java
-org/codehaus/groovy/ast/FieldNode.java
-org/codehaus/groovy/ast/GroovyClassVisitor.java
-org/codehaus/groovy/ast/GroovyCodeVisitor.java
-org/codehaus/groovy/ast/InnerClassNode.java
-org/codehaus/groovy/ast/MetadataNode.java
-org/codehaus/groovy/ast/MethodNode.java
-org/codehaus/groovy/ast/MixinNode.java
-org/codehaus/groovy/ast/ModuleNode.java
-org/codehaus/groovy/ast/Parameter.java
-org/codehaus/groovy/ast/PropertyNode.java
-org/codehaus/groovy/ast/expr/ArgumentListExpression.java
-org/codehaus/groovy/ast/expr/ArrayExpression.java
-org/codehaus/groovy/ast/expr/BinaryExpression.java
-org/codehaus/groovy/ast/expr/BooleanExpression.java
-org/codehaus/groovy/ast/expr/ClassExpression.java
-org/codehaus/groovy/ast/expr/ClosureExpression.java
-org/codehaus/groovy/ast/expr/ConstantExpression.java
-org/codehaus/groovy/ast/expr/ConstructorCallExpression.java
-org/codehaus/groovy/ast/expr/Expression.java
-org/codehaus/groovy/ast/expr/FieldExpression.java
-org/codehaus/groovy/ast/expr/GStringExpression.java
-org/codehaus/groovy/ast/expr/ListExpression.java
-org/codehaus/groovy/ast/expr/MapEntryExpression.java
-org/codehaus/groovy/ast/expr/MapExpression.java
-org/codehaus/groovy/ast/expr/MethodCallExpression.java
-org/codehaus/groovy/ast/expr/NamedArgumentListExpression.java
-org/codehaus/groovy/ast/expr/NotExpression.java
-org/codehaus/groovy/ast/expr/PostfixExpression.java
-org/codehaus/groovy/ast/expr/PrefixExpression.java
-org/codehaus/groovy/ast/expr/PropertyExpression.java
-org/codehaus/groovy/ast/expr/RangeExpression.java
-org/codehaus/groovy/ast/expr/RegexExpression.java
-org/codehaus/groovy/ast/expr/StaticMethodCallExpression.java
-org/codehaus/groovy/ast/expr/TupleExpression.java
-org/codehaus/groovy/ast/expr/VariableExpression.java
-org/codehaus/groovy/ast/stmt/AssertStatement.java
-org/codehaus/groovy/ast/stmt/BlockStatement.java
-org/codehaus/groovy/ast/stmt/BreakStatement.java
-org/codehaus/groovy/ast/stmt/CaseStatement.java
-org/codehaus/groovy/ast/stmt/CatchStatement.java
-org/codehaus/groovy/ast/stmt/ContinueStatement.java
-org/codehaus/groovy/ast/stmt/DoWhileStatement.java
-org/codehaus/groovy/ast/stmt/EmptyStatement.java
-org/codehaus/groovy/ast/stmt/ExpressionStatement.java
-org/codehaus/groovy/ast/stmt/ForStatement.java
-org/codehaus/groovy/ast/stmt/IfStatement.java
-org/codehaus/groovy/ast/stmt/ReturnStatement.java
-org/codehaus/groovy/ast/stmt/Statement.java
-org/codehaus/groovy/ast/stmt/SwitchStatement.java
-org/codehaus/groovy/ast/stmt/SynchronizedStatement.java
-org/codehaus/groovy/ast/stmt/ThrowStatement.java
-org/codehaus/groovy/ast/stmt/TryCatchStatement.java
-org/codehaus/groovy/ast/stmt/WhileStatement.java
-org/codehaus/groovy/classgen/ClassGenerator.java
-org/codehaus/groovy/classgen/ClassGeneratorException.java
-org/codehaus/groovy/classgen/VariableScopeCodeVisitor.java
-org/codehaus/groovy/classgen/CompilerFacade.java
-org/codehaus/groovy/classgen/GeneratorContext.java
-org/codehaus/groovy/classgen/MethodCaller.java
-org/codehaus/groovy/classgen/Variable.java
-org/codehaus/groovy/classgen/Verifier.java
-org/codehaus/groovy/classgen/VerifierCodeVisitor.java
-org/codehaus/groovy/runtime/ClassExtender.java
-org/codehaus/groovy/runtime/DefaultGroovyMethods.java
-org/codehaus/groovy/runtime/Invoker.java
-org/codehaus/groovy/runtime/InvokerException.java
-org/codehaus/groovy/runtime/InvokerHelper.java
-org/codehaus/groovy/runtime/InvokerInvocationException.java
-org/codehaus/groovy/runtime/IteratorClosureAdapter.java
-org/codehaus/groovy/runtime/MethodClosure.java
-org/codehaus/groovy/runtime/MethodHelper.java
-org/codehaus/groovy/runtime/NoSuchClassException.java
-org/codehaus/groovy/runtime/NoSuchMethodException.java
-org/codehaus/groovy/runtime/NoSuchPropertyException.java
-org/codehaus/groovy/syntax/AbstractTokenStream.java
-org/codehaus/groovy/syntax/LookAheadExhaustionException.java
-org/codehaus/groovy/syntax/SyntaxException.java
-org/codehaus/groovy/syntax/Token.java
-org/codehaus/groovy/syntax/TokenStream.java
-org/codehaus/groovy/syntax/TokenMismatchException.java
-org/codehaus/groovy/syntax/lexer/AbstractCharStream.java
-org/codehaus/groovy/syntax/lexer/CharStream.java
-org/codehaus/groovy/syntax/lexer/InputStreamCharStream.java
-org/codehaus/groovy/syntax/lexer/Lexer.java
-org/codehaus/groovy/syntax/lexer/LexerTokenStream.java
-org/codehaus/groovy/syntax/lexer/UnexpectedCharacterException.java
-org/codehaus/groovy/syntax/lexer/LexerException.java
-org/codehaus/groovy/syntax/lexer/UnterminatedStringLiteralException.java
-org/codehaus/groovy/syntax/parser/ASTBuilder.java
-org/codehaus/groovy/syntax/parser/CSTNode.java
-org/codehaus/groovy/syntax/parser/UnexpectedTokenException.java
-org/codehaus/groovy/syntax/parser/ParserException.java
-org/codehaus/groovy/syntax/parser/Parser.java
-org/codehaus/groovy/syntax/lexer/StringCharStream.java
diff --git a/groovy/groovy-native/libgroovy/patch.diff b/groovy/groovy-native/libgroovy/patch.diff
deleted file mode 100644
index 68b0bce..0000000
--- a/groovy/groovy-native/libgroovy/patch.diff
+++ /dev/null
@@ -1,82 +0,0 @@
---- org/codehaus/groovy/runtime/Invoker.java 2004-01-06 16:37:49.000000000 +0000
-+++ org/codehaus/groovy/runtime/Invoker.java 2004-01-06 16:38:46.000000000 +0000
-@@ -62,8 +62,6 @@
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
-
--import com.mockobjects.util.NotImplementedException;
--
- /**
- * A helper class to invoke methods or extract properties on arbitrary Java objects dynamically
- *
-@@ -244,7 +242,7 @@
- return matcher.group();
- }
- public void remove() {
-- throw new NotImplementedException();
-+ throw new UnsupportedOperationException();
- }
- };
- }
---- ./org/codehaus/groovy/runtime/InvokerHelper.java.orig 2004-01-06 17:13:41.000000000 +0000
-+++ ./org/codehaus/groovy/runtime/InvokerHelper.java 2004-01-06 17:14:24.000000000 +0000
-@@ -170,7 +170,7 @@
- }
- else if (object instanceof Matcher) {
- Matcher matcher = (Matcher) object;
-- return matcher.find();
-+ throw new UnsupportedOperationException("Matcher.find()");
- }
- else if (object instanceof Collection) {
- Collection collection = (Collection) object;
---- ./org/codehaus/groovy/runtime/Invoker.java.orig 2004-01-06 17:14:52.000000000 +0000
-+++ ./org/codehaus/groovy/runtime/Invoker.java 2004-01-06 17:17:41.000000000 +0000
-@@ -227,8 +227,7 @@
- public boolean hasNext() {
- if (done) return false;
- if (!found) {
-- found = matcher.find();
-- if (!found) done = true;
-+ throw new UnsupportedOperationException("Matcher.find()");
- }
- return found;
- }
-@@ -239,7 +238,7 @@
- }
- }
- found = false;
-- return matcher.group();
-+ throw new UnsupportedOperationException("Matcher.group()");
- }
- public void remove() {
- throw new UnsupportedOperationException();
-@@ -485,7 +484,7 @@
- pattern = Pattern.compile(toString(right));
- }
- String stringToCompare = toString(left);
-- return pattern.matcher(stringToCompare).matches();
-+ throw new UnsupportedOperationException("Matcher");
- }
-
- /**
---- ./org/codehaus/groovy/runtime/DefaultGroovyMethods.java.orig 2004-01-06 17:18:17.000000000 +0000
-+++ ./org/codehaus/groovy/runtime/DefaultGroovyMethods.java 2004-01-06 17:19:36.000000000 +0000
-@@ -221,7 +221,7 @@
- }
-
- public static boolean isCase(Pattern caseValue, Object switchValue) {
-- return caseValue.matcher(switchValue.toString()).matches();
-+ throw new UnsupportedOperationException("Matcher.matches()");
- }
-
- // Collection based methods
-@@ -850,8 +850,7 @@
- }
-
- public static String minus(String left, Object value) {
-- String text = toString(value);
-- return left.replaceFirst(text, "");
-+ throw new UnsupportedOperationException("String.replaceFirst()");
- }
-
- public static String multiply(String self, Number factor) {
diff --git a/groovy/modules/groovy-swt/.classpath b/groovy/modules/groovy-swt/.classpath
deleted file mode 100644
index face3a0..0000000
--- a/groovy/modules/groovy-swt/.classpath
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<classpath>
- <classpathentry kind="src" path="src\main">
- </classpathentry>
- <classpathentry output="target\test-classes" kind="src" path="src\test">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar">
- </classpathentry>
- <classpathentry kind="var" rootpath="JRE_SRCROOT" path="JRE_LIB" sourcepath="JRE_SRC">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/asm/jars/asm-1.4.1.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/asm/jars/asm-util-1.4.1.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/asm/jars/asm-attrs-1.4.1.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/commons-collections/jars/commons-collections-3.0.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.3.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/groovy/jars/groovy-1.0-rc1-snapshot.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/swt/jars/swt-win32-3.0m8.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/swt/jars/jface-3.0m8.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/swt/jars/forms-3.0m9-dev.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/swt/jars/runtime-3.0m8.jar">
- </classpathentry>
- <classpathentry kind="var" path="MAVEN_REPO/swt/jars/osgi-3.0m8.jar">
- </classpathentry>
- <classpathentry kind="output" path="target\classes">
- </classpathentry>
-</classpath>
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/.cvsignore b/groovy/modules/groovy-swt/.cvsignore
deleted file mode 100644
index 4e1b955..0000000
--- a/groovy/modules/groovy-swt/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.log
-target
diff --git a/groovy/modules/groovy-swt/.project b/groovy/modules/groovy-swt/.project
deleted file mode 100644
index 9e5b5c0..0000000
--- a/groovy/modules/groovy-swt/.project
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<projectDescription>
- <name>groovy-swt</name>
- <comment>groovy-swt</comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/LICENSE.txt b/groovy/modules/groovy-swt/LICENSE.txt
deleted file mode 100644
index 0f6cb23..0000000
--- a/groovy/modules/groovy-swt/LICENSE.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-/*
- $Id$
-
- Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
-
- Redistribution and use of this software and associated documentation
- ("Software"), with or without modification, are permitted provided
- that the following conditions are met:
-
- 1. Redistributions of source code must retain copyright
- statements and notices. Redistributions must also contain a
- copy of this document.
-
- 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 name "groovy" must not be used to endorse or promote
- products derived from this Software without prior written
- permission of The Codehaus. For written permission,
- please contact info@codehaus.org.
-
- 4. Products derived from this Software may not be called "groovy"
- nor may "groovy" appear in their names without prior written
- permission of The Codehaus. "groovy" is a registered
- trademark of The Codehaus.
-
- 5. Due credit should be given to The Codehaus -
- http://groovy.codehaus.org/
-
- THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
- ``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 CODEHAUS 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.
-
- */
diff --git a/groovy/modules/groovy-swt/README.txt b/groovy/modules/groovy-swt/README.txt
deleted file mode 100644
index 177d485..0000000
--- a/groovy/modules/groovy-swt/README.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-dependency forms-3.0m9-dev.jar can be downloaded from:
-http://www.dacelo.com/data
-
-this will be removed after eclipse-3.0m9 release
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/maven.xml b/groovy/modules/groovy-swt/maven.xml
deleted file mode 100644
index 21e4482..0000000
--- a/groovy/modules/groovy-swt/maven.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<project default="default" xmlns:j="jelly:core" xmlns:u="jelly:util" >
-
- <goal name="default" prereqs="clean, groovy:compile-tests">
- </goal>
-
- <goal name="setclasspath">
- <path id="test.classpath">
- <pathelement path="${maven.build.dest}"/>
- <pathelement path="target/classes"/>
- <pathelement path="target/test-classes"/>
- <path refid="maven.dependency.classpath"/>
- </path>
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="test.classpath"/>
- </goal>
-
- <goal name="groovy:compile" prereqs="java:compile, setclasspath" description="Compiles the main code">
- <copy todir="${basedir}/target/classes">
- <fileset dir="${basedir}/src/main">
- <include name="**/*.groovy"/>
- <exclude name="CVS/*"/>
- </fileset>
- </copy>
- <groovyc destdir="${basedir}/target/classes" srcdir="${basedir}/target/classes" listfiles="true">
- <classpath refid="test.classpath"/>
- </groovyc>
- </goal>
-
- <goal name="groovy:compile-tests" prereqs="groovy:compile, setclasspath" description="Compiles the test cases">
- <mkdir dir="${basedir}/target/test-classes"/>
- <copy todir="${basedir}/target/test-classes">
- <fileset dir="${basedir}/src/test">
- <include name="**/*.groovy"/>
- <exclude name="**/notworking/*.groovy"/>
- <exclude name="**/parser/*.groovy"/>
- <exclude name="CVS/*"/>
- </fileset>
- </copy>
- <touch>
- <fileset dir="${basedir}/target/test-classes" includes="**/*.groovy"/>
- </touch>
- <groovyc destdir="${basedir}/target/test-classes" srcdir="${basedir}/target/test-classes" listfiles="true">
- <classpath refid="test.classpath"/>
- </groovyc>
- </goal>
-
-
-</project>
diff --git a/groovy/modules/groovy-swt/project.properties b/groovy/modules/groovy-swt/project.properties
deleted file mode 100644
index 9f423d2..0000000
--- a/groovy/modules/groovy-swt/project.properties
+++ /dev/null
@@ -1,46 +0,0 @@
-maven.compile.source=1.4
-maven.compile.target=1.4
-maven.test.source=1.4
-maven.compile.deprecation=true
-maven.compile.debug=true
-maven.compile.optimize=true
-
-maven.javadoc.links=http://java.sun.com/j2se/1.4.1/docs/api/
-maven.javadoc.source=1.4
-
-maven.test.search.classdir = true
-
-maven.junit.fork=true
-maven.junit.usefile=true
-
-groovy.install.staging.dest=${maven.build.dir}/install/
-maven.html2xdoc.dir=${maven.build.dir}/html
-
-maven.xdoc.date = left
-
-#####################################################
-# codehaus theme
-#####################################################
-maven.xdoc.theme.url=http://codehaus.org/codehaus-style.css
-
-#####################################################
-# Where the jars are uploaded
-#####################################################
-maven.repo.central = dist.codehaus.org
-maven.repo.central.directory = /www/dist.codehaus.org
-
-#maven.repo.remote=http://www.ibiblio.org/maven
-maven.repo.remote=http://dist.codehaus.org
-
-
-#####################################################
-# swt platform
-# possible values, win32, linux-gtk, macosx
-#
-# for linux-gtk enable gtk deps in project.xml
-#####################################################
-platform=win32
-#platform=linux-gtk
-#platform=macosx
-
-
diff --git a/groovy/modules/groovy-swt/project.xml b/groovy/modules/groovy-swt/project.xml
deleted file mode 100644
index 4fd9e74..0000000
--- a/groovy/modules/groovy-swt/project.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-<project>
- <pomVersion>3</pomVersion>
- <groupId>groovy-swt</groupId>
- <artifactId>groovy-swt</artifactId>
- <name>groovy-swt</name>
- <currentVersion>0.2</currentVersion>
- <organization>
- <name>The Codehaus</name>
- <url>http://codehaus.org</url>
- <logo>http://codehaus.org/codehaus-small.gif</logo>
- </organization>
- <inceptionYear>2004</inceptionYear>
- <package>groovy.swt, groovy.jface</package>
- <description>groovy-swt</description>
- <url>http://groovy.codehaus.org/</url>
- <issueTrackingUrl>http://jira.codehaus.org/secure/BrowseProject.jspa?id=10242&report=roadmap</issueTrackingUrl>
- <siteAddress>groovy.codehaus.org</siteAddress>
- <siteDirectory>/www/groovy.codehaus.org</siteDirectory>
- <repository>
- <connection>scm:cvs:pserver:anonymous@cvs.codehaus.org:/scm/cvspublic:groovy/modules/groovy-swt</connection>
- <developerConnection>scm:cvs:ext:${maven.username}@cvs.codehaus.org:/scm/cvspublic:groovy/modules/groovy-swt</developerConnection>
- <url>http://cvs.groovy.codehaus.org/viewcvs.cgi/groovy/modules/groovy-swt</url>
- </repository>
- <versions/>
- <branches/>
- <mailingLists/>
- <developers>
- <developer>
- <id>ckl</id>
- <name>Christiaan ten Klooster</name>
- <email>ckl@dacelo.nl</email>
- <organization>Dacelo WebDevelopment</organization>
- <roles>
- <role>Developer</role>
- <role>Founder</role>
- </roles>
- </developer>
- </developers>
- <dependencies>
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm</artifactId>
- <version>1.4.1</version>
- <type>jar</type>
- <url>http://asm.objectweb.org/</url>
- <properties/>
- </dependency>
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm-util</artifactId>
- <version>1.4.1</version>
- <type>jar</type>
- <url>http://asm.objectweb.org/</url>
- <properties/>
- </dependency>
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm-attrs</artifactId>
- <version>1.4.1</version>
- <type>jar</type>
- <url>http://asm.objectweb.org/</url>
- <properties/>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.0</version>
- <type>jar</type>
- <properties/>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.3</version>
- <type>jar</type>
- <properties/>
- </dependency>
- <dependency>
- <groupId>groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>1.0-rc1-snapshot</version>
- <type>jar</type>
- <properties/>
- </dependency>
- <dependency>
- <groupId>swt</groupId>
- <artifactId>swt-${platform}</artifactId>
- <version>3.0m8</version>
- <type>jar</type>
- <properties/>
- </dependency>
- <dependency>
- <groupId>swt</groupId>
- <artifactId>jface</artifactId>
- <version>3.0m8</version>
- <type>jar</type>
- <properties/>
- </dependency>
- <dependency>
- <groupId>swt</groupId>
- <artifactId>forms</artifactId>
- <version>3.0m9-dev</version>
- <type>jar</type>
- <properties/>
- </dependency>
- <dependency>
- <groupId>swt</groupId>
- <artifactId>runtime</artifactId>
- <version>3.0m8</version>
- <type>jar</type>
- <properties/>
- </dependency>
- <dependency>
- <groupId>swt</groupId>
- <artifactId>osgi</artifactId>
- <version>3.0m8</version>
- <type>jar</type>
- <properties/>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <type>jar</type>
- <properties/>
- </dependency>
- </dependencies>
- <build>
- <nagEmailAddress>groovy-scm@lists.codehaus.org</nagEmailAddress>
- <sourceDirectory>src/main</sourceDirectory>
- <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
- <unitTest>
- <includes>
- <include>**/*Test.*</include>
- <include>**/*Bug.*</include>
- </includes>
- <resources>
- <resource>
- <directory>src/test</directory>
- <filtering>false</filtering>
- <includes>
- <include>**/*.properties</include>
- <include>**/*.xml</include>
- </includes>
- </resource>
- </resources>
- </unitTest>
- <resources>
- <resource>
- <directory>src/main</directory>
- <filtering>false</filtering>
- <includes>
- <include>**/*.properties</include>
- <include>**/*.xml</include>
- </includes>
- </resource>
- </resources>
- </build>
- <reports>
- <report>maven-license-plugin</report>
- <report>maven-checkstyle-plugin</report>
- <report>maven-pmd-plugin</report>
- <report>maven-jdepend-plugin</report>
- <report>maven-changelog-plugin</report>
- <report>maven-file-activity-plugin</report>
- <report>maven-developer-activity-plugin</report>
- <report>maven-jxr-plugin</report>
- <report>maven-javadoc-plugin</report>
- <report>maven-junit-report-plugin</report>
- <report>maven-faq-plugin</report>
- <report>maven-clover-plugin</report>
- <report>maven-changes-plugin</report>
- </reports>
-</project>
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/settings.props b/groovy/modules/groovy-swt/settings.props
deleted file mode 100644
index 3a9cf66..0000000
--- a/groovy/modules/groovy-swt/settings.props
+++ /dev/null
@@ -1,2 +0,0 @@
-#Fri Feb 20 19:43:20 CET 2004
-var1=true
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/ApplicationWindowDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/jface/ApplicationWindowDemo.groovy
deleted file mode 100644
index 09f6d0f..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/jface/ApplicationWindowDemo.groovy
+++ /dev/null
@@ -1,36 +0,0 @@
-package groovy.jface.examples
-
-import groovy.jface.JFaceBuilder
-
-class ApplicationWindowDemo {
- property mainapp
-
- void run() {
- swt = new JFaceBuilder()
-
- mainapp = swt.applicationWindow() {
-
- menuManager( text:"File" ) {
- action ( text:"Very Nice", closure:{ println "Very Nice !!!" } )
- separator()
- action ( text:"Check me", checked:true, closure:{ println "I've been checked" } )
- }
-
- menuManager( text:"Edit" ) {
- action ( text:"Say Hi Statusbar", closure:{ mainapp.setStatus('Hello ...') } )
- }
-
- fillLayout ( type:"vertical" )
-
- label( text:"A big red label", background:[204, 0, 0] )
- label( text:"I can barelly read this", foreground:[0,200,0] )
- label( text:"It sure looks like the dutch flag", foreground:[0,0,150], background:[0, 0, 153] )
-
- }
-
- mainapp.MenuBarManager.updateAll( true )
- mainapp.getShell().pack()
- mainapp.open()
-
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/PreferencesDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/jface/PreferencesDemo.groovy
deleted file mode 100644
index 9a24661..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/jface/PreferencesDemo.groovy
+++ /dev/null
@@ -1,39 +0,0 @@
-package groovy.jface.examples
-
-import groovy.jface.JFaceBuilder
-
-class PreferencesDemo {
- property pd
-
- void run() {
- jface = new JFaceBuilder()
- mainapp = jface.applicationWindow() {
-
- pd = preferenceDialog() {
-
- preferencePage( title:"General settings", filename:"settings.props" ) {
- booleanFieldEditor (propertyName:"var1", title:"It's boolean" )
- colorFieldEditor( propertyName:"var2", title:"MainColor" )
- directoryFieldEditor(propertyName:"var3", title:"Directory" )
- fileFieldEditor( propertyName:"var4", title:"File" )
- fontFieldEditor( propertyName:"var5", title:"Font" )
- integerFieldEditor( propertyName:"var6", title:"Integer" )
- stringFieldEditor( propertyName:"var7", title:"String" )
- }
-
- preferencePage( title:"Personal settings", filename:"settings.props" ) {
- booleanFieldEditor( propertyName:"var8", title:"It's boolean" )
- colorFieldEditor( propertyName:"var2", title:"MainColor" )
- directoryFieldEditor( propertyName:"var9", title:"Directory" )
- fileFieldEditor( propertyName:"var10", title:"File" )
- fontFieldEditor( propertyName:"var11", title:"Font" )
- integerFieldEditor( propertyName:"var12", title:"Integer" )
- stringFieldEditor( propertyName:"var13", title:"String" )
- }
- }
- }
-
- pd.open()
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoApplicationWindow.java b/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoApplicationWindow.java
deleted file mode 100644
index 1bfe148..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoApplicationWindow.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package groovy.jface;
-
-import groovy.lang.GroovyObject;
-import groovy.swt.SwtTest;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunDemoApplicationWindow extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunDemoApplicationWindow demo = new RunDemoApplicationWindow();
- GroovyObject object = demo.compile("src/examples/groovy/jface/ApplicationWindowDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoPreferences.java b/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoPreferences.java
deleted file mode 100644
index b6c5970..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoPreferences.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package groovy.jface;
-
-import groovy.lang.GroovyObject;
-import groovy.swt.SwtTest;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunDemoPreferences extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunDemoPreferences demo = new RunDemoPreferences();
- GroovyObject object = demo.compile("src/examples/groovy/jface/PreferencesDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoWizard.java b/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoWizard.java
deleted file mode 100644
index 4e0fd34..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/jface/RunDemoWizard.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package groovy.jface;
-
-import groovy.lang.GroovyObject;
-import groovy.swt.SwtTest;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunDemoWizard extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunDemoWizard demo = new RunDemoWizard();
- GroovyObject object = demo.compile("src/examples/groovy/jface/WizardDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/jface/WizardDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/jface/WizardDemo.groovy
deleted file mode 100644
index 60401ac..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/jface/WizardDemo.groovy
+++ /dev/null
@@ -1,87 +0,0 @@
-package groovy.jface.examples
-
-import groovy.jface.JFaceBuilder
-
-class WizardDemo extends Script {
- property mainapp
- property wizardPage1
- property text
- property wizardDialog1
-
- run() {
- jface = new JFaceBuilder()
-
- mainapp = jface.applicationWindow() {
-
- wizardDialog1 = wizardDialog() {
-
- wizardPage1 = wizardPage( title:"Step 1", description:"Step 1", closure: { parent |
- jface.composite( parent ) {
- gridLayout( numColumns:2 )
- label( text:"Some input" )
-
- text = text()
- label( text:"Label 1" )
-
- button( text:"Set Message") {
- onEvent( type:"Selection" , closure: {
- wizardPage1.setMessage( text.getText() )
- })
- }
-
- label( text:"Label 2" )
- button( text:"Set Error Message" ) {
- onEvent( type:"Selection", closure: {
- wizardPage1.setErrorMessage('ErrorMessage: This step is not complete')
- })
- }
-
- label( text:"Label 3" )
- button ( text:"Set Page Complete" ) {
- onEvent ( type:"Selection", closure: {
- wizardPage1.setPageComplete(true)
- })
- }
- }
-
- })
-
- wizardPage2 = wizardPage( title:"Step 2", description:"Step 2", closure: { parent |
- jface.composite( parent ) {
- gridLayout( numColumns:"2" )
- label( text:"Label 3" )
- button( text:"Do nothing" )
- }
- })
-
- wizardPage3 = wizardPage( title:"Step 3", description:"Step 3", closure: { parent |
- jface.composite( parent ) {
- gridLayout( numColumns:"2" )
- label( text:"Label 4" )
- button( text:"Do nothing" )
- }
- })
-
- }
-
- }
-
- wizardPage1.setPageComplete(false)
- wizardDialog1.open()
-
- }
-
- void onPerformFinish() {
- println "onPerformFinish called ..."
- }
-
- void onPerformCancel() {
- println "onPerformCancel called ......"
- }
-
-}
-
-
-
-
-
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/AwtSwtDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/AwtSwtDemo.groovy
deleted file mode 100644
index 00e70a3..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/AwtSwtDemo.groovy
+++ /dev/null
@@ -1,31 +0,0 @@
-package groovy.swt.examples
-
-import groovy.swt.SwtBuilder
-import groovy.swing.SwingBuilder
-
-
-class AwtSwtDemo {
- property swt
-
- void run() {
- swt = new SwtBuilder()
- swing = new SwingBuilder()
-
- shell = swt.shell ( text:'The AwtSwt Demo' ) {
- fillLayout()
-
- swing.current = awtFrame()
- swing.tree()
- }
-
- shell.open()
-
- while(! shell.isDisposed()) {
- if (! shell.display.readAndDispatch()) {
- shell.display.sleep();
- }
- }
-
- shell.display.dispose()
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/BrowserDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/BrowserDemo.groovy
deleted file mode 100644
index f5c3bf0..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/BrowserDemo.groovy
+++ /dev/null
@@ -1,96 +0,0 @@
-package groovy.swt.examples
-
-import groovy.swt.SwtBuilder
-
-class BrowserSwtDemo extends Script {
- property swt
- property shell
- property browser
- property location
- property status
- property progressBar
-
- void run() {
- swt = new SwtBuilder()
-
- shell = swt.shell( text:"The Browser Test", location:[100,100], size:[700,600] ) {
- gridLayout(numColumns:3)
-
- toolBar( style:"none" ) {
- gridData( horizontalSpan:3 )
-
- toolItem(style:"push", text:"Back") {
- onEvent(type:"Selection", closure:{ browser.back() })
- }
-
- toolItem(style:"push", text:"Forward") {
- onEvent(type:"Selection", closure:{ browser.forward() } )
- }
-
- toolItem(style:"push", text:"Stop") {
- onEvent(type:"Selection", closure:{ browser.stop() } )
- }
-
- toolItem(style:"push", text:"Refresh") {
- onEvent(type:"Selection", closure:{ browser.refresh() } )
- }
-
- toolItem(style:"push", text:"Go") {
- onEvent(type:"Selection", closure:{
- browser.setUrl( location.getText() )
- })
- }
- }
-
- label( style:"none", text:"Address" )
- location = text( style:"Border" ) {
- gridData( horizontalAlignment:"fill", horizontalSpan:2, grabExcessHorizontalSpace:true )
- }
-
-
- browser = browser( style:"border" ) {
- gridData( horizontalAlignment:"fill", verticalAlignment:"fill", horizontalSpan:3, grabExcessHorizontalSpace:true, grabExcessVerticalSpace:true)
-
- locationListener(type:"changed", closure: { event |
- location.setText( event.location )
- })
-
- progressListener(type:"changed", closure: { event |
- if (event.total != 0) {
- ratio = event.current * 100 / event.total
- progressBar.setSelection( Integer.parseInt("" + Math.round(Double.parseDouble("" + ratio))) )
- }
- })
-
- progressListener(type:"completed", closure: {
- progressBar.setSelection(0)
- })
-
- statusTextListener( closure: { event |
- status.setText(event.text)
- })
-
- }
-
- status = label( style:"none", text:"" ) {
- gridData( style:"fill_horizontal", horizontalSpan:2)
- }
-
- progressBar = progressBar () {
- gridData( horizontalAlignment:"end" )
- }
-
- }
-
- browser.setUrl( "http://feeds.codehaus.org/" )
- shell.open()
-
- while(! shell.isDisposed()) {
- if (! shell.display.readAndDispatch()) {
- shell.display.sleep();
- }
- }
-
- shell.display.dispose()
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/FormDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/FormDemo.groovy
deleted file mode 100644
index 5604304..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/FormDemo.groovy
+++ /dev/null
@@ -1,97 +0,0 @@
-package groovy.swt.examples
-
-import groovy.jface.JFaceBuilder
-
-class ApplicationDemo {
- property mainapp
-
- void run() {
- jface = new JFaceBuilder()
-
- mainapp = jface.applicationWindow( title:"The forms demo", size:[700,800], location:[0,0] ) {
- gridLayout ( numColumns:2 )
- form( text:"Hello, Eclipse Forms" ) {
- gridData( style:"fill_both" )
- tableWrapLayout()
-
- formSection( text:"section1", description:"description of section1", style:"description, twistie" ) {
- tableWrapData( style:"fill" )
-
- expansionListener( type:"expansionStateChanging", closure: { println "expansionStateChanging ... " + it } )
- expansionListener( type:"expansionStateChanged", closure: { println "expansionStateChanged ... " + it } )
-
- htmlText = "<form>"
- htmlText += "<li>list item</li>"
- htmlText += "<p>this html code with an url: http://groovy.codehaus.org</p>"
- htmlText += "<li style=\"text\" value=\"1.\">list item 2</li>"
- htmlText += "<li style=\"text\" value=\"2.\">list item 3</li>"
- htmlText += "</form>"
-
- formFormattedText( text:htmlText, parseTags:true, expandURLs:true )
-
- formButton ( text:"This is radiobutton1", style:"radio" )
- formButton ( text:"This is radiobutton2", style:"radio" )
-
- formButton ( text:"This is a ARROW button", style:"arrow" ) {
- onEvent(type:"Selection", closure:{ println "stop selecting me !!!" })
- }
- formButton ( text:"This is a PUSH button", style:"push" ) {
- onEvent(type:"Selection", closure:{ println "stop pushing me !!!" })
- }
- formButton ( text:"This is a TOGGLE button", style:"TOGGLE" ) {
- onEvent(type:"Selection", closure:{ println it.event })
- }
-
- }
-
- formSection( text:"section2", description:"description of section2", style:"description, twistie" ) {
- tableWrapData( style:"fill" )
- formLabel( text:"This is a label in section 2" )
- formExpandableComposite( text:"formExpandableComposite" )
- }
-
- formSection( text:"section3", description:"description of section3", style:"description, twistie" ) {
- tableWrapData( style:"fill" )
- formLabel( text:"Below me is a tree" )
- formTree()
- }
-
- formSeparator( style:"separator, horizontal" ) {
- tableWrapData( style:"fill" )
- }
-
- formButton( text:"This is a formButton" )
-
- formCompositeSeparator()
-
- formHyperlink( text:"this is a hyperlink" ) {
- hyperlinkListener( type:"hyperlinkUpdate", closure: { println "hyperlinkUpdate ... " + it } )
- hyperlinkListener( type:"linkEntered", closure: { println "linkEntered ... " + it } )
- hyperlinkListener( type:"linkExited", closure: { println "linkExited ... " + it } )
- hyperlinkListener( type:"linkActivated", closure: { println "linkActivated ... " + it } )
- }
-
- formLabel( text:"This is a formLabel, folowed by a formTable" )
- formTable() {
- tableWrapData( style:"fill" )
- }
-
-
-
- // NOT FULLY IMPLEMENTED YET:
- // formImageHyperlink( text:"formImageHyperlink" )
- // formPageBook( text:"formPageBook" )
-
- }
-
- form( text:"hello formScrolledForm" ) {
- gridData( style:"fill_both" )
- formLabel( text:"my parent is a scrolledForm" )
- formButton( text:"formButton" )
- }
- }
-
- mainapp.getShell().pack()
- mainapp.open()
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunAwtSwtDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunAwtSwtDemo.java
deleted file mode 100644
index 01b829f..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunAwtSwtDemo.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Created on Apr 19, 2004
- *
- */
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a> $Id$
- */
-public class RunAwtSwtDemo {
- public static void main(String[] args) throws Exception {
- RunDemoBrowser demo = new RunDemoBrowser();
- GroovyObject object = demo.compile("src/examples/groovy/swt/AwtSwtDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-// public static void main(String[] args) {
-// Display display = new Display();
-// Shell shell = new Shell(display);
-// Composite locationComp = new Composite(shell, SWT.DEFAULT);
-// shell.setLayout(new FillLayout());
-//
-// java.awt.Frame locationFrame = SWT_AWT.new_Frame(locationComp);
-//
-// locationFrame.add(new JTree());
-//
-// shell.open();
-// while (!shell.isDisposed()) {
-// if (!display.readAndDispatch()) display.sleep();
-// }
-// display.dispose();
-//
-// }
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoBrowser.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoBrowser.java
deleted file mode 100644
index 6f70ad2..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoBrowser.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunDemoBrowser extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunDemoBrowser demo = new RunDemoBrowser();
- GroovyObject object = demo.compile("src/examples/groovy/swt/BrowserDemo.groovy");
- object.invokeMethod("run", null);
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTableTree.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTableTree.java
deleted file mode 100644
index 3484fa8..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTableTree.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunDemoTableTree extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunDemoTableTree demo = new RunDemoTableTree();
- GroovyObject object = demo.compile("src/examples/groovy/swt/TableTreeDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTree.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTree.java
deleted file mode 100644
index 7206371..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunDemoTree.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunDemoTree extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunDemoTree demo = new RunDemoTree();
- GroovyObject object = demo.compile("src/examples/groovy/swt/TreeDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunFormDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunFormDemo.java
deleted file mode 100644
index d55f2d6..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunFormDemo.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunFormDemo extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunFormDemo demo = new RunFormDemo();
- GroovyObject object = demo.compile("src/examples/groovy/swt/FormDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunSashFormDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunSashFormDemo.java
deleted file mode 100644
index 34f6a7e..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunSashFormDemo.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-import groovy.swt.SwtTest;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunSashFormDemo extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunSashFormDemo demo = new RunSashFormDemo();
- GroovyObject object = demo.compile("src/examples/groovy/swt/SashFormDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTabDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTabDemo.java
deleted file mode 100644
index c74c836..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTabDemo.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Created on Apr 19, 2004
- *
- */
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * $Id$
- */
-public class RunTabDemo {
- public static void main(String[] args) throws Exception {
- RunDemoBrowser demo = new RunDemoBrowser();
- GroovyObject object = demo.compile("src/examples/groovy/swt/TabDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTrayDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTrayDemo.java
deleted file mode 100644
index 50a5509..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/RunTrayDemo.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-import groovy.swt.SwtTest;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunTrayDemo extends SwtTest {
-
- public static void main(String[] args) throws Exception {
- RunTrayDemo demo = new RunTrayDemo();
- GroovyObject object = demo.compile("src/examples/groovy/swt/TrayDemo.groovy");
- object.invokeMethod("run", null);
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/SashFormDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/SashFormDemo.groovy
deleted file mode 100644
index b35fded..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/SashFormDemo.groovy
+++ /dev/null
@@ -1,54 +0,0 @@
-package groovy.swt.examples
-
-import groovy.swt.SwtBuilder
-import org.eclipse.swt.layout.FormAttachment
-import org.eclipse.swt.graphics.Rectangle
-
-/*
-* java version: http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/snippits/snippet109.html
-*/
-
-class SwtDemo {
- property shell
- property sashForm1
-
- void run() {
- builder = new SwtBuilder()
- shell = builder.shell ( text:'The SashForm Demo' ) {
- fillLayout()
-
- sashForm1 = sashForm( style:"horizontal" ) {
- fillLayout()
-
- composite( style:"none" ) {
- fillLayout()
- label( text:"Label in pane 1" )
- }
-
- composite( style:"none" ) {
- fillLayout()
- button( text:"Button in pane2", style:"push" )
- }
-
- composite( style:"none" ) {
- fillLayout()
- label( text:"Label in pane3" )
- }
- }
-
- sashForm1.weights = [30,40,30]
-
- }
-
-
- shell.open()
-
- while(! shell.isDisposed()) {
- if (! shell.display.readAndDispatch()) {
- shell.display.sleep();
- }
- }
-
- }
-}
-
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/TabDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/TabDemo.groovy
deleted file mode 100644
index f3f8a6c..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/TabDemo.groovy
+++ /dev/null
@@ -1,52 +0,0 @@
-package groovy.swt.examples
-
-import groovy.swt.SwtBuilder
-
-
-class TabDemo {
- property swt
-
- void run() {
- swt = new SwtBuilder()
-
- shell = swt.shell ( text:'The Tab Demo', size:[500,400] ) {
- gridLayout()
-
- cTabFolder( style:"flat" ) {
- gridData( style:"fill_both" )
- cTabItem( style:"none", text:"Item1" ) {
- text( style:"border, multi", text:"Content for Item1" )
- }
- cTabItem( style:"none", text:"Item2" ) {
- text( style:"border, multi", text:"Content for Item2" )
- }
- cTabItem( style:"none", text:"Item3" ) {
- text( style:"border, multi", text:"Content for Item3" )
- }
- }
-
- tabFolder( style:"none" ) {
- gridData( style:"fill_both" )
- tabItem( style:"none", text:"Item4" ) {
- text( style:"border, multi", text:"Content for Item4" )
- }
- tabItem( style:"none", text:"Item5" ) {
- text( style:"border, multi", text:"Content for Item5" )
- }
- tabItem( style:"none", text:"Item6" ) {
- text( style:"border, multi", text:"Content for Item6" )
- }
- }
-
- }
-
- shell.open()
-
- while(! shell.isDisposed()) {
- if (! shell.display.readAndDispatch()) {
- shell.display.sleep();
- }
- }
-
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/TableTreeDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/TableTreeDemo.groovy
deleted file mode 100644
index 80f29f7..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/TableTreeDemo.groovy
+++ /dev/null
@@ -1,43 +0,0 @@
-package groovy.swt.examples
-
-import groovy.swt.SwtBuilder
-
-class TableTreeDemo {
- property swt
-
- void run() {
- swt = new SwtBuilder()
-
- shell = swt.shell ( text:'The TableTree Test1', location:[100,100], size:[700,600] ) {
- gridLayout(numColumns:3)
-
- tableTree( toolTipText:"This is a table tree!", style:"multi, full_selection" ) {
-
- gridData( style:"fill_both" )
-
- tableTreeItem ( text:"root1" ) {
- tableTreeItem ( text:"child 1-1" )
- tableTreeItem ( text:"child 1-2" )
- tableTreeItem ( text:"child 1-3" )
- }
-
- tableTreeItem ( text:"root2" ) {
- tableTreeItem ( text:"child 2-1" )
- tableTreeItem ( text:"child 2-2" )
- tableTreeItem ( text:"child 2-3" )
- }
-
- }
- }
-
- shell.open()
-
- while(! shell.isDisposed()) {
- if (! shell.display.readAndDispatch()) {
- shell.display.sleep();
- }
- }
-
- shell.display.dispose()
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/TrayDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/TrayDemo.groovy
deleted file mode 100644
index 112d3b9..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/TrayDemo.groovy
+++ /dev/null
@@ -1,53 +0,0 @@
-package groovy.swt.examples
-
-import groovy.swt.SwtBuilder
-
-class TrayDemo {
- property swt
-
- void run() {
- swt = new SwtBuilder()
-
- shell = swt.shell ( text:'The tray Demo' ) {
-
- trayMenu = menu {
- menuItem( text:"menuItem1" )
- menuItem( text:"menuItem2" )
- }
-
- tray() {
-
- trayItem( text:"trayItem1" ) {
- image( src:"src/test/groovy/swt/groovy-logo.png" )
-
- onEvent( type:"Selection", closure:{
- println "Selection event ..."
- })
- onEvent( type:"Hide", closure:{
- println "Hide event ..."
- })
- onEvent( type:"DefaultSelection", closure:{
- println "DefaultSelection event ..."
- })
- onEvent( type:"Show", closure:{
- println "Show event ..."
- })
- onEvent( type:"MenuDetect", closure:{
- println "MenuDetect event ..."
- trayMenu.visible = true
- })
- }
- }
- }
-
- shell.open()
-
- while(! shell.isDisposed()) {
- if (! shell.display.readAndDispatch()) {
- shell.display.sleep();
- }
- }
-
- shell.display.dispose()
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/TreeDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/TreeDemo.groovy
deleted file mode 100644
index 9991035..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/TreeDemo.groovy
+++ /dev/null
@@ -1,49 +0,0 @@
-package groovy.swt.examples
-
-import groovy.swt.SwtBuilder
-
-class SwtDemo {
- property swt
-
- void run() {
- swt = new SwtBuilder()
-
- shell = swt.shell ( text:'The Swt Demo #1', location:[100,100], size:[700,600] ) {
- gridLayout(numColumns:3)
-
- tree( toolTipText:"This is a tree!", style:"multi" ) {
-
- gridData( style:"fill_both" )
-
- treeItem( text:"A" ) {
- treeItem( text:"A/A" )
- treeItem( text:"A/B" )
- treeItem( text:"A/C" )
- }
-
- treeItem( text:"B" ) {
- treeItem( text:"B/A" )
- treeItem( text:"B/B" )
- treeItem( text:"B/C" )
- }
-
- menu( style:"pop_up" ) {
- menuItem( text:"do something!" )
- menuItem( text:"do something else" )
- }
-
- }
-
- }
-
- shell.open()
-
- while(! shell.isDisposed()) {
- if (! shell.display.readAndDispatch()) {
- shell.display.sleep();
- }
- }
-
- shell.display.dispose()
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/GuiBuilderDemo.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/GuiBuilderDemo.groovy
deleted file mode 100644
index 74dde02..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/GuiBuilderDemo.groovy
+++ /dev/null
@@ -1,66 +0,0 @@
-package groovy.swt.guibuilder
-
-import groovy.swt.guibuilder.ApplicationGuiBuilder
-
-class ApplicationGuiDemo {
- property comp
- property builder
- property mainapp
- property guiBuilder
- property comp1
-
- main( args ) {
-
- mainapp = guiBuilder.applicationWindow( title:"The ApplicationGuiDemo", size:[700,400] ) {
- fillLayout( )
-
- menuManager( text:"Screens" ) {
- action( text:"Screen1", closure:{
- guiBuilder.runScript( src:"Screen1.groovy", parent:mainapp, rebuild:true )
- })
- action( text:"Screen2", closure:{
- guiBuilder.runScript( src:"Screen2.groovy", parent:mainapp, rebuild:true )
- })
- }
-
- toolBar( style:"horizontal" ){
- toolItem( text:"Blue" ) {
- onEvent( type:"Selection", closure:{
- guiBuilder.rebuild( parent:comp1, closure:{
- guiBuilder.composite( it ) {
- fillLayout()
- label( text:"This is fresh new blue label ...", background:[0, 0, 255] )
- }
- })
- })
- }
-
- toolItem( text:"Red" ) {
- onEvent( type:"Selection", closure:{
- guiBuilder.rebuild( parent:comp1, closure:{
- guiBuilder.composite( it ) {
- fillLayout()
- label( text:"This is fresh new red label ...", background:[255, 0, 0] )
- }
- })
- })
- }
-
- }
-
- composite() {
-
- fillLayout()
-
- comp1 = composite() {
- fillLayout()
- label( text:"This is green label", background:[0, 255, 0] )
- }
- }
-
- }
-
- mainapp.MenuBarManager.updateAll(true)
- mainapp.open()
- }
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/RunGuiBuilderDemo.java b/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/RunGuiBuilderDemo.java
deleted file mode 100644
index 721a05d..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/RunGuiBuilderDemo.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package groovy.swt.guibuilder;
-
-import groovy.lang.Binding;
-import groovy.util.GroovyScriptEngine;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunGuiBuilderDemo {
-
- public static void main(String[] args) throws Exception {
- String basePath = "src/examples/groovy/swt/guibuilder";
- GroovyScriptEngine scriptEngine = new GroovyScriptEngine(basePath);
-
- Binding binding = new Binding();
- ApplicationGuiBuilder guiBuilder = new ApplicationGuiBuilder(basePath);
- binding.setVariable("guiBuilder", guiBuilder);
-
- scriptEngine.run("GuiBuilderDemo.groovy", binding);
- }
-
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen1.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen1.groovy
deleted file mode 100644
index 9efbc45..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen1.groovy
+++ /dev/null
@@ -1,18 +0,0 @@
-package groovy.swt.guibuilder
-
-class Screen1 extends Script {
-
- run() {
- guiBuilder.composite {
- fillLayout()
-
- group( text:"This is Screen1.groovy" ) {
- gridLayout()
- button( text:"the hardest", background:[0, 255, 255] )
- button( text:"button", background:[0, 255, 255] )
- button( text:"to button", background:[0, 255, 255] )
- }
- }
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen2.groovy b/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen2.groovy
deleted file mode 100644
index c928efe..0000000
--- a/groovy/modules/groovy-swt/src/examples/groovy/swt/guibuilder/Screen2.groovy
+++ /dev/null
@@ -1,17 +0,0 @@
-package groovy.swt.guibuilder
-
-class Screen2 extends Script {
-
- run() {
- guiBuilder.composite {
- fillLayout( type:"vertical")
- group( text:"This is Screen2.groovy", background:[255, 255, 255] ) {
- fillLayout( type:"vertical")
- label( text:"A big red label", background:[204, 0, 0] )
- label( text:"I can barelly read this", foreground:[0,200,0] )
- label( text:"It sure looks like the dutch flag", foreground:[0,0,150], background:[0, 0, 153] )
- }
- }
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/JFaceBuilder.java b/groovy/modules/groovy-swt/src/main/groovy/jface/JFaceBuilder.java
deleted file mode 100644
index 693338e..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/JFaceBuilder.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Created on Feb 25, 2004
- *
- */
-package groovy.jface;
-
-import groovy.jface.factory.DoubleClickListenerFactory;
-import groovy.jface.factory.MenuManagerFactory;
-import groovy.jface.factory.PreferencesDialogFactory;
-import groovy.jface.factory.PreferencesFieldEditorFactory;
-import groovy.jface.factory.PreferencesPageFactory;
-import groovy.jface.factory.SelectionChangedListenerFactory;
-import groovy.jface.factory.WindowFactory;
-import groovy.jface.factory.WizardDialogFactory;
-import groovy.jface.factory.WizardPageFactory;
-import groovy.jface.impl.ApplicationWindowImpl;
-import groovy.swt.SwtBuilder;
-import groovy.swt.factory.ActionFactory;
-import groovy.swt.factory.ImageFactory;
-
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.ColorFieldEditor;
-import org.eclipse.jface.preference.DirectoryFieldEditor;
-import org.eclipse.jface.preference.FileFieldEditor;
-import org.eclipse.jface.preference.FontFieldEditor;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.TableTreeViewer;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class JFaceBuilder extends SwtBuilder {
- protected void registerWidgets() {
- super.registerWidgets();
-
- // Viewer
- registerBeanFactory("tableViewer", TableViewer.class);
- registerBeanFactory("tableTreeViewer", TableTreeViewer.class);
- registerBeanFactory("treeViewer", TreeViewer.class);
- registerBeanFactory("checkboxTreeViewer", CheckboxTreeViewer.class);
-
- // Event
- registerFactory("doubleClickListener", new DoubleClickListenerFactory());
- registerFactory("selectionChangedListener",
- new SelectionChangedListenerFactory());
-
- // Window
- registerFactory("applicationWindow", new WindowFactory(ApplicationWindowImpl.class));
-
- // ContributionManager
- registerFactory("menuManager", new MenuManagerFactory());
-
- // Action tags
- registerFactory("action", new ActionFactory());
-
- // ContributionItem
- registerBeanFactory("separator", Separator.class);
-
- // Wizard
- registerFactory("wizardDialog", new WizardDialogFactory());
- registerFactory("wizardPage", new WizardPageFactory());
-
- // Preference
- registerFactory("preferenceDialog", new PreferencesDialogFactory());
- registerFactory("preferencePage", new PreferencesPageFactory());
- registerFactory("booleanFieldEditor", new PreferencesFieldEditorFactory(
- BooleanFieldEditor.class));
- registerFactory("colorFieldEditor", new PreferencesFieldEditorFactory(
- ColorFieldEditor.class));
- registerFactory("directoryFieldEditor", new PreferencesFieldEditorFactory(
- DirectoryFieldEditor.class));
- registerFactory("fileFieldEditor", new PreferencesFieldEditorFactory(
- FileFieldEditor.class));
- registerFactory("fontFieldEditor", new PreferencesFieldEditorFactory(
- FontFieldEditor.class));
- registerFactory("integerFieldEditor", new PreferencesFieldEditorFactory(
- IntegerFieldEditor.class));
- //registerBeanFactory("radioGroupFieldEditor",
- // RadioGroupFieldEditor.class);
- //registerBeanFactory("stringButtonFieldEditor",
- // StringButtonFieldEditor.class);
- registerFactory("stringFieldEditor", new PreferencesFieldEditorFactory(
- StringFieldEditor.class));
-
- // other
- registerFactory("image", new ImageFactory());
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ActionImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ActionImpl.java
deleted file mode 100644
index 7c5cb73..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/ActionImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Created on Feb 28, 2004
- *
- */
-package groovy.jface.factory;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.widgets.Event;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class ActionImpl extends Action implements ClosureSupport {
- private Closure closure;
- private Event event;
-
- public void runWithEvent(Event event) {
- if (closure == null) {
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
- this.event = event;
- closure.call(this);
- }
-
- public Closure getClosure() {
- return closure;
- }
-
- public void setClosure(Closure closure) {
- this.closure = closure;
- }
-
- public Event getEvent() {
- return event;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/DoubleClickListenerFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/DoubleClickListenerFactory.java
deleted file mode 100644
index 8764a9b..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/DoubleClickListenerFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Created on Feb 25, 2004
- *
- */
-package groovy.jface.factory;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-import groovy.swt.InvalidParentException;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-import java.util.Map;
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.StructuredViewer;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class DoubleClickListenerFactory extends AbstractSwtFactory implements
-SwtFactory, IDoubleClickListener, ClosureSupport {
- private Closure closure;
-
- /*
- * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- if (parent instanceof StructuredViewer) {
- StructuredViewer viewer = (StructuredViewer) parent;
- viewer.addDoubleClickListener(this);
- }
- else {
- throw new InvalidParentException("structuredViewer");
- }
- return parent;
- }
-
- /*
- * @see groovy.swt.ClosureSupport#getClosure()
- */
- public Closure getClosure() {
- return closure;
- }
-
- /*
- * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure)
- */
- public void setClosure(Closure closure) {
- this.closure = closure;
- }
-
- /*
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
- */
- public void doubleClick(DoubleClickEvent event) {
- closure.call(this);
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/MenuManagerFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/MenuManagerFactory.java
deleted file mode 100644
index 72e2959..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/MenuManagerFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package groovy.jface.factory;
-
-import groovy.lang.MissingPropertyException;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-import java.util.Map;
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.window.ApplicationWindow;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class MenuManagerFactory extends AbstractSwtFactory implements SwtFactory {
-
- /*
- * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
-
- String text = (String) properties.remove("text");
- if (text == null) {
- throw new MissingPropertyException("text",
- String.class);
- }
-
- MenuManager menuManager = new MenuManager(text);
- if (parent instanceof ApplicationWindow) {
- ApplicationWindow window = (ApplicationWindow) parent;
- if (window != null) {
- window.getMenuBarManager().add(menuManager);
- }
- }
-
- return menuManager;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesDialogFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesDialogFactory.java
deleted file mode 100644
index c6cd299..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesDialogFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package groovy.jface.factory;
-
-import groovy.jface.impl.PreferenceDialogImpl;
-import groovy.swt.InvalidParentException;
-import groovy.swt.SwtUtils;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class PreferencesDialogFactory extends AbstractSwtFactory implements
-SwtFactory {
-
- /*
- * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- Shell parentShell = SwtUtils.getParentShell(parent);
- if (parent != null) {
- PreferenceManager pm = new PreferenceManager();
- return new PreferenceDialogImpl(parentShell, pm);
- }
- else {
- throw new InvalidParentException(
- "applicationWindow or shell");
- }
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesFieldEditorFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesFieldEditorFactory.java
deleted file mode 100644
index d33429c..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesFieldEditorFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package groovy.jface.factory;
-
-import groovy.jface.impl.PreferencePageFieldEditorImpl;
-import groovy.lang.MissingPropertyException;
-import groovy.swt.InvalidParentException;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.PreferencePage;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class PreferencesFieldEditorFactory extends AbstractSwtFactory implements
- SwtFactory {
-
- private Class beanClass;
-
- public PreferencesFieldEditorFactory(Class beanClass) {
- this.beanClass = beanClass;
- }
-
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
-
- if (beanClass == null) { throw new GroovyException(
- "No Class available to create the FieldEditor"); }
-
- // check location
- if (!(parent instanceof PreferencePage)) { throw new InvalidParentException(
- "preferencePage"); }
-
- String name = (String) properties.get("propertyName");
- if (name == null) { throw new MissingPropertyException("propertyName",
- FieldEditor.class); }
-
- String labelText = (String) properties.get("title");
- if (labelText == null) { throw new MissingPropertyException("title",
- FieldEditor.class); }
-
- PreferencePageFieldEditorImpl preferencePageImpl = (PreferencePageFieldEditorImpl) parent;
- preferencePageImpl.addFieldCreator(beanClass, name, labelText);
-
- return preferencePageImpl;
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesPageFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesPageFactory.java
deleted file mode 100644
index 3a4cf6f..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/PreferencesPageFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package groovy.jface.factory;
-
-import groovy.jface.impl.PreferenceDialogImpl;
-import groovy.jface.impl.PreferencePageFieldEditorImpl;
-import groovy.lang.MissingPropertyException;
-import groovy.swt.InvalidParentException;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceNode;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.preference.PreferenceStore;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class PreferencesPageFactory extends AbstractSwtFactory implements
- SwtFactory {
-
- /** The Log to which logging calls will be made. */
- private static final Log log = LogFactory
- .getLog(PreferencesPageFactory.class);
-
- /*
- * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
-
- // check location
- if (!(parent instanceof PreferenceDialog)) { throw new InvalidParentException(
- "preferenceDialog"); }
-
- PreferenceDialogImpl preferenceDialogImpl = (PreferenceDialogImpl) parent;
-
- String filename = (String) properties.remove("filename");
- if (filename == null) { throw new MissingPropertyException("filename",
- PreferencePage.class); }
-
- String title = (String) properties.remove("title");
- if (title == null) { throw new MissingPropertyException("title",
- PreferencePage.class); }
-
- // build new PreferenceNode with same title as the PreferencePage
- PreferenceNode node = new PreferenceNode(title);
-
- // build new PreferencePage
- FieldEditorPreferencePage page = new PreferencePageFieldEditorImpl(
- title);
- PreferenceStore preferenceStore = new PreferenceStore(filename);
-
- try {
- preferenceStore.load();
- } catch (IOException e) {
- log.error(e);
- }
- page.setPreferenceStore(preferenceStore);
-
- // add node to PreferenceManager
- node.setPage(page);
- preferenceDialogImpl.getPreferenceManager().addToRoot(node);
-
- return page;
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/SelectionChangedListenerFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/SelectionChangedListenerFactory.java
deleted file mode 100644
index 6ac5b39..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/SelectionChangedListenerFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Created on Feb 25, 2004
- *
- */
-package groovy.jface.factory;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-import groovy.swt.InvalidParentException;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class SelectionChangedListenerFactory extends AbstractSwtFactory
- implements SwtFactory, ISelectionChangedListener, ClosureSupport {
-
- private Closure closure;
-
- /*
- * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
-
- if (parent instanceof Viewer) {
- Viewer viewer = (Viewer) parent;
- viewer.addSelectionChangedListener(this);
- } else {
- throw new InvalidParentException("viewer");
- }
-
- return this;
- }
-
- /*
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- closure.call(event);
- }
-
- /*
- * @see groovy.swt.ClosureSupport#getClosure()
- */
- public Closure getClosure() {
- return closure;
- }
-
- /*
- * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure)
- */
- public void setClosure(Closure closure) {
- this.closure = closure;
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WindowFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WindowFactory.java
deleted file mode 100644
index 1f2d45d..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WindowFactory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Created on Feb 28, 2004
- *
- */
-package groovy.jface.factory;
-
-import groovy.swt.InvalidParentException;
-import groovy.swt.convertor.PointConverter;
-import groovy.swt.factory.SwtFactory;
-import groovy.swt.factory.WidgetFactory;
-
-import java.util.List;
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class WindowFactory extends WidgetFactory implements SwtFactory {
-
- /**
- * @param beanClass
- */
- public WindowFactory(Class beanClass) {
- super(beanClass);
- }
-
- /*
- * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent) throws GroovyException {
- if (parent == null){
- parent = new Shell();
- }
- if (!(parent instanceof Shell)){
- throw new InvalidParentException("shell");
- }
-
- Window window = (Window) createWidget(parent);
- if (window != null){
- Shell shell = (Shell) parent;
-
- // set title of Window
- String title = (String) properties.remove("title");
- if (title != null){
- window.getShell().setText((String) title);
- }
-
- // set size of Window
- List size = (List) properties.remove("size");
- if (size != null){
- Point point = PointConverter.getInstance().parse(size);
- window.getShell().setSize(point);
- }
-
- // set location of Window
- List location = (List) properties.remove("location");
- if (location != null){
- Point point = PointConverter.getInstance().parse(location);
- window.getShell().setLocation(point);
- }
- }
- setBeanProperties(window, properties);
- return window;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardDialogFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardDialogFactory.java
deleted file mode 100644
index 7509d58..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardDialogFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Created on Feb 20, 2004
- *
- */
-package groovy.jface.factory;
-
-import groovy.jface.impl.WizardDialogImpl;
-import groovy.jface.impl.WizardImpl;
-import groovy.swt.SwtUtils;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class WizardDialogFactory extends AbstractSwtFactory implements SwtFactory {
-
- /*
- * @see groovy.swt.factory.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- Shell parentShell = SwtUtils.getParentShell(parent);
- Wizard wizard = new WizardImpl();
- WizardDialog wizardDialog = new WizardDialogImpl(parentShell, wizard);
- return wizardDialog;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardPageFactory.java b/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardPageFactory.java
deleted file mode 100644
index 89694cf..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/factory/WizardPageFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Created on Feb 20, 2004
- *
- */
-package groovy.jface.factory;
-
-import groovy.jface.impl.WizardDialogImpl;
-import groovy.jface.impl.WizardPageImpl;
-import groovy.lang.MissingPropertyException;
-import groovy.swt.InvalidParentException;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jface.wizard.WizardPage;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class WizardPageFactory extends AbstractSwtFactory implements SwtFactory {
-
- /*
- * @see groovy.swt.factory.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
-
- // check location
- if (!(parent instanceof WizardDialog)) {
- throw new InvalidParentException("wizardDialog");
- }
- WizardDialogImpl wizardDialog = (WizardDialogImpl) parent;
-
- // check for missing attributes
- String title = (String) properties.get("title");
- if (title == null) {
- throw new MissingPropertyException("title",
- WizardPage.class);
- }
-
- // get WizardPageImpl
- WizardPageImpl page = new WizardPageImpl(title);
- setBeanProperties(page, properties);
-
- // get Wizard
- WizardDialogImpl dialog = (WizardDialogImpl) parent;
- Wizard wizard = (Wizard) dialog.getWizard();
-
- // add WizardPage to the Wizard
- wizard.addPage(page);
- return page;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ApplicationWindowImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ApplicationWindowImpl.java
deleted file mode 100644
index e103c63..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/ApplicationWindowImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package groovy.jface.impl;
-
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * This is the default implementation for a ApplicationWindow
- *
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a>
- */
-public class ApplicationWindowImpl extends ApplicationWindow {
-
- /**
- * @param shell
- */
- public ApplicationWindowImpl(Shell parentShell) {
- super(parentShell);
-
- // default at all
- addMenuBar();
- addStatusLine();
- addToolBar(SWT.NULL);
- setBlockOnOpen(true);
-
- // create window
- create();
- }
-
- /*
- * override to make public
- *
- * @see org.eclipse.jface.window.Window#getContents()
- */
- public Control getContents() {
- return super.getContents();
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferenceDialogImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferenceDialogImpl.java
deleted file mode 100644
index a9a3ba9..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferenceDialogImpl.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Created on Feb 20, 2004
- *
- */
-package groovy.jface.impl;
-
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class PreferenceDialogImpl extends PreferenceDialog {
- public PreferenceDialogImpl(Shell shell, PreferenceManager pm) {
- super(shell, pm);
- // this.parentShell = shell;
- }
-
- protected void handleSave() {
- super.handleSave();
- /*
- * try { if (handleSave != null) { handleSave.run(context, output); }
- * else { invokeBody(output); } } catch (JellyTagException e) {
- * log.error(e);
- */
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferencePageFieldEditorImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferencePageFieldEditorImpl.java
deleted file mode 100644
index 90d3588..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/PreferencePageFieldEditorImpl.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Created on Feb 20, 2004
- *
- */
-package groovy.jface.impl;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class PreferencePageFieldEditorImpl extends FieldEditorPreferencePage {
-
- public class FieldEditorCreator {
-
- private Class beanClass;
-
- private String propertyName;
-
- private String title;
-
- public FieldEditorCreator(Class beanClass, String propertyName,
- String title) {
- this.beanClass = beanClass;
- this.propertyName = propertyName;
- this.title = title;
- }
-
- public FieldEditor createField(Composite parent) {
-
- FieldEditor fieldEditor = null;
-
- try {
- Class[] types = { String.class, String.class, Composite.class};
- Constructor constructor = beanClass.getConstructor(types);
- if (constructor != null) {
- Object[] arguments = { propertyName, title, parent};
- fieldEditor = (FieldEditor) constructor
- .newInstance(arguments);
- }
- } catch (Exception e) {
- }
-
- return fieldEditor;
- }
- }
-
- private List creatorFieldsfields = new ArrayList();
-
- public PreferencePageFieldEditorImpl(String title) {
- super(title, FieldEditorPreferencePage.GRID);
- }
-
- public void addFieldCreator(Class beanClass, String propertyName,
- String title) {
- creatorFieldsfields.add(new FieldEditorCreator(beanClass, propertyName,
- title));
- }
-
- protected void createFieldEditors() {
- Iterator i = creatorFieldsfields.iterator();
- while (i.hasNext()) {
- FieldEditorCreator creator = (FieldEditorCreator) i.next();
- FieldEditor fieldEditor = creator
- .createField(getFieldEditorParent());
- addField(fieldEditor);
- }
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardDialogImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardDialogImpl.java
deleted file mode 100644
index ad78f92..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardDialogImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Created on Feb 20, 2004
- *
- */
-package groovy.jface.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Provide a public method getWizard and provide access to parentShell
- *
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class WizardDialogImpl extends WizardDialog implements ClosureSupport {
- private Closure closure;
- private Shell parentShell;
-
- public WizardDialogImpl(Shell parentShell, IWizard newWizard) {
- super(parentShell, newWizard);
- this.parentShell = parentShell;
- }
-
- public IWizard getWizard() {
- return super.getWizard();
- }
-
- public Shell getParentShell() {
- return parentShell;
- }
-
- /*
- * @see groovy.swt.ClosureSupport#getClosure()
- */
- public Closure getClosure() {
- return closure;
- }
-
- /*
- * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure)
- */
- public void setClosure(Closure closure) {
- this.closure = closure;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardImpl.java
deleted file mode 100644
index 7dac1f8..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Created on Feb 20, 2004
- *
- */
-package groovy.jface.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.jface.wizard.Wizard;
-
-/**
- * Provides a Wizard implementation
- *
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class WizardImpl extends Wizard implements ClosureSupport{
- private Closure closure;
- public WizardImpl() {
- super();
- setNeedsProgressMonitor(true);
- }
-
- /*
- * TODO implements this
- *
- * @see org.eclipse.jface.wizard.IWizard#performCancel()
- */
- public boolean performCancel() {
- System.out.println("performCancel ...");
- return true;
- }
-
- /*
- * TODO implements this
- *
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- System.out.println("performFinish ...");
- return true;
- }
-
- /*
- * @see groovy.swt.ClosureSupport#getClosure()
- */
- public Closure getClosure() {
- return closure;
- }
-
- /*
- * @see groovy.swt.ClosureSupport#setClosure(groovy.lang.Closure)
- */
- public void setClosure(Closure closure) {
- this.closure = closure;
- }
-
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardPageImpl.java b/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardPageImpl.java
deleted file mode 100644
index 90be86e..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/jface/impl/WizardPageImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Created on Feb 21, 2004
- *
- */
-package groovy.jface.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Implementation of a WizardPage method createControl is called on
- * Dialog.open()
- *
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class WizardPageImpl extends WizardPage implements ClosureSupport {
- private Closure closure;
-
- public WizardPageImpl(String title) {
- super(title);
- }
-
- public void createControl(Composite parent) {
- if (closure == null) {
- throw new NullPointerException(
- "No closure has been configured for this WizardPage");
- }
- Composite composite = (Composite) closure.call(parent);
- setControl(composite);
- }
-
- public Closure getClosure() {
- return closure;
- }
-
- public void setClosure(Closure closure) {
- this.closure = closure;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/ClosureSupport.java b/groovy/modules/groovy-swt/src/main/groovy/swt/ClosureSupport.java
deleted file mode 100644
index 22d8856..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/ClosureSupport.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Created on Feb 16, 2004
- *
- */
-package groovy.swt;
-
-import groovy.lang.Closure;
-
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public interface ClosureSupport {
- public Closure getClosure();
-
- public void setClosure(Closure closure);
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidChildException.java b/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidChildException.java
deleted file mode 100644
index df53b76..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidChildException.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Created on Feb 16, 2004
- *
- */
-package groovy.swt;
-
-import org.codehaus.groovy.GroovyException;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class InvalidChildException extends GroovyException {
-
- public InvalidChildException(String parent, String child) {
- super("first child of " + parent + " should be " + child);
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidParentException.java b/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidParentException.java
deleted file mode 100644
index 9ec9691..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/InvalidParentException.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Created on Feb 16, 2004
- *
- */
-package groovy.swt;
-
-import org.codehaus.groovy.GroovyException;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class InvalidParentException extends GroovyException {
-
- /**
- * @param message
- */
- public InvalidParentException(String property) {
- super("parent should be: " + property);
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/SwtBuilder.java b/groovy/modules/groovy-swt/src/main/groovy/swt/SwtBuilder.java
deleted file mode 100644
index 9fdb013..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/SwtBuilder.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Created on Feb 15, 2004
- *
- */
-package groovy.swt;
-
-import groovy.lang.Closure;
-import groovy.swt.factory.AwtSwtFactory;
-import groovy.swt.factory.FormFactory;
-import groovy.swt.factory.FormLayoutDataFactory;
-import groovy.swt.factory.ImageFactory;
-import groovy.swt.factory.LayoutDataFactory;
-import groovy.swt.factory.LayoutFactory;
-import groovy.swt.factory.ListenerFactory;
-import groovy.swt.factory.SwtFactory;
-import groovy.swt.factory.TrayFactory;
-import groovy.swt.factory.WidgetFactory;
-import groovy.util.BuilderSupport;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.LocationListener;
-import org.eclipse.swt.browser.ProgressListener;
-import org.eclipse.swt.browser.StatusTextListener;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.custom.TableTreeItem;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowData;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Caret;
-import org.eclipse.swt.widgets.ColorDialog;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.CoolBar;
-import org.eclipse.swt.widgets.CoolItem;
-import org.eclipse.swt.widgets.Decorations;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.FontDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.ProgressBar;
-import org.eclipse.swt.widgets.Sash;
-import org.eclipse.swt.widgets.Scale;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Slider;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tracker;
-import org.eclipse.swt.widgets.TrayItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.forms.events.IExpansionListener;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.ColumnLayout;
-import org.eclipse.ui.forms.widgets.ColumnLayoutData;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class SwtBuilder extends BuilderSupport {
-
- private Map factories = new HashMap();
-
- private Logger log = Logger.getLogger(getClass().getName());
-
- public SwtBuilder() {
- registerWidgets();
- }
-
- /*
- * @see groovy.util.BuilderSupport#createNode(java.lang.Object)
- */
- protected Object createNode(Object name) {
- return createNode(name, Collections.EMPTY_MAP);
- }
-
- /*
- * @see groovy.util.BuilderSupport#createNode(java.lang.Object,
- * java.util.Map)
- */
- protected Object createNode(Object name, Map attributes) {
-
- Closure closure = (Closure) attributes.get("closure");
-
- Object widget = createWidget(name, attributes, getCurrent());
-
- if (widget != null) {
- if (widget instanceof ClosureSupport) {
- if (closure != null) {
- ClosureSupport closureSupport = (ClosureSupport) widget;
- closureSupport.setClosure(closure);
- }
- }
- }
-
- return widget;
- }
-
- /**
- * @param name
- * @param attributes
- * @return
- */
- protected Object createWidget(Object name, Map attributes, Object current) {
- Object widget = null;
- SwtFactory factory = (SwtFactory) factories.get(name);
- if (factory != null) {
- try {
- widget = factory.newInstance(attributes, current);
- } catch (Exception e) {
- log.log(Level.WARNING, e.toString());
- }
- } else {
- log.log(Level.WARNING, "Could not find match for name: " + name);
- }
- return widget;
- }
-
- /*
- * @see groovy.util.BuilderSupport#createNode(java.lang.Object,
- * java.lang.Object)
- */
- protected Object createNode(Object name, Object parent) {
- return createWidget(name, Collections.EMPTY_MAP, parent);
- }
-
- protected void registerBeanFactory(String name, final Class beanClass) {
- registerFactory(name, new WidgetFactory(beanClass));
- }
-
- protected void registerBeanFactory(String name, final Class beanClass,
- final int style) {
- registerFactory(name, new WidgetFactory(beanClass, style));
- }
-
- protected void registerFactory(String name, SwtFactory factory) {
- factories.put(name, factory);
- }
-
- protected void registerWidgets() {
-
- // widgets
- registerFactory("awtFrame", new AwtSwtFactory());
- registerBeanFactory("button", Button.class, SWT.BORDER | SWT.PUSH
- | SWT.CENTER);
- registerBeanFactory("canvas", Canvas.class);
- registerBeanFactory("caret", Caret.class);
- registerBeanFactory("combo", Combo.class, SWT.DROP_DOWN);
- registerBeanFactory("composite", Composite.class);
- registerBeanFactory("scrolledComposite", ScrolledComposite.class,
- SWT.H_SCROLL | SWT.V_SCROLL);
- registerBeanFactory("coolBar", CoolBar.class, SWT.VERTICAL);
- registerBeanFactory("coolItem", CoolItem.class);
- registerBeanFactory("decorations", Decorations.class);
- registerBeanFactory("group", Group.class);
- registerBeanFactory("label", Label.class, SWT.HORIZONTAL
- | SWT.SHADOW_IN);
- registerBeanFactory("list", List.class);
- registerBeanFactory("menu", Menu.class, SWT.DEFAULT);
- // registerMenuTag("menuBar", SWT.BAR);
-
- registerBeanFactory("menuSeparator", MenuItem.class, SWT.SEPARATOR);
- registerBeanFactory("menuItem", MenuItem.class);
- registerBeanFactory("messageBox", MessageBox.class);
- registerBeanFactory("progressBar", ProgressBar.class, SWT.HORIZONTAL);
- registerBeanFactory("sash", Sash.class);
- registerBeanFactory("scale", Scale.class);
- registerBeanFactory("shell", Shell.class, SWT.BORDER | SWT.CLOSE
- | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.TITLE);
- registerBeanFactory("slider", Slider.class);
- registerBeanFactory("tabFolder", TabFolder.class);
- registerBeanFactory("tabItem", TabItem.class);
- registerBeanFactory("table", Table.class, SWT.MULTI | SWT.BORDER
- | SWT.FULL_SELECTION);
- registerBeanFactory("tableColumn", TableColumn.class);
- registerBeanFactory("tableItem", TableItem.class);
- registerBeanFactory("text", Text.class);
- registerBeanFactory("toolBar", ToolBar.class, SWT.VERTICAL);
- registerBeanFactory("toolItem", ToolItem.class);
- registerBeanFactory("tracker", Tracker.class);
- registerFactory("tray", new TrayFactory());
- registerBeanFactory("trayItem", TrayItem.class);
- registerBeanFactory("tree", Tree.class, SWT.MULTI);
- registerBeanFactory("treeItem", TreeItem.class);
-
- // custom widgets
- registerBeanFactory("cTabFolder", CTabFolder.class);
- registerBeanFactory("cTabItem", CTabItem.class);
- registerBeanFactory("sashForm", SashForm.class);
- registerBeanFactory("tableTree", TableTree.class);
- registerBeanFactory("tableTreeItem", TableTreeItem.class);
-
- // layouts
- registerFactory("fillLayout", new LayoutFactory(FillLayout.class));
- registerFactory("gridLayout", new LayoutFactory(GridLayout.class));
- registerFactory("rowLayout", new LayoutFactory(RowLayout.class));
- registerFactory("formLayout", new LayoutFactory(FormLayout.class));
-
- // layout data objects
- registerFactory("gridData", new LayoutDataFactory(GridData.class));
- registerFactory("rowData", new LayoutDataFactory(RowData.class));
- registerFactory("formData", new FormLayoutDataFactory());
-
- // dialogs
- registerBeanFactory("colorDialog", ColorDialog.class);
- registerBeanFactory("directoryDialog", DirectoryDialog.class);
- registerBeanFactory("fileDialog", FileDialog.class);
- registerBeanFactory("fontDialog", FontDialog.class);
-
- // events
- registerFactory("onEvent", new ListenerFactory(Listener.class));
-
- // other tags
- registerFactory("image", new ImageFactory());
-
- // browser tags
- registerBeanFactory("browser", Browser.class, SWT.NONE);
- registerFactory("locationListener", new ListenerFactory(
- LocationListener.class));
- registerFactory("progressListener", new ListenerFactory(
- ProgressListener.class));
- registerFactory("statusTextListener", new ListenerFactory(
- StatusTextListener.class));
-
- // forms api
- registerFactory("form", new FormFactory("form"));
- registerFactory("scrolledForm", new FormFactory("scrolledForm"));
- registerFactory("formButton", new FormFactory("formButton"));
- registerFactory("formColors", new FormFactory("formColors"));
- registerFactory("formComposite", new FormFactory("formComposite"));
- registerFactory("formCompositeSeparator", new FormFactory(
- "formCompositeSeparator"));
- registerFactory("formExpandableComposite",
- new FormFactory("formButton"));
- registerFactory("formText", new FormFactory("formText"));
- registerFactory("formHyperlink", new FormFactory("formHyperlink"));
- registerFactory("formImageHyperlink", new FormFactory(
- "formImageHyperlink"));
- registerFactory("formLabel", new FormFactory("formLabel"));
- registerFactory("formPageBook", new FormFactory("formPageBook"));
- registerFactory("formPageBookPage", new FormFactory("formPageBookPage"));
- registerFactory("formSection", new FormFactory("formSection"));
- registerFactory("formSeparator", new FormFactory("formSeparator"));
- registerFactory("formTable", new FormFactory("formTable"));
- registerFactory("formToolkit", new FormFactory("formToolkit"));
- registerFactory("formFormattedText", new FormFactory(
- "formFormattedText"));
- registerFactory("formTree", new FormFactory("formTree"));
-
- // forms layout
- registerFactory("tableWrapLayout", new LayoutFactory(
- TableWrapLayout.class));
- registerFactory("tableWrapData", new LayoutDataFactory(
- TableWrapData.class));
- registerFactory("columnLayout", new LayoutFactory(
- ColumnLayout.class));
- registerFactory("columnLayoutData", new LayoutDataFactory(
- ColumnLayoutData.class));
-
- // forms listeners
- registerFactory("hyperlinkListener", new ListenerFactory(
- IHyperlinkListener.class));
- registerFactory("expansionListener", new ListenerFactory(
- IExpansionListener.class));
-
- // none eclipse widgets
- // registerBeanFactory("tDateText", TDateText.class);
- // registerBeanFactory("tCalendar", TCalendar.class);
- // registerBeanFactory("textEditor", TextEditor.class);
- } /*
- * @see groovy.util.BuilderSupport#setParent(java.lang.Object,
- * java.lang.Object)
- */
-
- protected void setParent(Object parent, Object child) {
-
- // TODO implement this
- //
- // if (parent instanceof ScrolledComposite && widget instanceof Control)
- // {
- // ScrolledComposite scrolledComposite = (ScrolledComposite) parent;
- // scrolledComposite.setContent((Control) widget);
- // }
-
- }
-
- /*
- * override to make public
- *
- * @see groovy.util.BuilderSupport#setCurrent(java.lang.Object)
- */
- public void setCurrent(Object current) {
- super.setCurrent(current);
- }
-
- /*
- * override to make public
- *
- * @see groovy.util.BuilderSupport#getCurrent()
- */
- public Object getCurrent() {
- return super.getCurrent();
- }
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/SwtUtils.java b/groovy/modules/groovy-swt/src/main/groovy/swt/SwtUtils.java
deleted file mode 100644
index 1219c03..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/SwtUtils.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package groovy.swt;
-
-import groovy.jface.impl.ApplicationWindowImpl;
-
-import java.lang.reflect.Field;
-import java.util.StringTokenizer;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * A helper class for working with SWT.
- *
- * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- *
- * @version 1.1
- */
-public class SwtUtils {
-
- /** The Log to which logging calls will be made. */
- private static final Log log = LogFactory.getLog(SwtUtils.class);
-
-
- /**
- * Parses the comma delimited String of style codes which are or'd
- * together. The given class describes the integer static constants
- *
- * @param constantClass is the type to look for static fields
- * @param text is a comma delimited text value such as "border, resize"
- * @return the int code
- */
- public static int parseStyle(Class constantClass, String text) throws GroovyException {
- return parseStyle(constantClass, text, true);
- }
-
- /**
- * Parses the comma delimited String of style codes which are or'd
- * together. The given class describes the integer static constants
- *
- * @param constantClass is the type to look for static fields
- * @param text is a comma delimited text value such as "border, resize"
- * @param toUpperCase is whether the text should be converted to upper case
- * before its compared against the reflection fields
- *
- * @return the int code
- */
- public static int parseStyle(Class constantClass, String text, boolean toUpperCase) throws GroovyException{
- int answer = 0;
- if (text != null) {
- if (toUpperCase) {
- text = text.toUpperCase();
- }
- StringTokenizer enum = new StringTokenizer(text, ",");
- while (enum.hasMoreTokens()) {
- String token = enum.nextToken().trim();
- answer |= getStyleCode(constantClass, token);
- }
- }
- return answer;
- }
-
- /**
- * @return the code for the given word or zero if the word doesn't match a
- * valid style
- */
- public static int getStyleCode(Class constantClass,String text) throws GroovyException {
- try {
- Field field = constantClass.getField(text);
- if (field == null) {
- log.warn( "Unknown style code: " + text +" will be ignored");
- return 0;
- }
- return field.getInt(null);
- } catch (NoSuchFieldException e) {
- throw new GroovyException("The value: " + text + " is not understood ");
- } catch (IllegalAccessException e) {
- throw new GroovyException("The value: " + text + " is not understood");
- }
- }
-
- /**
- * dispose all children
- *
- * @param parent
- */
- public static void disposeChildren(Composite parent) {
- Control[] children = parent.getChildren();
- for (int i = 0; i < children.length; i++) {
- Control control = children[i];
- control.dispose();
- }
- System.out.println();
- }
-
- /**
- * return the parent shell
- *
- * @param parent
- * @return
- */
- public static Shell getParentShell(Object parent) {
- if (parent instanceof ApplicationWindow) {
- return ((ApplicationWindowImpl) parent).getShell();
- }
- else if (parent instanceof Shell) {
- return (Shell) parent;
- }
- else {
- return null;
- }
- }
-
- /**
- * return the parent widget
- *
- * @param parent
- * @return
- */
- public static Object getParentWidget(Object parent) {
- if (parent instanceof ApplicationWindow) {
- return (Composite) ((ApplicationWindowImpl) parent).getContents();
- }
- else if (parent instanceof Form) {
- return ((Form) parent).getBody();
- }
- else if (parent instanceof ScrolledForm) {
- return ((ScrolledForm) parent).getBody();
- }
- else if (parent instanceof Section) {
- return ((Section) parent).getClient();
- }
- else if (parent instanceof CTabItem) {
- return ((CTabItem) parent).getParent();
- }
- else if (parent instanceof TabItem) {
- return ((TabItem) parent).getParent();
- }
- else if (parent instanceof Widget) {
- return (Widget) parent;
- }
- else {
- return parent;
- }
- }
-
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/ColorConverter.java b/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/ColorConverter.java
deleted file mode 100644
index c7926c9..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/ColorConverter.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package groovy.swt.convertor;
-
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.eclipse.swt.graphics.RGB;
-
-/**
- * A Converter that converts Strings in the form "#uuuuuu" or "x,y,z" into a
- * RGB object
- *
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class ColorConverter {
- private Logger log = Logger.getLogger(getClass().getName());
- private static final ColorConverter instance = new ColorConverter();
- private static String usageText = "Color value should be in the form of '#xxxxxx' or 'x,y,z'";
-
- public static ColorConverter getInstance() {
- return instance;
- }
-
- /**
- * Parsers a String in the form "x, y, z" into an SWT RGB class
- *
- * @param value
- * @return RGB
- */
- protected RGB parseRGB(String value) {
- StringTokenizer enum = new StringTokenizer(value, ",");
- int red = 0;
- int green = 0;
- int blue = 0;
- if (enum.hasMoreTokens()) {
- red = parseNumber(enum.nextToken());
- }
- if (enum.hasMoreTokens()) {
- green = parseNumber(enum.nextToken());
- }
- if (enum.hasMoreTokens()) {
- blue = parseNumber(enum.nextToken());
- }
- return new RGB(red, green, blue);
- }
-
- /**
- * Parsers a String in the form "#xxxxxx" into an SWT RGB class
- *
- * @param value
- * @return RGB
- */
- protected RGB parseHtml(String value) {
- if (value.length() != 7) {
- throw new IllegalArgumentException(usageText);
- }
- int colorValue = 0;
- try {
- colorValue = Integer.parseInt(value.substring(1), 16);
- java.awt.Color swingColor = new java.awt.Color(colorValue);
- return new RGB(swingColor.getRed(), swingColor.getGreen(), swingColor.getBlue());
- }
- catch (NumberFormatException ex) {
- throw new IllegalArgumentException(value + "is not a valid Html color\n " + ex);
- }
- }
-
- /**
- * Parse a String
- */
- public RGB parse(String value) {
- if (value.length() <= 1) {
- throw new IllegalArgumentException(usageText);
- }
- if (value.startsWith("[") && value.endsWith("]")) {
- value = value.substring(1, value.length() - 1);
- }
- if (value.charAt(0) == '#') {
- return parseHtml(value);
- }
- else if (value.indexOf(',') != -1) {
- return parseRGB(value);
- }
- else {
- throw new IllegalArgumentException(usageText);
- }
- }
-
- public RGB parse(List list) {
- if (list.size() != 3) {
- log.log(Level.WARNING, "color attribute must [x,y,z]");
- return null;
- }
- int red = parseNumber("" + list.get(0));
- int green = parseNumber("" + list.get(1));
- int blue = parseNumber("" + list.get(2));
- return new RGB(red, green, blue);
- }
-
- public Object convert(Class type, Object value) {
- Object answer = null;
- if (value != null) {
- String text = value.toString();
- answer = parse(text);
- }
- return answer;
- }
-
- protected int parseNumber(String text) {
- text = text.trim();
- return Integer.parseInt(text);
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/PointConverter.java b/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/PointConverter.java
deleted file mode 100644
index fec26c6..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/convertor/PointConverter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package groovy.swt.convertor;
-
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.eclipse.swt.graphics.Point;
-
-/**
- * A Converter that turns a List in the form [x, y] into a Point object
- *
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster</a>
- * $Id$
- */
-public class PointConverter {
- private Logger log = Logger.getLogger(getClass().getName());
-
- private static final PointConverter instance = new PointConverter();
-
- public static PointConverter getInstance() {
- return instance;
- }
-
- public Point parse(List list) {
- if (list.size() != 2) {
- log.log(Level.WARNING, "size attribute must [x,y]");
- return null;
- }
- int x = parseNumber("" + list.get(0));
- int y = parseNumber("" + list.get(1));
- return new Point(x, y);
- }
-
- protected int parseNumber(String text) {
- return Integer.parseInt(text.trim());
- }
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AbstractSwtFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AbstractSwtFactory.java
deleted file mode 100644
index 2fa55eb..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AbstractSwtFactory.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Created on Feb 15, 2004
- *
- */
-package groovy.swt.factory;
-
-import groovy.swt.SwtUtils;
-import groovy.swt.convertor.ColorConverter;
-import groovy.swt.convertor.PointConverter;
-
-import java.lang.reflect.Field;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.codehaus.groovy.runtime.InvokerHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public abstract class AbstractSwtFactory {
-
- public abstract Object newInstance(Map properties, Object parent)
- throws GroovyException;
-
- /**
- * set the properties
- *
- * @param bean
- * @param properties
- */
- protected void setBeanProperties(Object bean, Map properties) {
- if (bean instanceof Control) {
- Control control = (Control) bean;
-
- // set size of widget
- Object size = properties.remove("size");
- if (size != null) {
- setSize(control, size);
- }
-
- // set background of widget
- Object colorValue = properties.remove("background");
- if (colorValue != null) {
- Color background = getColor(control, colorValue);
- control.setBackground(background);
- }
-
- // set foreground of widget
- colorValue = properties.remove("foreground");
- if (colorValue != null) {
- Color foreground = getColor(control, colorValue);
- control.setForeground(foreground);
- }
- }
-
- for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- String property = entry.getKey().toString();
- Object value = entry.getValue();
- Field field = null;
- try {
- field = bean.getClass().getDeclaredField(property);
- if (value instanceof String) {
- int style = SwtUtils.parseStyle(SWT.class, (String) value);
- field.setInt(bean, style);
- } else if (value instanceof Boolean) {
- field.setBoolean(bean, ((Boolean) value).booleanValue());
- } else if (value instanceof Integer) {
- field.setInt(bean, ((Integer) value).intValue());
- } else if (value instanceof Double) {
- field.setDouble(bean, ((Double) value).doubleValue());
- } else if (value instanceof Float) {
- field.setFloat(bean, ((Float) value).floatValue());
- } else {
- InvokerHelper.setProperty(bean, property, value);
- }
-
- } catch (Exception e) {
- }
- if (field == null) {
- InvokerHelper.setProperty(bean, property, value);
- }
- }
- }
-
- protected Color getColor(Control control, Object colorValue) {
- Color color = null;
- if (colorValue != null) {
- RGB rgb = null;
- if (colorValue instanceof Color) {
- color = (Color) colorValue;
- } else if (colorValue instanceof List) {
- rgb = ColorConverter.getInstance().parse((List) colorValue);
- color = new Color(control.getDisplay(), rgb);
- } else {
- rgb = ColorConverter.getInstance().parse(colorValue.toString());
- color = new Color(control.getDisplay(), rgb);
- }
- }
- return color;
- }
-
- protected void setSize(Control control, Object size) {
- Point point = null;
- if (size != null) {
- if (size instanceof Point) {
- point = (Point) size;
- } else if (size instanceof List) {
- point = PointConverter.getInstance().parse((List) size);
- }
- control.setSize(point);
- }
- }
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ActionFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ActionFactory.java
deleted file mode 100644
index d9b1b13..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ActionFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package groovy.swt.factory;
-
-import groovy.jface.factory.ActionImpl;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IContributionManager;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class ActionFactory extends AbstractSwtFactory implements SwtFactory {
-
-
- /*
- * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- Action action = new ActionImpl();
- setBeanProperties(action, properties);
- if (parent instanceof IContributionManager){
- IContributionManager contributionManager = (IContributionManager) parent;
- contributionManager.add(action);
- }
- return action;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AwtSwtFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AwtSwtFactory.java
deleted file mode 100644
index b306630..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/AwtSwtFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Created on Feb 15, 2004
- *
- */
-package groovy.swt.factory;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.awt.SWT_AWT;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class AwtSwtFactory extends AbstractSwtFactory implements SwtFactory {
-
- /*
- * @see groovy.swt.impl.Factory#newInstance(java.util.Map, java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
-
- if (parent instanceof Composite) {
- return SWT_AWT.new_Frame((Composite) parent);
- }
-
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormFactory.java
deleted file mode 100644
index 1a8e94c..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormFactory.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Created on Feb 27, 2004
- *
- */
-package groovy.swt.factory;
-
-import groovy.swt.InvalidParentException;
-import groovy.swt.SwtUtils;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.forms.widgets.FormText;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledPageBook;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class FormFactory extends AbstractSwtFactory implements SwtFactory {
-
- /** static is evil, too many toolkits is evil */
- protected static FormToolkit toolkit;
-
- /** type of */
- private String type;
-
- /**
- * @param string
- */
- public FormFactory(String type) {
- this.type = type;
- }
-
- /*
- * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- Composite parentComposite = (Composite) SwtUtils
- .getParentWidget(parent);
- if (toolkit == null) {
- toolkit = new FormToolkit(parentComposite.getDisplay());
- toolkit.setBorderStyle(SWT.BORDER);
- }
- String styleProperty = (String) properties.remove("style");
- String text = (String) properties.remove("text");
- int style = SWT.NULL;
- if (styleProperty != null) {
- if (type.equals("formSection")) {
- style = SwtUtils.parseStyle(Section.class, styleProperty);
- } else {
- style = SwtUtils.parseStyle(SWT.class, styleProperty);
- }
- }
- if (parentComposite != null) {
- Object formWidget = getFormWidget(parentComposite, properties,
- style, text);
- setBeanProperties(formWidget, properties);
- return formWidget;
- } else {
- throw new InvalidParentException("composite instance");
- }
- }
-
- /**
- * @param parentComposite
- * @param style
- * @param text
- * @return
- */
- private Object getFormWidget(final Composite parentComposite,
- Map properties, int style, String text) throws GroovyException {
- if ("form".equals(type)) {
- Form form = toolkit.createForm(parentComposite);
- form.setText(text);
- return form;
- }
- if ("scrolledForm".equals(type)) { return toolkit
- .createScrolledForm(parentComposite); }
- if ("formButton".equals(type)) { return toolkit.createButton(
- parentComposite, text, style); }
- if ("formColors".equals(type)) { return toolkit.getColors(); }
- if ("formComposite".equals(type)) { return toolkit.createComposite(
- parentComposite, style); }
- if ("formCompositeSeparator".equals(type)) { return toolkit
- .createCompositeSeparator(parentComposite); }
- if ("formExpandableComposite".equals(type)) { return toolkit
- .createExpandableComposite(parentComposite, style); }
- if ("formText".equals(type)) { return toolkit.createText(
- parentComposite, text, style); }
- if ("formHyperlink".equals(type)) { return toolkit.createHyperlink(
- parentComposite, text, style); }
- if ("formImageHyperlink".equals(type)) { return toolkit
- .createImageHyperlink(parentComposite, style); }
- if ("formLabel".equals(type)) { return toolkit.createLabel(
- parentComposite, text, style); }
- if ("formPageBook".equals(type)) { return toolkit.createPageBook(
- parentComposite, style); }
- if ("formPageBookPage".equals(type)) {
- if (parentComposite instanceof ScrolledPageBook) {
- ScrolledPageBook pageBook = (ScrolledPageBook) parentComposite;
- String key = (String) properties.remove("key");
- if (key != null) {
- Composite page = pageBook.createPage(key);
- pageBook.registerPage(key, page);
- return page;
- }
- } else {
- throw new InvalidParentException("formPageBook");
- }
- }
- if ("formSection".equals(type)) {
- Section section = toolkit.createSection(parentComposite, style);
- if (text != null) {
- section.setText(text);
- }
- section.setSeparatorControl(toolkit
- .createCompositeSeparator(section));
- String description = (String) properties.remove("description");
- if (description != null) {
- section.setDescription(description);
- }
- Composite client = toolkit.createComposite(section);
- client.setLayout(new GridLayout());
- section.setClient(client);
- return section;
- }
- if ("formSeparator".equals(type)) { return toolkit.createSeparator(
- parentComposite, style); }
- if ("formTable".equals(type)) { return toolkit.createTable(
- parentComposite, style); }
- if ("formToolkit".equals(type)) { return toolkit; }
- if ("formFormattedText".equals(type)) {
- boolean parseTags = false;
- boolean expandURLs = false;
- if (properties.get("parseTags") != null) {
- parseTags = ((Boolean) properties.remove("parseTags"))
- .booleanValue();
- }
- if (properties.get("expandURLs") != null) {
- expandURLs = ((Boolean) properties.remove("expandURLs"))
- .booleanValue();
- }
- FormText formText = toolkit.createFormText(parentComposite, true);
- formText.setText(text, parseTags, expandURLs);
- return formText;
- }
- if ("formTree".equals(type)) { return toolkit.createTree(
- parentComposite, style); }
- return null;
- }
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormLayoutDataFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormLayoutDataFactory.java
deleted file mode 100644
index 8866f74..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/FormLayoutDataFactory.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Created on Feb 16, 2004
- *
- */
-package groovy.swt.factory;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-import java.util.Map;
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a> $Id
- * LayoutDataFactory.java,v 1.2 2004/03/18 08:51:47 ckl Exp $
- */
-public class FormLayoutDataFactory extends AbstractSwtFactory implements
- SwtFactory {
-
- /*
- * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- // get attachment properties
- List left = (List) properties.remove("left");
- List right = (List) properties.remove("right");
- List top = (List) properties.remove("top");
- List bottom = (List) properties.remove("bottom");
-
- // build new formdata
- FormData formData = new FormData();
- if (left != null) {
- formData.left = getFormAttachment(left);
- }
- if (right != null) {
- formData.right = getFormAttachment(right);
- }
- if (top != null) {
- formData.top = getFormAttachment(top);
- }
- if (bottom != null) {
- formData.bottom = getFormAttachment(bottom);
- }
-
- // set layout data
- if (parent instanceof Control) {
- Control control = (Control) parent;
- control.setLayoutData(formData);
- }
-
- // set remaining properties
- setBeanProperties(formData, properties);
-
- // return formdata
- return formData;
- }
-
- /**
- * @param list
- * @return @throws
- * GroovyException
- */
- private FormAttachment getFormAttachment(List list) throws GroovyException {
- FormAttachment formAttachment = null;
- try {
- // get constructor
- Class[] types = new Class[list.size()];
- for (int i = 0; i < list.size(); i++) {
- if (list.get(i).getClass() == Integer.class) {
- types[i] = int.class;
- } else if (list.get(i) instanceof Control) {
- types[i] = Control.class;
- } else {
- throw new GroovyException(
- "list element must be of type 'int' or 'Control': "
- + list.get(i));
- }
- }
- Constructor constructor = FormAttachment.class
- .getConstructor(types);
-
- // invoke constructor
- if (constructor != null) {
- Object[] values = new Object[list.size()];
- for (int i = 0; i < list.size(); i++) {
- values[i] = list.get(i);
- }
- formAttachment = (FormAttachment) constructor
- .newInstance(values);
- }
- } catch (Exception e) {
- throw new GroovyException(e.getMessage());
- }
- return formAttachment;
- }
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ImageFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ImageFactory.java
deleted file mode 100644
index 84016d9..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ImageFactory.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Created on Feb 15, 2004
- *
- */
-package groovy.swt.factory;
-
-import groovy.lang.MissingPropertyException;
-import groovy.swt.InvalidParentException;
-
-import java.io.File;
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Decorations;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class ImageFactory extends AbstractSwtFactory implements SwtFactory {
-
- /*
- * @see groovy.swt.impl.Factory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent) throws GroovyException {
- String src = (String) properties.remove("src");
- if (src == null) { throw new MissingPropertyException("src", Image.class); }
-
- if (parent == null) { throw new InvalidParentException("Widget or a Window"); }
-
- Image image = null;
- File imageFile = new File(src);
- if (imageFile.exists()) {
- image = new Image(Display.getCurrent(), src);
- } else {
- image = new Image(Display.getCurrent(), ImageFactory.class.getClassLoader()
- .getResourceAsStream(src));
- }
-
- if (parent instanceof Window) {
- setWindowImage((Window) parent, image);
- } else if (parent instanceof Widget) {
- setWidgetImage((Widget) parent, image);
- }
-
- return image;
- }
-
- /**
- * Set default image Window
- *
- * @param window
- * @param image
- */
- private void setWindowImage(Window window, Image image) {
- window.getShell().setImage(image);
- }
-
- /**
- * Add image to a widget
- *
- * @param parent
- * @param image
- * @throws JellyTagException
- */
- protected void setWidgetImage(Widget parent, Image image) throws GroovyException {
- if (parent instanceof Label) {
- Label label = (Label) parent;
- label.setImage(image);
-
- } else if (parent instanceof Button) {
- Button button = (Button) parent;
- button.setImage(image);
-
- } else if (parent instanceof Item) {
- Item item = (Item) parent;
- item.setImage(image);
-
- } else if (parent instanceof Decorations) {
- Decorations item = (Decorations) parent;
- item.setImage(image);
-
- } else {
- throw new GroovyException(
- "This tag must be nested inside a <label>, <button> or <item> tag");
- }
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/LayoutDataFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/LayoutDataFactory.java
deleted file mode 100644
index 847cbd4..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/LayoutDataFactory.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Created on Feb 16, 2004
- *
- */
-package groovy.swt.factory;
-
-import groovy.swt.SwtUtils;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster</a>
- * $Id$
- */
-public class LayoutDataFactory extends AbstractSwtFactory implements SwtFactory{
-
- private Class beanClass;
-
- /**
- * @param class1
- */
- public LayoutDataFactory(Class beanClass) {
- this.beanClass = beanClass;
- }
-
- /*
- * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
-
- Object bean = createWidget(properties, parent);
-
- if (bean != null) {
- setBeanProperties(bean, properties);
- }
-
- if (parent instanceof Control) {
- Control control = (Control) parent;
- control.setLayoutData(bean);
- }
-
- return bean;
- }
-
- private Object createWidget(Map properties, Object parent)
- throws GroovyException {
- Object bean = null;
-
- String styleText = (String) properties.remove("style");
- if (styleText != null) {
- int style = SwtUtils.parseStyle(beanClass, styleText);
-
- // now lets try invoke a constructor
- Class[] types = { int.class};
-
- try {
- Constructor constructor = beanClass.getConstructor(types);
- if (constructor != null) {
- Object[] values = { new Integer(style)};
- bean = constructor.newInstance(values);
- }
- } catch (NoSuchMethodException e) {
- throw new GroovyException(e.getMessage());
- } catch (InstantiationException e) {
- throw new GroovyException(e.getMessage());
- } catch (IllegalAccessException e) {
- throw new GroovyException(e.getMessage());
- } catch (InvocationTargetException e) {
- throw new GroovyException(e.getMessage());
- }
- } else {
- try {
- bean = beanClass.newInstance();
- } catch (InstantiationException e) {
- throw new GroovyException(e.getMessage());
- } catch (IllegalAccessException e) {
- throw new GroovyException(e.getMessage());
- }
- }
-
- if (bean != null) {
- setBeanProperties(bean, properties);
- }
-
- return bean;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/LayoutFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/LayoutFactory.java
deleted file mode 100644
index db87120..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/LayoutFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Created on Feb 15, 2004
- *
- */
-package groovy.swt.factory;
-
-import groovy.swt.SwtUtils;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class LayoutFactory extends AbstractSwtFactory implements SwtFactory {
-
- private Class beanClass;
-
- /**
- * @param beanClass
- */
- public LayoutFactory(Class beanClass) {
- this.beanClass = beanClass;
- }
-
- /*
- * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
-
- Layout layout;
- try {
- layout = (Layout) beanClass.newInstance();
- } catch (InstantiationException e) {
- throw new GroovyException(e.getMessage());
- } catch (IllegalAccessException e) {
- throw new GroovyException(e.getMessage());
- }
-
- if (layout != null) {
- setBeanProperties(layout, properties);
- }
-
- Widget parentComposite = (Widget) SwtUtils.getParentWidget(parent);
- if (parentComposite != null) {
- ((Composite) parentComposite).setLayout(layout);
- }
-
- return layout;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ListenerFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ListenerFactory.java
deleted file mode 100644
index 300f4ac..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/ListenerFactory.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Created on Feb 15, 2004
- */
-package groovy.swt.factory;
-
-import groovy.swt.SwtUtils;
-import groovy.swt.impl.ExpansionListenerImpl;
-import groovy.swt.impl.HyperLinkListenerImpl;
-import groovy.swt.impl.ListenerImpl;
-import groovy.swt.impl.LocationListenerImpl;
-import groovy.swt.impl.ProgressListenerImpl;
-import groovy.swt.impl.StatusTextListenerImpl;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.browser.LocationListener;
-import org.eclipse.swt.browser.ProgressListener;
-import org.eclipse.swt.browser.StatusTextListener;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.forms.events.IExpansionListener;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.AbstractHyperlink;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class ListenerFactory extends AbstractSwtFactory implements SwtFactory {
-
- private Class beanClass;
-
- /**
- * @param class1
- */
- public ListenerFactory(Class beanClass) {
- this.beanClass = beanClass;
- }
-
- /*
- * @see groovy.swt.impl.SwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- final String type = (String) properties.remove("type");
- if (parent instanceof Browser) {
- Browser browser = (Browser) parent;
- if (beanClass.equals(LocationListener.class)) {
- LocationListener locationListener = new LocationListenerImpl(
- type);
- browser.addLocationListener(locationListener);
- return locationListener;
- } else if (beanClass.equals(ProgressListener.class)) {
- ProgressListener progressListener = new ProgressListenerImpl(
- type);
- browser.addProgressListener(progressListener);
- return progressListener;
- } else if (beanClass.equals(StatusTextListener.class)) {
- StatusTextListener statusTextListener = new StatusTextListenerImpl();
- browser.addStatusTextListener(statusTextListener);
- return statusTextListener;
- }
- } else if (parent instanceof AbstractHyperlink) {
- AbstractHyperlink hyperlink = (AbstractHyperlink) parent;
- IHyperlinkListener hyperLinkListenerImpl = new HyperLinkListenerImpl(
- type);
- hyperlink.addHyperlinkListener(hyperLinkListenerImpl);
- return hyperLinkListenerImpl;
- } else if (parent instanceof ExpandableComposite) {
- ExpandableComposite expandableComposite = (ExpandableComposite) parent;
- IExpansionListener expansionListener = new ExpansionListenerImpl(
- type);
- expandableComposite.addExpansionListener(expansionListener);
- return expansionListener;
-
- } else if (parent instanceof Widget || parent instanceof Viewer) {
- Widget widget = null;
- if (parent instanceof Viewer) {
- widget = ((Viewer) parent).getControl();
- } else {
- widget = (Widget) parent;
- }
- int eventType = getEventType(type);
- if (eventType == 0) { throw new GroovyException(
- "No event type specified, could not understand: " + type); }
- ListenerImpl listenerImpl = new ListenerImpl();
- widget.addListener(eventType, listenerImpl);
- return listenerImpl;
- }
- throw new GroovyException("No factory found for class: " + beanClass);
- }
-
- /**
- * Parses the given event type String and returns the SWT event type code
- *
- * @param type
- * is the String event type
- * @return the SWT integer event type
- */
- protected int getEventType(String type) throws GroovyException {
- return SwtUtils.parseStyle(SWT.class, type, false);
- }
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/SwtFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/SwtFactory.java
deleted file mode 100644
index 5143287..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/SwtFactory.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Created on Feb 15, 2004
- *
- */
-package groovy.swt.factory;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public interface SwtFactory {
-
- /**
- * Create a new instance
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException;
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/TrayFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/TrayFactory.java
deleted file mode 100644
index bcdc9b0..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/TrayFactory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Created on Feb 15, 2004
- *
- */
-package groovy.swt.factory;
-
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class TrayFactory extends AbstractSwtFactory implements SwtFactory {
-
- /*
- * @see groovy.swt.impl.Factory#newInstance(java.util.Map, java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- return Display.getCurrent().getSystemTray();
- }
-
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/WidgetFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/factory/WidgetFactory.java
deleted file mode 100644
index 34e3505..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/factory/WidgetFactory.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Created on Feb 15, 2004
- *
- */
-package groovy.swt.factory;
-
-import groovy.swt.SwtUtils;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.TabItem;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class WidgetFactory extends AbstractSwtFactory implements SwtFactory {
-
- protected Class beanClass;
-
- protected int style = SWT.NONE;
-
- public WidgetFactory(Class beanClass) {
- this.beanClass = beanClass;
- }
-
- /**
- * @param beanClass2
- * @param style
- */
- public WidgetFactory(Class beanClass, int style) {
- this.beanClass = beanClass;
- this.style = style;
- }
-
- /*
- * @see groovy.swt.impl.Factory#newInstance(java.util.Map, java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- String styleProperty = (String) properties.remove("style");
- if (styleProperty != null) {
- style = SwtUtils.parseStyle(SWT.class, styleProperty);
- }
-
- Object parentWidget = SwtUtils.getParentWidget(parent);
- Object bean = createWidget(parentWidget);
- if (bean != null) {
- setBeanProperties(bean, properties);
- }
-
- setControl(bean, parent);
-
- return bean;
- }
-
- /**
- * @param parent
- * @param bean
- * @return @throws
- * GroovyException
- */
- protected Object createWidget(Object parent) throws GroovyException {
- if (beanClass == null) { throw new GroovyException(
- "No Class available to create the new widget"); }
- try {
- if (parent == null) {
- // lets try call a constructor with a single style
- Class[] types = { int.class};
- Constructor constructor = beanClass.getConstructor(types);
- if (constructor != null) {
- Object[] arguments = { new Integer(style)};
- return constructor.newInstance(arguments);
- }
- } else {
- // lets try to find the constructor with 2 arguments with the
- // 2nd argument being an int
- Constructor[] constructors = beanClass.getConstructors();
- if (constructors != null) {
- for (int i = 0, size = constructors.length; i < size; i++) {
- Constructor constructor = constructors[i];
- Class[] types = constructor.getParameterTypes();
- if (types.length == 2
- && types[1].isAssignableFrom(int.class)) {
- if (types[0].isAssignableFrom(parent.getClass())) {
- Object[] arguments = { parent,
- new Integer(style)};
- return constructor.newInstance(arguments);
- }
- // lets try to find the constructor with 1
- // arguments
- } else if (types.length == 1
- && types[0].isAssignableFrom(parent.getClass())) {
- Object[] arguments = { parent};
- return constructor.newInstance(arguments);
- }
- }
- }
- }
- return beanClass.newInstance();
- } catch (NoSuchMethodException e) {
- throw new GroovyException(e.getMessage());
- } catch (InstantiationException e) {
- throw new GroovyException(e.getMessage());
- } catch (IllegalAccessException e) {
- throw new GroovyException(e.getMessage());
- } catch (InvocationTargetException e) {
- throw new GroovyException(e.getTargetException()
- .getLocalizedMessage());
- }
- }
-
- protected void setControl(Object bean, Object parent) {
- if (parent instanceof CTabItem) {
- CTabItem tabItem = (CTabItem) parent;
- tabItem.setControl((Control) bean);
- } else if (parent instanceof TabItem) {
- TabItem tabItem = (TabItem) parent;
- tabItem.setControl((Control) bean);
- }
- }
-
-
-
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/ApplicationGuiBuilder.java b/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/ApplicationGuiBuilder.java
deleted file mode 100644
index be8339a..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/ApplicationGuiBuilder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Created on Mar 1, 2004
- *
- */
-package groovy.swt.guibuilder;
-
-import groovy.jface.JFaceBuilder;
-import groovy.util.GroovyScriptEngine;
-
-import java.io.IOException;
-import java.util.logging.Logger;
-
-/**
- * WORK IN PROGRESS, don't use this one yet
- *
- * This will be the main guibuilder
- *
- * TODO provide entry point for pull tools (e.g. i18n, security)
- *
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class ApplicationGuiBuilder extends JFaceBuilder {
- /** the logger */
- private Logger log = Logger.getLogger(getClass().getName());
-
- /** the caching script engine */
- private GroovyScriptEngine scriptEngine;
-
- /**
- * tha constructor
- *
- * @param rootUrl
- * @throws IOException
- */
- public ApplicationGuiBuilder(String rootUrl) throws IOException {
- scriptEngine = new GroovyScriptEngine(rootUrl);
- }
-
- /*
- * @see groovy.swt.SwtBuilder#registerWidgets()
- */
- protected void registerWidgets() {
- super.registerWidgets();
- registerFactory("rebuild", new RebuildFactory(this));
- registerFactory("runScript", new RunScriptFactory(this));
- }
-
- /**
- * @return Returns the scriptEngine.
- */
- public GroovyScriptEngine getScriptEngine() {
- return scriptEngine;
- }
-
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/RebuildFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/RebuildFactory.java
deleted file mode 100644
index f252046..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/RebuildFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Created on Mar 17, 2004
- *
- */
-package groovy.swt.guibuilder;
-
-import groovy.lang.Closure;
-import groovy.lang.MissingPropertyException;
-import groovy.swt.InvalidParentException;
-import groovy.swt.SwtUtils;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-import java.util.Map;
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Rebuild a swt widget by first disposing all children
- *
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * $Id$
- */
-public class RebuildFactory extends AbstractSwtFactory implements SwtFactory {
-
- private ApplicationGuiBuilder guiBuilder;
-
- /**
- * @param builder
- */
- public RebuildFactory(ApplicationGuiBuilder guiBuilder) {
- this.guiBuilder = guiBuilder;
- }
-
- /*
- * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent) throws GroovyException {
- // get parent
- if( properties.containsKey("parent") ) {
- parent = properties.remove("parent");
- }
- if (parent == null) {
- throw new InvalidParentException("not null");
- }
-
- Composite parentComposite = (Composite) SwtUtils.getParentWidget(parent);
- if (parentComposite == null) {
- throw new MissingPropertyException("parent", RebuildFactory.class);
- }
- guiBuilder.setCurrent(parentComposite);
-
- // get closure
- Closure closure = (Closure) properties.remove("closure");
- if (closure == null) {
- throw new MissingPropertyException("closure", RebuildFactory.class);
- }
-
- // rebuild & pack widgets
- SwtUtils.disposeChildren(parentComposite);
-
- Object obj = closure.call(parentComposite);
- if (obj instanceof Composite) {
- ((Composite) obj).layout();
- }
- parentComposite.layout();
-
- return obj;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/RunScriptFactory.java b/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/RunScriptFactory.java
deleted file mode 100644
index 45083dd..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/guibuilder/RunScriptFactory.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Created on Mar 17, 2004
- *
- */
-package groovy.swt.guibuilder;
-
-import groovy.lang.Binding;
-import groovy.lang.MissingPropertyException;
-import groovy.swt.SwtUtils;
-import groovy.swt.factory.AbstractSwtFactory;
-import groovy.swt.factory.SwtFactory;
-
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.codehaus.groovy.GroovyException;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Run another script
- *
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * $Id$
- */
-public class RunScriptFactory extends AbstractSwtFactory implements SwtFactory {
-
- /** the logger */
- private Logger log = Logger.getLogger(getClass().getName());
-
- /** the builder */
- private ApplicationGuiBuilder guiBuilder;
-
- /**
- * @param scriptEngine
- */
- public RunScriptFactory(ApplicationGuiBuilder guiBuilder) {
- this.guiBuilder = guiBuilder;
- }
-
- /*
- * @see groovy.swt.factory.AbstractSwtFactory#newInstance(java.util.Map,
- * java.lang.Object)
- */
- public Object newInstance(Map properties, Object parent)
- throws GroovyException {
- // get src
- String src = (String) properties.remove("src");
- if (src == null) { throw new MissingPropertyException("src",
- RunScriptFactory.class); }
-
- // get binding
- Binding binding = (Binding) properties.remove("binding");
- if (binding == null) {
- binding = new Binding();
- }
-
- // get parent composite
- Composite parentComposite = null;
- Object obj = properties.remove("parent");
- if (obj != null) {
- parentComposite = (Composite) SwtUtils.getParentWidget(obj);
- if (parentComposite == null && parent instanceof Composite) {
- parentComposite = (Composite) parent;
- }
- } else {
- parentComposite = (Composite) SwtUtils.getParentWidget(guiBuilder.getCurrent());
- }
- guiBuilder.setCurrent(parentComposite);
-
- // dispose children
- Boolean rebuild = (Boolean) properties.remove("rebuild");
- if (parentComposite != null && rebuild != null
- && rebuild.booleanValue()) {
- SwtUtils.disposeChildren(parentComposite);
- }
-
- // run script
- return runScript(src, parentComposite, binding);
- }
-
- /**
- * @param widget
- * @param script
- * @param parent
- * @return
- */
- private Object runScript(String script, Composite parent, Binding binding)
- throws GroovyException {
-
- // script binding
- binding.setVariable("guiBuilder", guiBuilder);
- if (parent != null) {
- binding.setVariable("parent", parent);
- }
- Object obj = null;
- try {
- obj = guiBuilder.getScriptEngine().run(script, binding);
- } catch (Exception e) {
- log.log(Level.WARNING, e.getMessage());
- }
-
- // layout parent
- parent.layout();
-
- return obj;
- }
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ExpansionListenerImpl.java b/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ExpansionListenerImpl.java
deleted file mode 100644
index ecd7a6e..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ExpansionListenerImpl.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Created on Feb 28, 2004
- *
- */
-package groovy.swt.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.events.IExpansionListener;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class ExpansionListenerImpl implements IExpansionListener, ClosureSupport{
- private String type;
- private Closure closure;
-
- public ExpansionListenerImpl(String type) {
- this.type = type;
- }
-
- public Closure getClosure()
- {
- return closure;
- }
-
- public void setClosure(Closure closure)
- {
- this.closure = closure;
- }
-
- /*
- * @see org.eclipse.ui.forms.events.ExpansionListener#expansionStateChanging(org.eclipse.ui.forms.events.ExpansionEvent)
- */
- public void expansionStateChanging(ExpansionEvent event) {
- if (closure == null){
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
- if ("expansionStateChanging".equals(type))
- {
- closure.call(event);
- }
- }
-
- /*
- * @see org.eclipse.ui.forms.events.ExpansionListener#expansionStateChanged(org.eclipse.ui.forms.events.ExpansionEvent)
- */
- public void expansionStateChanged(ExpansionEvent event) {
- if (closure == null){
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
- if ("expansionStateChanged".equals(type))
- {
- closure.call(event);
- }
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/HyperLinkListenerImpl.java b/groovy/modules/groovy-swt/src/main/groovy/swt/impl/HyperLinkListenerImpl.java
deleted file mode 100644
index 054798f..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/HyperLinkListenerImpl.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Created on Feb 28, 2004
- *
- */
-package groovy.swt.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class HyperLinkListenerImpl implements IHyperlinkListener, ClosureSupport {
- private String type;
- private Closure closure;
-
- public HyperLinkListenerImpl(String type) {
- this.type = type;
- }
-
- public Closure getClosure()
- {
- return closure;
- }
-
- public void setClosure(Closure closure)
- {
- this.closure = closure;
- }
-
- /*
- * @see javax.swing.event.HyperlinkListener#hyperlinkUpdate(javax.swing.event.HyperlinkEvent)
- */
- public void hyperlinkUpdate(HyperlinkEvent event) {
- if (closure == null){
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
- if ("hyperlinkUpdate".equals(type))
- {
- closure.call(event);
- }
- }
-
- /*
- * @see org.eclipse.ui.forms.events.HyperlinkListener#linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkEntered(HyperlinkEvent event) {
- if (closure == null){
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
- if ("linkEntered".equals(type))
- {
- closure.call(event);
- }
- }
-
- /*
- * @see org.eclipse.ui.forms.events.HyperlinkListener#linkExited(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkExited(HyperlinkEvent event) {
- if (closure == null){
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
- if ("linkExited".equals(type))
- {
- closure.call(event);
- }
- }
-
- /*
- * @see org.eclipse.ui.forms.events.HyperlinkListener#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkActivated(HyperlinkEvent event) {
- if (closure == null){
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
- if ("linkActivated".equals(type))
- {
- closure.call(event);
- }
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ListenerImpl.java b/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ListenerImpl.java
deleted file mode 100644
index 1f2d2ed..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ListenerImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Created on Feb 16, 2004
- *
- */
-package groovy.swt.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class ListenerImpl implements Listener, ClosureSupport {
- private Closure closure;
-
- public Closure getClosure() {
- return closure;
- }
-
- public void setClosure(Closure closure) {
- this.closure = closure;
- }
-
- public void handleEvent(Event event) {
- if (closure == null){
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
- closure.call(event);
- }
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/LocationListenerImpl.java b/groovy/modules/groovy-swt/src/main/groovy/swt/impl/LocationListenerImpl.java
deleted file mode 100644
index b0ecaae..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/LocationListenerImpl.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package groovy.swt.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.swt.browser.LocationEvent;
-import org.eclipse.swt.browser.LocationListener;
-
-/**
- * This implementation adds a LocationListener to a browser widget
- *
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- */
-public class LocationListenerImpl implements LocationListener, ClosureSupport {
-
- private String type;
-
- private Closure closure;
-
- /**
- * @param type
- */
- public LocationListenerImpl(String type)
- {
- this.type = type;
- }
-
- public Closure getClosure()
- {
- return closure;
- }
-
- public void setClosure(Closure closure)
- {
- this.closure = closure;
- }
-
- /*
- * @see org.eclipse.swt.browser.LocationListener#changing(org.eclipse.swt.browser.LocationEvent)
- */
- public void changing(LocationEvent event)
- {
- if (closure == null) { throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
-
- if ("changing".equals(type))
- {
- closure.setProperty("event", new CustomLocationEvent(event));
- closure.call(event);
- }
-
- }
-
- /*
- * @see org.eclipse.swt.browser.LocationListener#changed(org.eclipse.swt.browser.LocationEvent)
- */
- public void changed(LocationEvent event)
- {
- if (closure == null) {
- throw new NullPointerException(
- "No closure has been configured for this Action");
- }
-
- if ("changed".equals(type))
- {
- closure.setProperty("event", new CustomLocationEvent(event));
- closure.call(event);
- }
- }
-
- public class CustomLocationEvent {
-
- private LocationEvent event;
-
- public CustomLocationEvent(LocationEvent event)
- {
- this.event = event;
- }
-
- public String getLocation()
- {
- return event.location;
- }
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ProgressListenerImpl.java b/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ProgressListenerImpl.java
deleted file mode 100644
index 785a05b..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/ProgressListenerImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package groovy.swt.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.swt.browser.ProgressEvent;
-import org.eclipse.swt.browser.ProgressListener;
-
-/**
- * This implementation adds a ProgressListener to a browser widget
- *
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- */
-public class ProgressListenerImpl implements ProgressListener, ClosureSupport {
-
- private Closure closure;
-
- private String type;
-
- /**
- * @param type
- */
- public ProgressListenerImpl(String type) {
- this.type = type;
- }
-
- public Closure getClosure() {
- return closure;
- }
-
- public void setClosure(Closure closure) {
- this.closure = closure;
- }
-
- /*
- * @see org.eclipse.swt.browser.ProgressListener#changed(org.eclipse.swt.browser.ProgressEvent)
- */
- public void changed(ProgressEvent event) {
-
- if (closure == null) {
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
-
- if ("changed".equals(type)) {
- closure.setProperty("event", new CustomProgressEvent(event));
- closure.call(event);
- }
-
- }
-
- /*
- * @see org.eclipse.swt.browser.ProgressListener#completed(org.eclipse.swt.browser.ProgressEvent)
- */
- public void completed(ProgressEvent event) {
- if (closure == null) {
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
-
- if ("completed".equals(type)) {
- closure.setProperty("event", new CustomProgressEvent(event));
- closure.call(event);
- }
-
- }
-
- public class CustomProgressEvent {
-
- private ProgressEvent event;
-
- public CustomProgressEvent(ProgressEvent event) {
- this.event = event;
- }
-
- public int getCurrent() {
- return event.current;
- }
-
- public int getTotal() {
- return event.total;
- }
- }
-
-}
\ No newline at end of file
diff --git a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/StatusTextListenerImpl.java b/groovy/modules/groovy-swt/src/main/groovy/swt/impl/StatusTextListenerImpl.java
deleted file mode 100644
index 628ceab..0000000
--- a/groovy/modules/groovy-swt/src/main/groovy/swt/impl/StatusTextListenerImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package groovy.swt.impl;
-
-import groovy.lang.Closure;
-import groovy.swt.ClosureSupport;
-
-import org.eclipse.swt.browser.StatusTextEvent;
-import org.eclipse.swt.browser.StatusTextListener;
-
-/**
- * This implementation adds a StatusTextListener to a browser widget
- *
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster</a>
- */
-public class StatusTextListenerImpl implements StatusTextListener, ClosureSupport {
-
- private Closure closure;
-
- public Closure getClosure()
- {
- return closure;
- }
-
- public void setClosure(Closure closure)
- {
- this.closure = closure;
- }
-
- /*
- * @see org.eclipse.swt.browser.StatusTextListener#changed(org.eclipse.swt.browser.StatusTextEvent)
- */
- public void changed(StatusTextEvent event)
- {
- if (closure == null) {
- throw new NullPointerException(
- "No closure has been configured for this Listener");
- }
-
- closure.setProperty("event", new CustomStatusTextEvent(event));
- closure.call(event);
- }
-
- public class CustomStatusTextEvent
- {
- private StatusTextEvent event;
-
- public CustomStatusTextEvent(StatusTextEvent event)
- {
- this.event = event;
- }
-
- public String getText()
- {
- return event.text;
- }
- }
-
-
-}
diff --git a/groovy/modules/groovy-swt/src/test/groovy/jface/JFaceBuilderTest.java b/groovy/modules/groovy-swt/src/test/groovy/jface/JFaceBuilderTest.java
deleted file mode 100644
index ced080d..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/jface/JFaceBuilderTest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Created on Mar 6, 2004
- *
- */
-package groovy.jface;
-
-import groovy.lang.GroovyObject;
-import groovy.swt.SwtTest;
-import junit.framework.TestCase;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * $Id$
- */
-public class JFaceBuilderTest extends TestCase {
- public void testBasic() throws Exception {
- SwtTest demo = new SwtTest();
- GroovyObject object = demo.compile("src/test/groovy/jface/JFaceBuilderTest1.groovy");
- object.invokeMethod("run", null);
- }
-}
diff --git a/groovy/modules/groovy-swt/src/test/groovy/jface/JFaceBuilderTest1.groovy b/groovy/modules/groovy-swt/src/test/groovy/jface/JFaceBuilderTest1.groovy
deleted file mode 100644
index f2843d7..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/jface/JFaceBuilderTest1.groovy
+++ /dev/null
@@ -1,53 +0,0 @@
-package groovy.jface
-
-import groovy.jface.JFaceBuilder
-
-class JFaceBuilderTest1 {
- property jface
- void run() {
- jface = new JFaceBuilder()
-
- jface.applicationWindow() {
- // Viewers
- tableViewer() {
- doubleClickListener()
- selectionChangedListener()
- }
-
- tableTreeViewer()
- treeViewer()
- checkboxTreeViewer()
-
- // ContributionManager
- menuManager( text:"menuManager" )
-
- // Action tags
- action()
-
- // ContributionItem
- separator()
-
- // Wizard
- wizardDialog(){
- wizardPage( title:"title" )
- }
-
- // Preferences
- preferenceDialog( ) {
- preferencePage( filename:"src/test/groovy/jface/test.properties", title:"myprefs" ) {
- booleanFieldEditor( propertyName:"prop", title:"none" )
- colorFieldEditor( propertyName:"prop", title:"none" )
- directoryFieldEditor( propertyName:"prop", title:"none" )
- fileFieldEditor( propertyName:"prop", title:"none" )
- fontFieldEditor( propertyName:"prop", title:"none" )
- integerFieldEditor( propertyName:"prop", title:"none" )
- stringFieldEditor( propertyName:"prop", title:"none" )
- }
- }
-
- image( src:"src/test/groovy/swt/groovy-logo.png" )
- }
- }
-}
-
-
diff --git a/groovy/modules/groovy-swt/src/test/groovy/jface/test.properties b/groovy/modules/groovy-swt/src/test/groovy/jface/test.properties
deleted file mode 100644
index e69de29..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/jface/test.properties
+++ /dev/null
diff --git a/groovy/modules/groovy-swt/src/test/groovy/swt/SwtBuilderTest.java b/groovy/modules/groovy-swt/src/test/groovy/swt/SwtBuilderTest.java
deleted file mode 100644
index a09e52c..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/swt/SwtBuilderTest.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Created on Mar 6, 2004
- *
- */
-package groovy.swt;
-
-import groovy.lang.GroovyObject;
-import junit.framework.TestCase;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a>
- * $Id$
- */
-public class SwtBuilderTest extends TestCase {
- public void testBasic() throws Exception {
- SwtTest demo = new SwtTest();
- GroovyObject object = demo.compile("src/test/groovy/swt/SwtBuilderTest1.groovy");
- object.invokeMethod("run", null);
- }
-}
diff --git a/groovy/modules/groovy-swt/src/test/groovy/swt/SwtBuilderTest1.groovy b/groovy/modules/groovy-swt/src/test/groovy/swt/SwtBuilderTest1.groovy
deleted file mode 100644
index da7287b..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/swt/SwtBuilderTest1.groovy
+++ /dev/null
@@ -1,127 +0,0 @@
-package groovy.swt
-
-import groovy.swt.SwtBuilder
-
-class SwtBuilderTest1 {
- property swt
- void run() {
- swt = new SwtBuilder()
- swt.shell(){
- button()
- canvas()
- caret()
- combo()
- composite()
- scrolledComposite()
- coolBar() {
- coolItem()
- }
- decorations()
- group()
- label()
- list()
- menu() {
- menuSeparator()
- menuItem()
- }
- messageBox()
- progressBar()
- sash()
- scale()
- slider()
- tabFolder() {
- tabItem()
- }
- table() {
- tableColumn()
- tableItem()
- }
- text()
- toolBar(){
- toolItem()
- }
- tracker()
- tray() {
- trayItem()
- }
- tree(){
- treeItem()
- }
- cTabFolder() {
- cTabItem()
- }
- tableTree() {
- tableTreeItem()
- }
- fillLayout()
- gridLayout()
- rowLayout()
- gridData()
- rowData()
- colorDialog()
- directoryDialog()
- fileDialog()
- fontDialog()
- onEvent( type:"Selection" )
- onEvent( type:"Paint" )
- onEvent( type:"DefaultSelection" )
- onEvent( type:"Dispose" )
- onEvent( type:"FocusIn" )
- onEvent( type:"FocusOut" )
- onEvent( type:"Hide" )
- onEvent( type:"Show" )
- onEvent( type:"KeyDown" )
- onEvent( type:"KeyUp" )
- onEvent( type:"MouseDown" )
- onEvent( type:"MouseUp" )
- onEvent( type:"MouseDoubleClick" )
- onEvent( type:"MouseMove" )
- onEvent( type:"Resize" )
- onEvent( type:"Move" )
- onEvent( type:"Close" )
- onEvent( type:"Activate" )
- onEvent( type:"Iconify" )
- onEvent( type:"Deiconify" )
- onEvent( type:"Deactivate" )
- onEvent( type:"Expand" )
- onEvent( type:"Collapse" )
- onEvent( type:"Modify" )
- onEvent( type:"Verify" )
- onEvent( type:"Help" )
- onEvent( type:"Arm" )
- onEvent( type:"MouseExit" )
- onEvent( type:"MouseEnter" )
- onEvent( type:"MouseHover" )
- onEvent( type:"Traverse" )
- image( src:"src/test/groovy/swt/groovy-logo.png" )
- browser() {
- locationListener()
- progressListener()
- statusTextListener()
- }
- form(){
- formButton()
- formComposite()
- formCompositeSeparator()
- formExpandableComposite()
- formText()
- formHyperlink(){
- hyperlinkListener()
- }
- formImageHyperlink()
- formLabel()
- formPageBook()
- formSection(){
- expansionListener()
- }
- formSeparator()
- formTable()
- formFormattedText()
- formTree()
- tableWrapLayout()
- tableWrapData()
- }
- scrolledForm()
- }
- }
-}
diff --git a/groovy/modules/groovy-swt/src/test/groovy/swt/SwtTest.java b/groovy/modules/groovy-swt/src/test/groovy/swt/SwtTest.java
deleted file mode 100644
index 172556f..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/swt/SwtTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Created on Feb 25, 2004
- *
- */
-package groovy.swt;
-
-import groovy.lang.GroovyClassLoader;
-import groovy.lang.GroovyObject;
-
-import java.io.File;
-
-import junit.framework.TestCase;
-
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class SwtTest extends TestCase {
- public GroovyObject compile(String fileName) throws Exception {
- GroovyClassLoader loader = new GroovyClassLoader();
- Class groovyClass = loader.parseClass(new File(fileName));
- GroovyObject object = (GroovyObject) groovyClass.newInstance();
- assertTrue(object != null);
- return object;
- }
-
- public void testSwt() {
- Shell shell = new Shell();
- shell.dispose();
- }
-
- public void testJFace() {
- Shell shell = new Shell();
- ApplicationWindow window = new ApplicationWindow(shell);
- shell.dispose();
- }
-}
diff --git a/groovy/modules/groovy-swt/src/test/groovy/swt/groovy-logo.png b/groovy/modules/groovy-swt/src/test/groovy/swt/groovy-logo.png
deleted file mode 100644
index 54af4c1..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/swt/groovy-logo.png
+++ /dev/null
Binary files differ
diff --git a/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/DynamicUIBuilder.java b/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/DynamicUIBuilder.java
deleted file mode 100644
index bea03a8..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/DynamicUIBuilder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Created on Mar 7, 2004
- *
- */
-package groovy.swt.scrapbook;
-
-import groovy.jface.JFaceBuilder;
-
-import java.util.Map;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster</a>
- * $Id$
- */
-public class DynamicUIBuilder extends JFaceBuilder {
- public DynamicUIBuilder() {
- super();
- }
-
- /*
- * @see groovy.util.BuilderSupport#createNode(java.lang.Object)
- */
- public Object createNode(Object name) {
-// System.out.println("createNode: " + name);
- return super.createNode(name);
- }
-
- /*
- * @see groovy.util.BuilderSupport#createNode(java.lang.Object, java.util.Map)
- */
- protected Object createNode(Object name, Map attributes) {
- System.out.println("createNode: " + name + " [attributes:] " + attributes);
- return super.createNode(name, attributes);
- }
-
- /*
- * @see groovy.util.BuilderSupport#createNode(java.lang.Object, java.lang.Object)
- */
- protected Object createNode(Object name, Object parent) {
- System.out.println("createNode: " + name + " [parent:] " + parent);
- return super.createNode(name, parent);
- }
-
-}
diff --git a/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/NamedObject.java b/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/NamedObject.java
deleted file mode 100644
index fe02c53..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/NamedObject.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Created on Mar 7, 2004
- *
- */
-package groovy.swt.scrapbook;
-
-/**
- * @author <a href:ckl at dacelo.nl">Christiaan ten Klooster </a> $Id$
- */
-public class NamedObject {
- private String name = "empty name";
- private String description = "empty desc";
- private String value = "empty value";
-
- /**
- * @return Returns the description.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description
- * The description to set.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return Returns the name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name
- * The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return Returns the value.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value
- * The value to set.
- */
- public void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/NamedObjectUI.groovy b/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/NamedObjectUI.groovy
deleted file mode 100644
index fe83f1f..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/NamedObjectUI.groovy
+++ /dev/null
@@ -1,14 +0,0 @@
-
-builder.composite( parent ) {
-
- gridLayout( numColumns:2 )
-
- gridData( style:"fill_both" )
- label( style:"none", text:obj.description ) {
- gridData( style:"fill_both" )
- }
-
- text( style:"Border", text:obj.value )
-
-}
-
diff --git a/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/RunDynamicUIDemo.java b/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/RunDynamicUIDemo.java
deleted file mode 100644
index 6f19c67..0000000
--- a/groovy/modules/groovy-swt/src/test/groovy/swt/scrapbook/RunDynamicUIDemo.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package groovy.swt.scrapbook;
-
-import groovy.lang.Binding;
-import groovy.swt.SwtTest;
-import groovy.util.GroovyScriptEngine;
-
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author <a href="mailto:ckl@dacelo.nl">Christiaan ten Klooster </a>
- * @version $Revision$
- */
-public class RunDynamicUIDemo extends SwtTest {
- public void testBasic() throws Exception {
- NamedObject namedObject = new NamedObject();
-
-// Shell parent = new Shell();
- DynamicUIBuilder builder = new DynamicUIBuilder();
- Shell shell = (Shell) builder.createNode("shell");
-
- Binding binding = new Binding();
- binding.setVariable("obj", namedObject);
- binding.setVariable("builder", builder);
- binding.setVariable("parent", shell);
-
- GroovyScriptEngine scriptEngine = new GroovyScriptEngine("src/test/groovy/swt/dynamvc/");
- Object object = scriptEngine.run("NamedObjectUI.groovy", binding);
-
- shell.open();
- while (!shell.isDisposed()) {
- if (!shell.getDisplay().readAndDispatch()) {
- shell.getDisplay().sleep();
- }
- }
- }
-}
diff --git a/groovy/modules/pages/src/main/groovy/modules/pages/GroovyPage.java b/groovy/modules/pages/src/main/groovy/modules/pages/GroovyPage.java
deleted file mode 100644
index 55753b8..0000000
--- a/groovy/modules/pages/src/main/groovy/modules/pages/GroovyPage.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package groovy.modules.pages;
-
-import groovy.lang.Script;
-import groovy.lang.Binding;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 10, 2004
- * Default base class of pages. Provides access to many useful functions for web page writers.
- * Note: Currently unused due to a bug in Groovy not allowing classes derived indirectly from Script
- * to receive their Binding data. Also, many functions to be added soon.
- */
-public abstract class GroovyPage extends Script {
-
-/* private final ThreadLocal bindings = new ThreadLocal();
-
- public Binding getBinding() {
- return (Binding)bindings.get();
- } // getBinding()
-
- public void setBinding(Binding binding) {
- bindings.set(binding);
- } // setBinding()
-
- public Object getProperty(String property) {
- return getBinding().getVariable(property);
- }
-
- public void setProperty(String property, Object newValue) {
- getBinding().setVariable(property, newValue);
- }
-*/
- /**
- * Defaults to deflt if value is null.
- */
- public Object ensure(Object value, Object deflt) {
- return value == null ? deflt : value;
- } // ensure()
-
- /**
- * Convert from HTML to Unicode text. This function converts many of the encoded HTML
- * characters to normal Unicode text. Example: &lt; to <. This is the opposite
- * of showHtml().
- * @see showHtml(String)
- */
- public static String fromHtml(String text)
- {
- int ixz;
- if (text == null || (ixz = text.length()) == 0) return text;
- StringBuffer buf = new StringBuffer(ixz);
- String rep = null;
- for (int ix = 0; ix < ixz; ix++)
- {
- char c = text.charAt(ix);
- if (c == '&');
- {
- String sub = text.substring(ix + 1).toLowerCase();
- if (sub.startsWith("lt;"))
- {
- c = '<';
- ix += 3;
- }
- else
- if (sub.startsWith("gt;"))
- {
- c = '>';
- ix += 3;
- }
- else
- if (sub.startsWith("amp;"))
- {
- c = '&';
- ix += 4;
- }
- else
- if (sub.startsWith("nbsp;"))
- {
- c = ' ';
- ix += 5;
- }
- else
- if (sub.startsWith("semi;"))
- {
- c = ';';
- ix += 5;
- }
- else
- if (sub.startsWith("#"))
- {
- char c2 = 0;
- for (int iy = ix + 1; iy < ixz; iy++)
- {
- char c1 = text.charAt(iy);
- if (c1 >= '0' && c1 <= '9')
- {
- c2 = (char)(c2 * 10 + c1);
- continue;
- }
- if (c1 == ';')
- {
- c = c2;
- ix = iy;
- }
- break;
- }
- }
- }
- if (rep != null)
- {
- buf.append(rep);
- rep = null;
- }
- else buf.append(c);
- }
- return buf.toString();
- } // fromHtml()
-
- /**
- * Substring Replacer. For each instance of <b>sub</b> found in <b>str</b>, it is replaced
- * by <b>rep</b>. The resulting String is returned.
- */
- public static String replace(String str, String sub, String rep)
- {
- StringBuffer buf = null;
- int lenS = sub.length();
- for (int last = 0;;)
- {
- int ix = str.indexOf(sub, last);
- if (ix < 0)
- {
- if (buf != null)
- {
- buf.append(str.substring(last));
- str = buf.toString(); // return str as result
- }
- break;
- }
- if (buf == null) buf = new StringBuffer(str.length() * 3 / 2);
- buf.append(str.substring(last, ix));
- buf.append(rep);
- last = ix + lenS;
- }
- return str;
- } // replace()
-
- /**
- * Substring Replacer. For each instance of <b>sub</b> found in <b>str</b>, it is replaced
- * by <b>rep</b>. The buffer argument itself is modifed and returned. This is faster than
- * replace(), especially useful when called multiple times for various replacements.
- */
- public static StringBuffer replaceBuf(StringBuffer buf, String sub, String rep)
- {
- String str = buf.toString();
- int lenS = sub.length();
- int diff = rep.length() - lenS;
- int offset = 0;
- for (int last = 0;;)
- {
- int ix = str.indexOf(sub, last);
- if (ix < 0) break;
- buf.replace(ix + offset, ix + offset + lenS, rep);
- last = ix + lenS;
- offset += diff;
- }
- return buf;
- } // replaceBuf()
-
-} // GroovyPage
-
diff --git a/groovy/modules/pages/src/main/groovy/modules/pages/GroovyPages.java b/groovy/modules/pages/src/main/groovy/modules/pages/GroovyPages.java
deleted file mode 100644
index 44d18d5..0000000
--- a/groovy/modules/pages/src/main/groovy/modules/pages/GroovyPages.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright 2003 (C) Troy Heninger. All Rights Reserved.
- *
- * Redistribution and use of this software and associated documentation
- * ("Software"), with or without modification, are permitted provided that the
- * following conditions are met: 1. Redistributions of source code must retain
- * copyright statements and notices. Redistributions must also contain a copy
- * of this document. 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 name "groovy" must not be used to endorse or promote products derived
- * from this Software without prior written permission of The Codehaus. For
- * written permission, please contact info@codehaus.org. 4. Products derived
- * from this Software may not be called "groovy" nor may "groovy" appear in
- * their names without prior written permission of The Codehaus. "groovy" is a
- * registered trademark of The Codehaus. 5. Due credit should be given to The
- * Codehaus - http://groovy.codehaus.org/
- *
- * THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS ``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 CODEHAUS 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.
- *
- */
-package groovy.modules.pages;
-
-import groovy.lang.Binding;
-import groovy.lang.GroovyClassLoader;
-import groovy.lang.Script;
-import org.codehaus.groovy.runtime.InvokerHelper;
-import org.codehaus.groovy.syntax.SyntaxException;
-import org.codehaus.groovy.modules.pages.Loader;
-import org.codehaus.groovy.modules.pages.Parse;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.*;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 10, 2004
- * Main servlet class. Example usage in web.xml:
- * <servlet>
- * <servlet-name>GroovyPages</servlet-name>
- * <servlet-class>groovy.modules.pages.GroovyPages</servlet-class>
- * <init-param>
- * <param-name>allowSpilling</param-name>
- * <param-value>1</param-value>
- * <description>
- * Allows developers to view the intermediade source code, when they pass
- * a spillGroovy argument in the URL.
- * </description>
- * </init-param>
- * </servlet>
- */
-
-public class GroovyPages extends HttpServlet /*implements GroovyObject*/ {
- Object x;
- private ServletContext context;
- private boolean allowSpilling = false;
-
- private static Map pageCache = Collections.synchronizedMap(new HashMap());
- private static ClassLoader parent;
-
- /**
- * @return the servlet context
- */
- public ServletContext getServletContext() { return context; }
-
- private static class PageMeta {
- private Class servletScriptClass;
- private long lastModified;
- private Map dependencies = new HashMap();
- private InputStream groovySource;
- } // PageMeta
-
- /**
- * Initialize the servlet, set it's parameters.
- * @param config servlet settings
- */
- public void init(ServletConfig config) {
- // Get the servlet context
- context = config.getServletContext();
- context.log("Groovy servlet initialized");
-
- // Ensure that we use the correct classloader so that we can find
- // classes in an application server.
- parent = Thread.currentThread().getContextClassLoader();
- if (parent == null) parent = getClass().getClassLoader();
-
- allowSpilling = config.getInitParameter("allowSpilling") != null;
- } // init()
-
- /**
- * Handle HTTP GET requests.
- * @param request
- * @param response
- * @throws ServletException
- * @throws IOException
- */
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- doPage(request, response);
- } // doGet()
-
- /**
- * Handle HTTP POST requests.
- * @param request
- * @param response
- * @throws ServletException
- * @throws IOException
- */
- public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- doPage(request, response);
- } // doPost()
-
- /**
- * Execute page and produce output.
- * @param request
- * @param response
- * @throws ServletException
- * @throws IOException
- */
- public void doPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- String pageId = getPageId(request);
- URL pageUrl = getPageUrl(pageId);
- if (pageUrl == null) {
- context.log("GroovyPages: \"" + pageUrl + "\" not found");
- response.sendError(404, "\"" + pageUrl + "\" not found.");
- return;
- }
-
- boolean spillGroovy = allowSpilling && request.getParameter("spillGroovy") != null;
- PageMeta pageMeta = getPage(pageId, pageUrl, request.getServletPath(), spillGroovy);
- Writer out = GroovyWriter.getInstance(response, 8192);
- try {
- if (spillGroovy) {
- // Set it to TEXT
- response.setContentType("text/plain"); // must come before response.getOutputStream()
- send(pageMeta.groovySource, out);
- pageMeta.groovySource = null;
- } else {
- System.out.println("Start");
- // Set it to HTML by default
- response.setContentType("text/html"); // must come before response.getWriter()
- Binding binding = getBinding(request, response, out);
- Script page = InvokerHelper.createScript(pageMeta.servletScriptClass, binding);
-// page.setBinding(binding);
- page.run();
- }
- } finally {
- if (out != null) out.close();
- System.out.println("Done");
- }
- } // doPage()
-
- /**
- * Prepare Bindings before instantiating page.
- * @param request
- * @param response
- * @param out
- * @return the Bindings
- * @throws IOException
- */
- protected Binding getBinding(HttpServletRequest request, HttpServletResponse response, Writer out)
- throws IOException {
- // Set up the script context
- Binding binding = new Binding();
- binding.setVariable("request", new GroovyRequest(request));
- binding.setVariable("response", response);
- binding.setVariable("application", context);
- binding.setVariable("session", new GroovySession(request));
- binding.setVariable("out", out);
-
- // Form parameters. If there are multiple its passed as a list.
- for (Enumeration paramEnum = request.getParameterNames(); paramEnum.hasMoreElements();) {
- String key = (String) paramEnum.nextElement();
- if (binding.getVariable(key) == null) {
- String[] values = request.getParameterValues(key);
- if (values.length == 1) {
- binding.setVariable(key, values[0]);
- } else {
- binding.setVariable(key, values);
- }
- }
- }
- return binding;
- } // getBinding()
-
- /**
- * Lookup page class or load new one if needed.
- * @param pageId
- * @param pageUrl
- * @param servletPath
- * @param spillGroovy
- * @return
- * @throws IOException
- * @throws ServletException
- */
- protected PageMeta getPage(String pageId, URL pageUrl, String servletPath, boolean spillGroovy)
- throws IOException, ServletException {
- // Lock on the pageId to ensure that only one compile occurs for any script
- synchronized (pageId) {
- // Get the URLConnection
- URLConnection groovyScriptConn = pageUrl.openConnection();
- // URL last modified
- long lastModified = groovyScriptConn.getLastModified();
- // Check the cache for the script
- PageMeta pageMeta = (PageMeta)pageCache.get(pageId);
- // If the pageMeta isn't null check all the dependencies
- boolean dependencyOutOfDate = false;
- if (pageMeta != null && !spillGroovy) {
- isPageNew(pageMeta);
- }
- if (pageMeta == null || pageMeta.lastModified < lastModified || dependencyOutOfDate || spillGroovy) {
- pageMeta = newPage(pageId, servletPath, groovyScriptConn, lastModified, spillGroovy);
- }
- return pageMeta;
- }
- } // getPage()
-
- /**
- * Is page new or changed?
- * @param pageMeta page data
- * @return true if compile needed
- */
- private boolean isPageNew(PageMeta pageMeta) {
- for (Iterator i = pageMeta.dependencies.keySet().iterator(); i.hasNext(); ) {
- URLConnection urlc = null;
- URL url = (URL)i.next();
- try {
- urlc = url.openConnection();
- urlc.setDoInput(false);
- urlc.setDoOutput(false);
- long dependentLastModified = urlc.getLastModified();
- if (dependentLastModified > ((Long)pageMeta.dependencies.get(url)).longValue()) {
- return true;
- }
- } catch (IOException ioe) {
- return true;
- }
- }
- return false;
- } // isPageNew()
-
- /**
- * Load and compile new page.
- * @param pageId
- * @param servletPath
- * @param groovyScriptConn
- * @param lastModified
- * @param spillGroovy
- * @return
- * @throws IOException
- * @throws ServletException
- */
- private PageMeta newPage(String pageId, String servletPath, URLConnection groovyScriptConn, long lastModified,
- boolean spillGroovy) throws IOException, ServletException {
- Parse parse = new Parse(pageId, groovyScriptConn.getInputStream());
- InputStream in = parse.parse();
-
- // Make a new pageMeta
- PageMeta pageMeta = new PageMeta();
-
- // just return groovy and don't compile if asked
- if (spillGroovy) {
- pageMeta.groovySource = in;
- return pageMeta;
- }
- // Compile the script into an object
- GroovyClassLoader groovyLoader = new Loader(parent, context, servletPath, pageMeta.dependencies);
- Class scriptClass;
- try {
- scriptClass =
- groovyLoader.parseClass(in, pageId.substring(1));
- } catch (SyntaxException e) {
- throw new ServletException("Could not parse script: " + pageId, e);
- }
- pageMeta.servletScriptClass = scriptClass;
- pageMeta.lastModified = lastModified;
- pageCache.put(pageId, pageMeta);
- return pageMeta;
- } // newPage()
-
- /**
- * Return the page identifier.
- * @param request
- * @return
- */
- protected String getPageId(HttpServletRequest request) {
- // Get the name of the Groovy script (intern the name so that we can
- // lock on it)
- int contextLength = request.getContextPath().length();
- return request.getRequestURI().substring(contextLength).intern();
- } // getPageId()
-
- /**
- * Return the page URL from the request path.
- * @param pageId
- * @return
- * @throws MalformedURLException
- */
- protected URL getPageUrl(String pageId) throws MalformedURLException {
- // Check to make sure that the file exists in the web application
- return context.getResource(pageId);
- } // getPageUrl()
-
- /**
- * Copy all of input to output.
- * @param in
- * @param out
- * @throws IOException
- */
- public static void send(InputStream in, Writer out) throws IOException {
- try {
- Reader reader = new InputStreamReader(in);
- char[] buf = new char[8192];
- for (;;) {
- int read = reader.read(buf);
- if (read <= 0) break;
- out.write(buf, 0, read);
- }
- } finally {
- out.close();
- in.close();
- }
- } // send()
-
-} // GroovyPages
diff --git a/groovy/modules/pages/src/main/groovy/modules/pages/GroovyRequest.java b/groovy/modules/pages/src/main/groovy/modules/pages/GroovyRequest.java
deleted file mode 100644
index 1bd233e..0000000
--- a/groovy/modules/pages/src/main/groovy/modules/pages/GroovyRequest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package groovy.modules.pages;
-
-import groovy.util.Proxy;
-
-import java.util.*;
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 13, 2004
- * Proxy for ServletRequest. All calls get forwarded to actual request, but also provides Map
- * functionality to request parameters.
- */
-public class GroovyRequest extends Proxy implements Map {
- public static final String PREFIX = "groovy.var.";
- public static final int PREFIX_LEN = PREFIX.length();
- public static final Null NULL = new Null();
-
- private Map map = new HashMap();
-
- /**
- * Singleton to represent a nulled out/cleared parameter at runtime.
- */
- static class Null {
- Null() {}
- public boolean equals(Object obj) {
- return obj instanceof Null;
- }
- } // Null
-
- /**
- * Constructor. All request attributes, parameters, and headers become members.
- * @param request encapsulated request
- */
- GroovyRequest(HttpServletRequest request) {
- super(request);
- String name;
- Enumeration en = request.getHeaderNames();
- while (en.hasMoreElements()) {
- name = (String)en.nextElement();
- String header = request.getHeader(name);
- if (!header.equals(NULL)) {
- map.put(name, header);
- }
- }
- en = request.getParameterNames();
- while (en.hasMoreElements()) {
- name = (String)en.nextElement();
- String[] values = request.getParameterValues(name);
- if (values == null) continue;
- if (values.length == 1) map.put(name, values[0]);
- else map.put(name, Arrays.asList(values));
- }
- en = request.getAttributeNames();
- while (en.hasMoreElements()) {
- name = (String)en.nextElement();
- if (name.startsWith(PREFIX)) {
- Object value = request.getAttribute(name);
- if (!value.equals(NULL)) {
- map.put(name.substring(PREFIX_LEN), value);
- }
- }
- }
- } // GroovyRequest()
-
- /**
- * Clear all parameters.
- */
- public void clear() { map.clear(); }
-
- /**
- * Returns true if parameter key has or had a value.
- */
- public boolean containsKey(Object key) { return map.containsKey(key); }
-
- /**
- * Returns true if value exists.
- * @param value
- * @return
- */
- public boolean containsValue(Object value) { return map.containsValue(value); }
-
- /**
- * Returns the complete set of parameters.
- * @return
- */
- public Set entrySet() { return map.entrySet(); }
-
- /**
- * Returns the parameter or null.
- * @param key
- * @return
- */
- public Object get(Object key) { return map.get(key); }
-
- /**
- * Lookup parameter or bean property.
- * @param property
- * @return
- */
- public Object getProperty(String property) {
- Object result = super.getProperty(property);
- if (result.equals(NULL)) result = null;
- return result;
- } // getProperty()
-
- /**
- * Returns the original request.
- * @return
- */
- public ServletRequest getRequest() { return (ServletRequest)getRealObject(); }
-
- /**
- * Probably never true, because there's always some headers.
- * @return
- */
- public boolean isEmpty() { return map.isEmpty(); }
-
- /**
- * Returns the complete set of keys.
- * @return
- */
- public Set keySet() { return map.keySet(); }
-
- /**
- * Change a parameter for later use in the page or for sending to a called page.
- * @param key
- * @param value
- * @return
- */
- public Object put(Object key, Object value) {
- if (value == null) value = NULL;
- getRequest().setAttribute(PREFIX + key, value);
- if (value.equals(NULL)) return map.remove(key);
- else return map.put(key, value);
- } // put()
-
- /**
- * Change all included parameters.
- * @param t
- */
- public void putAll(Map t) {
- Iterator it = t.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry entry = (Map.Entry)it.next();
- put(entry.getKey(), entry.getValue());
- }
- }
-
- /**
- * Set's the parameter to null.
- * @param key
- * @return
- */
- public Object remove(Object key) { return put(key, null); }
-
- /**
- * Returns the number of parameters.
- * @return
- */
- public int size() { return map.size(); }
-
- /**
- * Returns the complete set of values.
- * @return
- */
- public Collection values() { return map.values(); }
-
-} // GroovyRequest
diff --git a/groovy/modules/pages/src/main/groovy/modules/pages/GroovySession.java b/groovy/modules/pages/src/main/groovy/modules/pages/GroovySession.java
deleted file mode 100644
index 7493acd..0000000
--- a/groovy/modules/pages/src/main/groovy/modules/pages/GroovySession.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package groovy.modules.pages;
-
-import groovy.util.Proxy;
-
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 13, 2004
- * Proxy for HttpSession. All calls get forwarded to actual session, but also provides Map
- * functionality to session variables.
- */
-public class GroovySession extends Proxy implements Map {
- private Map map = Collections.synchronizedMap(new HashMap());
-
- /**
- * Constructor, takes request, extracts and encapsulates the session.
- * @param request
- */
- GroovySession(HttpServletRequest request) {
- super(request.getSession(true));
- HttpSession session = getSession();
- Enumeration en = session.getAttributeNames();
- while (en.hasMoreElements()) {
- String name = (String)en.nextElement();
- map.put(name, session.getAttribute(name));
- }
- } // GroovySession()
-
- /**
- * Clear all variables.
- */
- public void clear() {
- map.clear();
- Collection names = new HashSet();
- HttpSession session = getSession();
- Enumeration en = session.getAttributeNames();
- while (en.hasMoreElements()) {
- names.add(en.nextElement());
- }
- Iterator it = names.iterator();
- while (it.hasNext()) {
- remove(it.next());
- }
- } // clear()
-
- /**
- * Return true if the variables is set.
- * @param key
- * @return
- */
- public boolean containsKey(Object key) { return map.containsKey(key); }
-
- /**
- * Return true if value is in one of the variables.
- * @param value
- * @return
- */
- public boolean containsValue(Object value) { return map.containsValue(value); }
-
- /**
- * Return the complete set of variables.
- * @return
- */
- public Set entrySet() { return map.entrySet(); }
-
- /**
- * Get the variable.
- * @param key
- * @return
- */
- public Object get(Object key) { return map.get(key); }
-
- /**
- * Return the real session object.
- * @return
- */
- public HttpSession getSession() { return (HttpSession)getRealObject(); }
-
- /**
- * Return true if no variables have been set.
- * @return
- */
- public boolean isEmpty() { return map.isEmpty(); }
-
- /**
- * Return the complete set of variable names.
- * @return
- */
- public Set keySet() { return map.keySet(); }
-
- /**
- * Set the variable, or clear it if value = null.
- * @param key
- * @param value
- * @return
- */
- public Object put(Object key, Object value) {
- getSession().setAttribute(String.valueOf(key), value);
- if (value == null) return map.remove(key);
- else return map.put(key, value);
- } // put()
-
- /**
- * Copy all members of t in.
- * @param t
- */
- public void putAll(Map t) {
- Iterator it = t.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry entry = (Map.Entry)it.next();
- put(entry.getKey(), entry.getValue());
- }
- }
-
- /**
- * Remove the variable.
- * @param key
- * @return
- */
- public Object remove(Object key) {
- return put(key, null);
- }
-
- /**
- * Return the number of variables.
- * @return
- */
- public int size() { return map.size(); }
-
- /**
- * Return the complete collection of values.
- * @return the values
- */
- public Collection values() { return map.values(); }
-
-} // GroovySession
diff --git a/groovy/modules/pages/src/main/groovy/modules/pages/GroovyWriter.java b/groovy/modules/pages/src/main/groovy/modules/pages/GroovyWriter.java
deleted file mode 100644
index 44b4031..0000000
--- a/groovy/modules/pages/src/main/groovy/modules/pages/GroovyWriter.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package groovy.modules.pages;
-
-import javax.servlet.ServletResponse;
-import java.io.*;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 13, 2004
- * A buffered writer that won't commit the response until the buffer has reached the high
- * water mark, or until flush() or close() is called.
- */
-public class GroovyWriter extends PrintWriter {
- private ServletResponse response;
- private CharArrayWriter out0 = new CharArrayWriter();
- private Writer out1;
- private int max;
- private boolean trouble = false;
-
- /**
- * Private constructor. Use getInstance() instead.
- * @param response
- * @param out
- * @param max
- */
- private GroovyWriter(ServletResponse response, CharArrayWriter out, int max) {
- super(out);
- this.response = response;
- this.out0 = out;
- this.max = max;
- } // GroovyWriter
-
- /**
- * Make sure streams get closed eventually.
- * @throws Throwable
- */
- protected void finalize() throws Throwable {
- close();
- super.finalize();
- } // finalize()
-
- /**
- * Flush the stream if it's not closed and check its error state.
- * Errors are cumulative; once the stream encounters an error, this
- * routine will return true on all successive calls.
- *
- * @return True if the print stream has encountered an error, either on the
- * underlying output stream or during a format conversion.
- */
- public boolean checkError() {
- if (super.checkError()) return true;
- return trouble;
- } // checkError()
-
- /**
- * Close the stream.
- * @see #checkError()
- */
- public void close() {
-// System.out.println("GroovyWriter.close()");
- if (!response.isCommitted()) {
- response.setContentLength(out0.size());
- System.out.println("Content Length = " + out0.size());
- }
- flush();
- super.close();
- } // close()
-
- /**
- * Flush the stream.
- * @see #checkError()
- */
- public synchronized void flush() {
-// System.out.println("GroovyWriter.flush()");
- if (trouble) return;
- super.flush();
- if (out1 == null) {
- try {
- out1 = response.getWriter();
- } catch (IOException e) {
- trouble = true;
- return;
- }
- }
- try {
- out1.write(out0.toCharArray());
- out0.reset();
- } catch (IOException e) {
- trouble = true;
- }
- } // flush()
-
- /**
- * Static factory method to create the writer.
- * @param response
- * @param max
- * @return
- */
- static GroovyWriter getInstance(ServletResponse response, int max) {
- return new GroovyWriter(response, new CharArrayWriter(max), max);
- } // getInstance()
-
- /**
- * Print an object. The string produced by the <code>{@link
- * java.lang.String#valueOf(Object)}</code> method is translated into bytes
- * according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
- * method.
- *
- * @param obj The <code>Object</code> to be printed
- * @see java.lang.Object#toString()
- */
- public void print(Object obj) {
- if (obj == null) obj = "";
- write(String.valueOf(obj));
- }
-
- /**
- * Print a string. If the argument is <code>null</code> then the string
- * <code>""</code> is printed. Otherwise, the string's characters are
- * converted into bytes according to the platform's default character
- * encoding, and these bytes are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
- *
- * @param s The <code>String</code> to be printed
- */
- public void print(String s) {
- if (s == null) s = "";
- write(s);
- } // print()
-
- /**
- * Write a single character.
- * @param c int specifying a character to be written.
- */
- public void write(int c) {
- if (trouble) return;
- super.write(c);
- if (out0.size() >= max) {
- flush();
- }
- } // write()
-
- /**
- * Write a portion of an array of characters.
- * @param buf Array of characters
- * @param off Offset from which to start writing characters
- * @param len Number of characters to write
- */
- public void write(char buf[], int off, int len) {
- if (trouble || buf == null || len == 0) return;
- super.write(buf, off, len);
- if (out0.size() >= max) {
- flush();
- }
- } // write()
-
- /**
- * Write a portion of a string.
- * @param s A String
- * @param off Offset from which to start writing characters
- * @param len Number of characters to write
- */
- public void write(String s, int off, int len) {
- if (trouble || s == null || s.length() == 0) return;
- super.write(s, off, len);
- if (out0.size() >= max) {
- flush();
- }
- } // write()
-
-} // GroovyWriter
diff --git a/groovy/modules/pages/src/main/groovy/util/Proxy.java b/groovy/modules/pages/src/main/groovy/util/Proxy.java
deleted file mode 100644
index 09eb87a..0000000
--- a/groovy/modules/pages/src/main/groovy/util/Proxy.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package groovy.util;
-
-import groovy.lang.GroovyObjectSupport;
-import groovy.lang.MetaClass;
-import groovy.lang.MissingPropertyException;
-import groovy.lang.MissingMethodException;
-import org.codehaus.groovy.runtime.InvokerHelper;
-
-/**
- * Created by IntelliJ IDEA.
- * User: Troy Heninger
- * Date: Jan 21, 2004
- * Proxy for another object. All property accesses and method invokations get forwarded to actual object.
- * This class is abstract because it is meant to be subclassed, with new properties and methods provided.
- */
-public class Proxy extends GroovyObjectSupport {
-
- private Object real;
- private MetaClass meta;
-
- /**
- * Constructor. Takes real object to be excapsulated.
- * @param real
- */
- public Proxy(Object real) {
- this.real = real;
- this.meta = InvokerHelper.getMetaClass(real);
- } // Proxy()
-
- /**
- * Get the property of this proxy, or the real object if property doesn't exist.
- * @param property
- * @return
- */
- public Object getProperty(String property) {
- try {
- return getMetaClass().getProperty(this, property);
- } catch (MissingPropertyException e) {
- return meta.getProperty(real, property);
- }
- } // getProperty()
-
- /**
- * Set the property of this proxy, or the real object if property doesn't exist.
- * @param property
- * @param newValue
- */
- public void setProperty(String property, Object newValue) {
- try {
- getMetaClass().setProperty(this, property, newValue);
- } catch (MissingPropertyException e) {
- meta.setProperty(real, property, newValue);
- } catch (MissingMethodException e) {
- meta.setProperty(real, property, newValue);
- }
- } // setProperty()
-
- /**
- * Returns the encapsulated object.
- * @return
- */
- public Object getRealObject() { return real; }
-
- /**
- * Call a method of this proxy, or the real object if method doesn't exist.
- * @param name
- * @param args
- * @return
- */
- public Object invokeMethod(String name, Object args) {
- try {
- return getMetaClass().invokeMethod(this, name, args);
- } catch (MissingMethodException e) {
- return meta.invokeMethod(this, name, args);
- }
- } // invokeMethod()
-
-} // Proxy
diff --git a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Loader.java b/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Loader.java
deleted file mode 100644
index 474083c..0000000
--- a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Loader.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.codehaus.groovy.modules.pages;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.net.URLConnection;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-
-import groovy.lang.GroovyClassLoader;
-
-import org.codehaus.groovy.syntax.SyntaxException;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 10, 2004
- * Class loader that knows about loading from a servlet context and about class dependancies.
- */
-public class Loader extends GroovyClassLoader {
-
- private String servletPath;
- private ServletContext context;
- private Map dependencies;
-
- /**
- * Constructor.
- * @param parent
- * @param context
- * @param servletPath
- * @param dependencies
- */
- public Loader(ClassLoader parent, ServletContext context, String servletPath, Map dependencies) {
- super(parent);
- this.context = context;
- this.servletPath = servletPath;
- this.dependencies = dependencies;
- } // Loader()
-
- /**
- * Load the class.
- * @todo Fix this to work with .gsp extensions
- * @param className
- * @return
- * @throws ClassNotFoundException
- */
- protected Class findClass(String className) throws ClassNotFoundException {
- String filename = className.replace('.', File.separatorChar) + ".groovy";
- URL dependentScript;
- try {
- dependentScript = context.getResource("/WEB-INF/groovy/" + filename);
- if (dependentScript == null) {
- String current = servletPath.substring(0, servletPath.lastIndexOf("/") + 1);
- dependentScript = context.getResource(current + filename);
- }
- } catch (MalformedURLException e) {
- throw new ClassNotFoundException(className + ": " + e);
- }
- if (dependentScript == null) {
- throw new ClassNotFoundException("Could not find " + className + " in webapp");
- } else {
- URLConnection dependentScriptConn;
- try {
- dependentScriptConn = dependentScript.openConnection();
- dependencies.put(dependentScript, new Long(dependentScriptConn.getLastModified()));
- } catch (IOException e1) {
- throw new ClassNotFoundException("Could not read " + className + ": " + e1);
- }
- try {
- return parseClass(dependentScriptConn.getInputStream(), filename);
- } catch (SyntaxException e2) {
- throw new ClassNotFoundException("Syntax error in " + className + ": " + e2);
- } catch (IOException e2) {
- throw new ClassNotFoundException("Problem reading " + className + ": " + e2);
- }
- }
- }
-}
diff --git a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Parse.java b/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Parse.java
deleted file mode 100644
index f1b3d0d..0000000
--- a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Parse.java
+++ /dev/null
@@ -1,265 +0,0 @@
-package org.codehaus.groovy.modules.pages;
-
-import groovy.modules.pages.GroovyPage;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 10, 2004
- * Parser for GroovyPages.
- */
-public class Parse implements Tokens {
- public static final boolean DEBUG = false;
-
- private static final Pattern paraBreak = Pattern.compile("/p>\\s*<p[^>]*>", Pattern.CASE_INSENSITIVE);
- private static final Pattern rowBreak = Pattern.compile("((/td>\\s*</tr>\\s*<)?tr[^>]*>\\s*<)?td[^>]*>", Pattern.CASE_INSENSITIVE);
-
- private Scan scan;
- private StringBuffer buf;
- private String className;
- private boolean finalPass = false;
-
- public Parse(String name, InputStream in) throws IOException {
- scan = new Scan(readStream(in));
- makeName(name);
- } // Parse()
-
- public InputStream parse() {
- buf = new StringBuffer();
- page();
- finalPass = true;
- scan.reset();
- page();
-// if (DEBUG) System.out.println(buf);
- InputStream out = new ByteArrayInputStream(buf.toString().getBytes());
- buf = null;
- scan = null;
- return out;
- } // parse()
-
- private void declare(boolean gsp) {
- if (finalPass) return;
- if (DEBUG) System.out.println("parse: declare");
- buf.append("\n");
- write(scan.getToken().trim(), gsp);
- buf.append("\n\n");
- } // declare()
-
- private void direct() {
- if (finalPass) return;
- if (DEBUG) System.out.println("parse: direct");
- String text = scan.getToken();
- text = text.trim();
-// System.out.println("direct(" + text + ')');
- if (text.startsWith("page ")) directPage(text);
- } // direct()
-
- private void directPage(String text) {
- text = text.substring(5).trim();
-// System.out.println("directPage(" + text + ')');
- Pattern pat = Pattern.compile("(\\w+)\\s*=\\s*\"([^\"]*)\"");
- Matcher mat = pat.matcher(text);
- for (int ix = 0;;) {
- if (!mat.find(ix)) return;
- String name = mat.group(1);
- String value = mat.group(2);
- if (name.equals("import")) pageImport(value);
- ix = mat.end();
- }
- } // directPage()
-
- private void expr() {
- if (!finalPass) return;
- if (DEBUG) System.out.println("parse: expr");
- buf.append("out.print(");
- String text = scan.getToken().trim();
- buf.append(GroovyPage.fromHtml(text));
- buf.append(")\n");
- } // expr()
-
- private void html() {
- if (!finalPass) return;
- if (DEBUG) System.out.println("parse: html");
- StringBuffer text = new StringBuffer(scan.getToken());
- while (text.length() > 80) {
- int end = 80;
- // don't end a line with a '\'
- while (text.charAt(end - 1) == '\\') end--;
- print(text.subSequence(0, end));
- text.delete(0, end);
- }
- if (text.length() > 0) {
- print(text);
- }
- } // html()
-
- private void makeName(String name) {
- int slash = name.lastIndexOf('/');
- if (slash >= 0) name = name.substring(slash + 1);
- StringBuffer buf = new StringBuffer(name.length());
- for (int ix = 0, ixz = name.length(); ix < ixz; ix++) {
- char c = name.charAt(ix);
- if (c < '0' || (c > '9' && c < '@') || (c > 'Z' && c < '_') || (c > '_' && c < 'a') || c > 'z') c = '_';
- else if (ix == 0 && c >= '0' && c <= '9') c = '_';
- buf.append(c);
- }
- className = buf.toString();
- } // makeName()
-
- private static boolean match(CharSequence pat, CharSequence text, int start) {
- int ix = start, ixz = text.length(), ixy = start + pat.length();
- if (ixz > ixy) ixz = ixy;
- if (pat.length() > ixz - start) return false;
- for (; ix < ixz; ix++) {
- if (Character.toLowerCase(text.charAt(ix)) != Character.toLowerCase(pat.charAt(ix - start))) {
- return false;
- }
- }
- return true;
- } // match()
-
- private static int match(Pattern pat, CharSequence text, int start) {
- Matcher mat = pat.matcher(text);
- if (mat.find(start) && mat.start() == start) {
- return mat.end();
- }
- return 0;
- } // match()
-
- private void page() {
- if (DEBUG) System.out.println("parse: page");
- if (finalPass) {
- buf.append("\nclass ");
- buf.append(className);
-// buf.append(" extends GroovyPage {\n");
- buf.append(" extends Script {\n"); //implements GroovyPage {\n");
- buf.append("run() {\n");
- } else {
- buf.append("import groovy.modules.pages.GroovyPage\n");
- }
- loop: for (;;) {
- int state = scan.nextToken();
- switch (state) {
- case EOF: break loop;
- case HTML: html(); break;
- case JEXPR: expr(); break;
- case JSCRIPT: script(false); break;
- case JDIRECT: direct(); break;
- case JDECLAR: declare(false); break;
- case GEXPR: expr(); break;
- case GSCRIPT: script(true); break;
- case GDIRECT: direct(); break;
- case GDECLAR: declare(true); break;
- }
- }
- if (finalPass) {
- buf.append("}\n}\n");
-// buf.append("} // run()\n");
- }
- } // page()
-
- private void pageImport(String value) {
-// System.out.println("pageImport(" + value + ')');
- String[] imports = Pattern.compile(";").split(value.subSequence(0, value.length()));
- for (int ix = 0; ix < imports.length; ix++) {
- buf.append("import ");
- buf.append(imports[ix]);
- buf.append('\n');
- }
- } // pageImport()
-
- private void print(CharSequence text) {
- buf.append("out.print('");
- for (int ix = 0, ixz = text.length(); ix < ixz; ix++) {
- char c = text.charAt(ix);
- String rep = null;
- if (c == '\n') rep = "\\n";
- else if (c == '\r') rep = "\\r";
- else if (c == '\t') rep = "\\t";
- else if (c == '\'') rep = "\\'";
- else if (c == '\\') rep = "\\\\";
- if (rep != null) buf.append(rep);
- else buf.append(c);
- }
- buf.append("')\n");
- } // print()
-
- private String readStream(InputStream in) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- byte[] buf = new byte[8192];
- for (;;) {
- int read = in.read(buf);
- if (read <= 0) break;
- out.write(buf, 0, read);
- }
- return out.toString();
- } finally {
- out.close();
- in.close();
- }
- } // readStream()
-
- private void script(boolean gsp) {
- if (!finalPass) return;
- if (DEBUG) System.out.println("parse: script");
- buf.append("\n");
- write(scan.getToken().trim(), gsp);
- buf.append("\n\n");
- } // script()
-
- private void write(CharSequence text, boolean gsp) {
- if (!gsp) {
- buf.append(text);
- return;
- }
- for (int ix = 0, ixz = text.length(); ix < ixz; ix++) {
- char c = text.charAt(ix);
- String rep = null;
- if (Character.isWhitespace(c)) {
- for (ix++; ix < ixz; ix++) {
- if (Character.isWhitespace(text.charAt(ix))) continue;
- ix--;
- rep = " ";
- break;
- }
- } else if (c == '&') {
- if (match(";", text, ix)) {
- rep = ";";
- ix += 5;
- } else if (match("&", text, ix)) {
- rep = "&";
- ix += 4;
- } else if (match("<", text, ix)) {
- rep = "<";
- ix += 3;
- } else if (match(">", text, ix)) {
- rep = ">";
- ix += 3;
- }
- } else if (c == '<') {
- if (match("<br>", text, ix) || match("<hr>", text, ix)) {
- rep = "\n";
- ix += 3;
- } else {
- int end = match(paraBreak, text, ix);
- if (end <= 0) end = match(rowBreak, text, ix);
- if (end > 0) {
- rep = "\n";
- ix = end;
- }
- }
- }
- if (rep != null) buf.append(rep);
- else buf.append(c);
- }
- } // write()
-
-} // Parse
diff --git a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Reverse.java b/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Reverse.java
deleted file mode 100644
index 7d66d04..0000000
--- a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Reverse.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.codehaus.groovy.modules.pages;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 16, 2004
- * Utility class to reverse a char sequence.
- */
-class Reverse implements CharSequence {
- private CharSequence text;
- private int start, end, anchor;
-
- Reverse(CharSequence text) {
- this(text, 0, text.length());
- }
-
- Reverse(CharSequence text, int start, int end) {
- this.text = text;
- this.start = start;
- this.end = end;
- anchor = end - 1;
- }
- public char charAt(int index) {
- return text.charAt(anchor - index);
- }
-
- public int length() {
- return end - start;
- }
-
- public CharSequence subSequence(int start, int end) {
- return new Reverse(text, anchor - end, anchor - start);
- }
-
- public String toString() {
- int len = length();
- StringBuffer buf = new StringBuffer(len);
- for (int ix = anchor; ix >= start; ix--) {
- buf.append(text.charAt(ix));
- }
- return buf.toString();
- }
-} // Reverse
diff --git a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Scan.java b/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Scan.java
deleted file mode 100644
index 7029f98..0000000
--- a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Scan.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.codehaus.groovy.modules.pages;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 10, 2004
- * Lexer for GroovyPages.
- */
-class Scan implements Tokens {
- private String text;
- private int end1, begin1, end2, begin2, state = HTML, len, level;
- private boolean str1, str2;
-
- Scan(String text) {
- Strip strip = new Strip(text);
- strip.strip(0);
- this.text = strip.toString();
- len = this.text.length();
- } // Scan()
-
- private int found(int newState, int skip) {
- begin2 = begin1;
- end2 = --end1;
- begin1 = end1 += skip;
- int lastState = state;
- state = newState;
- return lastState;
- } // found()
-
- String getToken() {
- return text.substring(begin2, end2);
- } // getToken()
-
- int nextToken() {
- for (;;) {
- int left = len - end1;
- if (left == 0) {
- end1++; // in order to include the last letter
- return found(EOF, 0);
- }
- char c = text.charAt(end1++);
- char c1 = left > 1 ? text.charAt(end1) : 0;
- char c2 = left > 2 ? text.charAt(end1 + 1) : 0;
-
- if (str1) {
- if (c == '\\') end1++;
- else if (c == '\'') str1 = false;
- continue;
- } else if (str2) {
- if (c == '\\') end1++;
- else if (c == '"') str2 = false;
- continue;
- } else if (level > 0 && (c == ')' || c == '}' || c == ']')) {
- level--;
- continue;
- }
-
- switch (state) {
- case HTML:
- if (c == '<' && left > 3) {
- if (c1 == '%') {
- if (c2 == '=') {
- return found(JEXPR, 3);
- } else if (c2 == '@') {
- return found(JDIRECT, 3);
- } else if (c2 == '!') {
- return found(JDECLAR, 3);
- } else if (c2 == '-' && left > 3 && text.charAt(end1 + 2) == '-') {
- if (skipJComment()) continue;
- }
- return found(JSCRIPT, 2);
- }
- } else if (c == '$' && c1 == '{') {
- return found(GEXPR, 2);
- } else if (c == '%' && c1 == '{') {
- if (c2 == '-' && left > 3 && text.charAt(end1 + 2) == '-') {
- if (skipGComment()) continue;
- }
- return found(GSCRIPT, 2);
- } else if (c == '!' && c1 == '{') {
- return found(GDECLAR, 2);
- } else if (c == '@' && c1 == '{') {
- return found(GDIRECT, 2);
- }
- break;
- case JEXPR:
- case JSCRIPT:
- case JDIRECT:
- case JDECLAR:
- if (c == '%' && c1 == '>') {
- return found(HTML, 2);
- }
- break;
- case GEXPR:
- case GDIRECT:
- if (c == '}' && !str1 && !str2 && level == 0) {
- return found(HTML, 1);
- }
- break;
- case GSCRIPT:
- if (c == '}' && c1 == '%' && !str1 && !str2 && level == 0) {
- return found(HTML, 2);
- }
- break;
- case GDECLAR:
- if (c == '}' && (c1 == '!' || c1 == '%') && !str1 && !str2 && level == 0) {
- return found(HTML, 2);
- }
- break;
- }
- }
- } // nextToken()
-
- private boolean skipComment(char c3, char c4) {
- int ix = end1 + 3;
- for (int ixz = len - 4; ; ix++) {
- if (ix >= ixz) return false;
- if (text.charAt(ix) == '-' && text.charAt(ix + 1) == '-' && text.charAt(ix + 2) == c3
- && text.charAt(ix + 3) == c4) break;
- }
- text = text.substring(0, --end1) + text.substring(ix + 4);
- len = text.length();
- return true;
- } // skipComment()
-
- private boolean skipGComment() {
- return skipComment('}', '%');
- } // skipGComment()
-
- private boolean skipJComment() {
- return skipComment('%', '>');
- } // skipJComment()
-
- void reset() {
- end1= begin1 = end2 = begin2 = level = 0;
- state = HTML;
- } // reset()
-
-} // Scan
-
diff --git a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Strip.java b/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Strip.java
deleted file mode 100644
index 2fff35b..0000000
--- a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Strip.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.codehaus.groovy.modules.pages;
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 10, 2004
- * Utility class to strip HTML from around tags that specify it.
- */
-class Strip {
- private static Pattern stripTag = Pattern.compile("\\^([a-zA-Z]+)%\\{([^}]|\\}[^%])*\\}%");
- private static Pattern anyTag = Pattern.compile("((\\^[a-zA-Z])?%\\{([^}]|\\}[^%])*\\}%|[$@]\\{[^}]*\\})");
-
- private StringBuffer text;
-
- Strip(CharSequence text) {
- this.text = new StringBuffer(text.toString());
- } // Scan()
-
- void strip(int index) {
- Matcher match = stripTag.matcher(text);
- if (match.find(index)) {
- strip(match.end());
- String tag = match.group(1);
- int start = match.start() + 1 + tag.length(); // begin after '^tag'; at the '%{'
- int end = match.end();
- Pattern patAfter = Pattern.compile("</" + tag + "(>|[^>a-zA-Z][^>]*>)\\s*", Pattern.CASE_INSENSITIVE);
- Matcher matchAfter = patAfter.matcher(text);
- if (matchAfter.find(end)) {
- int end2 = matchAfter.end();
- Matcher matchAny = anyTag.matcher(text.subSequence(0, end2));
- if (matchAny.find(end)) end2 = matchAny.start();
- Pattern nextTagPat = Pattern.compile("<" + tag + "(\\s|>)", Pattern.CASE_INSENSITIVE);
- Matcher matchNext = nextTagPat.matcher(text.subSequence(0, end2));
- if (matchNext.find(end)) end2 = matchNext.start();
- // System.out.println("Stripping " + text.subSequence(end, end2));
- text.delete(end, end2);
- }
- Pattern patBefore = Pattern.compile(new Reverse("*s\\<" + tag).toString(),
- Pattern.CASE_INSENSITIVE);
- Matcher matchBefore = patBefore.matcher(new Reverse(text, 0, start));
- if (matchBefore.find()) {
- int start2 = start - matchBefore.end();
- Matcher matchAny = anyTag.matcher(text.subSequence(0, start));
- if (matchAny.find(start2)) start2 = matchAny.end();
- // System.out.println("Stripping " + text.subSequence(start2, start));
- text.delete(start2, start);
- }
- }
- } // strip()
-
- public String toString() {
- return text.toString();
- }
-
-} // Strip
diff --git a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Tokens.java b/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Tokens.java
deleted file mode 100644
index d4bfc59..0000000
--- a/groovy/modules/pages/src/main/org/codehaus/groovy/modules/pages/Tokens.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.codehaus.groovy.modules.pages;
-
-/**
- * Created by IntelliJ IDEA.
- * Author: Troy Heninger
- * Date: Jan 10, 2004
- * Token constants for lexer and parser.
- */
-interface Tokens {
- static final int EOF = -1;
- static final int HTML = 0;
- static final int JEXPR = 1; // <%= ... %>
- static final int JSCRIPT = 2; // <% .... %>
- static final int JDIRECT = 3; // <%@ ... %>
- static final int JDECLAR = 4; // <%! ... %>
- static final int GEXPR = 11; // ${ ... }
- static final int GSCRIPT = 12; // %{ ... }%
- static final int GDIRECT = 13; // @{ ... }
- static final int GDECLAR = 14; // !{ ... }!
-}
diff --git a/groovy/modules/pages/src/web/WEB-INF/web.xml b/groovy/modules/pages/src/web/WEB-INF/web.xml
deleted file mode 100644
index 29845c2..0000000
--- a/groovy/modules/pages/src/web/WEB-INF/web.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<web-app>
- <display-name>GroovyPages Test</display-name>
- <description>GroovyPages Test</description>
- <servlet>
- <servlet-name>GroovyPages</servlet-name>
- <servlet-class>groovy.modules.pages.GroovyPages</servlet-class>
- <init-param>
- <param-name>allowSpilling</param-name>
- <param-value>1</param-value>
- <description>
- Allows developers to view the intermediade source code, when they pass
- a spillGroovy argument in the URL.
- </description>
- </init-param>
- </servlet>
- <servlet>
- <servlet-name>GroovyServlet</servlet-name>
- <servlet-class>groovy.servlet.GroovyServlet</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>GroovyPages</servlet-name>
- <url-pattern>*.gsp</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>GroovyServlet</servlet-name>
- <url-pattern>*.groovy</url-pattern>
- </servlet-mapping>
- <welcome-file-list>
- <welcome-file>default.htm</welcome-file>
- <welcome-file>index.html</welcome-file>
- <welcome-file>index.htm</welcome-file>
- </welcome-file-list>
-</web-app>
diff --git a/groovy/modules/pages/src/web/default.htm b/groovy/modules/pages/src/web/default.htm
deleted file mode 100644
index 12c3474..0000000
--- a/groovy/modules/pages/src/web/default.htm
+++ /dev/null
@@ -1,45 +0,0 @@
-<html>
-
-<head>
-<meta http-equiv="Content-Language" content="en-us">
-<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
-<meta name="ProgId" content="FrontPage.Editor.Document">
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<title>GroovyPages Examples</title>
-</head>
-
-<body>
-
-<h2 align="center">GroovyPages Examples Home</h2>
-
-<p>Here are some pages that demonstrate GroovyPages in action. These
-examples are running live and include the source code as well. Note: if
-you wish to view the intermediate groovy code, pass a spillGroovy parameter in
-the URL then view the source to the page. <a href="simple.gsp?spillGroovy">Click here for an example.</a></p>
-<div align="center">
- <center>
- <table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1">
- <tr>
- <td align="right">
- <a href="http://www.investortech.com/emp/troy/groovypages.htm">GroovyPages</a></td>
- <td>Back to the GroovyPages development site</td>
- </tr>
- <tr>
- <td align="right"><a href="simple.gsp">Simple Example</a></td>
- <td>A very basic example</td>
- </tr>
- <tr>
- <td align="right"><a href="jsp.gsp">JSP Syntax</a></td>
- <td>Shows how GroovyPages supports the JSP syntax</td>
- </tr>
- <tr>
- <td align="right"><a href="visible.gsp">Visible Syntax</a></td>
- <td>Shows how GroovyPages supports an alternate syntax</td>
- </tr>
- </table>
- </center>
-</div>
-
-</body>
-
-</html>
\ No newline at end of file
diff --git a/groovy/modules/pages/src/web/jsp.gsp b/groovy/modules/pages/src/web/jsp.gsp
deleted file mode 100644
index ef7e585..0000000
--- a/groovy/modules/pages/src/web/jsp.gsp
+++ /dev/null
@@ -1,85 +0,0 @@
-<html>
-<head>
-<title>GroovyPages Test</title>
-</head>
-<body>
-<h2 align="center">JSP Syntax</h2>
-<table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
- <tr>
- <td>
- <i>Links:</i></td>
- <td>
- <i>
- <a href="default.htm">Examples Home</a></i></td>
- <td>
- <i> <a href="simple.gsp">Simple Example</a></i></td>
- <td>
- <i>
- <a href="visible.gsp?arg=This+is+a+test+argument&lastCount=${session.count}">
- Visible Syntax</a></i></td>
- <td>
- <i>
- <a href="jsp.gsp?arg=This+is+a+test+argument&lastCount=<%=session.count%>">
- JSP Syntax</a></i></td>
- </tr>
-</table>
-<p> This is an example of GroovyPages showing the use of the
-JSP syntax. This syntax is exactly like JSP except that the code portions
-are Groovy, rather than Java. GroovyPages also support an alternate
-editor-visible syntax which is sometimes preferable when the programmer is also the
-page designer or when they want to see and edit their in the web editor's
-formatted, normal view, rather than in raw, noisy HTML all of the time.</p>
-<% // Make sure count is set
-if (session.count == null) session.count = 1
-%>
-<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
- <tr>
- <td valign="top" width="50%">
- <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
- <tr>
- <td colspan="2" align="center"><b>Page Arguments</b></td>
- </tr>
- <tr>
- <td>Argument</td>
- <td>Value</td>
- </tr>
- <% // For each parameter
- for (it in request) { %>
- <tr>
- <td><%= it.key %> </td>
- <td><%= it.value %> </td>
- </tr>
- <% } %>
- </table>
- </td>
- <td valign="top" width="50%">
- <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
- <tr>
- <td colspan="2" align="center"><b>Session Variables</b></td>
- </tr>
- <tr>
- <td>Variable</td>
- <td>Value</td>
- </tr>
- <% // For each session variable
- session.each() { %>
- <tr>
- <td><%= it.key %> </td>
- <td><%= it.value %> </td>
- </tr>
- <% } %>
- </table>
- </td>
- </tr>
-</table>
-<% // Increment the count on each refresh
-session.count++
-%>
-<h3>The Source Code</h3>
-<pre><span style="background-color: #99FF99"><% // Make sure count is set<br>if (session.count == null) session.count = 1<br>%></span><br><table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
-collapse" bordercolor="#111111" width="100%" id="AutoNumber1"><br> <tr><br> <td valign="top" width="50%"><br> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
- bordercolor="#111111" width="100%" id="AutoNumber2"><br> <tr><br> <td colspan="2" align="center"><b>Page Arguments</b></td><br> </tr><br> <tr><br> <td>Argument</td><br> <td>Value</td><br> </tr><br> <span style="background-color: #99FF99"><% // For each parameter<br> for (it in request) { %></span><br> <tr><br> <td><span style="background-color: #99FF99"><%= it.key %></span>&nbsp;</td><br> <td><span style="background-color: #99FF99"><%= it.value %></span>&nbsp;</td><br> </tr><br> <span style="background-color: #99FF99"><% } %></span><br> </table><br> </td><br> <td valign="top" width="50%"><br> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
- bordercolor="#111111" width="100%" id="AutoNumber3"><br> <tr><br> <td colspan="2" align="center"><b>Session Variables</b></td><br> </tr><br> <tr><br> <td>Variable</td><br> <td>Value</td><br> </tr><br> <span style="background-color: #99FF99"><% // For each session variable<br> session.each() { %></span><br> <tr><br> <td><span style="background-color: #99FF99"><%= it.key %></span>&nbsp;</td><br> <td><span style="background-color: #99FF99"><%= it.value %></span>&nbsp;</td><br> </tr><br> <span style="background-color: #99FF99"><% } %></span><br> </table><br> </td><br> </tr><br></table>
-<span style="background-color: #99FF99"><% // Increment the count on each refresh<br>session.count++<br>%></span></pre>
-</body>
-</html>
\ No newline at end of file
diff --git a/groovy/modules/pages/src/web/simple.groovy b/groovy/modules/pages/src/web/simple.groovy
deleted file mode 100644
index 76a967c..0000000
--- a/groovy/modules/pages/src/web/simple.groovy
+++ /dev/null
@@ -1,57 +0,0 @@
-import java.util.Date
-if (session.count == null) {
- session.count = 1
-}
-out.println(<<<EOS
-<html>
-<head>
-<title>Groovlet Example</title>
-</head>
-<body>
-<h2 align="center">Groovelet Example</h2>
-<table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
- <tr>
- <td>
- <i>Links:</i></td>
- <td>
- <i>
- <a href="default.htm">Examples Home</a></i></td>
- <td>
- <i> <a href="simple.gsp">Simple Example</a></i></td>
- <td>
- <i>
- <a href="visible.gsp?arg=This+is+a+test+argument&lastCount=${session.count}">
- Visible Syntax</a></i></td>
- <td>
- <i>
- <a href="jsp.gsp?arg=This+is+a+test+argument&lastCount=${session.count}">
- JSP Syntax</a></i></td>
- </tr>
-</table>
-<p> This is a simple example of a Groovlet using GroovyServlet. This page
-does the same thing as the GroovyPages <a href="simple.gsp">Simple Example</a>.
-From the source code below, you can see that it doesn't take much to write a simple servlet with
-Groovy. But for more complex servlets, GroovyPages can be a great benefit because it is embedded
-in your HTML, like JSP.</p>
-<p>Hello, ${request.remoteHost}: ${session.count}! ${new Date()}</p>
-<h3>The Source Code</h3>
-<pre><span style="background-color: #99FF99">import java.util.Date
-if (session.count == null) {
- session.count = 1
-}
-out.println(<<<EOS</span>
-<html>
-<head>
-<title>Groovlet Example</title>
-</head>
-<body>
-<p>Hello, <span style="background-color: #99FF99">${request.remoteHost}</span>: <span style="background-color: #99FF99">${session.count}</span>! <span style="background-color: #99FF99">${new Date()}</span></p>
-</body>
-</html>
-<span style="background-color: #99FF99">EOS)
-session.count = session.count + 1</span>
-</pre>
-</body>
-</html>
-EOS)
-session.count = session.count + 1
diff --git a/groovy/modules/pages/src/web/simple.gsp b/groovy/modules/pages/src/web/simple.gsp
deleted file mode 100644
index 887af1e..0000000
--- a/groovy/modules/pages/src/web/simple.gsp
+++ /dev/null
@@ -1,50 +0,0 @@
-<html>
-<head>
-<title>Simple GroovyPages Example</title>
-</head>
-<body>
-<h2 align="center">Simple Example</h2>
-<table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
- <tr>
- <td>
- <i>Links:</i></td>
- <td>
- <i>
- <a href="default.htm">Examples Home</a></i></td>
- <td>
- <i> <a href="simple.gsp">Simple Example</a></i></td>
- <td>
- <i>
- <a href="visible.gsp?arg=This+is+a+test+argument&lastCount=${session.count}">
- Visible Syntax</a></i></td>
- <td>
- <i>
- <a href="jsp.gsp?arg=This+is+a+test+argument&lastCount=<%=session.count%>">
- JSP Syntax</a></i></td>
- </tr>
-</table>
-<p> This is a simple example of GroovyPages. This page
-does the same thing as the <a href="simple.groovy">Groovlet Example</a>.
-From the source code below, you can see that GroovyPages are very similar to JSP,
-except much easier to use because Groovy is underneath.</p>
-<%@ page import="java.util.Date" %>
-
-<% if (session.count == null) session.count = 1 %>
-<p>Hello, ${request.remoteHost}: ${session.count}! ${new Date()}</p>
-<% session.count++ %>
-<h3>The Source Code</h3>
-<pre><html>
-<head>
-<title>Simple Example</title>
-</head>
-<body>
-<span style="background-color: #99FF99"><%@ page import="java.util.Date" %></span>
-
-<span style="background-color: #99FF99"><% if session.count == null
-session.count = 1 %></span>
-<p>Hello, <span style="background-color: #99FF99">${request.remoteHost}</span>: <span style="background-color: #99FF99">${session.count}</span>! <span style="background-color: #99FF99">${new Date()}</span></p>
-<span style="background-color: #99FF99"><% session.count++ %></span>
-</body>
-</html></pre>
-</body>
-</html>
\ No newline at end of file
diff --git a/groovy/modules/pages/src/web/sql.gsp b/groovy/modules/pages/src/web/sql.gsp
deleted file mode 100644
index a96b78b..0000000
--- a/groovy/modules/pages/src/web/sql.gsp
+++ /dev/null
@@ -1,14 +0,0 @@
-<html>
- <head>
- <title>Test Database Access</title>
- </head>
- <body>
- <p>^p@{page import="groovy.sql.Sql, test.groovy.sql.TestHelper"}</p>
- <p>^p%{sql = TestHelper.makeSql()<br>
- type = 'cheese'<br>
- sql.queryEach("select * from FOOD where type = ${type}")
- { }%</p>
- <p>Found cheese ${it.name}</p>
- <p>^p%{ } }%</p>
- </body>
-</html>
\ No newline at end of file
diff --git a/groovy/modules/pages/src/web/test1.groovy b/groovy/modules/pages/src/web/test1.groovy
deleted file mode 100644
index 936ce05..0000000
--- a/groovy/modules/pages/src/web/test1.groovy
+++ /dev/null
@@ -1,11 +0,0 @@
-html = <<<EOS
-<html>
-<head>
-<title>Groovlet Example</title>
-</head>
-<body>
-<p>Hello</p>
-</body>
-</html>
-EOS
-out.println(html)
diff --git a/groovy/modules/pages/src/web/test2.groovy b/groovy/modules/pages/src/web/test2.groovy
deleted file mode 100644
index c81acb7..0000000
--- a/groovy/modules/pages/src/web/test2.groovy
+++ /dev/null
@@ -1,10 +0,0 @@
-out.println(<<<EOS
-<html>
-<head>
-<title>Groovlet Example</title>
-</head>
-<body>
-<p>Hello</p>
-</body>
-</html>
-EOS)
diff --git a/groovy/modules/pages/src/web/visible.gsp b/groovy/modules/pages/src/web/visible.gsp
deleted file mode 100644
index eed96c3..0000000
--- a/groovy/modules/pages/src/web/visible.gsp
+++ /dev/null
@@ -1,155 +0,0 @@
-<html>
-<head>
-<title>GroovyPages Test</title>
-</head>
-<body>
-<h2 align="center">Visible Syntax</h2>
-<table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
- <tr>
- <td>
- <i>Links:</i></td>
- <td>
- <i>
- <a href="default.htm">Examples Home</a></i></td>
- <td>
- <i> <a href="simple.gsp">Simple Example</a></i></td>
- <td>
- <i>
- <a href="visible.gsp?arg=This+is+a+test+argument&lastCount=${session.count}">
- Visible Syntax</a></i></td>
- <td>
- <i>
- <a href="jsp.gsp?arg=This+is+a+test+argument&lastCount=<%=session.count%>">
- JSP Syntax</a></i></td>
- </tr>
-</table>
-<p> This is an example of GroovyPages showing the use of the editor
-visible syntax. This syntax uses curly braces like %{ groovlet }% and ${
-expression }, instead of the less-than greater-than of JSP, like <% groovlet %>
-and <%= expression %>. Though both syntaxes are supported in GroovyPages,
-using visible syntax is sometimes preferable when the programmer is also the
-page designer or when they want to see and edit their in the web editor's
-formatted, normal view, rather than in raw, noisy HTML all of the time.
-It's perfectly acceptable to mix both syntaxes on the same page.</p>
-<p><i><b>Make sure count is set and increment it on each refresh</b></i><br>
-^p%{<br>
-if (session.count == null) session.count = 1<br>
-}%</p>
-<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
- <tr>
- <td valign="top" width="50%">
- <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
- <tr>
- <td colspan="2" align="center"><b>Page Arguments</b></td>
- </tr>
- <tr>
- <td>Argument</td>
- <td>Value</td>
- </tr>
- <tr>
- <td colspan="2"><i><b>For each parameter</b></i><br>
-^tr%{ for (it in request) { }%</td>
- </tr>
- <tr>
- <td>${ it.key }</td>
- <td>${ it.value }</td>
- </tr>
- <tr>
- <td colspan="2">^tr%{ } }% <i><b>Comments are safe before and after
- stripping tags</b></i></td>
- </tr>
- </table>
- </td>
- <td valign="top" width="50%">
- <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
- <tr>
- <td colspan="2" align="center"><b>Session Variables</b></td>
- </tr>
- <tr>
- <td>Variable</td>
- <td>Value</td>
- </tr>
- <tr>
- <td colspan="2"><i><b>For each session variable</b></i><br>
-^tr%{ session.each() { }%</td>
- </tr>
- <tr>
- <td>${ it.key }</td>
- <td>${ it.value }</td>
- </tr>
- <tr>
- <td colspan="2">^tr%{ } }% <i><b>because they will get
- stripped off</b></i></td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<p><i><b>Increment the count on each refresh</b></i><br>
-^p%{
-session.count++
-}%</p>
-<h3>The Source Code</h3>
-<p> You will note that the source code below appears more noisy when
-compared with JSP syntax. It is when you look at the raw HTML. But
-web editors help you to stay out of HTML mode, and when you edit your page that
-way most of the noise goes away.</p>
-<pre><p><i><b>Make sure count is set</b></i><br>
-<span style="background-color: #99FF99">^p%{<br>
-if (session.count == null) session.count = 1<br>
-}%</span></p>
-<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
- <tr>
- <td valign="top" width="50%">
- <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
- <tr>
- <td colspan="2" align="center"><b>Page Arguments</b></td>
- </tr>
- <tr>
- <td>Argument</td>
- <td>Value</td>
- </tr>
- <tr>
- <td colspan="2"><span style="background-color: #99FF99"><i><b>For each parameter</b></i><br>
- ^tr%{ for (it in request) { }%</span></td>
- </tr>
- <tr>
- <td><span style="background-color: #99FF99">${ it.key }</span></td>
- <td><span style="background-color: #99FF99">${ it.value }</span></td>
- </tr>
- <tr>
- <td colspan="2"><span style="background-color: #99FF99">^tr%{ } }% <i><b>Comments are safe before and after
- stripping tags</b></i></span></td>
- </tr>
- </table>
- </td>
- <td valign="top" width="50%">
- <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
- <tr>
- <td colspan="2" align="center"><b>Session Variables</b></td>
- </tr>
- <tr>
- <td>Variable</td>
- <td>Value</td>
- </tr>
- <tr>
- <td colspan="2"><span style="background-color: #99FF99"><i><b>For each session variable</b></i><br>
- ^tr%{ session.each() { }%</span></td>
- </tr>
- <tr>
- <td><span style="background-color: #99FF99">${ it.key }</span></td>
- <td><span style="background-color: #99FF99">${ it.value }</span></td>
- </tr>
- <tr>
- <td colspan="2"><span style="background-color: #99FF99">^tr%{ } }% <i><b>because they will get
- stripped off</b></i></span></td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-<p><i><b>Increment the count on each refresh</b></i><br>
-<span style="background-color: #99FF99">^p%{ session.count++ }%</span></p>
-</pre>
-</body>
-</html>
\ No newline at end of file
diff --git a/groovy/modules/process/.classpath b/groovy/modules/process/.classpath
deleted file mode 100644
index 543e599..0000000
--- a/groovy/modules/process/.classpath
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="lib/concurrent.jar"/>
- <classpathentry kind="lib" path="/home/yuri/local/groovy/lib/asm-1.4.1.jar"/>
- <classpathentry kind="lib" path="/home/yuri/local/groovy/lib/asm-attrs-1.4.1.jar"/>
- <classpathentry kind="lib" path="/home/yuri/local/groovy/lib/asm-util-1.4.1.jar"/>
- <classpathentry kind="lib" path="/home/yuri/local/groovy/lib/groovy-1.0-beta-3-snapshot.jar"/>
- <classpathentry kind="lib" path="/home/yuri/local/groovy/lib/junit-3.8.1.jar"/>
- <classpathentry kind="output" path="build/classes"/>
-</classpath>
diff --git a/groovy/modules/process/.project b/groovy/modules/process/.project
deleted file mode 100644
index 6c847c5..0000000
--- a/groovy/modules/process/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>groosh</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/groovy/modules/process/lib/concurrent.jar b/groovy/modules/process/lib/concurrent.jar
deleted file mode 100644
index 51872bf..0000000
--- a/groovy/modules/process/lib/concurrent.jar
+++ /dev/null
Binary files differ
diff --git a/groovy/modules/process/src/conf/groovy-classworlds.conf b/groovy/modules/process/src/conf/groovy-classworlds.conf
deleted file mode 100644
index f6c5934..0000000
--- a/groovy/modules/process/src/conf/groovy-classworlds.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-##############################################################################
-## ##
-## Groovy Shell Classworlds Configuration ##
-## ##
-##############################################################################
-
-##
-## $Revision: 1.3 $ $Date: 2003/10/31 12:30:57 $
-##
-
-# The main entry-point
-main is groovy.lang.GroovyShell from groovy
-
-# The core Groovy class-realm
-[groovy]
- # Allow access to resources
- load ${groovy.home}/conf
-
- # Load required libraries
- load ${groovy.home}/lib/*.jar
- load /home/yuri/workspace/groosh/lib/*.jar
- load /home/yuri/workspace/groosh/build/classes/
diff --git a/groovy/modules/process/src/conf/groovyc-classworlds.conf b/groovy/modules/process/src/conf/groovyc-classworlds.conf
deleted file mode 100644
index d90bc68..0000000
--- a/groovy/modules/process/src/conf/groovyc-classworlds.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-##############################################################################
-## ##
-## Groovy Compiler Classworlds Configuration ##
-## ##
-##############################################################################
-
-##
-## $Revision: 1.2 $ $Date: 2003/10/06 20:42:55 $
-##
-
-# The main entry-point
-main is org.codehaus.groovy.tools.FileSystemCompiler from groovy
-
-# The core Groovy class-realm
-[groovy]
- # Allow access to resources
- load ${groovy.home}/conf
-
- # Load required libraries
- load ${groovy.home}/lib/*.jar
- load /home/yuri/workspace/groosh/lib/*.jar
- load /home/yuri/workspace/groosh/build/classes/
diff --git a/groovy/modules/process/src/include/nativeprocess.h b/groovy/modules/process/src/include/nativeprocess.h
deleted file mode 100644
index e23db30..0000000
--- a/groovy/modules/process/src/include/nativeprocess.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class com_baulsupp_process_NativeProcess */
-
-#ifndef _Included_com_baulsupp_process_NativeProcess
-#define _Included_com_baulsupp_process_NativeProcess
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* Inaccessible static: initialised */
-/*
- * Class: com_baulsupp_process_NativeProcess
- * Method: startProcess
- * Signature: (Ljava/lang/String;[Ljava/lang/String;III)I
- */
-JNIEXPORT jint JNICALL Java_com_baulsupp_process_NativeProcess_startProcess
- (JNIEnv *, jobject, jstring, jobjectArray, jint, jint, jint);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/GridClosureProcess.java b/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/GridClosureProcess.java
deleted file mode 100644
index 4378a88..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/GridClosureProcess.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.baulsupp.groovy.groosh;
-
-import java.util.Arrays;
-import java.util.List;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-
-import groovy.lang.Closure;
-
-public class GridClosureProcess extends StreamClosureProcess {
- public GridClosureProcess(Closure closure) {
- super(closure);
- }
-
- protected void process(final InputStream is, final OutputStream os) throws IOException {
- BufferedReader ris = new BufferedReader(new InputStreamReader(is));
- Writer wos = new PrintWriter(new OutputStreamWriter(os, "ISO-8859-1"));
-
- String line;
-
- List l = new ArrayList();
-
- while ((line = ris.readLine()) != null) {
- String[] content = line.split("\\s+");
- List contentList = Arrays.asList(content);
-
- l.clear();
- l.add(contentList);
- l.add(wos);
- closure.call(l);
- wos.flush();
- }
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/Groosh.java b/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/Groosh.java
deleted file mode 100644
index 2ef0c02..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/Groosh.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.baulsupp.groovy.groosh;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import java.util.Map;
-
-
-import EDU.oswego.cs.dl.util.concurrent.Executor;
-import EDU.oswego.cs.dl.util.concurrent.ThreadedExecutor;
-import groovy.lang.Closure;
-import groovy.lang.GroovyObjectSupport;
-
-public class Groosh extends GroovyObjectSupport {
- private Executor executor = new ThreadedExecutor();
- private static Map registeredProcesses = new HashMap();
-
- static {
- registerProcess("groovy", StreamClosureProcess.class);
- registerProcess("each_line", LineClosureProcess.class);
- registerProcess("grid", GridClosureProcess.class);
- }
-
- public static void registerProcess(String name, Class clazz) {
- registeredProcesses.put(name, clazz);
- }
-
- public Object invokeMethod(String name, Object args) {
- GrooshProcess process;
- try {
- if (registeredProcesses.containsKey(name)) {
- process = createProcess((Class) registeredProcesses.get(name), args);
- } else {
- process = new ShellProcess(name, args);
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- return process;
- }
-
- private GrooshProcess createProcess(Class class1, Object arg) {
- GrooshProcess process = null;
-
- try {
- Constructor c = class1.getConstructor(new Class[] {Closure.class});
- process = (GrooshProcess) c.newInstance((Object[]) arg);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- return process;
- }
-
- public void execute(Runnable r) {
- try {
- executor.execute(r);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/GrooshProcess.java b/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/GrooshProcess.java
deleted file mode 100644
index 36a3228..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/GrooshProcess.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.baulsupp.groovy.groosh;
-
-import java.io.File;
-import java.io.IOException;
-
-import com.baulsupp.process.FileStreams;
-import com.baulsupp.process.Sink;
-import com.baulsupp.process.Source;
-import com.baulsupp.process.StandardStreams;
-import com.baulsupp.process.StringStreams;
-
-// TODO class should not be reentrant
-// that is if output is already set, don't let it be done twice.
-public abstract class GrooshProcess {
- protected abstract Sink getSink();
-
- protected abstract Source getSource();
-
- public String toStringOut() throws IOException {
- StringStreams.StringSink sink = StringStreams.stringSink();
-
- getSource().connect(sink);
- start();
-
- return sink.toString();
- }
-
- // TODO should this be asynchronous, would be less obvious though!
- public void toFile(File f) throws IOException {
- Sink sink = FileStreams.sink(f, false);
-
- getSource().connect(sink);
- start();
-
- waitForExit();
- }
-
- // needs to be asynchronous so they can continue the chain
- public GrooshProcess pipeTo(GrooshProcess process) throws IOException {
- getSource().connect(process.getSink());
-
- start();
-
- // return other process so chaining is possible
- return process;
- }
-
- // TODO should this be asynchronous, would be less obvious though!
- public void toStdOut() throws IOException {
- Sink sink = StandardStreams.stdout();
-
- getSource().connect(sink);
- start();
-
- waitForExit();
- }
-
- public GrooshProcess fromStdIn() throws IOException {
- Source source = StandardStreams.stdin();
-
- source.connect(getSink());
-
- return this;
- }
-
- public GrooshProcess fromString(String s) throws IOException {
- Source source = StringStreams.stringSource(s);
-
- source.connect(getSink());
-
- return this;
- }
-
- public abstract void start() throws IOException;
-
- public abstract void waitForExit() throws IOException;
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/LineClosureProcess.java b/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/LineClosureProcess.java
deleted file mode 100644
index bbaeecd..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/LineClosureProcess.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.baulsupp.groovy.groosh;
-
-import java.util.List;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-
-import groovy.lang.Closure;
-
-public class LineClosureProcess extends StreamClosureProcess {
- public LineClosureProcess(Closure closure) {
- super(closure);
- }
-
- protected void process(final InputStream is, final OutputStream os) throws IOException {
- BufferedReader ris = new BufferedReader(new InputStreamReader(is));
- Writer wos = new PrintWriter(new OutputStreamWriter(os, "ISO-8859-1"));
-
- String line;
-
- List l = new ArrayList();
-
- while ((line = ris.readLine()) != null) {
- l.clear();
- l.add(line);
- l.add(wos);
- closure.call(l);
- wos.flush();
- }
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/ShellProcess.java b/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/ShellProcess.java
deleted file mode 100644
index 9b3a824..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/ShellProcess.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.baulsupp.groovy.groosh;
-
-import java.io.IOException;
-
-import com.baulsupp.process.AppProcess;
-import com.baulsupp.process.ProcessFactory;
-import com.baulsupp.process.Sink;
-import com.baulsupp.process.Source;
-
-public class ShellProcess extends GrooshProcess {
- private AppProcess process = null;
- private String name;
- private String[] args;
-
- public ShellProcess(String name, Object arg1) throws IOException {
- this.name = name;
- this.args = getArgs(arg1);
-
- process = ProcessFactory.buildProcess(name, args);
- }
-
- private String[] getArgs(Object arg1) {
- if (arg1 == null)
- return new String[0];
- else if (arg1 instanceof String[])
- return (String[]) arg1;
- else if (arg1 instanceof Object[]) {
- Object[] argsO = (Object[]) arg1;
- String[] argsS = new String[argsO.length];
- for (int i = 0; i < argsO.length; i++) {
- argsS[i] = String.valueOf(argsO[i]);
- }
- return argsS;
- } else if (arg1 instanceof String)
- return new String[] {(String) arg1};
- else
- throw new IllegalStateException("no support for args of type " + arg1.getClass());
- }
-
- public void waitForExit() throws IOException {
- process.result();
- }
-
- public void start() throws IOException {
- process.start();
- }
-
- public Sink getSink() {
- return process.getInput();
- }
-
- public Source getSource() {
- return process.getOutput();
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/StreamClosureProcess.java b/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/StreamClosureProcess.java
deleted file mode 100644
index f3635d8..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/groovy/groosh/StreamClosureProcess.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package com.baulsupp.groovy.groosh;
-
-import groovy.lang.Closure;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.channels.Channels;
-import java.nio.channels.Pipe;
-import java.util.ArrayList;
-import java.util.List;
-
-import EDU.oswego.cs.dl.util.concurrent.FutureResult;
-
-import com.baulsupp.process.IOUtil;
-import com.baulsupp.process.Sink;
-import com.baulsupp.process.Source;
-import com.baulsupp.process.StandardStreams;
-
-public class StreamClosureProcess extends GrooshProcess implements Runnable {
- protected Closure closure;
- private InputStream is;
- private OutputStream os;
- private FutureResult result = new FutureResult();
-
- public StreamClosureProcess(Closure closure) {
- this.closure = closure;
- }
-
- public void start() {
- if (is == null)
- throw new RuntimeException("closure processes need a source");
-
- if (os == null)
- os = StandardStreams.stdout().getStream();
-
- try {
- IOUtil.executor.execute(new Runnable() {
- public void run() {
- StreamClosureProcess.this.run();
- }
- });
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void waitForExit() throws IOException {
- try {
- result.get();
- } catch (Exception e) {
- // TODO handle the exceptions
- throw new RuntimeException(e);
- }
- }
-
- public void run() {
- try {
- process(is, os);
- result.set(Boolean.TRUE);
- } catch (IOException e) {
- // TODO remove debug once caller handle exception
- System.out.println("ASYNC EXCEPTION (SCP.run): " + e);
- result.setException(e);
- } finally {
- try {
- os.flush();
- os.close();
- is.close();
- } catch (IOException e) {
- if (result.getException() == null) {
- // TODO remove debug once caller handle exception
- System.out.println("ASYNC EXCEPTION (SCP.run): " + e);
- result.setException(e);
- }
- }
- }
- }
-
- protected void process(final InputStream is, final OutputStream os) throws IOException {
- List l = new ArrayList();
- l.add(is);
- l.add(os);
- closure.call(l);
- os.flush();
- }
-
- public class ClosureSink extends Sink {
-
- public void setStream(InputStream is) {
- StreamClosureProcess.this.is = is;
- }
-
- public boolean receivesStream() {
- return true;
- }
- }
-
- protected Sink getSink() {
- return new ClosureSink();
- }
-
- public class ClosureSource extends Source {
- public void connect(Sink sink) throws IOException {
- if (sink.providesStream()) {
- StreamClosureProcess.this.os = sink.getStream();
- } else if (sink.receivesStream()) {
- Pipe pipe = Pipe.open();
- StreamClosureProcess.this.os = Channels.newOutputStream(pipe.sink());
- sink.setStream(Channels.newInputStream(pipe.source()));
- } else {
- throw new UnsupportedOperationException("sink type unknown");
- }
- }
- }
-
- protected Source getSource() {
- return new ClosureSource();
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/AppProcess.java b/groovy/modules/process/src/main/com/baulsupp/process/AppProcess.java
deleted file mode 100644
index 9087b3a..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/AppProcess.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.IOException;
-
-// TODO how does the completion of the input/output i.e. to a file get monitored?
-public interface AppProcess {
- Sink getInput();
- Source getOutput();
- Source getError();
-
- void start() throws IOException;
- int result();
- boolean hadError();
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/CharSequenceSource.java b/groovy/modules/process/src/main/com/baulsupp/process/CharSequenceSource.java
deleted file mode 100644
index 9c3d5fb..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/CharSequenceSource.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.baulsupp.process;
-
-public class CharSequenceSource extends Source {
- public void connect(Sink sink) {
- throw new RuntimeException();
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/DevNull.java b/groovy/modules/process/src/main/com/baulsupp/process/DevNull.java
deleted file mode 100644
index b42dbbb..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/DevNull.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class DevNull {
- public static class NullSink extends Sink {
- public OutputStream getStream() {
- return new OutputStream() {
- public void write(int b) throws IOException {
- // do nothing
- }
- };
- }
-
- public void setStream(final InputStream is) {
- // TODO handle result/exception?
- IOUtil.pumpAsync(is, getStream());
- }
-
- public boolean providesStream() {
- return true;
- }
-
- public boolean receivesStream() {
- return true;
- }
- }
-
- public static class NullSource extends Source {
- public void connect(Sink sink) {
- if (sink.providesStream()) {
- try {
- sink.getStream().close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- } else if (sink.receivesStream()) {
- sink.setStream(new ByteArrayInputStream(new byte[0]));
- } else {
- throw new UnsupportedOperationException("sink type unknown");
- }
- }
- }
-
- public static Sink createSink() {
- return new NullSink();
- }
-
- public static Source createSource() {
- return new NullSource();
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/FileStreams.java b/groovy/modules/process/src/main/com/baulsupp/process/FileStreams.java
deleted file mode 100644
index 49f8056..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/FileStreams.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-
-public class FileStreams {
- public static class FileSource extends Source {
- private File file;
- private FileInputStream is;
-
- public FileSource(File f) throws FileNotFoundException {
- this.file = f;
- this.is = new FileInputStream(f);
- }
-
- public void connect(Sink sink) {
- if (sink.providesStream()) {
- // TODO handle result
- IOUtil.pumpAsync(is, sink.getStream());
- } else if (sink.receivesStream()) {
- sink.setStream(is);
- } else {
- throw new UnsupportedOperationException("sink type unknown");
- }
- }
- }
-
- public static Source source(File file) throws FileNotFoundException {
- return new FileSource(file);
- }
-
- public static class FileSink extends Sink {
- private File file;
- private FileOutputStream os;
-
- public FileSink(File f, boolean append) throws FileNotFoundException {
- this.file = f;
- this.os = new FileOutputStream(f, append);
- }
-
- public OutputStream getStream() {
- return os;
- }
-
- public boolean providesStream() {
- return true;
- }
- }
-
- public static Sink sink(File file, boolean append) throws FileNotFoundException {
- return new FileSink(file, append);
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/IOUtil.java b/groovy/modules/process/src/main/com/baulsupp/process/IOUtil.java
deleted file mode 100644
index c219ece..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/IOUtil.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import EDU.oswego.cs.dl.util.concurrent.Executor;
-import EDU.oswego.cs.dl.util.concurrent.FutureResult;
-import EDU.oswego.cs.dl.util.concurrent.ThreadedExecutor;
-
-public class IOUtil {
- private static final int BUFFER_SIZE = 8192;
- public static final Executor executor = new ThreadedExecutor();
-
- public static int pump(InputStream is, OutputStream stream) throws IOException {
- int pumped = 0;
- byte[] buffy = new byte[BUFFER_SIZE];
-
- int read = 0;
- while ((read = is.read(buffy)) != -1) {
- stream.write(buffy, 0, read);
- pumped += read;
- }
-
- return read;
- }
-
- public static FutureResult pumpAsync(final InputStream is, final OutputStream os) {
- final FutureResult result = new FutureResult();
- try {
- executor.execute(new Runnable() {
- public void run() {
- try {
- int read = IOUtil.pump(is, os);
- result.set(new Integer(read));
- } catch (IOException e) {
- // TODO remove debug once caller handle exception
- System.out.println("ASYNC EXCEPTION (IOU.pumpAsync): " + e);
- result.setException(e);
- } finally {
- try {
- os.close();
- is.close();
- } catch (IOException e) {
- // TODO remove debug once caller handle exception
- System.out.println("ASYNC EXCEPTION (IOU.pumpAsync): " + e);
- result.setException(e);
- }
- }
- }
- });
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
-
- return result;
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/JavaProcess.java b/groovy/modules/process/src/main/com/baulsupp/process/JavaProcess.java
deleted file mode 100644
index f9e3a67..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/JavaProcess.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class JavaProcess implements AppProcess {
- private String[] command;
- private Process process;
-
- private boolean errHandled = false;
- private boolean outHandled = false;
- private boolean inHandled = false;
-
- private JavaProcess(String[] command) throws IOException {
- this.command = command;
- process = Runtime.getRuntime().exec(command);
- }
-
- public static JavaProcess createProcess(String command, String[] args) throws IOException {
- String[] commandArgs = concat(command, args);
-
- return new JavaProcess(commandArgs);
- }
-
- private static String[] concat(String command, String[] args) {
- String[] commandArgs = new String[args.length + 1];
- commandArgs[0] = command;
- System.arraycopy(args, 0, commandArgs, 1, args.length);
- return commandArgs;
- }
-
- public void start() throws IOException {
- if (!inHandled) {
- process.getOutputStream().close();
- }
-
- // Should we throw away, it would make it explicit to direct the output somewhere.
- if (!outHandled)
- IOUtil.pumpAsync(process.getInputStream(), StandardStreams.stderr().getStream());
-
- if (!errHandled)
- IOUtil.pumpAsync(process.getErrorStream(), StandardStreams.stderr().getStream());
- }
-
- public Sink getInput() {
- return new InSink();
- }
-
- public Source getOutput() {
- return new OutSource();
- }
-
- public Source getError() {
- return new ErrSource();
- }
-
- public int result() {
- try {
- return process.waitFor();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-
- public boolean hadError() {
- return result() != 0;
- }
-
- public class InSink extends Sink {
- public OutputStream getStream() {
- inHandled = true;
- return process.getOutputStream();
- }
-
- public boolean providesStream() {
- return true;
- }
- }
-
- public class OutSource extends Source {
- public void connect(Sink sink) {
- if (sink.providesStream()) {
- outHandled = true;
- // TODO handle result
- IOUtil.pumpAsync(process.getInputStream(), sink.getStream());
- } else if (sink.receivesStream()) {
- outHandled = true;
- sink.setStream(process.getInputStream());
- } else {
- throw new UnsupportedOperationException("sink type unknown");
- }
- }
- }
-
- public class ErrSource extends Source {
- public void connect(Sink sink) {
- if (sink.providesStream()) {
- errHandled = true;
- // TODO handle result
- IOUtil.pumpAsync(process.getInputStream(), sink.getStream());
- } else if (sink.receivesStream()) {
- errHandled = true;
- sink.setStream(process.getInputStream());
- } else {
- throw new UnsupportedOperationException("sink type unknown");
- }
- }
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/ProcessFactory.java b/groovy/modules/process/src/main/com/baulsupp/process/ProcessFactory.java
deleted file mode 100644
index 00fff0d..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/ProcessFactory.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.IOException;
-
-public class ProcessFactory {
- public static AppProcess buildProcessPipeline(String commandLine) {
- throw new UnsupportedOperationException();
- }
-
- public static AppProcess buildProcess(String command, String[] args) throws IOException {
- return JavaProcess.createProcess(command, args);
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/Sink.java b/groovy/modules/process/src/main/com/baulsupp/process/Sink.java
deleted file mode 100644
index 3459e0a..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/Sink.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-// TODO need an isFinished method
-// in general process.waitForExit() knows when input has finished
-// but not aware of output has reached destination neccesarily!
-public class Sink {
- public boolean receivesStream() {
- return false;
- }
-
- public boolean providesStream() {
- return false;
- }
-
- public OutputStream getStream() {
- throw new UnsupportedOperationException();
- }
-
- public void setStream(InputStream channel) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/Source.java b/groovy/modules/process/src/main/com/baulsupp/process/Source.java
deleted file mode 100644
index de38013..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/Source.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.IOException;
-
-public abstract class Source {
- public abstract void connect(Sink sink) throws IOException;
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/StandardStreams.java b/groovy/modules/process/src/main/com/baulsupp/process/StandardStreams.java
deleted file mode 100644
index 2b49f48..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/StandardStreams.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-// TODO don't let stdout, stderr be closed
-public class StandardStreams {
- public static class InSource extends Source {
- public void connect(Sink sink) {
- InputStream is = new FileInputStream(FileDescriptor.in);
-
- if (sink.providesStream()) {
- // TODO feels better if this is line based, rather than fixed buffer size based
- // TODO handle result
- IOUtil.pumpAsync(is, sink.getStream());
- } else if (sink.receivesStream()) {
- sink.setStream(is);
- } else {
- throw new UnsupportedOperationException("sink type unknown");
- }
- }
- }
-
- public static Source stdin() {
- return new InSource();
- }
-
- public static class ErrSink extends Sink {
- public OutputStream getStream() {
- return new FileOutputStream(FileDescriptor.err) {
- public void close() throws IOException {
- // ignore close
- flush();
- }
- };
- }
-
- public boolean providesStream() {
- return true;
- }
- }
-
- public static Sink stderr() {
- return new ErrSink();
- }
-
- public static class OutSink extends Sink {
- public OutputStream getStream() {
- return new FileOutputStream(FileDescriptor.out) {
- public void close() throws IOException {
- // ignore close
- flush();
- }
- };
- }
-
- public boolean providesStream() {
- return true;
- }
- }
-
- public static Sink stdout() {
- return new OutSink();
- }
-
-}
diff --git a/groovy/modules/process/src/main/com/baulsupp/process/StringStreams.java b/groovy/modules/process/src/main/com/baulsupp/process/StringStreams.java
deleted file mode 100644
index af0656b..0000000
--- a/groovy/modules/process/src/main/com/baulsupp/process/StringStreams.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.baulsupp.process;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import EDU.oswego.cs.dl.util.concurrent.FutureResult;
-
-public class StringStreams {
- public static class StringSink extends Sink {
- private ByteArrayOutputStream baos = new ByteArrayOutputStream();
- private FutureResult result = new FutureResult();
-
- public boolean receivesStream() {
- return true;
- }
-
- public void setStream(InputStream is) {
- result = IOUtil.pumpAsync(is, baos);
- }
-
- public String toString() {
- try {
- result.get();
- } catch (Exception e) {
- // TODO handle better
- throw new RuntimeException(e);
- }
-
- try {
- return baos.toString("ISO-8859-1");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- public static StringSink stringSink() {
- return new StringSink();
- }
-
- public static class StringSource extends Source {
- private InputStream is;
-
- public StringSource(String s) {
- byte[] buffy;
-
- try {
- buffy = s.getBytes("ISO-8859-1");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
-
- this.is = new ByteArrayInputStream(buffy);
- }
-
- public void connect(Sink sink) {
- if (sink.providesStream()) {
- // TODO handle result
- IOUtil.pumpAsync(is, sink.getStream());
- } else if (sink.receivesStream()) {
- sink.setStream(is);
- } else {
- throw new UnsupportedOperationException("sink type unknown");
- }
- }
- }
-
- public static StringSource stringSource(String s) {
- return new StringSource(s);
- }
-}
diff --git a/groovy/modules/process/src/test_scripts/basic_cat.groovy b/groovy/modules/process/src/test_scripts/basic_cat.groovy
deleted file mode 100644
index fef7b54..0000000
--- a/groovy/modules/process/src/test_scripts/basic_cat.groovy
+++ /dev/null
@@ -1,4 +0,0 @@
-gsh = new com.baulsupp.groovy.groosh.Groosh();
-
-c = gsh.cat('test_scripts/blah.txt').toStdOut();
-
diff --git a/groovy/modules/process/src/test_scripts/blah.txt b/groovy/modules/process/src/test_scripts/blah.txt
deleted file mode 100644
index 2a52b65..0000000
--- a/groovy/modules/process/src/test_scripts/blah.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-a
-b
-ba
-c
-d
-
diff --git a/groovy/modules/process/src/test_scripts/cat_to_file.groovy b/groovy/modules/process/src/test_scripts/cat_to_file.groovy
deleted file mode 100644
index d1d1cf8..0000000
--- a/groovy/modules/process/src/test_scripts/cat_to_file.groovy
+++ /dev/null
@@ -1,5 +0,0 @@
-gsh = new com.baulsupp.groovy.groosh.Groosh();
-
-gsh.cat('test_scripts/blah.txt').toFile(new java.io.File('blah.out'));
-
-
diff --git a/groovy/modules/process/src/test_scripts/dict.groovy b/groovy/modules/process/src/test_scripts/dict.groovy
deleted file mode 100644
index 17db64e..0000000
--- a/groovy/modules/process/src/test_scripts/dict.groovy
+++ /dev/null
@@ -1,5 +0,0 @@
-gsh = new com.baulsupp.groovy.groosh.Groosh();
-
-gsh.cat('/usr/share/dict/words').pipeTo(gsh.grep('lexia')).toStdOut();
-
-
diff --git a/groovy/modules/process/src/test_scripts/dict_args.groovy b/groovy/modules/process/src/test_scripts/dict_args.groovy
deleted file mode 100644
index 5c19708..0000000
--- a/groovy/modules/process/src/test_scripts/dict_args.groovy
+++ /dev/null
@@ -1,9 +0,0 @@
-gsh = new com.baulsupp.groovy.groosh.Groosh();
-
-if (args.length == 0) {
- System.err.println("please provide a search pattern");
- System.err.println("usage: dict_args querystring");
-} else {
- gsh.cat('/usr/share/dict/words').pipeTo(gsh.grep(args[0])).toStdOut();
-}
-
diff --git a/groovy/modules/process/src/test_scripts/each_line.groovy b/groovy/modules/process/src/test_scripts/each_line.groovy
deleted file mode 100644
index f1105e6..0000000
--- a/groovy/modules/process/src/test_scripts/each_line.groovy
+++ /dev/null
@@ -1,13 +0,0 @@
-gsh = new com.baulsupp.groovy.groosh.Groosh();
-
-cat = gsh.cat('test_scripts/blah.txt');
-lines = gsh.each_line { line,w |
- w.write("*");
- w.write(line);
- w.write("\n");
-};
-
-cat.pipeTo(lines);
-lines.toStdOut();
-
-
diff --git a/groovy/modules/process/src/test_scripts/find_grid.groovy b/groovy/modules/process/src/test_scripts/find_grid.groovy
deleted file mode 100644
index 0fb5741..0000000
--- a/groovy/modules/process/src/test_scripts/find_grid.groovy
+++ /dev/null
@@ -1,19 +0,0 @@
-// BUG?? java.util.Arrays.asList fails with util on null!
-// changed java code to send List
-
-gsh = new com.baulsupp.groovy.groosh.Groosh();
-
-f = gsh.find('.', '-name', '*.java', '-ls');
-total = 0;
-lines = gsh.grid { values,w |
- x = values[2,4,6,10];
- s = x.join(' ');
- w.println(s);
- total += Integer.parseInt(values[6]);
-};
-
-f.pipeTo(lines);
-lines.toStdOut();
-
-System.out.println("Total: " + total);
-
diff --git a/groovy/modules/process/src/test_scripts/stdin_cat.groovy b/groovy/modules/process/src/test_scripts/stdin_cat.groovy
deleted file mode 100644
index fdbecb0..0000000
--- a/groovy/modules/process/src/test_scripts/stdin_cat.groovy
+++ /dev/null
@@ -1,6 +0,0 @@
-gsh = new com.baulsupp.groovy.groosh.Groosh();
-
-// does this fail if you change c to cat?
-gsh.cat().fromStdIn().toStdOut();
-
-
diff --git a/groovy/modules/process/src/test_scripts/tostring.groovy b/groovy/modules/process/src/test_scripts/tostring.groovy
deleted file mode 100644
index c6f44f6..0000000
--- a/groovy/modules/process/src/test_scripts/tostring.groovy
+++ /dev/null
@@ -1,6 +0,0 @@
-gsh = new com.baulsupp.groovy.groosh.Groosh();
-
-s = gsh.cat('test_scripts/blah.txt').pipeTo(gsh.grep('a')).toStringOut();
-
-System.out.println('->' + s.toString() + '<-');
-
diff --git a/groovy/modules/process/todo.txt b/groovy/modules/process/todo.txt
deleted file mode 100644
index 49d8b75..0000000
--- a/groovy/modules/process/todo.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-H - Change encoding from ISO-8859-1. ISO-8859-1 is a marker to search for, rather than using the implicit methods.
-
-M - Various TODOs in the code.
-M - Line based stdin, rather than buffer based. More intuitive for users.
-M - Handle process completion including sink? Source can be ignored?
-M - Groovy operator overloading.
-M - Throw error if source/sink retrieved twice etc. Or after start() called.
-
-E - Pipeline parsing i.e |, `.
-E - Tee Process for duplicating output
-E - Concat for joining multiple inputs. With ThreadLocal input name!
-E - Sink/Source dealing with Reader/Writer?
-
-General
-
-bin/groovy test_scripts/dict_args.groovy 2>&1 | grep -v NativeMethod | grep -v Delegating | grep -v Launcher | grep -v Method.invoke | grep -v Invoker | grep -v MetaClass
-
-Caught: java.lang.ArrayIndexOutOfBoundsException: 0
-java.lang.ArrayIndexOutOfBoundsException: 0
- at org.codehaus.groovy.runtime.DefaultGroovyMethods.get(DefaultGroovyMethods.java:741)
- at dict_args.run(test_scripts/dict_args.groovy:7)
- at dict_args.invokeMethod(test_scripts/dict_args.groovy)
- at dict_args.main(test_scripts/dict_args.groovy)
- at groovy.lang.GroovyShell.run(GroovyShell.java:166)
- at groovy.lang.GroovyShell.main(GroovyShell.java:85)
-
diff --git a/groovy/modules/xmlrpc/src/main/groovy/net/xmlrpc/XMLRPCServer.java b/groovy/modules/xmlrpc/src/main/groovy/net/xmlrpc/XMLRPCServer.java
deleted file mode 100644
index 53c5a30..0000000
--- a/groovy/modules/xmlrpc/src/main/groovy/net/xmlrpc/XMLRPCServer.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
-
- Copyright 2004 (C) John Wilson. All Rights Reserved.
-
- Redistribution and use of this software and associated documentation
- ("Software"), with or without modification, are permitted provided
- that the following conditions are met:
-
- 1. Redistributions of source code must retain copyright
- statements and notices. Redistributions must also contain a
- copy of this document.
-
- 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 name "groovy" must not be used to endorse or promote
- products derived from this Software without prior written
- permission of The Codehaus. For written permission,
- please contact info@codehaus.org.
-
- 4. Products derived from this Software may not be called "groovy"
- nor may "groovy" appear in their names without prior written
- permission of The Codehaus. "groovy" is a registered
- trademark of The Codehaus.
-
- 5. Due credit should be given to The Codehaus -
- http://groovy.codehaus.org/
-
- THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
- ``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 CODEHAUS 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.
-
- */
-
-package groovy.net.xmlrpc;
-
-import groovy.lang.Closure;
-import groovy.lang.GroovyClassLoader;
-import groovy.lang.GroovyObject;
-import groovy.lang.GroovyObjectSupport;
-import groovy.lang.GroovyRuntimeException;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import uk.co.wilson.net.http.MinMLHTTPServer;
-import uk.co.wilson.net.xmlrpc.XMLRPCMessageProcessor;
-
-/**
- * @author John Wilson (tug@wilson.co.uk)
- *
- */
-public class XMLRPCServer extends GroovyObjectSupport {
-private byte[] base64 = new byte[600];
-{
- for (int i = 0; i != this.base64.length; i++) {
- this.base64[i] = (byte)i;
- }
-}
-public byte[] getBase64() { return this.base64;} // bodge to allow testing
-
- private static byte[] host;
- static {
- try {
- host = ("Host: " + InetAddress.getLocalHost().getHostName() +"\r\n").getBytes();
- } catch (UnknownHostException e) {
- host = "Host: unknown\r\n ".getBytes();
- }
- }
- private static final byte[] userAgent = "User-Agent: Groovy XML-RPC\r\n".getBytes();
- private static final byte[] contentTypeXML = "Content-Type: text/xml\r\n".getBytes();
- private static final byte[] contentLength = "Content-Length: ".getBytes();
- private static final byte[] startResponse = ("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
- "<methodResponse>\n" +
- "\t<params>\n" +
- "\t\t<param>\n").getBytes();
- private static final byte[] endResponse = ("\n" +
- "\t\t</param>\n" +
- "\t</params>\n" +
- "</methodResponse>").getBytes();
- private static final byte[] startError = ("<?xml version=\"1.0\"?>\n" +
- "<methodResponse>\n" +
- "\t<fault>\n" +
- "\t\t<value>\n" +
- "\t\t\t<struct>\n" +
- "\t\t\t\t<member>\n" +
- "\t\t\t\t\t<name>faultCode</name>\n" +
- "\t\t\t\t\t<value><int>0</int></value>\n" +
- "\t\t\t\t</member>\n" +
- "\t\t\t\t<member>\n" +
- "\t\t\t\t\t<name>faultString</name>\n" +
- "\t\t\t\t\t<value><string>").getBytes();
-
- private static final byte[] endError = ("</string></value>\n" +
- "\t\t\t\t</member>\n" +
- "\t\t\t</struct>\n" +
- "\t\t</value>\n" +
- "\t</fault>\n" +
- "</methodResponse>\n").getBytes();
-
- private MinMLHTTPServer server = null;
- private final int minWorkers;
- private final int maxWorkers;
- private final int maxKeepAlives;
- private final int workerIdleLife;
- private final int socketReadTimeout;
- private final StringBuffer propertyPrefix = new StringBuffer();
- private final Map registeredMethods = new HashMap();
-
- /**
- * @param minWorkers
- * @param maxWorkers
- * @param maxKeepAlives
- * @param workerIdleLife
- * @param socketReadTimeout
- */
- public XMLRPCServer(final int minWorkers,
- final int maxWorkers,
- final int maxKeepAlives,
- final int workerIdleLife,
- final int socketReadTimeout)
- {
- this.minWorkers = minWorkers;
- this.maxWorkers = maxWorkers;
- this.maxKeepAlives = maxKeepAlives;
- this.workerIdleLife = workerIdleLife;
- this.socketReadTimeout = socketReadTimeout;
- }
-
- /**
- *
- */
- public XMLRPCServer() {
- this(2, 10, 8, 60000, 60000);
- }
-
- /**
- * @param serverSocket
- */
- public void startServer(final ServerSocket serverSocket) throws IOException {
- if (this.server != null) stopServer();
-
- final MinMLHTTPServer server = new MinMLHTTPServer(serverSocket,
- this.minWorkers,
- this.maxWorkers,
- this.maxKeepAlives,
- this.workerIdleLife,
- this.socketReadTimeout) {
-
- /* (non-Javadoc)
- * @see uk.co.wilson.net.MinMLSocketServer#makeNewWorker()
- */
- protected Worker makeNewWorker() {
- return new HTTPWorker() {
- protected void processPost(final InputStream in,
- final OutputStream out,
- final String uri,
- final String version)
- throws Exception
- {
-
- try {
- final StringBuffer buffer = new StringBuffer();
- final XMLRPCMessageProcessor requestParser = new XMLRPCMessageProcessor();
-
- out.write(version.getBytes());
- out.write(okMessage);
- out.write(userAgent);
- out.write(host);
- out.write(contentTypeXML);
- writeKeepAlive(out);
- out.write(contentLength);
-
- requestParser.parseMessage(in);
-
- final String methodName = requestParser.getMethodname();
- final List params = requestParser.getParams();
- final Object closure = XMLRPCServer.this.registeredMethods.get(methodName);
-
- if (closure == null) throw new GroovyRuntimeException("XML-RPC method " + methodName + " is not supported on this server");
-
- Object result = ((Closure)closure).call(params.toArray());
-
- if (result == null) result = new Integer(0);
-
- XMLRPCMessageProcessor.emit(buffer, result);
-
-// System.out.println(buffer.toString());
-
- final byte[] response = buffer.toString().getBytes("ISO-8859-1");
-
- out.write(String.valueOf(startResponse.length + response.length + endResponse.length).getBytes());
- out.write(endOfLine);
- out.write(endOfLine);
- out.write(startResponse);
- out.write(response);
- out.write(endResponse);
- }
- catch (final Throwable e) {
-// e.printStackTrace();
- final String message = e.getMessage();
- final byte[] error = ((message == null) ? endError.getClass().getName() : e.getMessage()).getBytes();
-
- out.write(String.valueOf(startError.length + error.length + endError.length).getBytes());
- out.write(endOfLine);
- out.write(endOfLine);
- out.write(startError);
- out.write(error);
- out.write(endError);
- }
- }
- };
- }
- };
-
- this.server = server;
-
- new Thread() {
- public void run() {
- server.start();
- }
- }.start();
- }
-
- public void stopServer() throws IOException {
- this.server.shutDown();
- }
-
- /* (non-Javadoc)
- * @see groovy.lang.GroovyObject#getProperty(java.lang.String)
- */
- public Object getProperty(final String property) {
- /**
- *
- * Allow server.a.b.c = {...}
- * This creates a method with the name "a.b.c"
- * This technique is shamelessly stolen from the Python XML-RPC implementation
- * Thanks and credit to Fredrik Lundh
- *
- */
-
- this.propertyPrefix.append(property).append('.');
-
- return this;
- }
-
- /* (non-Javadoc)
- * @see groovy.lang.GroovyObject#setProperty(java.lang.String, java.lang.Object)
- */
- public void setProperty(final String property, final Object method) {
- final String methodName = this.propertyPrefix.append(property).toString();
- final Closure closure;
-
- this.propertyPrefix.setLength(0);
-
- if (method instanceof Closure) {
- try {
- closure = (Closure)(((Closure)method).clone());
- closure.setDelegate(this);
- } catch (CloneNotSupportedException e) {
- throw new GroovyRuntimeException("groovy.lang.Closure doesn't implement Clonable");
- }
- } else if (method instanceof Class) {
- closure = null;
- } else {
- //
- // calling a method on an instance of a class
- //
-
- final Method methods[] = method.getClass().getMethods();
- boolean foundMatch = false;
- int numberofParameters = 0;
-
- for (int i = 0; i != methods.length; i++) {
- if (methods[i].getName().equals(methodName)) {
- if (foundMatch) {
- if (numberofParameters != methods[i].getParameterTypes().length)
- ;// TODO: throw exception
- } else {
- foundMatch = true;
- numberofParameters = methods[i].getParameterTypes().length;
- }
- }
- }
-
- if (foundMatch) {
- closure = makeObjectProxy(methodName, numberofParameters);
- closure.setDelegate(method);
- } else {
- // TODO: throw execption
- closure = null;
- }
- }
-
- this.registeredMethods.put(methodName, closure);
- }
-
- private Closure makeObjectProxy(final String methodName, final int numberOfParameters) {
- final String paramIn, paramOut;
-
- if (numberOfParameters == 0) {
- paramIn = paramOut = "";
- } else {
- final StringBuffer params = new StringBuffer();
-
- for (int i = 0; i != numberOfParameters; i++) {
- params.append(", p" + i);
- }
-
- paramOut = params.delete(0, 2).toString();
- paramIn = paramOut + " |";
- }
-
- final String generatedCode = "class X { closure = {" + paramIn + " this." + methodName + "(" + paramOut + ") }}";
- System.out.println(generatedCode);
-
- try {
- final InputStream in = new ByteArrayInputStream(generatedCode.getBytes());
- final GroovyObject groovyObject = (GroovyObject)new GroovyClassLoader().parseClass(in, methodName).newInstance();
-
- return (Closure)(groovyObject.getProperty("closure"));
- } catch (Exception e) {
- throw new GroovyRuntimeException("Can't generate proxy for XML-RPC method " + methodName, e);
- }
- }
-}
diff --git a/groovy/modules/xmlrpc/src/main/groovy/net/xmlrpc/XMLRPCServerProxy.java b/groovy/modules/xmlrpc/src/main/groovy/net/xmlrpc/XMLRPCServerProxy.java
deleted file mode 100644
index c3e8781..0000000
--- a/groovy/modules/xmlrpc/src/main/groovy/net/xmlrpc/XMLRPCServerProxy.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-
- Copyright 2004 (C) John Wilson. All Rights Reserved.
-
- Redistribution and use of this software and associated documentation
- ("Software"), with or without modification, are permitted provided
- that the following conditions are met:
-
- 1. Redistributions of source code must retain copyright
- statements and notices. Redistributions must also contain a
- copy of this document.
-
- 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 name "groovy" must not be used to endorse or promote
- products derived from this Software without prior written
- permission of The Codehaus. For written permission,
- please contact info@codehaus.org.
-
- 4. Products derived from this Software may not be called "groovy"
- nor may "groovy" appear in their names without prior written
- permission of The Codehaus. "groovy" is a registered
- trademark of The Codehaus.
-
- 5. Due credit should be given to The Codehaus -
- http://groovy.codehaus.org/
-
- THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
- ``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 CODEHAUS 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.
-
- */
-
-package groovy.net.xmlrpc;
-
-import groovy.lang.Closure;
-import groovy.lang.GroovyObjectSupport;
-import groovy.lang.GroovyRuntimeException;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.List;
-
-import org.xml.sax.SAXException;
-
-import uk.co.wilson.net.xmlrpc.XMLRPCMessageProcessor;
-
-/**
- * @author John Wilson (tug@wilson.co.uk)
- */
-public class XMLRPCServerProxy extends GroovyObjectSupport {
- private URL serverURL;
- private StringBuffer propertyPrefix = new StringBuffer();
-
- public XMLRPCServerProxy(final String serverURL) throws MalformedURLException {
- this.serverURL = new URL(serverURL);
- }
-
- /* (non-Javadoc)
- * @see groovy.lang.GroovyObject#getProperty(java.lang.String)
- */
- public Object getProperty(final String property) {
- /**
- *
- * Allow serverProxy.a.b.c(...)
- * This invokes a remote method with the name "a.b.c"
- * This technique is shamelessly stolen from the Python XML-RPC implementation
- * Thanks and credit to Fredrik Lundh
- *
- */
-
- this.propertyPrefix.append(property).append('.');
-
- return this;
- }
-
- /* (non-Javadoc)
- * @see groovy.lang.GroovyObject#invokeMethod(java.lang.String, java.lang.Object)
- */
- public Object invokeMethod(final String name, final Object args) {
- final String methodName = this.propertyPrefix.append(name).toString();
-
- this.propertyPrefix.setLength(0);
-
- if ("invokeMethod".equals(methodName)) return super.invokeMethod(methodName, args);
-
- try {
- final Object[] params = (args instanceof List) ? ((List)args).toArray() : (Object[])args;
- int numberOfparams = params.length;
-
- if (numberOfparams != 0 && params[numberOfparams - 1] instanceof Closure) {
- numberOfparams--; // the closure is not to be passed to the remote method
- }
-
- final StringBuffer buffer = new StringBuffer("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<methodCall>\n\t<methodName>");
-
- XMLRPCMessageProcessor.encodeString(buffer, methodName).append("</methodName>\n\t<params>\n");
-
- for (int i = 0; i != numberOfparams; i++) {
- final Object param = params[i];
-
- XMLRPCMessageProcessor.emit(buffer.append("\t\t<param>"), param).append("</param>\n");
- }
-
- buffer.append("\t</params>\n</methodCall>\n");
-
-// System.out.println(buffer.toString());
-
- byte [] request = buffer.toString().getBytes("ISO-8859-1");
- final URLConnection connection = this.serverURL.openConnection();
-
- connection.setDoInput(true);
- connection.setDoOutput(true);
- connection.setUseCaches(false);
- connection.setAllowUserInteraction(false);
- connection.setRequestProperty("Content-Length", Integer.toString(request.length));
- connection.setRequestProperty("Content-Type", "text/xml");
-
- final OutputStream requestStream = connection.getOutputStream();
- requestStream.write(request);
- requestStream.flush();
- requestStream.close();
-
- final XMLRPCMessageProcessor responseParser = new XMLRPCMessageProcessor();
-
- responseParser.parseMessage(connection.getInputStream());
-
- final List response = responseParser.getParams();
-
- if (response == null) throw new GroovyRuntimeException("Empty response from server");
-
- if (numberOfparams == params.length) {
- return response.get(0);
- } else {
- // pass the result of the call to the closure
- return ((Closure)params[numberOfparams]).call(new Object[] {response.get(0)});
- }
-
- } catch (final IOException e) {
- e.printStackTrace();
-
- return null;
-
- } catch (final SAXException e) {
- e.printStackTrace();
-
- return null;
- }
- }
-}
diff --git a/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/MinMLSocketServer.java b/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/MinMLSocketServer.java
deleted file mode 100644
index fca14e3..0000000
--- a/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/MinMLSocketServer.java
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (c) 2001 The Wilson Partnership.
-// All Rights Reserved.
-// @(#)MinMLSocketServer.java, 0.1, 6th July 2001
-// Author: John Wilson - tug@wilson.co.uk
-
-package uk.co.wilson.net;
-
-/*
-Copyright (c) 2001 John Wilson (tug@wilson.co.uk).
-All rights reserved.
-Redistribution and use in source and binary forms,
-with or without modification, are permitted provided
-that the following conditions are met:
-
-Redistributions of source code must retain the above
-copyright notice, this list of conditions and the
-following disclaimer.
-
-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.
-
-THIS SOFTWARE IS PROVIDED BY JOHN WILSON ``AS IS'' AND ANY
-EXPRESS 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 JOHN WILSON
-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
-*/
-
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketException;
-
-import java.io.InterruptedIOException;
-import java.io.IOException;
-
-public abstract class MinMLSocketServer{
- public MinMLSocketServer(final ServerSocket serverSocket,
- final int minWorkers,
- final int maxWorkers,
- final int workerIdleLife)
- {
- this.serverSocket = serverSocket;
- this.minWorkers = Math.max(minWorkers, 1);
- this.maxWorkers = Math.max(this.minWorkers, maxWorkers);
- this.workerIdleLife = workerIdleLife;
- }
-
- public void start() {
- getNewWorker().run();
- }
-
- public synchronized void shutDown() throws IOException {
- this.serverSocket.close();
- }
-
- public int getPortNumber() {
- return this.serverSocket.getLocalPort();
- }
-
- protected abstract Worker makeNewWorker();
-
- private void setsocketTimeout(final int timeout) {
- try {
- this.serverSocket.setSoTimeout(timeout);
- }
- catch (final SocketException e) {
- }
- }
-
- private Worker getNewWorker() {
-if (debug) System.out.println("Starting new thread: liveWorkerCount = " + this.liveWorkerCount + " workingWorkerCount = " + this.workingWorkerCount);
- if (this.liveWorkerCount++ == this.minWorkers)
- setsocketTimeout(this.workerIdleLife);
-
- return makeNewWorker();
- }
-
- private synchronized void startWork() {
- if (++this.workingWorkerCount == this.liveWorkerCount && this.liveWorkerCount < this.maxWorkers)
- new Thread(getNewWorker()).start();
-if (debug) System.out.println("Thread starting work: liveWorkerCount = " + this.liveWorkerCount + " workingWorkerCount = " + this.workingWorkerCount);
- }
-
- private synchronized void endWork() {
- this.workingWorkerCount--;
-if (debug) System.out.println("Thread ending work: liveWorkerCount = " + this.liveWorkerCount + " workingWorkerCount = " + this.workingWorkerCount);
- }
-
- private synchronized boolean workerMustDie() {
-if (debug) System.out.println("Thread timing out socket read: liveWorkerCount = " + this.liveWorkerCount + " workingWorkerCount = " + this.workingWorkerCount);
- if (this.liveWorkerCount > this.minWorkers && this.liveWorkerCount != this.workingWorkerCount + 1) {
-if (debug) System.out.println("Thread commits suicide");
- workerDies();
-
- return true;
- }
-
- return false;
- }
-
- private synchronized void workerDies() {
- if (--this.liveWorkerCount == this.minWorkers)
- setsocketTimeout(0);
-if (debug) System.out.println("Thread dying: liveWorkerCount = " + this.liveWorkerCount + " workingWorkerCount = " + this.workingWorkerCount);
- }
-
- protected abstract class Worker implements Runnable {
- public final void run() {
- try {
- while (true) {
- final Socket socket;
-
- try {
- socket = MinMLSocketServer.this.serverSocket.accept();
-
- try {
- try {
- MinMLSocketServer.this.startWork();
-
- Thread.yield(); // let a blocked worker thread do an accept()
-
- process(socket);
- }
- catch (final Exception e) {
- processingException(e);
- }
- }
- finally {
- try {
- socket.close();
- }
- catch (final IOException e) {
-if (debug) {
- System.out.println("Exception thrown when closing socket: " + e.toString());
- e.printStackTrace();
-}
- }
- finally {
- MinMLSocketServer.this.endWork();
- }
- }
- }
- catch (final InterruptedIOException e) {
- if (MinMLSocketServer.this.workerMustDie()) return;
- }
- }
- }
- catch (final Exception e) {
- operatingException(e);
-if (debug) {
- System.out.println("Thread dying due to Exception: " + e.toString());
- e.printStackTrace();
-}
-
- MinMLSocketServer.this.workerDies();
- }
- }
-
- protected abstract void process(Socket socket) throws Exception;
-
- protected void processingException(final Exception e) {
- }
-
- protected void operatingException(final Exception e) {
- }
- }
-
- private final ServerSocket serverSocket;
- protected final int minWorkers;
- protected final int maxWorkers;
- protected final int workerIdleLife;
- private int liveWorkerCount = 0;
- private int workingWorkerCount = 0;
-
- private static final boolean debug = false;
-}
diff --git a/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/http/MinMLHTTPServer.java b/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/http/MinMLHTTPServer.java
deleted file mode 100644
index 4bf90ea..0000000
--- a/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/http/MinMLHTTPServer.java
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright (c) 2001 The Wilson Partnership.
-// All Rights Reserved.
-// @(#)MinMLHTTPServer.java, 0.3, 14th October 2001
-// Author: John Wilson - tug@wilson.co.uk
-
-package uk.co.wilson.net.http;
-
-/*
-Copyright (c) 2001 John Wilson (tug@wilson.co.uk).
-All rights reserved.
-Redistribution and use in source and binary forms,
-with or without modification, are permitted provided
-that the following conditions are met:
-
-Redistributions of source code must retain the above
-copyright notice, this list of conditions and the
-following disclaimer.
-
-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.
-
-THIS SOFTWARE IS PROVIDED BY JOHN WILSON ``AS IS'' AND ANY
-EXPRESS 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 JOHN WILSON
-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
-*/
-
-import uk.co.wilson.net.MinMLSocketServer;
-
-import java.net.ServerSocket;
-import java.net.Socket;
-
-import java.io.InputStream;
-import java.io.BufferedInputStream;
-import java.io.OutputStream;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-
-import java.util.StringTokenizer;
-
-public abstract class MinMLHTTPServer extends MinMLSocketServer {
- public MinMLHTTPServer(final ServerSocket serverSocket,
- final int minWorkers,
- final int maxWorkers,
- final int maxKeepAlives,
- final int workerIdleLife,
- final int socketReadTimeout)
- {
- super(serverSocket, minWorkers, maxWorkers, workerIdleLife);
-
- this.maxKeepAlives = maxKeepAlives;
- this.socketReadTimeout = socketReadTimeout;
- }
-
- private synchronized boolean startKeepAlive() {
- if (this.keepAliveCount < this.maxKeepAlives) {
- MinMLHTTPServer.this.keepAliveCount++;
-
- return true;
- }
-
- return false;
- }
-
- private synchronized void endKeepAlive() {
- this.keepAliveCount--;
- }
-
- private static class LimitedInputStream extends InputStream {
- public LimitedInputStream(final InputStream in, final int contentLength) {
- this.in = in;
- this.contentLength = contentLength;
- }
-
- public int available() throws IOException {
- return Math.min(this.in.available(), this.contentLength);
- }
-
- public void close() throws IOException {
- //
- // Don't close the input stream as there is more data
- // but skip past any unread data in this section
- //
-
- skip(this.contentLength);
- }
-
- public int read() throws IOException {
- if (this.contentLength == 0) return -1;
-
- this.contentLength--;
-
- return this.in.read();
- }
-
- public int read(final byte[] buffer) throws IOException {
- return read(buffer, 0, buffer.length);
- }
-
- public int read(final byte[] buffer, final int offset, int length) throws IOException {
- if (this.contentLength == 0) return -1;
-
- length = this.in.read(buffer, offset, Math.min(length, this.contentLength));
-
- if (length != -1) this.contentLength -= length;
-
- return length;
- }
-
- public long skip(long count) throws IOException {
- count = Math.min(count, this.contentLength);
-
- this.contentLength -= count;
-
- return this.in.skip(count);
- }
-
- private int contentLength;
- private final InputStream in;
- }
-
- protected abstract class HTTPWorker extends Worker {
- protected final void process(final Socket socket) throws Exception {
- try {
- socket.setSoTimeout(MinMLHTTPServer.this.socketReadTimeout);
-
- final InputStream in = new BufferedInputStream(socket.getInputStream());
- final OutputStream out = new BufferedOutputStream(socket.getOutputStream());
- int contentLength;
-
- do {
- contentLength = -1;
-
- while (readLine(in) != -1 && this.count == 0); // skip any leading blank lines
- final StringTokenizer toks = new StringTokenizer(new String(this.buf, 0, this.count));
- final String method = toks.nextToken();
- final String uri = toks.nextToken();
- final String version = toks.hasMoreTokens() ? toks.nextToken() : "";
-
- while (readLine(in) != -1 && this.count != 0) {
- final String option = new String(this.buf, 0, this.count).trim().toLowerCase();
-
- if (option.startsWith("connection:")) {
- if (option.endsWith("keep-alive")) {
- if (!this.keepAlive)
- this.keepAlive = MinMLHTTPServer.this.startKeepAlive();
- } else if (this.keepAlive) {
- MinMLHTTPServer.this.endKeepAlive();
- this.keepAlive = false;
- }
- } else if (option.startsWith("content-length:")) {
- contentLength = Integer.parseInt(option.substring(15).trim());
- //
- // This can throw NumberFormatException
- // In which case we will abort the transaction
- //
- }
- }
-
- if (contentLength == -1) {
- processMethod(in, out, method, uri, version);
- } else {
- final InputStream limitedIn = new LimitedInputStream(in, contentLength);
-
- processMethod(limitedIn, out, method, uri, version);
-
- limitedIn.close(); // skips unread bytes
- }
-
- out.flush();
-
- } while(contentLength != -1 && this.keepAlive);
- }
- finally {
- if (this.keepAlive == true) {
- MinMLHTTPServer.this.endKeepAlive();
- this.keepAlive = false;
- }
- }
- }
-
- protected void processMethod(final InputStream in,
- final OutputStream out,
- final String method,
- final String uri,
- final String version)
- throws Exception
- {
- if (method.equalsIgnoreCase("GET"))
- processGet(in, out, uri, version);
- else if (method.equalsIgnoreCase("HEAD"))
- processHead(in, out, uri, version);
- else if (method.equalsIgnoreCase("POST"))
- processPost(in, out, uri, version);
- else if (method.equalsIgnoreCase("PUT"))
- processPut(in, out, uri, version);
- else
- processOther(in, out, method, uri, version);
- }
-
- protected void processGet(final InputStream in,
- final OutputStream out,
- final String uri,
- final String version)
- throws Exception
- {
- out.write(version.getBytes());
- out.write(errorMessage1);
- out.write(get);
- out.write(errorMessage2);
- }
-
- protected void processHead(final InputStream in,
- final OutputStream out,
- final String uri,
- final String version)
- throws Exception
- {
- out.write(version.getBytes());
- out.write(errorMessage1);
- out.write(head);
- out.write(errorMessage2);
- }
-
- protected void processPost(final InputStream in,
- final OutputStream out,
- final String uri,
- final String version)
- throws Exception
- {
- out.write(version.getBytes());
- out.write(errorMessage1);
- out.write(post);
- out.write(errorMessage2);
- }
-
- protected void processPut(final InputStream in,
- final OutputStream out,
- final String uri,
- final String version)
- throws Exception
- {
- out.write(version.getBytes());
- out.write(errorMessage1);
- out.write(put);
- out.write(errorMessage2);
- }
-
- protected void processOther(final InputStream in,
- final OutputStream out,
- final String method,
- final String uri,
- final String version)
- throws Exception
- {
- out.write(version.getBytes());
- out.write(errorMessage1);
- out.write(method.getBytes());
- out.write(errorMessage2);
- }
-
- protected void writeKeepAlive(final OutputStream res) throws IOException {
- res.write(this.keepAlive ? keepConnection : closeConnection);
- }
-
- private int readLine(final InputStream in) throws IOException {
- int nextByte;
-
- this.count = 0;
-
- while (!((nextByte = in.read()) == '\r' && (nextByte = in.read()) =='\n') && nextByte != -1) {
- this.buf[this.count] = (byte)nextByte;
-
- if (this.count != this.buf.length - 1) this.count++; // sort of crude should probably handle long lines better
- }
-
- return nextByte;
- }
-
- private final byte[] buf = new byte[256];
- private int count = 0;
- private boolean keepAlive = false;
- }
-
- private int keepAliveCount = 0;
- protected final int maxKeepAlives;
- protected final int socketReadTimeout;
-
- protected static final byte[] okMessage = (" 200 OK \r\n"
- + "Server: uk.co.wilson.net.http.HTTPServer\r\n").getBytes();
-
- protected static final byte[] endOfLine = "\r\n".getBytes();
- protected static final byte[] get = "GET".getBytes();
- protected static final byte[] head = "HEAD".getBytes();
- protected static final byte[] post = "POST".getBytes();
- protected static final byte[] put = "PUT".getBytes();
- protected static final byte[] errorMessage1 = (" 400 Bad Request\r\n"
- + "Server: uk.co.wilson.net.http.HTTPServer\r\n\r\n"
- + "Method ").getBytes();
-
- protected static final byte[] errorMessage2 = " not implemented\r\n".getBytes();
- protected static final byte[] keepConnection = "Connection: Keep-Alive\r\n".getBytes();
- protected static final byte[] closeConnection = "Connection: Close\r\n".getBytes();
-}
diff --git a/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/xmlrpc/XMLRPCMessageProcessor.java b/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/xmlrpc/XMLRPCMessageProcessor.java
deleted file mode 100644
index 5b0a5a9..0000000
--- a/groovy/modules/xmlrpc/src/main/uk/co/wilson/net/xmlrpc/XMLRPCMessageProcessor.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Created on Jan 4, 2004
- */
-package uk.co.wilson.net.xmlrpc;
-
-/*
- Copyright (c) 2004 John Wilson (tug@wilson.co.uk).
- All rights reserved.
- Redistribution and use in source and binary forms,
- with or without modification, are permitted provided
- that the following conditions are met:
-
- Redistributions of source code must retain the above
- copyright notice, this list of conditions and the
- following disclaimer.
-
- 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.
-
- THIS SOFTWARE IS PROVIDED BY JOHN WILSON ``AS IS'' AND ANY
- EXPRESS 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 JOHN WILSON
- 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
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-
-import org.xml.sax.AttributeList;
-import org.xml.sax.SAXException;
-
-import uk.co.wilson.xml.MinML;
-
-
-
-public class XMLRPCMessageProcessor extends MinML {
- private static final byte[] translateTable = (
- //
- "\u0042\u0042\u0042\u0042\u0042\u0042\u0042\u0042"
- // \t \n \r
- + "\u0042\u0042\u0041\u0041\u0042\u0042\u0041\u0042"
- //
- + "\u0042\u0042\u0042\u0042\u0042\u0042\u0042\u0042"
- //
- + "\u0042\u0042\u0042\u0042\u0042\u0042\u0042\u0042"
- // sp ! " # $ % & '
- + "\u0041\u0042\u0042\u0042\u0042\u0042\u0042\u0042"
- // ( ) * + , - . /
- + "\u0042\u0042\u0042\u003E\u0042\u0042\u0042\u003F"
- // 0 1 2 3 4 5 6 7
- + "\u0034\u0035\u0036\u0037\u0038\u0039\u003A\u003B"
- // 8 9 : ; < = > ?
- + "\u003C\u003D\u0042\u0042\u0042\u0040\u0042\u0042"
- // @ A B C D E F G
- + "\u0042\u0000\u0001\u0002\u0003\u0004\u0005\u0006"
- // H I J K L M N O
- + "\u0007\u0008\t\n\u000B\u000C\r\u000E"
- // P Q R S T U V W
- + "\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016"
- // X Y Z [ \ ] ^ _
- + "\u0017\u0018\u0019\u0042\u0042\u0042\u0042\u0042"
- // ' a b c d e f g
- + "\u0042\u001A\u001B\u001C\u001D\u001E\u001F\u0020"
- // h i j k l m n o p
- + "\u0021\"\u0023\u0024\u0025\u0026\u0027\u0028"
- // p q r s t u v w
- + "\u0029\u002A\u002B\u002C\u002D\u002E\u002F\u0030"
- // x y z
- + "\u0031\u0032\u0033").getBytes();
-
- private interface Emitter {
- void emit(StringBuffer buffer, Object value) throws SAXException;
- }
-
- private final static Map elements = new HashMap();
- static {
- final char[] tTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".toCharArray();
-
- elements.put(Integer.class,
- new Emitter() {
- public void emit(final StringBuffer buffer, final Object integer) {
- buffer.append("<value><i4>").append(integer).append("</i4></value>");
- }
- });
- elements.put(Character.class, elements.get(Integer.class));
- elements.put(Byte.class, elements.get(Integer.class));
- elements.put(Short.class, elements.get(Integer.class));
-
- elements.put(Double.class,
- new Emitter() {
- public void emit(final StringBuffer buffer, final Object number) {
- buffer.append("<value><double>").append(number).append("</double></value>");
- }
- });
- elements.put(Float.class, elements.get(Double.class));
-
- elements.put(String.class,
- new Emitter() {
- public void emit(final StringBuffer buffer, final Object string) throws SAXException {
- encodeString(buffer.append("<value><string>"), (String)string).append("</string></value>");
- }
- });
-
- elements.put(Boolean.class,
- new Emitter() {
- public void emit(final StringBuffer buffer, final Object bool) {
- buffer.append("<value><boolean>").append((((Boolean)bool).booleanValue()) ? "1" : "0").append("</boolean></value>");
- }
- });
-
- elements.put(byte [].class,
- new Emitter() {
- public void emit(final StringBuffer buffer, final Object bytes) {
- int charCount = 0;
- final byte[] data = (byte[])bytes;
- final int numChars = ((data.length + 2) / 3) * 4;
- final int dLimit = (data.length / 3) * 3;
-
- buffer.ensureCapacity(numChars + 128 + (data.length / 54));
- buffer.append("<value><base64>\n");
-
- for (int dIndex = 0; dIndex != dLimit; dIndex += 3) {
- int d = ((data[dIndex] & 0XFF) << 16) | ((data[dIndex + 1] & 0XFF) << 8) | (data[dIndex + 2] & 0XFF);
-
- buffer.append(tTable[d >> 18]);
- buffer.append(tTable[(d >> 12) & 0X3F]);
- buffer.append(tTable[(d >> 6) & 0X3F]);
- buffer.append(tTable[d & 0X3F]);
-
- if (++charCount == 18) {
- buffer.append('\n');
- charCount = 0;
- }
- }
-
- if (dLimit != data.length) {
- int d = (data[dLimit] & 0XFF) << 16;
-
- if (dLimit + 1 != data.length) {
- d |= (data[dLimit + 1] & 0XFF) << 8;
- }
-
- buffer.append(tTable[d >> 18]);
- buffer.append(tTable[(d >> 12) & 0X3F]);
- buffer.append((dLimit + 1 < data.length) ? tTable[(d >> 6) & 0X3F] : '=');
- buffer.append('=');
- }
-
- buffer.append("\n</base64></value>");
- }
- });
-
- elements.put(Date.class,
- new Emitter() {
- private final DateFormat dateTime = new SimpleDateFormat ("yyyyMMdd'T'HH:mm:ss");
-
- public synchronized void emit(final StringBuffer buffer, final Object date) {
- buffer.append("<value><dateTime.iso8601>").append(this.dateTime.format((Date)date)).append("</dateTime.iso8601></value>");
- }
- });
- }
-
- public static StringBuffer emit(final StringBuffer buffer, final Object param) throws SAXException {
- final Emitter emitter = (Emitter)elements.get(param.getClass());
-
- if (emitter == null) {
- if (param instanceof List) {
- final Iterator iterator = ((List)param).iterator();
-
- buffer.append("<value><array><data>");
-
- while (iterator.hasNext()) {
- emit(buffer, iterator.next());
- }
-
- buffer.append("</data></array></value>");
-
- } else if (param instanceof Map) {
- final Iterator iterator =((Map)param).entrySet().iterator();
-
- buffer.append("<value><struct>");
-
- while (iterator.hasNext()) {
- final Map.Entry entry = (Map.Entry)iterator.next();
-
- emit(encodeString(buffer.append("<member><name>"), (String)entry.getKey()).append("</name>"), entry.getValue()).append("</member>");
- }
-
- buffer.append("</struct></value>");
- }
- } else {
- emitter.emit(buffer, param);
- }
-
- return buffer;
- }
-
- public static StringBuffer encodeString(final StringBuffer buffer, final String string) throws SAXException {
- for (int i = 0; i != string.length(); i++) {
- final char c = string.charAt(i);
-
- if (c >= 0X20 || c == 0X09 || c == 0X0A || c == 0X0D) {
- if (c == '>') {
- buffer.append(">");
- } else if (c == '<') {
- buffer.append("<");
- } else if (c == '&') {
- buffer.append("&");
- } else if (c > 0xff) {
- if (c > 0XD800 && !(c >= 0XE000 && c < 0XFFFE))
- throw new SAXException("Can't include character with value 0x"
- + Integer.toHexString(c)
- + " in a well formed XML document");
-
-
- buffer.append("&#x").append(Integer.toHexString(c)).append(';');
- } else {
- buffer.append(c);
- }
- } else {
- throw new SAXException("Can't include character with value 0x"
- + Integer.toHexString(c)
- + " in a well formed XML document");
- }
- }
-
- return buffer;
- }
-
- /*
- * A really cheap and cheerful XML-RPC reponse parser
- * It only really cares if the reponse contains a <param> or <fault>
- * element. When the server is implemented this will be redone to be lots pickier.
- */
-
-
- private Object params = null;
- private Object name = null;
- private String methodName = null;
- private Map struct = null;
- private List array = null;
- private Boolean inArray = Boolean.FALSE;
- private Stack aggregateStack = new Stack();
- private boolean gotValue = false;
- private final StringBuffer buffer = new StringBuffer();
- private final DateFormat dateTime = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
- private final Boolean bools[] = {new Boolean(false), new Boolean(true)};
-
- public void parseMessage(final InputStream in) throws SAXException, IOException {
- parse(new InputStreamReader(in, "ISO-8859-1"));
- }
-
- public List getParams() {
- return (List)this.params;
- }
-
- public String getMethodname() {
- return this.methodName;
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.DocumentHandler#startElement(java.lang.String, org.xml.sax.AttributeList)
- */
- public void startElement(final String name, final AttributeList attributes) {
- if ("value".equals(name) || "name".equals(name) || "methodName".equals(name)) {
- this.buffer.setLength(0);
- this.gotValue = false;
- this.aggregateStack.push(this.inArray);
- this.inArray = Boolean.FALSE;
- } else if ("struct".equals(name)) {
- this.aggregateStack.push(this.struct);
- this.aggregateStack.push(this.name);
- this.struct = new HashMap();
- } else if ("array".equals(name) || "params".equals(name)) {
- this.aggregateStack.push(this.inArray);
- this.inArray = Boolean.TRUE;
- this.aggregateStack.push(this.array);
- this.array = new ArrayList();
- }
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.DocumentHandler#characters(char[], int, int)
- */
- public void characters(final char[] ch, final int start, final int length) {
- this.buffer.append(ch, start, length);
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.DocumentHandler#endElement(java.lang.String)
- */
- public void endElement(final String name) throws SAXException {
- if ("value".equals(name)) {
- if (!this.gotValue) {
- this.params = this.buffer.toString();
- this.gotValue = true;
- }
-
- this.inArray = (Boolean)this.aggregateStack.pop();
-
- if (this.inArray.booleanValue())
- this.array.add(this.params);
- } else if ("string".equals(name)) {
- this.params = this.buffer.toString();
- this.gotValue = true;
- } else if ("i4".equals(name) || "int".equals(name)) {
- this.params = new Integer(this.buffer.toString());
- this.gotValue = true;
- } else if ("boolean".equals(name)) {
- try {
- this.params = this.bools[Integer.parseInt(this.buffer.toString())];
- }
- catch (final RuntimeException e) {
- throw new SAXException("bad Boolean value: " + this.buffer.toString());
- }
-
- this.gotValue = true;
- } else if ("dateTime.iso8601".equals(name)) {
- try {
- synchronized (this) {
- this.params = this.dateTime.parse(this.buffer.toString());
- }
- } catch (ParseException e) {
- throw new SAXException(e);
- }
- this.gotValue = true;
- } else if ("base64".equals(name)) {
- int bytesIndex = 0;
- int byteShift = 4;
- int tmp = 0;
- boolean done = false;
-
- for (int i = 0; i != this.buffer.length(); i++) {
- final char c = this.buffer.charAt(i);
- final int sixBit = (c < 123) ? translateTable[c] : 66;
-
- if (sixBit < 64) {
- if (done) throw new SAXException("= character not at end of base64 value");
-
- tmp = (tmp << 6) | sixBit;
-
- if (byteShift-- != 4) {
- this.buffer.setCharAt(bytesIndex++, (char)((tmp >> (byteShift * 2)) & 0XFF));
- }
-
- } else if (sixBit == 64) {
-
- byteShift--;
- done = true;
-
- } else if (sixBit == 66) {
- // RFC 2045 says that I'm allowed to take the presence of
- // these characters as evedence of data corruption
- // So I will
- throw new SAXException("bad character in base64 value");
- }
-
- if (byteShift == 0) byteShift = 4;
- }
- this.buffer.setLength(bytesIndex);
- try {
- this.params = this.buffer.toString().getBytes("ISO-8859-1");
- } catch (UnsupportedEncodingException e) {
- throw new SAXException("Base 64 decode produced byte values > 255");
- }
- this.gotValue = true;
- } else if ("double".equals(name)) {
- this.params = new Double(this.buffer.toString());
- this.gotValue = true;
- } else if ("name".equals(name)) {
- this.name = this.buffer.toString();
- this.inArray = (Boolean)this.aggregateStack.pop();
- } else if ("member".equals(name)) {
- this.struct.put(this.name, this.params);
- } else if ("struct".equals(name)) {
- this.params = this.struct;
- this.name = (String)this.aggregateStack.pop();
- this.struct = (Map)this.aggregateStack.pop();
- } else if ("array".equals(name) || "params".equals(name)) {
- this.params = this.array;
- this.array = (List)this.aggregateStack.pop();
- this.inArray = (Boolean)this.aggregateStack.pop();
- } else if ("methodName".equals(name)) {
- this.methodName = this.buffer.toString();
- this.inArray = (Boolean)this.aggregateStack.pop();
- } else if ("fault".equals(name)) {
- throw new RuntimeException("XML-RPC call Failure: " +
- (String)((Map)this.params).get("faultString") +
- ", fault code = " +
- ((Integer)((Map)this.params).get("faultCode")).toString());
- }
- }
-}
\ No newline at end of file
diff --git a/groovy/modules/xmlrpc/src/main/uk/co/wilson/xml/MinML.java b/groovy/modules/xmlrpc/src/main/uk/co/wilson/xml/MinML.java
deleted file mode 100644
index 90111ac..0000000
--- a/groovy/modules/xmlrpc/src/main/uk/co/wilson/xml/MinML.java
+++ /dev/null
@@ -1,739 +0,0 @@
-// Copyright (c) 2000, 2001 The Wilson Partnership.
-// All Rights Reserved.
-// @(#)MinML.java, 1.4, 26th October 2001
-// Author: John Wilson - tug@wilson.co.uk
-
-package uk.co.wilson.xml;
-
-/*
-Copyright (c) 2000, 2001 John Wilson (tug@wilson.co.uk).
-All rights reserved.
-Redistribution and use in source and binary forms,
-with or without modification, are permitted provided
-that the following conditions are met:
-
-Redistributions of source code must retain the above
-copyright notice, this list of conditions and the
-following disclaimer.
-
-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.
-
-All advertising materials mentioning features or use
-of this software must display the following acknowledgement:
-
-This product includes software developed by John Wilson.
-The name of John Wilson may not be used to endorse or promote
-products derived from this software without specific prior
-written permission.
-
-THIS SOFTWARE IS PROVIDED BY JOHN WILSON ``AS IS'' AND ANY
-EXPRESS 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 JOHN WILSON
-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
-*/
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.Writer;
-import java.net.URL;
-import java.util.Locale;
-import java.util.Stack;
-import java.util.Vector;
-
-import org.xml.sax.AttributeList;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import uk.org.xml.sax.DocumentHandler;
-import uk.org.xml.sax.Parser;
-
-public class MinML implements Parser, Locator, DocumentHandler, ErrorHandler {
- public static final int endStartName = 0;
- public static final int emitStartElement = 1;
- public static final int emitEndElement = 2;
- public static final int emitCharacters = 3;
- public static final int saveAttributeName = 4;
- public static final int saveAttributeValue = 5;
- public static final int startComment = 6;
- public static final int endComment = 7;
- public static final int incLevel = 8;
- public static final int decLevel = 9;
- public static final int startCDATA = 10;
- public static final int endCDATA = 11;
- public static final int processCharRef = 12;
- public static final int writeCdata = 13;
- public static final int exitParser = 14;
- public static final int parseError = 15;
- public static final int discardAndChange = 16;
- public static final int discardSaveAndChange = 17;
- public static final int saveAndChange = 18;
- public static final int change = 19;
-
- public static final int inSkipping = 0;
- public static final int inSTag = 1;
- public static final int inPossiblyAttribute = 2;
- public static final int inNextAttribute = 3;
- public static final int inAttribute = 4;
- public static final int inAttribute1 = 5;
- public static final int inAttributeValue = 6;
- public static final int inAttributeQuoteValue = 7;
- public static final int inAttributeQuotesValue = 8;
- public static final int inETag = 9;
- public static final int inETag1 = 10;
- public static final int inMTTag = 11;
- public static final int inTag = 12;
- public static final int inPI = 13;
- public static final int inPI1 = 14;
- public static final int inPossiblySkipping = 15;
- public static final int inCharData = 16;
- public static final int inCDATA = 17;
- public static final int inCDATA1 = 18;
- public static final int inComment =19;
- public static final int inDTD = 20;
-
- public MinML(final int initialBufferSize, final int bufferIncrement) {
- this.initialBufferSize = initialBufferSize;
- this.bufferIncrement = bufferIncrement;
- }
-
- public MinML() {
- this(256, 128);
- }
-
- public void parse(final Reader in) throws SAXException, IOException {
- final Vector attributeNames = new Vector();
- final Vector attributeValues = new Vector();
-
- final AttributeList attrs = new AttributeList() {
- public int getLength() {
- return attributeNames.size();
- }
-
- public String getName(final int i) {
- return (String)attributeNames.elementAt(i);
- }
-
- public String getType(final int i) {
- return "CDATA";
- }
-
- public String getValue(final int i) {
- return (String)attributeValues.elementAt(i);
- }
-
- public String getType(final String name) {
- return "CDATA";
- }
-
- public String getValue(final String name) {
- final int index = attributeNames.indexOf(name);
-
- return (index == -1) ? null : (String)attributeValues.elementAt(index);
- }
- };
-
- final MinMLBuffer buffer = new MinMLBuffer(in);
- int currentChar = 0, charCount = 0;
- int level = 0;
- String elementName = null;
- String state = operands[inSkipping];
-
- this.lineNumber = 1;
- this.columnNumber = 0;
-
- try {
-main: while(true) {
- charCount++;
-
- //
- // this is to try and make the loop a bit faster
- // currentChar = buffer.read(); is simpler but is a bit slower.
- //
- currentChar = (buffer.nextIn == buffer.lastIn) ? buffer.read() : buffer.chars[buffer.nextIn++];
-
- final int transition;
-
- if (currentChar > ']') {
- transition = state.charAt(14);
- } else {
- final int charClass = charClasses[currentChar + 1];
-
- if (charClass == -1) fatalError("Document contains illegal control character with value " + currentChar, this.lineNumber, this.columnNumber);
-
- if (charClass == 12) {
- if (currentChar == '\r') {
- currentChar = '\n';
- charCount = -1;
- }
-
- if (currentChar == '\n') {
- if (charCount == 0) continue; // preceeded by '\r' so ignore
-
- if (charCount != -1) charCount = 0;
-
- this.lineNumber++;
- this.columnNumber = 0;
- }
- }
-
- transition = state.charAt(charClass);
- }
-
- this.columnNumber++;
-
- final String operand = operands[transition >>> 8];
-
- switch (transition & 0XFF) {
- case endStartName:
- // end of start element name
- elementName = buffer.getString();
- if (currentChar != '>' && currentChar != '/') break; // change state to operand
- // drop through to emit start element (we have no attributes)
-
- case emitStartElement:
- // emit start element
-
- final Writer newWriter = this.extDocumentHandler.startElement(elementName, attrs,
- (this.tags.empty()) ?
- this.extDocumentHandler.startDocument(buffer)
- :
- buffer.getWriter());
-
- buffer.pushWriter(newWriter);
- this.tags.push(elementName);
-
- attributeValues.removeAllElements();
- attributeNames.removeAllElements();
-
- if (currentChar != '/') break; // change state to operand
-
- // <element/> drop through
-
- case emitEndElement:
- // emit end element
-
- if (this.tags.empty())
- fatalError("end tag at begining of document", this.lineNumber, this.columnNumber);
-
- final String begin = (String)this.tags.pop();
- buffer.popWriter();
- elementName = buffer.getString();
-
- if (currentChar != '/' && !elementName.equals(begin)) {
- fatalError("end tag </" + elementName + "> does not match begin tag <" + begin + ">",
- this.lineNumber, this.columnNumber);
- } else {
- this.documentHandler.endElement(begin);
-
- if (this.tags.empty()) {
- this.documentHandler.endDocument();
- return;
- }
- }
- break; // change state to operand
-
-
- case emitCharacters:
- // emit characters
-
- buffer.flush();
- break; // change state to operand
-
- case saveAttributeName:
- // save attribute name
-
- attributeNames.addElement(buffer.getString());
- break; // change state to operand
-
- case saveAttributeValue:
- // save attribute value
-
- attributeValues.addElement(buffer.getString());
- break; // change state to operand
-
- case startComment:
- // change state if we have found "<!--"
-
- if (buffer.read() != '-') continue; // not "<!--"
-
- break; // change state to operand
-
- case endComment:
- // change state if we find "-->"
-
- if ((currentChar = buffer.read()) == '-') {
- // deal with the case where we might have "------->"
- while ((currentChar = buffer.read()) == '-');
-
- if (currentChar == '>') break; // end of comment, change state to operand
- }
-
- continue; // not end of comment, don't change state
-
- case incLevel:
-
- level++;
-
- break;
-
- case decLevel:
-
- if (level == 0) break; // outer level <> change state
-
- level--;
-
- continue; // in nested <>, don't change state
-
- case startCDATA:
- // change state if we have found "<![CDATA["
-
- if (buffer.read() != 'C') continue; // don't change state
- if (buffer.read() != 'D') continue; // don't change state
- if (buffer.read() != 'A') continue; // don't change state
- if (buffer.read() != 'T') continue; // don't change state
- if (buffer.read() != 'A') continue; // don't change state
- if (buffer.read() != '[') continue; // don't change state
- break; // change state to operand
-
- case endCDATA:
- // change state if we find "]]>"
-
- if ((currentChar = buffer.read()) == ']') {
- // deal with the case where we might have "]]]]]]]>"
- while ((currentChar = buffer.read()) == ']') buffer.write(']');
-
- if (currentChar == '>') break; // end of CDATA section, change state to operand
-
- buffer.write(']');
- }
-
- buffer.write(']');
- buffer.write(currentChar);
- continue; // not end of CDATA section, don't change state
-
- case processCharRef:
- // process character entity
-
- int crefState = 0;
-
- currentChar = buffer.read();
-
- while (true) {
- if ("#amp;&pos;'quot;\"gt;>lt;<".charAt(crefState) == currentChar) {
- crefState++;
-
- if (currentChar == ';') {
- buffer.write("#amp;&pos;'quot;\"gt;>lt;<".charAt(crefState));
- continue main;
-
- } else if (currentChar == '#') {
- final int radix;
-
- currentChar = buffer.read();
-
- if (currentChar == 'x') {
- radix = 16;
- currentChar = buffer.read();
- } else {
- radix = 10;
- }
-
- int charRef = Character.digit((char)currentChar, radix);
-
- while (true) {
- currentChar = buffer.read();
-
- final int digit = Character.digit((char)currentChar, radix);
-
- if (digit == -1) break;
-
- charRef = (char)((charRef * radix) + digit);
- }
-
- if (currentChar == ';' && charRef != -1) {
- buffer.write(charRef);
- continue main;
- }
-
- break; // bad char reference
- } else {
- currentChar = buffer.read();
- }
- } else {
- crefState = ("\u0001\u000b\u0006\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff" +
-// # a m p ; & p o s ; '
-// 0 1 2 3 4 5 6 7 8 9 a
- "\u0011\u00ff\u00ff\u00ff\u00ff\u00ff\u0015\u00ff\u00ff\u00ff" +
-// q u o t ; " g t ; >
-// b b d e f 10 11 12 13 14
- "\u00ff\u00ff\u00ff").charAt(crefState);
-// l t ;
-// 15 16 17
-
- if (crefState == 255) break; // bad char reference
- }
- }
- // drop through to report error and exit
-
- case parseError:
- // report fatal error
-
- fatalError(operand, this.lineNumber, this.columnNumber);
- // drop through to exit parser
-
- case exitParser:
- // exit parser
-
- return;
-
- case writeCdata:
- // write character data
- // this will also write any skipped whitespace
-
- buffer.write(currentChar);
- break; // change state to operand
-
- case discardAndChange:
- // throw saved characters away and change state
-
- buffer.reset();
- break; // change state to operand
-
- case discardSaveAndChange:
- // throw saved characters away, save character and change state
-
- buffer.reset();
- // drop through to save character and change state
-
- case saveAndChange:
- // save character and change state
-
- buffer.saveChar((char)currentChar);
- break; // change state to operand
-
- case change:
- // change state to operand
-
- break; // change state to operand
- }
-
- state = operand;
- }
- }
- catch (final IOException e) {
- this.errorHandler.fatalError(new SAXParseException(e.toString(), null, null, this.lineNumber, this.columnNumber, e));
- }
- finally {
- this.errorHandler = this;
- this.documentHandler = this.extDocumentHandler = this;
- this.tags.removeAllElements();
- }
- }
-
- public void parse(final InputSource source) throws SAXException, IOException {
- if (source.getCharacterStream() != null)
- parse(source.getCharacterStream());
- else if (source.getByteStream() != null)
- parse(new InputStreamReader(source.getByteStream()));
- else
- parse(new InputStreamReader(new URL(source.getSystemId()).openStream()));
- }
-
- public void parse(final String systemId) throws SAXException, IOException {
- parse(new InputSource(systemId));
- }
-
- public void setLocale(final Locale locale) throws SAXException {
- throw new SAXException("Not supported");
- }
-
- public void setEntityResolver(final EntityResolver resolver) {
- // not supported
- }
-
- public void setDTDHandler(final DTDHandler handler) {
- // not supported
- }
-
- public void setDocumentHandler(final org.xml.sax.DocumentHandler handler) {
- this.documentHandler = (handler == null) ? this : handler;
- this.extDocumentHandler = this;
- }
-
- public void setDocumentHandler(final DocumentHandler handler) {
- this.documentHandler = this.extDocumentHandler = (handler == null) ? this : handler;
- this.documentHandler.setDocumentLocator(this);
- }
-
- public void setErrorHandler(final ErrorHandler handler) {
- this.errorHandler = (handler == null) ? this : handler;
- }
-
- public void setDocumentLocator(final Locator locator) {
- }
-
- public void startDocument() throws SAXException {
- }
-
- public Writer startDocument(final Writer writer) throws SAXException {
- this.documentHandler.startDocument();
- return writer;
- }
-
- public void endDocument() throws SAXException {
- }
-
- public void startElement(final String name, final AttributeList attributes) throws SAXException {
- }
-
- public Writer startElement(final String name, final AttributeList attributes, final Writer writer)
- throws SAXException
- {
- this.documentHandler.startElement(name, attributes);
- return writer;
- }
-
- public void endElement(final String name) throws SAXException {
- }
-
- public void characters(final char ch[], final int start, final int length) throws SAXException {
- }
-
- public void ignorableWhitespace(final char ch[], final int start, final int length) throws SAXException {
- }
-
- public void processingInstruction(final String target, final String data) throws SAXException {
- }
-
- public void warning(final SAXParseException e) throws SAXException {
- }
-
- public void error(final SAXParseException e) throws SAXException {
- }
-
- public void fatalError(final SAXParseException e) throws SAXException {
- throw e;
- }
-
- public String getPublicId() {
- return "";
- }
-
-
- public String getSystemId() {
- return "";
- }
-
- public int getLineNumber () {
- return this.lineNumber;
- }
-
- public int getColumnNumber () {
- return this.columnNumber;
- }
-
- private void fatalError(final String msg, final int lineNumber, final int columnNumber) throws SAXException {
- final SAXParseException e = new SAXParseException(msg, null, null, lineNumber, columnNumber);
-
- this.errorHandler.fatalError(e);
-
- throw e;
- }
-
- private class MinMLBuffer extends Writer {
- public MinMLBuffer(final Reader in) {
- this.in = in;
- }
-
- public void close() throws IOException {
- flush();
- }
-
- public void flush() throws IOException {
- try {
- _flush();
- if (this.writer != this) this.writer.flush();
- }
- finally {
- this.flushed = true;
- }
- }
-
- public void write(final int c) throws IOException {
- this.written = true;
- this.chars[this.count++] = (char)c;
- }
-
- public void write(final char[] cbuf, final int off, final int len) throws IOException {
- this.written = true;
- System.arraycopy(cbuf, off, this.chars, this.count, len);
- this.count += len;
- }
-
- public void saveChar(final char c) {
- this.written = false;
- this.chars[this.count++] = c;
- }
-
- public void pushWriter(final Writer writer) {
- MinML.this.tags.push(this.writer);
-
- this.writer = (writer == null) ? this : writer;
-
- this.flushed = this.written = false;
- }
-
- public Writer getWriter() {
- return this.writer;
- }
-
- public void popWriter() throws IOException {
- try {
- if (!this.flushed && this.writer != this) this.writer.flush();
- }
- finally {
- this.writer = (Writer)MinML.this.tags.pop();
- this.flushed = this.written = false;
- }
- }
-
- public String getString() {
- final String result = new String(this.chars, 0, this.count);
-
- this.count = 0;
- return result;
- }
-
- public void reset() {
- this.count = 0;
- }
-
- public int read() throws IOException {
- if (this.nextIn == this.lastIn) {
- if (this.count != 0) {
- if (this.written) {
- _flush();
- } else if (this.count >= (this.chars.length - MinML.this.bufferIncrement)) {
- final char[] newChars = new char[this.chars.length + MinML.this.bufferIncrement];
-
- System.arraycopy(this.chars, 0, newChars, 0, this.count);
- this.chars = newChars;
- }
- }
-
- final int numRead = this.in.read(this.chars, this.count, this.chars.length - this.count);
-
- if (numRead == -1) return -1;
-
- this.nextIn = this.count;
- this.lastIn = this.count + numRead;
- }
-
- return this.chars[this.nextIn++];
- }
-
- private void _flush() throws IOException {
- if (this.count != 0) {
- try {
- if (this.writer == this) {
- try {
- MinML.this.documentHandler.characters(this.chars, 0, this.count);
- }
- catch (final SAXException e) {
- throw new IOException(e.toString());
- }
- } else {
- this.writer.write(this.chars, 0, this.count);
- }
- }
- finally {
- this.count = 0;
- }
- }
- }
-
- private int nextIn = 0, lastIn = 0;
- private char[] chars = new char[MinML.this.initialBufferSize];
- private final Reader in;
- private int count = 0;
- private Writer writer = this;
- private boolean flushed = false;
- private boolean written = false;
- }
-
- private DocumentHandler extDocumentHandler = this;
- private org.xml.sax.DocumentHandler documentHandler = this;
- private ErrorHandler errorHandler = this;
- private final Stack tags = new Stack();
- private int lineNumber = 1;
- private int columnNumber = 0;
- private final int initialBufferSize;
- private final int bufferIncrement;
-
- private static final byte[] charClasses = {
- // EOF
- 13,
- // \t \n \r
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 12, -1, -1, 12, -1, -1,
- //
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- // SP ! " # $ % & ' ( ) * + , - . /
- 12, 8, 7, 14, 14, 14, 3, 6, 14, 14, 14, 14, 14, 11, 14, 2,
- // 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 5, 1, 4,
- //
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
- // [ \ ]
- 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 9, 14, 10
- };
-
- private static final String[] operands = {
- "\u0c13\u150f\u150f\u150f\u150f\u150f\u150f\u150f\u150f\u150f\u150f\u150f\u0013\u000e\u150f",
- "\u160f\u0f00\u0b00\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u0112\u0200\u170f\u0112",
- "\u160f\u0f01\u0b01\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u0213\u170f\u0412",
- "\u160f\u0f01\u0b01\u160f\u180f\u180f\u180f\u180f\u180f\u180f\u180f\u180f\u0313\u170f\u0412",
- "\u180f\u180f\u180f\u180f\u180f\u0604\u180f\u180f\u180f\u180f\u180f\u0412\u0513\u170f\u0412",
- "\u180f\u180f\u180f\u180f\u180f\u0604\u180f\u180f\u180f\u180f\u180f\u180f\u0513\u170f\u180f",
- "\u190f\u190f\u190f\u190f\u190f\u190f\u0713\u0813\u190f\u190f\u190f\u190f\u0613\u170f\u190f",
- "\u0712\u0712\u0712\u1a0c\u0712\u0712\u0305\u0712\u0712\u0712\u0712\u0712\u0712\u170f\u0712",
- "\u0812\u0812\u0812\u1a0c\u0812\u0812\u0812\u0305\u0812\u0812\u0812\u0812\u0812\u170f\u0812",
- "\u160f\u0002\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u0912\u0913\u170f\u0912",
- "\u1b0f\u1b0f\u0903\u1b0f\u1b0f\u1b0f\u1b0f\u1b0f\u1113\u1b0f\u1b0f\u1b0f\u1b0f\u170f\u1b0f",
- "\u160f\u0013\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u160f\u170f\u160f",
- "\u160f\u1c0f\u0913\u160f\u0d13\u160f\u160f\u160f\u1113\u160f\u160f\u160f\u160f\u170f\u0111",
- "\u0d13\u0d13\u0d13\u0d13\u0e13\u0d13\u0d13\u0d13\u0d13\u0d13\u0d13\u0d13\u0d13\u170f\u0d13",
- "\u0d13\u0013\u0d13\u0d13\u0e13\u0d13\u0d13\u0d13\u0d13\u0d13\u0d13\u0d13\u0d13\u170f\u0d13",
- "\u0c10\u100d\u100d\u1a0c\u100d\u100d\u100d\u100d\u100d\u100d\u100d\u100d\u0f12\u170f\u100d",
- "\u0a13\u100d\u100d\u1a0c\u100d\u100d\u100d\u100d\u100d\u100d\u100d\u100d\u100d\u170f\u100d",
- "\u1d0f\u1d0f\u1d0f\u1d0f\u1d0f\u1d0f\u1d0f\u1d0f\u1d0f\u120a\u1d0f\u1306\u1d0f\u170f\u1413",
- "\u120d\u120d\u120d\u120d\u120d\u120d\u120d\u120d\u120d\u120d\u100b\u120d\u120d\u170f\u120d",
- "\u1313\u1313\u1313\u1313\u1313\u1313\u1313\u1313\u1313\u1313\u1313\u0007\u1313\u170f\u1313",
- "\u1408\u0009\u1413\u1413\u1413\u1413\u1413\u1413\u1413\u1413\u1413\u1413\u1413\u170f\u1413",
- "expected Element",
- "unexpected character in tag",
- "unexpected end of file found",
- "attribute name not followed by '='",
- "invalid attribute value",
- "invalid Character Entity",
- "expecting end tag",
- "empty tag",
- "unexpected character after <!"
- };
-}
diff --git a/groovy/modules/xmlrpc/src/main/uk/org/xml/sax/DocumentHandler.java b/groovy/modules/xmlrpc/src/main/uk/org/xml/sax/DocumentHandler.java
deleted file mode 100644
index 1775d86..0000000
--- a/groovy/modules/xmlrpc/src/main/uk/org/xml/sax/DocumentHandler.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package uk.org.xml.sax;
-
-import java.io.Writer;
-import org.xml.sax.SAXException;
-import org.xml.sax.AttributeList;
-
-public interface DocumentHandler extends org.xml.sax.DocumentHandler {
- Writer startDocument(final Writer writer) throws SAXException;
- Writer startElement(final String name, final AttributeList attributes, final Writer writer)
- throws SAXException;
-}
diff --git a/groovy/modules/xmlrpc/src/main/uk/org/xml/sax/Parser.java b/groovy/modules/xmlrpc/src/main/uk/org/xml/sax/Parser.java
deleted file mode 100644
index bdd744d..0000000
--- a/groovy/modules/xmlrpc/src/main/uk/org/xml/sax/Parser.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package uk.org.xml.sax;
-
-public interface Parser extends org.xml.sax.Parser {
- void setDocumentHandler(DocumentHandler handler);
-}
\ No newline at end of file
diff --git a/groovy/modules/xmlrpc/src/test/groovy/net/xmlrpc/GroovyXmlrpcTest.groovy b/groovy/modules/xmlrpc/src/test/groovy/net/xmlrpc/GroovyXmlrpcTest.groovy
deleted file mode 100644
index 3a08a0e..0000000
--- a/groovy/modules/xmlrpc/src/test/groovy/net/xmlrpc/GroovyXmlrpcTest.groovy
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright 2004 (C) John Wilson. All Rights Reserved.
- *
- * Redistribution and use of this software and associated documentation
- * ("Software"), with or without modification, are permitted provided that the
- * following conditions are met: 1. Redistributions of source code must retain
- * copyright statements and notices. Redistributions must also contain a copy
- * of this document. 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 name "groovy" must not be used to endorse or promote products derived
- * from this Software without prior written permission of The Codehaus. For
- * written permission, please contact info@codehaus.org. 4. Products derived
- * from this Software may not be called "groovy" nor may "groovy" appear in
- * their names without prior written permission of The Codehaus. "groovy" is a
- * registered trademark of The Codehaus. 5. Due credit should be given to The
- * Codehaus - http://groovy.codehaus.org/
- *
- * THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS ``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 CODEHAUS 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.
- *
- */
-
-package groovy.net.xmlrpc
-
-import java.net.ServerSocket
-
-import groovy.util.GroovyTestCase
-
-/**
- * Tests the use of the structured Attribute type
- *
- * @author <a href="mailto:tug@wilson.co.uk">John Wilson/a>
-
- */
-public class GroovyXmlrpcTest extends GroovyTestCase {
-
- public void testXmlrpcCalls() {
- //
- // create a new XML-RPC server
- //
- server = new XMLRPCServer(2, 10, 8, 1000, 1000)
-
- //
- // add methods that can be called remotely
- //
- server.validator1.arrayOfStructsTest = {structs |
- count = 0
-
- for (struct in structs) {
- count += struct['curly']
- }
-
- return count
- }
-
- server.validator1.countTheEntities = {string |
- ctLeftAngleBrackets = 0
- ctRightAngleBrackets = 0
- ctAmpersands = 0
- ctApostrophes = 0
- ctQuotes = 0
-
- for (c in string) {
- switch (c) {
- case '<' :
- ctLeftAngleBrackets++
- break;
-
- case '>' :
- ctRightAngleBrackets++
- break;
-
- case '&' :
- ctAmpersands++
- break;
-
- case '\'' :
- ctApostrophes++
- break;
-
- case '"' :
- ctQuotes++
- break;
-
- default:
- }
- }
-
- return ['ctLeftAngleBrackets' : ctLeftAngleBrackets,
- 'ctRightAngleBrackets' : ctRightAngleBrackets,
- 'ctAmpersands' : ctAmpersands,
- 'ctApostrophes' : ctApostrophes,
- 'ctQuotes' : ctQuotes]
- }
-
- server.validator1.easyStructTest = {struct | return struct['larry'] + struct['moe'] + struct['curly'] }
-
- server.validator1.echoStructTest = {struct | return struct }
-
- server.validator1.manyTypesTest = {p1, p2, p3, p4, p5, p6 |
- return [p1, p2, p3, p4, p5, p6]
- }
-
- server.validator1.moderateSizeArrayCheck = {array | return array[0] + array[array.size() - 1] }
-
- server.validator1.nestedStructTest = {struct |
- day = struct['2000']['04']['01']
- return day['larry'] + day['moe'] + day['curly']
- }
-
- server.validator1.simpleStructReturnTest = {number |
- return ['times10' : number * 10, 'times100' : number * 100, 'times1000' : number * 1000]
- }
-
- server.echo = {return it}
-
- //
- // switch the server on
- //
- serverSocket = new ServerSocket(0)
- server.startServer(serverSocket)
-
- try {
-
- //
- // create a proxy of the server to handle calls
- //
- serverProxy = new XMLRPCServerProxy("http://127.0.0.1:${serverSocket.getLocalPort()}")
-
- result = serverProxy.validator1.arrayOfStructsTest([['curly': 9], ['curly' : 3]])
-
- assertEquals("validator1.arrayOfStructsTest", result, 12)
-
- serverProxy.validator1.countTheEntities('<.\'" l&oi ><><><>"""') { result |
- assertEquals("serverProxy.validator1.countTheEntities", result['ctLeftAngleBrackets'], 4)
- assertEquals("serverProxy.validator1.countTheEntities", result['ctRightAngleBrackets'], 4)
- assertEquals("serverProxy.validator1.countTheEntities", result['ctApostrophes'], 1)
- assertEquals("serverProxy.validator1.countTheEntities", result['ctAmpersands'], 1)
- assertEquals("serverProxy.validator1.countTheEntities", result['ctQuotes'], 4)
- }
-
-
- serverProxy.validator1.manyTypesTest('a', 1.125, 'c', 1, 2, 3) { result |
- assertEquals("serverProxy.validator1.manyTypesTest", result[0], 'a')
- assertEquals("serverProxy.validator1.manyTypesTest", result[1], 1.125)
- assertEquals("serverProxy.validator1.manyTypesTest", result[2], 'c')
- assertEquals("serverProxy.validator1.manyTypesTest", result[3], 1)
- assertEquals("serverProxy.validator1.manyTypesTest", result[4], 2)
- assertEquals("serverProxy.validator1.manyTypesTest", result[5], 3)
- }
-
- result = serverProxy.validator1.moderateSizeArrayCheck(['a', 'b', 'c'])
-
- assertEquals("serverProxy.validator1.moderateSizeArrayCheck", result, 'ac')
- }
- finally {
- //
- // switch the server off
- //
- server.stopServer()
- }
- }
-}