Sling Context-Aware configuration (part 3): using a UI

In the last post I gave you a small tour how you can create your context-aware configuration. And you always used CRXDE Lite to do changes on your configuration. Which is ok for testing and during development, but as this configuration is made to be changed (otherwise we might have put it into OSGI, do you remember?), we need to provide a better way to do it. Something suited also for less-technical users.

Steffen Seifert (of the Adobe partner Pro!Vision) started the project wcm.io and contributed there a lot of interesting stuff and extensions for AEM. And they also developed an editor for CA-Config (http://wcm.io/caconfig/editor/index.html).

Ok, so let’s use it. The integration is very simple:

  • Add the dependency to the io.wcm.caconfig.editor.page package and add it as subpackage to your ui.apps package.
  • Add a static template which uses “wcm-io/caconfig/editor/components/page/editor” as resourceType.
  • And use this template.

(I added these steps to my github example code at https://github.com/joerghoh/cqdump/tree/master/ca-config-example).

When you open this page at /content/ca-config/en/configuration.html, you see all available configurations for this bucket and when you click on the configuration you can edit it (including saving back to the correct location in the repository).

 

 

 

 

Cases like “the user does not have the permission to write this configuration” are also handled gracefully.

So the WCM.io configuration editor gives you a nice way to let users edit configuration without using CRXDE Light.

In the next blog post I want to introduce configuration inheritance which can help you to reduce the amount of configuration work.

4 thoughts on “Sling Context-Aware configuration (part 3): using a UI

    1. Jörg Post author

      Please see the response above and check if it helps in your case as well.

  1. Akash Ramchandani

    Hi Jörg, Thanks for sharing the article. Its really helpful.

    I need bit of your help on this. I tried all the steps mentioned in this article to set up wcm io, but my configuration page is not showing configured values. Below is what i did to set this up in my project.
    1) I have used io.wcm.caconfig.editor.package-1.3.0.zip package.
    2) I am using existing configuration template available at this path /apps/wcm-io/caconfig/editor-package/templates/editor
    3) The resource type of my configuration page is wcm-io/caconfig/editor/components/page/editor
    4) I am using appropriate dependency org.apache.sling:org.apache.sling.caconfig.api:1.1.0

    5) Below is my configuration class
    class @Configuration(label=" Global Configuration")
    public @interface GlobalConifguration {

    @Property(label="Dam Notification Folder")
    String damNotificationURL() default "/content/dam/test";
    }

    6) My content page has property sling:configRef with value as /conf/project/content
    7) I have created appropriate configuration node as com.project.GlobalConifguration at /conf/project/content/sling:configs with value of property damNotificationURL as /content/dam/test
    8) Have created configuration page at path /content/project using wcm.io context aware configuration editor template.

    However, the configuration page is not listing any configurations. It is also not enabling the Add button.
    Tried debugging it using http://localhost:4502/system/console/slingcaconfig and i could see my /content/project is resolving to correct configuration and listing the apprpriate property damNotificationURL as /content/dam/test.

    Any idea what i could be doing wrong which could lead in not listing my configuration in the wcm io page? Anything missed by me to set up this project? Any service user configuration that i need to do? Or any specific permission needed.

    Thanks for your help in advance

Comments are closed.