Given a hierarchy of CAC configurations defined at multiple levels, for example:
/content
/en
+{CAC1}
/animals
/dogs
+{CAC2}
/hound
/bloodhound
/dachshund
/poodle
/cats
/de
Suppose that I have the resource for `bloodhound` and then I do:
ConfigurationBuilder builder = resource.adaptTo(ConfigurationBuilder.class);
myConfig = builder.as(MyConfig.class);
I can access the configuration properties as needed, but how to get the path where the actual configuration is defined which in this case would be path of CAC2 i.e. /content/en/animals/dogs?
I tried something like:
@Reference
private ConfigurationResourceResolver configResourceResolver;
...
String contextPath = configResourceResolver.getContextPath(resource);
but contextPath always returns /content/en/animals/dogs/hound/bloodhound and NOT /content/en/animals/dogs which is what is required for my use case.
I have also tried
realContextPath = configResourceResolver.getResource(resource, "sling:configs", MyConfig.class.getName())
but this always returns null.
Is there a way to do it via the API?
Note: I'm using caconfig with the wcm.io editor and extras.