Hi Charles,
1/ the pid is not correct: it's the OSGi one, not the Felix one that you
have to get
2/ you have a service with the ID, not a service.pid
3/ Why don't you get the ConfigAdmin service using Blueprint:
<reference id="configurationAdmin"
interface="org.osgi.service.cm.ConfigurationAdmin"/>
and after inject in your bean
<property name="configAdmin" ref="configurationAdmin"/>
4/ You can get the ConfigAdmin service programmaticaly using
bundleContext.getServiceReferences(null, filter).
Anyway, the "encoded" approach doesn't look good to me.
What you want to achieve exactly ?
By the way, I created a Jira to have something more generic: a
ConfigAdmin interceptor/adapter that check if the value contains {CRYPT}
as prefix/suffix and unencode it in that case.
Regards
JB
On 12/19/2012 05:32 PM, Charles Moulliard wrote:
Hi,
Using PoJoSr and extending the example that we have as unit test for
jaas/jasypt, I try to retrieve a OSGI Config Admin service registered
using blueprint under the key encryptConfig
<cm:property-placeholder persistent-id="encryptConfig"
update-strategy="reload" >
<cm:default-properties>
<cm:property name="encoded" value="ENC(${foo})"/>
</cm:default-properties>
</cm:property-placeholder>
Java code
ConfigurationAdmin configAdmin =
getOsgiService(ConfigurationAdmin.class,
"(service.pid=org.apache.felix.cm.ConfigurationAdmin)"); // THERE IS AN
OBJECT IN DEBUG MODE
Configuration[] configs =
configAdmin.listConfigurations("(service.pid=encryptConfig)");
When I execute the following code, the Configuration[] object is null
Can someone tell me what is wrong in my code ?
Regards,
--
Charles Moulliard
Apache Committer / Sr. Enterprise Architect (RedHat)
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com