Hi,
you need to use the two argument createFactoryConfiguration method and
pass in null as the second argument. Without that, this configuration is
automatically bound to the bundle creating the config. WIth specifying
null as the location, it will be picked up by the fs bundle instead and
get bound to it
Regards
Carsten
Sandro Boehme wrote
> Hi,
>
> I would like to create a 'ConfigurationAdmin' 'Configuration' for the
> 'FsResourceProvider' in my code. From my understanding I would do it
> like that:
>
> Configuration fsProviderConfig =
> configurationAdmin.createFactoryConfiguration("org.apache.sling.fsprovider.internal.FsResourceProvider");
>
>
> Dictionary<String, String> fsProviderProps = new Hashtable<>();
> fsProviderProps.put("provider.roots", "/jspm");
> fsProviderProps.put("provider.file", "jspm");
>
> fsProviderConfig.update(fsProviderProps);
>
> But 'FsResourceProvider.activate(BundleContext, Map)' is never called as
> it is when I manually add a configuration in the Configuration Admin
> Console and the new file system resource provider is not visible in the
> repository.
>
> If I look in the Configuration Admin Console there has indeed a
> configuration been created. But it is not listed under 'Apache Sling
> Filesystem Resource Provider' like it probably should be. Instead the
> configuration is listed without a container.
>
> That's why I would guess the pid I use in 'createFactoryConfiguration'
> is wrong. But it's the same one
> 'AbstractBundleInstallMojo.addConfiguration()' is using when the Sling
> Maven Plugin is doing the mount.
>
> Does anyone have an idea what I should do differently?
> Any hints are much appreciated!
>
> Thanks,
>
> Sandro
>
--
Carsten Ziegeler
Adobe Research Switzerland
[email protected]