OpenOffice.org Community Innovation Program Entry
Groovy For OpenOffice

June 23, 2008

Name, contact details, and country of residence of the Entrant

James White
26272 Summerhill Lane
Laguna Hills, CA 92653
USA

OpenOffice.org: jimwhite

email: jim@pagesmiths.com

web: http://www.ifcx.org/wiki/JimWhite.html

skype: JamesPaulWhite

phone: +1 (949) 831-0684

Sole entrant, but hoping CIP will lead to some contributors!

Whether the Entrant(s) meet the Eligibility Criteria for cash awards

Yes.

Which one of the six Categories of Interest the Entry is addressing

Technical.

The problem addressed and why it is interesting

This extension adds the ability to code macros in the Groovy programming language (http://groovy.codehaus.org/). Groovy is an excellent scripting language for the Java platform, and especially for working with the UNO API. Groovy syntax supports essentially all of Java, but also allows for very terse code styles through dynamic language features and Java API helpers.

Of special value to OpenOffice UNO API programming is the Groovy Category feature (aka mixins) that enables API helpers to be implemented that make Groovy macros as clean and as brief as OOoBASIC macros (in contrast to, for example, Java or BeanShell UNO macros).

G4OO was created in order to support the development of IFCX Wings, and so for me, that is what is most interesting about it. Wings enables creation of a whole new class of “live” documentation, tutorials, books, and tests using OpenOffice. Wings is the subject of a seperate OpenOffice CIP entry.

For more general business purposes though I think that an OpenOffice macro facility that supports developers who are not using OOoBASIC, but is still highly productive and efficient with regard to programmer effort, is very worthwhile. Groovy is extremely effective at improving the productivity of Java programmers on the sorts of scripting tasks that OpenOffice UNO macros are typically used for.

The methods & resources used

The extension is implemented in Java and is partly based on the OpenOffice code for the BeanShell macro implementation. The skeleton for the extension and it's build script was generated by the NetBeans OpenOffice AddOn Wizard. Internally the JSR-223 Scripting for the Java Platform is used to interface with the Groovy engine. Also included is Apache Ivy (http://ant.apache.org/ivy/), the agile dependency manager. Ivy is very useful because it solves the problem of downloading and caching dependencies (particularly JAR files) from any source (including Maven repositories) and managing the Java Classpath. Without that kind of automated dependency management, only relatively limited macros could be effectively deployed.

For development work, source code and full documentation, supporting test cases, etc.

Project home page: http://www.ifcx.org/wiki/GroovyForOpenOffice.html.

Package including binary and documentation: http://sourceforge.net/project/showfiles.php?group_id=199110&package_id=237851.

The binary is also available from the OOo repository for Extensions: http://extensions.services.openoffice.org/project/GroovyForOpenOffice. There have been 900 downloads in the one week it has been listed there.

Usage examples in addition to those in the documentation are being added to the OOo Wiki: http://wiki.services.openoffice.org/wiki/API/Samples/Groovy.

Subversion source repository: http://ifcx.svn.sourceforge.net/viewvc/ifcx/GroovyForOpenOffice/trunk/.

The most comprehensive example of G4OO usage is IFCX Wings. A copy is included in the SF.net download package.

Any other information that will help the Program Committee evaluate the merits of the Entry

Support for G4OO could lead to further improvements in OpenOffice macro scripting capabilities. Some of the possibilities are:

A more complete set of UNO API helpers, incorporated into the extension itself along with documentation and samples would be helpful to macro developers.

The ability to use the Apache Ivy library packaged with the extension directly in the Groovy macros via Javadoc-style annotations. This is a feature that will be available soon for IFCX Wings.

A GUI for configuring Apache Ivy & Maven repository and depedency options may be obtained by collaboration with the IvyBeans effort (a NetBeans CIP Large Project award winner).

An article for the OOo Developer Guide on how the G4OO extension works with an emphasis on how to adapt it to other programming languages with JSR-233 Java Scripting API engines.

A generalized extension based on the JSR-233 Java Scripting API would be a logical development of the OpenOffice Scripting Framework. The IFCX Wings project has demonstrated JSR-223 engines working inside OpenOffice for: Ruby/JRuby, Python/Jython, Haskell/Jaskell, OCaml, Scheme, and more.

The G4OO macro editor and debugging capabilities are very limited, as is the BeanShell macro editor on which it is based. For complex macros I currently do debugging from an external IDE using a UNO client/server project. Implementation of an integration method that made working with an IDE like NetBeans directly with OOo macros would greatly ease the (currently rather difficult when not using OOoBASIC) task of OpenOffice macro development. This would naturally fit with generalizing the Scripting Framework to use JSR-223.