Thank Marius, I didn't know this interface and it works well (event though my bundle seems to start twice by itself but the second time it works so it's ok).
Regarding the changes not save, I used ResourceResolver.commit instead of Session.save() and it works. Thank you! Best regards, Guillaume On Tue, Feb 23, 2016 at 12:17 PM, Marius Petria <[email protected]> wrote: > > > > > > On 2/23/16, 12:51 PM, "Guillaume Lucazeau" <[email protected]> wrote: > > >The second issue is that my service needs access to an administrative > >session for this ordering. I mapped it to the admin user with > >ServiceUserMapperImpl.amended in sling:OsgiConfig nodes, however this > >configuration is fired after the bundle has started. Which means that my > >service fails because no mapping is found at the time it's started, and I > >have to manually restart it to execute this code. > > > >Is there a possibility to fire this configuration before the bundle start? > >I've looked at priorities but didn't manage to make it work. > > You can use the ServiceUserMapped interface to wait until your > configuration is registered. An OSGI service is registered for each mapping. > > @Reference(target="(subServiceName=mySubService)”) > ServiceUserMapped serviceUserMapped; > > > > [1] > https://github.com/apache/sling/blob/7c4a53755aed1211c9af313a3973cd2543a7bbe0/bundles/extensions/serviceusermapper/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapped.java >
