This project will help you learn Kotlin programming language. You will find examples of common AEM developer tasks all written in both Java and Kotlin.
Local AEM author 6.5.8 instance running on http://localhost:4502
(*) Can be changed in instance.local-author.httpUrl prop in gradle.user.properties
Put cq-quickstart-6.5.0.jar, license.properties, aem-service-pkg-6.5.8.zip
inside <project_root>/instance/ folder and run gradlew instanceUp.
G.A.P. will create and start AEM author instance for you (this will take a few minutes).
Set true on instance.local-publish.enabled prop in gradle.user.properties
If you like to run it just type gradlew from root folder or use provided package deploy build for IntelliJ IDE
(*) Build is checking if org.apache.sling.api ver. 2.22.0 is available on the instance to ensure deployment on AEM 6.5.8
this can be disabled in build.gradle.kts
-
SimpleServiceJava | Kotlin
OSGi@ComponentandService(all in one class) with (static final fieldin Java /companion object- in Kotlin). -
SimpleServletJava | Kotlin
OSGi@ComponentandSling Servletwithdependency injectionto another service.
You can test both servlets on:
http://localhost:4502/bin/java/hello
http://localhost:4502/bin/kotlin/hello -
ConfigurableServiceJava | Kotlin
Serviceinterfacedefinition. -
ConfigurableServiceImplJava | Kotlin
OSGi component that can be configured inAdobe Experience Manager Web Console Configuration.
Use of@ObjectClassDefinition,@AttributeDefinitionand service implementation.
Compare how to transformArraytoMapwithStream APIin Java andClosuresin Kotlin. -
ComponentDecoratorFilterJava | Kotlin
OSGi component and basic implementation ofjavax.servlet.Filter -
ComponentDecoratorProcessorJava | Kotlin
Class used by ComponentDecoratorFilter to replace markup text with some other text. Compare howfinal fieldsare defined,casting.
Meetelvis operatorandfields definition directly in constructorwhen writing in Kotlin. -
SampleModelJava | Kotlin
SimpleSling Modelwith property and serviceinjection. Learn how to inject primitive types in Kotlin. -
Sample Componentpath
Sample Component with Touch UI config dialog. Add selectorjavaorkotlinand switch fromJSPtoHTLwith different model implementations. Links: Java | Kotlin
- 6.5.8 - Project recreated for the newer GAP | migrated to AEM 6.5.8
- 1.0.1 - GAP and Gradle updated | build scripts migrated to Kotlin DSL | AEM 6.3
- 1.0.0 - Initial version from 2018 | build scripts in Groovy DSL | AEM 6.3
