RE: Need help in implementing Sling Context Aware Configuration

2016-11-17 Thread Stefan Seifert
you do not need org.apache.sling.caconfig.bnd-plugin as direct reference in 
your - it's only useful as dependency for maven-bundle-plugin or other tooling 
that used bnd to generate the OSGi SCR metadata, see [1] as an example.

but this should not be the source of your problem - did you deploy the bundles 
org.apache.sling.caconfig.impl, org.apache.sling.caconfig.api, 
org.apache.sling.caconfig.spi to your application instance, and are they 
running (check OSGi console)?

if yes, can you give us the full stack trace?

stefan


[1] 
http://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration.html#context-aware-configuration-bnd-plugin


>-Original Message-
>From: Gopal Agarwal [mailto:gagar...@adobe.com]
>Sent: Thursday, November 17, 2016 4:00 PM
>To: users@sling.apache.org
>Subject: Need help in implementing Sling Context Aware Configuration
>
>Hi,
>
>I am looking to use Sling Context Aware Configuration.
>https://sling.apache.org/documentation/bundles/context-aware-
>configuration/context-aware-configuration.html
>
>I have added these in the POM file
>
>org.apache.sling
>org.apache.sling.caconfig.impl
>1.0.0
>
>
>org.apache.sling
>org.apache.sling.caconfig.api
>1.0.0
>
>
>org.apache.sling
>org.apache.sling.caconfig.spi
>1.0.0
>
>
>org.apache.sling
>org.apache.sling.caconfig.bnd-
>plugin
>1.0.0
>
>
>
>Java code
>ResourceResolver resourceResolver = request.getResourceResolver();
>Resource contentResource = (Resource)
>resourceResolver.getResource("/content/ubi/test");
>ValueMap props =
>contentResource.adaptTo(ConfigurationBuilder.class).asValueMap();
>String param1 = props.get("param1", String.class);
>
>Issue:
>ConfigurationBuilder Class is not getting resolved.
>
>Am I missing something?  Any help is appreciated..
>
>
>Regards,
>Gopal
>




Need help in implementing Sling Context Aware Configuration

2016-11-17 Thread Gopal Agarwal
Hi,

I am looking to use Sling Context Aware Configuration.
https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration.html

I have added these in the POM file

org.apache.sling
org.apache.sling.caconfig.impl
1.0.0


org.apache.sling
org.apache.sling.caconfig.api
1.0.0


org.apache.sling
org.apache.sling.caconfig.spi
1.0.0


org.apache.sling
org.apache.sling.caconfig.bnd-plugin
1.0.0



Java code
ResourceResolver resourceResolver = request.getResourceResolver();
Resource contentResource = (Resource) 
resourceResolver.getResource("/content/ubi/test");
ValueMap props = 
contentResource.adaptTo(ConfigurationBuilder.class).asValueMap();
String param1 = props.get("param1", String.class);

Issue:
ConfigurationBuilder Class is not getting resolved.

Am I missing something?  Any help is appreciated..


Regards,
Gopal