Skip to content

Commit

Permalink
Merge branch 'release/12.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
markdaugherty committed Jun 15, 2018
2 parents 21e3a7d + 486e75d commit 4aea8b3
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 145 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ The AEM Groovy Console provides an interface for running [Groovy](http://www.gro

## Compatibility

**AEM 6.4 Beta users**: the latest development version (`12.0.0-SNAPSHOT`) is compatible with AEM 6.4. You will need to clone this repository and build with Maven to install (see [Building From Source](#building-from-source)). The Groovy Console will have a proper downloadable release when the non-beta AEM 6.4 is officially released.

Groovy Console Version(s) | AEM Version
------------ | -------------
11.x.x | 6.3
Expand All @@ -34,6 +36,12 @@ Additional build profiles may be added in the project's `pom.xml` to support dep

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.

## Building From Source

To build and install the latest development version of the Groovy Console (or if you've made source modifications), run the following Maven command.

mvn install -P local

## 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.
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<parent>
<groupId>com.icfolson.aem</groupId>
<artifactId>aem-parent-uber-jar</artifactId>
<version>6.3.1.1</version>
<version>6.3.1.2</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>com.icfolson.aem.groovy.console</groupId>
<artifactId>aem-groovy-console</artifactId>
<packaging>jar</packaging>
<version>11.3.0</version>
<version>12.0.0</version>
<name>AEM Groovy Console</name>
<description>
The AEM Groovy Console provides an interface for running Groovy scripts in the AEM container. Scripts can be
Expand Down Expand Up @@ -124,7 +124,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<version>3.7.0</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<source>1.8</source>
Expand Down Expand Up @@ -240,7 +240,7 @@
<plugin>
<groupId>com.icfolson.maven.plugins</groupId>
<artifactId>aem-package-maven-plugin</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -261,7 +261,7 @@
<plugin>
<groupId>com.icfolson.maven.plugins</groupId>
<artifactId>osgi-bundle-status-maven-plugin</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
<executions>
<execution>
<id>status-author</id>
Expand Down Expand Up @@ -403,7 +403,7 @@
<dependency>
<groupId>com.icfolson.aem.groovy.extension</groupId>
<artifactId>aem-groovy-extension-bundle</artifactId>
<version>4.0.0</version>
<version>5.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ <h4 class="panel-title">
<div class="panel-body">
<p>The binding variables listed below are available for use in all scripts.</p>
<ul>
<li>session - <a href="http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Session.html" target="_blank">javax.jcr.Session</a></li>
<li>pageManager - <a href="http://dev.day.com/content/docs/en/cq/current/javadoc/com/day/cq/wcm/api/PageManager.html" target="_blank">com.day.cq.wcm.api.PageManager</a></li>
<li>resourceResolver - <a href="http://sling.apache.org/apidocs/sling5/org/apache/sling/api/resource/ResourceResolver.html" target="_blank">org.apache.sling.api.resource.ResourceResolver</a></li>
<li>slingRequest - <a href="http://sling.apache.org/apidocs/sling5/org/apache/sling/api/SlingHttpServletRequest.html" target="_blank">org.apache.sling.api.SlingHttpServletRequest</a></li>
<li>queryBuilder - <a href="http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/search/QueryBuilder.html" target="_blank">com.day.cq.search.QueryBuilder</a></li>
<li>session - <a href="https://docs.adobe.com/docs/en/spec/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html" target="_blank">javax.jcr.Session</a></li>
<li>pageManager - com.day.cq.wcm.api.PageManager</li>
<li>resourceResolver - <a href="https://sling.apache.org/apidocs/sling10/org/apache/sling/api/resource/ResourceResolver.html" target="_blank">org.apache.sling.api.resource.ResourceResolver</a></li>
<li>slingRequest - <a href="https://sling.apache.org/apidocs/sling10/org/apache/sling/api/SlingHttpServletRequest.html" target="_blank">org.apache.sling.api.SlingHttpServletRequest</a></li>
<li>queryBuilder - <a href="https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc/com/day/cq/search/QueryBuilder.html" target="_blank">com.day.cq.search.QueryBuilder</a></li>
<li>bundleContext - <a href="http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html" target="_blank">org.osgi.framework.BundleContext</a></li>
<li>log - <a href="http://www.slf4j.org/api/org/slf4j/Logger.html" target="_blank">org.slf4j.Logger</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ <h4 class="panel-title">
<li>activate(String path, ReplicationOptions options) - <span class="muted">Activate the node at the given path with supplied options.</span></li>
<li>deactivate(String path) - <span class="muted">Deactivate the node at the given path.</span></li>
<li>deactivate(String path, ReplicationOptions options) - <span class="muted">Deactivate the node at the given path with supplied options.</span></li>
<li>doWhileDisabled(String componentClassName, Closure closure) - <span class="muted">Execute the provided closure while the specified OSGi component is disabled.</span></li>
<li>createQuery(Map predicates) - <span class="muted">Create a <a href="http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/search/Query.html" target="_blank">Query</a> instance from the <a href="http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/search/QueryBuilder.html" target="_blank">QueryBuilder</a> for the current JCR session.</span></li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.icfolson.aem.groovy.console.audit
import com.day.text.Text
import com.icfolson.aem.groovy.console.response.RunScriptResponse
import groovy.transform.ToString
import org.apache.sling.api.resource.Resource

import javax.jcr.Node

Expand All @@ -25,7 +26,7 @@ class AuditRecord {

private static final Integer DEPTH_USER_ID = 5

private Node node
private Resource resource

@Delegate
final RunScriptResponse response
Expand All @@ -34,16 +35,16 @@ class AuditRecord {

final Calendar date

AuditRecord(Node node) {
this.node = node
AuditRecord(Resource resource) {
this.resource = resource

path = node.path
date = node.getProperty(JCR_CREATED).date
response = RunScriptResponse.fromAuditRecordNode(node)
path = resource.path
date = resource.valueMap.get(JCR_CREATED, Calendar)
response = RunScriptResponse.fromAuditRecordResource(resource)
}

String getUserId() {
node.getAncestor(DEPTH_USER_ID).name
resource.adaptTo(Node).getAncestor(DEPTH_USER_ID).name
}

String getRelativePath() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.icfolson.aem.groovy.console.audit

import com.icfolson.aem.groovy.console.response.RunScriptResponse
import org.apache.sling.api.resource.PersistenceException

import javax.jcr.RepositoryException
import javax.jcr.Session
Expand All @@ -13,35 +14,36 @@ interface AuditService {
* @param session request session for the user executing the script
* @param response response containing execution result or exception
* @throws RepositoryException if error occurs creating audit record
* @throws PersistenceException if error occurs creating audit record
*/
AuditRecord createAuditRecord(Session session, RunScriptResponse response) throws RepositoryException
AuditRecord createAuditRecord(Session session,
RunScriptResponse response) throws RepositoryException, PersistenceException

/**
* Delete all audit records.
*
* @param session request session, only audit records for the current user will be deleted
* @throws RepositoryException if an error occurs while deleting audit nodes
* @throws PersistenceException if an error occurs while deleting audit resources
*/
void deleteAllAuditRecords(Session session) throws RepositoryException
void deleteAllAuditRecords(Session session) throws PersistenceException

/**
* Delete an audit record.
*
* @param session request session, only audit records for the current user will be deleted
* @param userId user that owns the audit record
* @param relativePath relative path to audit record from parent audit node
* @throws RepositoryException if an error occurs while deleting the audit record node
* @param relativePath relative path to audit record from parent audit resource
* @throws PersistenceException if an error occurs while deleting the audit record resource
*/
void deleteAuditRecord(Session session, String userId, String relativePath) throws RepositoryException
void deleteAuditRecord(Session session, String userId, String relativePath) throws PersistenceException

/**
* Get all audit records.
*
* @param session request session, only audit records for the current user will be retrieved
* @return all audit records
* @throws RepositoryException if error occurs getting audit records
*/
List<AuditRecord> getAllAuditRecords(Session session) throws RepositoryException
List<AuditRecord> getAllAuditRecords(Session session)

/**
* Get the audit record at the given relative path.
Expand All @@ -50,9 +52,8 @@ interface AuditService {
* @param userId user that owns the audit record
* @param relativePath relative path to audit record from parent audit node
* @return audit record or null if none exists
* @throws RepositoryException if error occurs getting audit record
*/
AuditRecord getAuditRecord(Session session, String userId, String relativePath) throws RepositoryException
AuditRecord getAuditRecord(Session session, String userId, String relativePath)

/**
* Get a list of audit records for the given date range.
Expand All @@ -61,7 +62,6 @@ interface AuditService {
* @param startDate start date
* @param endDate end date
* @return list of audit records in the given date range
* @throws RepositoryException if error occurs getting audit records
*/
List<AuditRecord> getAuditRecords(Session session, Calendar startDate, Calendar endDate) throws RepositoryException
List<AuditRecord> getAuditRecords(Session session, Calendar startDate, Calendar endDate)
}
Loading

0 comments on commit 4aea8b3

Please sign in to comment.