New Features for the venerable AEM Groovy Console

Over nearly four years of existence, the AEM Groovy Console has evolved with new features, enhancements, and bug fixes.  I owe a great deal of thanks to my colleagues and the AEM developer community for their ideas and, more importantly, pull requests.  Some of the highlights are listed below.

OSGi Service Typeahead

A new typeahead input was added to the toolbar to simplify insertion of OSGi service references into the script body.  The typeahead is backed by a list of all available OSGi services (and classes that are adaptable from a Sling resource resolver).

 

groovy-console-typeahead


Upon selection, a code snippet is added to the script body containing a new variable with the service or adaptable class instance.

 

groovy-console-typeahead-editor

History

To mitigate the risk of executing scripts in shared AEM environments, the Groovy Console now maintains an audit record for each script execution.  The history index is searchable by date or script contents and allows for scripts to be recalled into the editor for viewing or rerunning.  Audit records also have a permalink for sharing or bookmarking previously-executed scripts.

 

groovy-console-history

Bootstrap

The UI has been upgraded to Bootstrap 3 for improved responsiveness, interactions, and JavaScript behavior.

Extensions

Organizations often have specific needs for their scripts, and the new extension API in version 7.0.0 of the console offers hooks for customizing script execution.  These extension provider interfaces can be implemented as OSGi services in a bundle to supply the following customizations:

  • Additional script bindings, such as domain-specific services or instances
  • Groovy metaclasses to supplement the class/interface decorations already provided by the AEM Groovy Extension bundle
  • Star imports, utilized by the script compiler configuration for adding to the list of packages imported by default

Much gratitude to Fryderyk Wysocki for contributing this feature.

Notifications

The Groovy Console now provides email notifications for completed script executions; however, developers may implement their own custom notification services by implementing the new Notification Service interface.  All implemented notification services will be dynamically registered and called for each script execution.

Get Started

The latest version of the console is compatible with AEM 6.0 and can be built from source and installed by following the instructions on GitHub.