Skip to content

Commit

Permalink
Merge branch 'release/11.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
markdaugherty committed May 16, 2017
2 parents 4492596 + 7b65f30 commit b9966be
Show file tree
Hide file tree
Showing 44 changed files with 409 additions and 214 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

## Overview

The AEM Groovy Console provides an interface for running [Groovy](http://groovy.codehaus.org/) scripts in the AEM (Adobe CQ) container. Scripts can be created to manipulate content in the JCR, call OSGi services, or execute arbitrary code using the AEM, Sling, or JCR APIs. After installing the package in AEM (instructions below), see the [console page](http://localhost:4502/etc/groovyconsole.html) for documentation on the available bindings and methods. Sample scripts are included in the package for reference.
The AEM Groovy Console provides an interface for running [Groovy](http://www.groovy-lang.org/) scripts in the AEM container. Scripts can be created to manipulate content in the JCR, call OSGi services, or execute arbitrary code using the AEM, Sling, or JCR APIs. After installing the package in AEM (instructions below), see the [console page](http://localhost:4502/etc/groovyconsole.html) for documentation on the available bindings and methods. Sample scripts are included in the package for reference.

![Screenshot](src/site/screenshot.png)

## Requirements

* AEM 6.2 running on localhost:4502
* AEM 6.3 running on localhost:4502
* Versions 9.x.x and 10.x.x are compatible with AEM 6.2
* Versions 8.x.x are compatible with AEM 6.1
* Versions 7.x.x are compatible with AEM 6.0
Expand All @@ -20,14 +20,20 @@ The AEM Groovy Console provides an interface for running [Groovy](http://groovy.

## Installation

1. [Download the console package](https://github.com/OlsonDigital/aem-groovy-console/releases/download/10.1.1/aem-groovy-console-10.1.1.zip). For previous versions, tags can be checked out from GitHub and built directly from the source (e.g. `mvn install`).
1. [Download the console package](https://github.com/OlsonDigital/aem-groovy-console/releases/download/11.0.0/aem-groovy-console-11.0.0.zip). For previous versions, tags can be checked out from GitHub and built directly from the source (e.g. `mvn install`).

2. [Verify](http://localhost:4502/etc/groovyconsole.html) the installation.

Additional build profiles may be added in the project's pom.xml to support deployment to non-localhost AEM servers.

AEM 6.0 no longer allows vanity paths for pages in /etc by default. To enable access to the Groovy Console from /groovyconsole as in previous versions, the Apache Sling Resource Resolver Factory OSGi configuration must be updated to allow vanity paths from /etc. The Groovy Console Configuration Service can then be updated to enable the vanity path if so desired.

## Excluding the Groovy OSGi Bundle

If your AEM instance has multiple applications using Groovy and the `groovy-all` bundle is already deployed, you can exclude this bundle from the Groovy Console package build with the `exclude-groovy-bundle` Maven profile. This should prevent issues with conflicting Groovy versions at runtime.

mvn install -P local,exclude-groovy-bundle

## Context Path Support

If you are running AEM with a context path, set the Maven property `aem.context.path` during installation.
Expand All @@ -36,7 +42,7 @@ If you are running AEM with a context path, set the Maven property `aem.context.

## Extensions

Starting in version 7.0.0, the Groovy Console provides extension hooks to further customize script execution. The console exposes an API containing three extension provider interfaces that can be implemented as OSGi services in any bundle deployed to an AEM instance. See the default extension providers in the `com.icfolson.aem.groovy.console.extension.impl` package for examples of how a bundle can implement these services to supply additional script bindings, metaclasses, and star imports.
Beginning in version 7.0.0, the Groovy Console provides extension hooks to further customize script execution. The console exposes an API containing three extension provider interfaces that can be implemented as OSGi services in any bundle deployed to an AEM instance. See the default extension providers in the `com.icfolson.aem.groovy.console.extension.impl` package for examples of how a bundle can implement these services to supply additional script bindings, metaclasses, and star imports.

### Notifications

Expand Down
26 changes: 11 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
<parent>
<groupId>com.icfolson.aem</groupId>
<artifactId>aem-parent-uber-jar</artifactId>
<version>6.2.0</version>
<version>6.3.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>com.icfolson.aem.groovy.console</groupId>
<artifactId>aem-groovy-console</artifactId>
<packaging>jar</packaging>
<version>10.1.1</version>
<version>11.0.0</version>
<name>AEM Groovy Console</name>
<description>
The AEM Groovy Console provides an interface for running Groovy scripts in the AEM (Adobe CQ) container. Scripts
can be created to manipulate content in the JCR, call OSGi services, or execute arbitrary code using the AEM,
Sling, or JCR APIs.
The AEM Groovy Console provides an interface for running Groovy scripts in the AEM container. Scripts can be
created to manipulate content in the JCR, call OSGi services, or execute arbitrary code using the AEM, Sling,
or JCR APIs.
</description>

<organization>
Expand Down Expand Up @@ -156,7 +156,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.21.0</version>
<version>1.24.0</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
Expand All @@ -172,7 +172,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.0</version>
<extensions>true</extensions>
<executions>
<execution>
Expand Down Expand Up @@ -381,37 +381,33 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-api</artifactId>
</dependency>

<!-- compile -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
<version>1.9.12</version>
<version>1.12.0</version>
</dependency>

<!-- provided -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.7</version>
<version>2.4.11</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.icfolson.aem.groovy.extension</groupId>
<artifactId>aem-groovy-extension-bundle</artifactId>
<version>3.0.0</version>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>

<!-- test -->
<dependency>
<groupId>com.icfolson.aem.prosper</groupId>
<artifactId>prosper</artifactId>
<version>9.0.1</version>
<version>11.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
7 changes: 7 additions & 0 deletions src/main/content/META-INF/vault/definition/.content.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:vlt="http://www.day.com/jcr/vault/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="vlt:PackageDefinition"
acHandling="merge"
buildCount="1"
requiresRoot="{Boolean}true"/>
3 changes: 3 additions & 0 deletions src/main/content/META-INF/vault/filter.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/groovyconsole/components"/>
<filter root="/apps/groovyconsole/config"/>
<filter root="/apps/groovyconsole/install"/>
<filter root="/apps/groovyconsole/templates"/>
<filter root="/etc/clientlibs/groovyconsole"/>
<filter root="/etc/groovyconsole">
<exclude pattern="/etc/groovyconsole/scripts(/.*)?"/>
<exclude pattern="/etc/groovyconsole/jcr:content/audit(/.*)?"/>
</filter>
<filter root="/home/users/system/groovy-console-system-user"/>
<filter root="/rep:policy"/>
</workspaceFilter>
5 changes: 5 additions & 0 deletions src/main/content/META-INF/vault/nodetypes.cnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<'rep'='internal'>

[rep:RepoAccessControllable]
mixin
+ rep:repoPolicy (rep:Policy) protected ignore
3 changes: 2 additions & 1 deletion src/main/content/META-INF/vault/properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<comment>FileVault Package Properties</comment>
<entry key="createdBy">${aem.username}</entry>
<entry key="name">${project.artifactId}</entry>
<entry key="acHandling">merge</entry>
<entry key="description">${project.description}</entry>
<entry key="lastModified">${timestamp}</entry>
<entry key="lastModifiedBy">${aem.username}</entry>
Expand All @@ -12,7 +13,7 @@
<entry key="version">${project.version}</entry>
<entry key="requiresRoot">true</entry>
<entry key="dependencies" />
<entry key="group" />
<entry key="group">ICF Olson</entry>
<entry key="packageFormatVersion">2</entry>
<entry key="lastWrapped">${timestamp}</entry>
<entry key="lastWrappedBy">${aem.username}</entry>
Expand Down
6 changes: 6 additions & 0 deletions src/main/content/jcr_root/.content.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
jcr:mixinTypes="[rep:AccessControllable,rep:RepoAccessControllable]"
jcr:primaryType="rep:root"
sling:resourceType="sling:redirect"
sling:target="/index.html"/>
8 changes: 8 additions & 0 deletions src/main/content/jcr_root/_rep_policy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
jcr:primaryType="rep:ACL">
<allow
jcr:primaryType="rep:GrantACE"
rep:principalName="groovy-console-system-user"
rep:privileges="{Name}[jcr:all]"/>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ <h4 class="panel-title">
<a data-toggle="collapse" data-parent="#info" href="#about">About</a>
</h4>
</div>
<div id="about" class="panel-collapse collapse">
<div id="about" class="panel-collapse collapse" data-sly-use.about="com.icfolson.aem.groovy.console.components.About">
<div class="panel-body">
<ul>
<li>Inspired by Guillaume Laforge's <a href="http://groovyconsole.appspot.com" target="_blank">Groovy Web Console</a>.</li>
<li>Implemented with <a href="http://www.groovy-lang.org" target="_blank">Groovy</a> version <%= groovy.lang.GroovySystem.getVersion() %> and <a href="http://getbootstrap.com/" target="_blank">Bootstrap</a>.</li>
<li>Implemented with <a href="http://www.groovy-lang.org" target="_blank">Groovy</a> version ${about.version} and <a href="http://getbootstrap.com/" target="_blank">Bootstrap</a>.</li>
<li>Code editing capabilities provided by <a href="http://ace.c9.io/" target="_blank">Ace</a>.</li>
<li>Project hosted on <a href="https://github.com/OlsonDigital/aem-groovy-console" target="_blank">GitHub</a> for <a href="http://www.olsondigital.com" target="_blank">Olson Digital</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<div class="container">
<sly data-sly-include="toolbar.html"></sly>

<div class="panel-group" id="data-group">
<sly data-sly-include="data.html"></sly>
</div>

<div class="alert alert-success" id="message-success" role="alert" style="display: none;">
<span class="message"></span>
</div>
Expand All @@ -11,7 +15,7 @@
<span class="message"></span>
</div>

<div id="editor" class="ace_editor_wrapper"></div>
<div id="script-editor" class="ace_editor_wrapper"></div>

<pre id="stacktrace" class="alert-danger" style="display: none;"></pre>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h4 class="panel-title">
</div>
<div id="builders" class="panel-collapse collapse">
<div class="panel-body">
<p>Additional binding variables are provided for the following builders. The instances named below are available for use in all scripts. <a href="http://groovy.codehaus.org/Builders" target="_blank">Builders</a> use a special syntax to create a structured tree of data (in this case, content in the JCR).</p>
<p>Additional binding variables are provided for the following builders. The instances named below are available for use in all scripts. <a href="http://groovy-lang.org/dsls.html#_builders" target="_blank">Builders</a> use a special syntax to create a structured tree of data (in this case, content in the JCR).</p>
<ul>
<li>nodeBuilder - <span class="muted">Each "node" in the syntax tree corresponds to a Node in the repository. A new Node is created only if there is no existing node for the current name.</span>
<pre>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#data-group" href="#data">Data</a>
</h4>
</div>
<div id="data" class="panel-collapse collapse">
<div class="panel-body">
<p>Editor contents will be added to the script bindings in a variable named <code>data</code>. JSON data will be converted to a map. If data is not valid JSON, the <code>data</code> variable will be a <code>String</code>.</p>

<div id="data-editor" class="ace_editor_wrapper"></div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h4 class="panel-title">
<a data-toggle="collapse" data-parent="#info" href="#imports">Imports</a>
</h4>
</div>
<div id="imports" class="panel-collapse collapse">
<div id="imports" class="panel-collapse collapse" data-sly-use.imports="com.icfolson.aem.groovy.console.components.Imports">
<div class="panel-body">
<p>Additional packages imported into all scripts.</p>
<ul>
Expand All @@ -15,6 +15,7 @@ <h4 class="panel-title">
<li><a href="http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/package-summary.html" target="_blank">javax.jcr</a></li>
<li><a href="http://sling.apache.org/apidocs/sling7/org/apache/sling/api/package-summary.html" target="_blank">org.apache.sling.api</a></li>
<li><a href="http://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/package-summary.html" target="_blank">org.apache.sling.api.resource</a></li>
<li data-sly-repeat.import="${imports.starImports}">${import}</li>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
user.mapping="[aem-groovy-console=groovy-console-system-user]"/>
6 changes: 3 additions & 3 deletions src/main/content/jcr_root/etc/.content.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
jcr:mixinTypes="[rep:AccessControllable]"
jcr:primaryType="sling:Folder"/>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:mixinTypes="[rep:AccessControllable]"
jcr:primaryType="sling:Folder"/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,27 @@ body {
padding-bottom: 30px;
}

#editor {
#script-editor {
position: relative;
height: 400px;
}

#data-editor {
position: relative;
height: 200px;
}

#loader {
display: inline-block;
margin-left: 5px;
visibility: hidden;
}

#data-group {
margin-top: 10px;
margin-bottom: 10px;
}

#message-success, #message-error {
margin-top: 20px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ bootstrap.min.js
bootstrap3-typeahead.min.js
ace.js
mode-groovy.js
mode-json.js
theme-ambiance.js
theme-chaos.js
theme-chrome.js
Expand All @@ -21,7 +22,6 @@ theme-github.js
theme-idle_fingers.js
theme-katzenmilch.js
theme-kr.js
theme-kr_theme.js
theme-kuroir.js
theme-merbivore.js
theme-merbivore_soft.js
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@ GroovyConsole.Audit = function () {
var script = table.row(tr).data().relativePath;

$.getJSON('/bin/groovyconsole/audit.json?script=' + script, function (response) {
editor.getSession().setValue(response.script);
scriptEditor.getSession().setValue(response.script);

if (response.data.length) {
dataEditor.getSession().setValue(response.data);

GroovyConsole.showData();
} else {
GroovyConsole.hideData();
}

GroovyConsole.reset();
GroovyConsole.showResult(response);
Expand Down
Loading

0 comments on commit b9966be

Please sign in to comment.