├── bundle
└── src
│ ├── test
│ ├── java
│ │ └── .gitignore
│ └── resources
│ │ └── Script.groovy
│ └── main
│ ├── resources
│ ├── email-fail.template
│ └── email-success.template
│ ├── groovy
│ └── org
│ │ └── cid15
│ │ └── aem
│ │ └── groovy
│ │ └── console
│ │ ├── response
│ │ ├── SaveScriptResponse.groovy
│ │ ├── impl
│ │ │ └── DefaultSaveScriptResponse.groovy
│ │ └── RunScriptResponse.groovy
│ │ ├── components
│ │ ├── AboutPanel.groovy
│ │ ├── Scheduler.groovy
│ │ ├── ImportsPanel.groovy
│ │ ├── ActiveJobsPanel.groovy
│ │ ├── HistoryPanel.groovy
│ │ ├── BindingsPanel.groovy
│ │ └── Body.groovy
│ │ ├── api
│ │ ├── context
│ │ │ ├── JobScriptContext.groovy
│ │ │ ├── ScriptData.groovy
│ │ │ ├── ServletScriptContext.groovy
│ │ │ └── ScriptContext.groovy
│ │ ├── StarImportExtensionProvider.groovy
│ │ ├── CompilationCustomizerExtensionProvider.groovy
│ │ ├── ScriptMetaClassExtensionProvider.groovy
│ │ ├── BindingExtensionProvider.groovy
│ │ ├── impl
│ │ │ ├── ScheduledJobScriptContext.groovy
│ │ │ ├── RequestScriptData.groovy
│ │ │ └── RequestScriptContext.groovy
│ │ ├── ActiveJob.groovy
│ │ ├── StarImport.groovy
│ │ ├── BindingVariable.groovy
│ │ └── JobProperties.groovy
│ │ ├── notification
│ │ ├── NotificationService.groovy
│ │ └── EmailNotificationService.groovy
│ │ ├── servlets
│ │ ├── AbstractJsonResponseServlet.groovy
│ │ ├── ScriptSavingServlet.groovy
│ │ └── ScriptDownloadServlet.groovy
│ │ ├── utils
│ │ └── GroovyScriptUtils.groovy
│ │ ├── extension
│ │ ├── ExtensionService.groovy
│ │ └── impl
│ │ │ └── DefaultStarImportExtensionProvider.groovy
│ │ ├── table
│ │ └── Table.groovy
│ │ ├── GroovyConsoleService.groovy
│ │ ├── audit
│ │ ├── AuditRecord.groovy
│ │ └── AuditService.groovy
│ │ ├── job
│ │ ├── event
│ │ │ ├── impl
│ │ │ │ └── DefaultGroovyConsoleEmailNotificationEventHandler.groovy
│ │ │ └── AbstractGroovyConsoleScheduledJobEventHandler.groovy
│ │ └── consumer
│ │ │ └── GroovyConsoleScheduledJobConsumer.groovy
│ │ ├── configuration
│ │ ├── ConfigurationService.groovy
│ │ └── impl
│ │ │ └── DefaultConfigurationService.groovy
│ │ └── constants
│ │ └── GroovyConsoleConstants.groovy
│ └── java
│ └── org
│ └── cid15
│ └── aem
│ └── groovy
│ └── console
│ └── configuration
│ └── impl
│ └── ConfigurationServiceProperties.java
├── src
└── site
│ └── screenshot.png
├── .gitignore
├── ui.apps
├── src
│ └── main
│ │ └── content
│ │ ├── jcr_root
│ │ └── apps
│ │ │ └── groovyconsole
│ │ │ ├── clientlibs
│ │ │ ├── css.txt
│ │ │ ├── resources
│ │ │ │ ├── img
│ │ │ │ │ ├── sort_asc.png
│ │ │ │ │ ├── sort_both.png
│ │ │ │ │ ├── sort_desc.png
│ │ │ │ │ ├── ajax-loader.gif
│ │ │ │ │ ├── sort_asc_disabled.png
│ │ │ │ │ └── sort_desc_disabled.png
│ │ │ │ └── fonts
│ │ │ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ │ │ └── glyphicons-halflings-regular.woff2
│ │ │ ├── .content.xml
│ │ │ ├── js
│ │ │ │ ├── services.js
│ │ │ │ ├── theme-gruvbox.js
│ │ │ │ ├── theme-kuroir.js
│ │ │ │ ├── theme-xcode.js
│ │ │ │ ├── theme-clouds.js
│ │ │ │ ├── theme-nord_dark.js
│ │ │ │ ├── theme-eclipse.js
│ │ │ │ ├── theme-solarized_dark.js
│ │ │ │ ├── theme-vibrant_ink.js
│ │ │ │ ├── theme-merbivore.js
│ │ │ │ ├── theme-github.js
│ │ │ │ ├── theme-solarized_light.js
│ │ │ │ ├── theme-idle_fingers.js
│ │ │ │ ├── theme-dawn.js
│ │ │ │ ├── theme-kr_theme.js
│ │ │ │ ├── local-storage.js
│ │ │ │ ├── theme-monokai.js
│ │ │ │ ├── theme-clouds_midnight.js
│ │ │ │ ├── theme-merbivore_soft.js
│ │ │ │ ├── theme-cobalt.js
│ │ │ │ ├── theme-gob.js
│ │ │ │ ├── theme-twilight.js
│ │ │ │ ├── theme-tomorrow.js
│ │ │ │ ├── theme-pastel_on_dark.js
│ │ │ │ ├── theme-dracula.js
│ │ │ │ ├── theme-mono_industrial.js
│ │ │ │ ├── theme-textmate.js
│ │ │ │ ├── theme-tomorrow_night.js
│ │ │ │ ├── theme-chrome.js
│ │ │ │ └── theme-crimson_editor.js
│ │ │ ├── js.txt
│ │ │ └── css
│ │ │ │ └── console.css
│ │ │ ├── components
│ │ │ ├── .content.xml
│ │ │ └── console
│ │ │ │ ├── head.html
│ │ │ │ ├── .content.xml
│ │ │ │ ├── headlibs.html
│ │ │ │ ├── enhancements.html
│ │ │ │ ├── data.html
│ │ │ │ ├── imports.html
│ │ │ │ ├── bindings.html
│ │ │ │ ├── active-jobs.html
│ │ │ │ ├── opendialog.xml
│ │ │ │ ├── about.html
│ │ │ │ ├── scheduled-jobs.html
│ │ │ │ ├── toolbar.html
│ │ │ │ ├── savedialog.xml
│ │ │ │ ├── body.html
│ │ │ │ ├── history.html
│ │ │ │ └── builders.html
│ │ │ ├── templates
│ │ │ ├── .content.xml
│ │ │ └── console
│ │ │ │ └── .content.xml
│ │ │ └── .content.xml
│ │ └── META-INF
│ │ └── vault
│ │ └── filter.xml
└── pom.xml
├── all
└── src
│ └── main
│ └── content
│ └── META-INF
│ └── vault
│ └── filter.xml
├── ui.config
├── src
│ └── main
│ │ └── content
│ │ ├── META-INF
│ │ └── vault
│ │ │ └── filter.xml
│ │ └── jcr_root
│ │ └── apps
│ │ └── groovyconsole
│ │ └── osgiconfig
│ │ └── config
│ │ ├── org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-groovy-console.xml
│ │ └── org.apache.sling.jcr.repoinit.RepositoryInitializer-groovyconsole.config
└── pom.xml
├── ui.content
├── src
│ └── main
│ │ └── content
│ │ ├── META-INF
│ │ └── vault
│ │ │ └── filter.xml
│ │ └── jcr_root
│ │ └── var
│ │ └── groovyconsole
│ │ ├── .content.xml
│ │ └── scripts
│ │ ├── samples
│ │ ├── FindPagesWithProperty.groovy
│ │ ├── DeleteOsgiConfigurations.groovy
│ │ ├── FindPagesWithTemplate.groovy
│ │ ├── ListTemplates.groovy
│ │ ├── .content.xml
│ │ ├── UpdatePageTitles.groovy
│ │ ├── FulltextQuery.groovy
│ │ ├── FindReferences.groovy
│ │ ├── UpdateOsgiConfiguration.groovy
│ │ ├── JcrSearch.groovy
│ │ ├── FindOrphanedComponents.groovy
│ │ ├── CreateOsgiConfigurations.groovy
│ │ └── CreatePackage.groovy
│ │ └── .content.xml
└── pom.xml
├── LICENSE
├── .github
└── workflows
│ └── maven.yml
└── ui.apps.structure
└── pom.xml
/bundle/src/test/java/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/bundle/src/test/resources/Script.groovy:
--------------------------------------------------------------------------------
1 | println "BEER"
--------------------------------------------------------------------------------
/src/site/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CID15/aem-groovy-console/HEAD/src/site/screenshot.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .idea
3 | *.iml
4 | *.iws
5 | .project
6 | .metadata
7 | .classpath
8 | .settings/
9 | target/
--------------------------------------------------------------------------------
/ui.apps/src/main/content/jcr_root/apps/groovyconsole/clientlibs/css.txt:
--------------------------------------------------------------------------------
1 | #base=css
2 |
3 | bootstrap.css
4 | bootstrap-theme.css
5 | daterangepicker.css
6 | datatables.css
7 | console.css
--------------------------------------------------------------------------------
/ui.apps/src/main/content/META-INF/vault/filter.xml:
--------------------------------------------------------------------------------
1 |
2 |
Script executed by $username on $timestamp.
2 |$script4 |
$stackTrace-------------------------------------------------------------------------------- /ui.apps/src/main/content/jcr_root/apps/groovyconsole/components/.content.xml: -------------------------------------------------------------------------------- 1 | 2 |
Script executed by $username on $timestamp.
2 |$script<% 4 | if (result) { 5 | out << "
${result}"
7 | }
8 |
9 | if (output) {
10 | out << "${output}"
12 | }
13 | %>$runningTime-------------------------------------------------------------------------------- /ui.config/src/main/content/jcr_root/apps/groovyconsole/osgiconfig/config/org.apache.sling.jcr.repoinit.RepositoryInitializer-groovyconsole.config: -------------------------------------------------------------------------------- 1 | scripts=[ 2 | " 3 | create path /var/groovyconsole/audit(sling:Folder) 4 | 5 | create service user aem-groovy-console-service with path system/aem-groovy-console 6 | set ACL for aem-groovy-console-service 7 | allow jcr:all on / 8 | allow jcr:all on /var/groovyconsole/audit 9 | end 10 | "] 11 | -------------------------------------------------------------------------------- /ui.apps/src/main/content/jcr_root/apps/groovyconsole/components/console/.content.xml: -------------------------------------------------------------------------------- 1 | 2 |
Script metaclass.
7 | */
8 | interface ScriptMetaClassExtensionProvider {
9 |
10 | /**
11 | * Get a closure to register a metaclass for the script to be executed.
12 | *
13 | * @param scriptContext current script execution context
14 | * @return a closure containing metamethods to register for scripts
15 | */
16 | Closure getScriptMetaClass(ScriptContext scriptContext)
17 | }
18 |
--------------------------------------------------------------------------------
/bundle/src/main/groovy/org/cid15/aem/groovy/console/api/context/ScriptData.groovy:
--------------------------------------------------------------------------------
1 | package org.cid15.aem.groovy.console.api.context
2 |
3 | import org.apache.sling.api.resource.ResourceResolver
4 |
5 | /**
6 | * Script data for saving scripts.
7 | */
8 | interface ScriptData {
9 |
10 | /**
11 | * Resource resolver for saving scripts.
12 | *
13 | * @return resource resolver
14 | */
15 | ResourceResolver getResourceResolver()
16 |
17 | /**
18 | * File name to be saved.
19 | *
20 | * @return file name
21 | */
22 | String getFileName()
23 |
24 | /**
25 | * Script content to be saved.
26 | *
27 | * @return script content
28 | */
29 | String getScript()
30 | }
--------------------------------------------------------------------------------
/bundle/src/main/groovy/org/cid15/aem/groovy/console/api/context/ServletScriptContext.groovy:
--------------------------------------------------------------------------------
1 | package org.cid15.aem.groovy.console.api.context
2 |
3 | import org.apache.sling.api.SlingHttpServletRequest
4 | import org.apache.sling.api.SlingHttpServletResponse
5 |
6 | /**
7 | * Script context for scripts executed by a servlet (e.g. the default POST servlet execution).
8 | */
9 | interface ServletScriptContext extends ScriptContext {
10 |
11 | /**
12 | * Get the servlet request.
13 | *
14 | * @return request
15 | */
16 | SlingHttpServletRequest getRequest()
17 |
18 | /**
19 | * Get the servlet response.
20 | *
21 | * @return response
22 | */
23 | SlingHttpServletResponse getResponse()
24 | }
--------------------------------------------------------------------------------
/ui.apps/src/main/content/jcr_root/apps/groovyconsole/components/console/enhancements.html:
--------------------------------------------------------------------------------
1 | See the AEM Groovy Extension documentation here for details on registered metaclasses.
10 |Editor contents will be added to the script bindings in a variable named data. JSON data will be converted to a map. If data is not valid JSON, the data variable will be of type String.
Additional packages imported into all scripts.
10 |The binding variables listed below are available for use in all scripts.
10 || ID | 9 |Start Time | 10 |Title | 11 |Description | 12 |Script | 13 |
|---|---|---|---|---|
| ${job.id} | 18 |${job.formattedStartTime} | 19 |${job.title} | 20 |${job.description} | 21 |${job.script} | 22 |
| 18 | | 19 | | Title | 20 |Description | 21 |Script | 22 |Cron Expression | 23 |Next Execution | 24 |25 | |
|---|
| 40 | | 41 | | Date | 42 |Job Title | 43 |Script | 44 |45 | | 46 | |
|---|
Additional binding variables are provided for the following builders. The instances named below are available for use in all scripts. Builders use a special syntax to create a structured tree of data (in this case, content in the JCR).
10 |
13 | nodeBuilder.etc {
14 | satirists("sling:Folder") {
15 | bierce(firstName: "Ambrose", lastName: "Bierce", birthDate: Calendar.instance.updated(year: 1842, month: 5, date: 24))
16 | mencken(firstName: "H.L.", lastName: "Mencken", birthDate: Calendar.instance.updated(year: 1880, month: 8, date: 12))
17 | other("sling:Folder", "jcr:title": "Other")
18 | }
19 | }
20 |
28 | pageBuilder.content {
29 | beer {
30 | styles("Styles") {
31 | "jcr:content"("jcr:lastModifiedBy": "me", "jcr:lastModified": Calendar.instance) {
32 | data("sling:Folder")
33 | }
34 | dubbel("Dubbel")
35 | tripel("Tripel")
36 | saison("Saison")
37 | }
38 | breweries("Breweries", "jcr:lastModifiedBy": "me", "jcr:lastModified": Calendar.instance)
39 | }
40 | }
41 |