Re: Discuss SLING-4312: Register an osgi service for each available service user
I think that's slightly nicer - but I guess either way works. I changed it as you suggested. On a slightly related topic, looking more closely to the ServiceUserMapperImpl I see that there are several levels of fallback for service user resolution (fallback to bundle default, or to global default). While this offers a lot of flexibility, to me it feels a bit strange in the context of a security feature. If defaults are set, it can happen (especially at startup) that code is executed using different serviceUsers, e.g. a component can execute using the bundle default or global default until its specific subService is available, and it can be easily imagined how this can cause subtle errors. Right, I guess we have not thought about it initially and simply assumed that all users are properly setup anyway. I wouldn't mind removing the fallbacks - although that is an incompatible change. But let's open an issue for that. I created [1] to discuss and track this. For this issue, I haven't seen any strong objection, so let's move on and get it done. OK, the code landed in revision 1662665. Marius [1] https://issues.apache.org/jira/browse/SLING-4461
Re: Discuss SLING-4312: Register an osgi service for each available service user
Am 26.02.15 um 01:53 schrieb Marius Petria: If the sub service name is not set, the service reg property is not set, the target is then target=(!(subServiceName=*)) Carsten, you are suggesting that is mapping.subServiceName == null then I should not put the property in the service reg. I added a property with empty string but I can do it as you suggest and drop the property altogether if it is null. I think that's slightly nicer - but I guess either way works. On a slightly related topic, looking more closely to the ServiceUserMapperImpl I see that there are several levels of fallback for service user resolution (fallback to bundle default, or to global default). While this offers a lot of flexibility, to me it feels a bit strange in the context of a security feature. If defaults are set, it can happen (especially at startup) that code is executed using different serviceUsers, e.g. a component can execute using the bundle default or global default until its specific subService is available, and it can be easily imagined how this can cause subtle errors. Right, I guess we have not thought about it initially and simply assumed that all users are properly setup anyway. I wouldn't mind removing the fallbacks - although that is an incompatible change. But let's open an issue for that. For this issue, I haven't seen any strong objection, so let's move on and get it done. Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org
Re: Discuss SLING-4312: Register an osgi service for each available service user
If the sub service name is not set, the service reg property is not set, the target is then target=(!(subServiceName=*)) Carsten, you are suggesting that is mapping.subServiceName == null then I should not put the property in the service reg. I added a property with empty string but I can do it as you suggest and drop the property altogether if it is null. On a slightly related topic, looking more closely to the ServiceUserMapperImpl I see that there are several levels of fallback for service user resolution (fallback to bundle default, or to global default). While this offers a lot of flexibility, to me it feels a bit strange in the context of a security feature. If defaults are set, it can happen (especially at startup) that code is executed using different serviceUsers, e.g. a component can execute using the bundle default or global default until its specific subService is available, and it can be easily imagined how this can cause subtle errors. Marius
Re: Discuss SLING-4312: Register an osgi service for each available service user
On 2/25/15, 5:31 PM, Antonio Sanso asa...@adobe.com wrote: Question on the implementation though. What if the sub service name is not set for a mapping? In my implementation if the subServiceName is null, then it is registered as empty string and can be bound as target=(subServiceName=). Marius
Re: Discuss SLING-4312: Register an osgi service for each available service user
hi Marius On Feb 25, 2015, at 12:17 PM, Marius Petria mpet...@adobe.com wrote: Hi Antonio, On 2/25/15, 12:36 PM, Antonio Sanso asa...@adobe.com wrote: Usually the person that set’s the OSGi configuration (aka the administrator) is different than the one that codes a bundle (aka the administrator). This can also happen in two distinct phases of the project. I have the impression that this feature mixes the concerns… I think that is a perfect example why we should have such a dependency mechanism, as the the phases are executed by different personas. As a developer I would like to specify that my component should only be started when the administrator has configured a subServiceName and that is ready to be used. Using the Sling initial content in the same bundle as the component is not always possible, for example if the component is 3rd party bundle. Also I am not sure there is a guarantee to always work. Even more, the solution relies on the fact the service user is configured by the “developer” but as you said this can be configured by an “administrator. As a side note I think we should even allow a component to be able to restart when a mapping is changed as its security context is changed. re-thinking again I finally agree with you. Question on the implementation though. What if the sub service name is not set for a mapping? regards antonio Marius
Re: Discuss SLING-4312: Register an osgi service for each available service user
Am 25.02.15 um 03:18 schrieb Antonio Sanso: hi Oliver On Feb 25, 2015, at 12:09 PM, Oliver Lietz apa...@oliverlietz.de wrote: On Wednesday 25 February 2015 10:50:36 Antonio Sanso wrote: hi * On Feb 24, 2015, at 6:00 PM, Oliver Lietz apa...@oliverlietz.demailto:apa...@oliverlietz.de wrote: On Friday 20 February 2015 17:53:02 Marius Petria wrote: Hi, hi Marius, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. I hadn't the time to look into the implementation but I have this use case right now. A service user mapping and a bundle with a service which relies on this mapping are deployed in a (AEM) package - service fails because of mapping not yet available when service gets activated. A ServiceUserMapping service as reference would solve this problem. So +1 for this approach and the name ServiceUserMapping. a valid alternative that will end up to a NOOP for SLING-4312 is to use Sling initial content in the same bundle rather than a package. hi Antonio, we have a dedicated bundle (with Sling-Initial-Content) for configurations and IMHO service user mappings (as well as other global configurations) should be kept at a single place and not spread around in different application bundles. in general I do agree with you. This can be an exception though (hence why we introduced the concept of mapping amendments aka https://issues.apache.org/jira/browse/SLING-3578) I don't think that initial content solves the problem. What happens if an administrator of the system reconfigures the mapping, removes it, changes it? In that case the service is still active but does not work - at least not for the time of reconfiguration. OSGi configurations are dynamic and we should accept this fact. Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org
Re: Discuss SLING-4312: Register an osgi service for each available service user
On 2/25/15, 6:28 PM, Antonio Sanso asa...@adobe.com wrote: On 2/25/15, 5:31 PM, Antonio Sanso asa...@adobe.com wrote: Question on the implementation though. What if the sub service name is not set for a mapping? In my implementation if the subServiceName is null, then it is registered as empty string and can be bound as target=(subServiceName=)”. so which is the Service User that is supposed to be bound by @Reference in this case? The intent of target=(subServiceName=)” (using an empty subServiceName) is for the component to start when there is a registered mapping with no subservice defined. So, if com.mybundle=serviceUser is registered then the @Reference will be bound to an object representing that mapping. Marius
Re: Discuss SLING-4312: Register an osgi service for each available service user
On Feb 25, 2015, at 5:07 PM, Marius Petria mpet...@adobe.com wrote: On 2/25/15, 5:31 PM, Antonio Sanso asa...@adobe.com wrote: Question on the implementation though. What if the sub service name is not set for a mapping? In my implementation if the subServiceName is null, then it is registered as empty string and can be bound as target=(subServiceName=)”. so which is the Service User that is supposed to be bound by @Reference in this case? regards antonio Marius
Re: Discuss SLING-4312: Register an osgi service for each available service user
Am 25.02.15 um 08:28 schrieb Antonio Sanso: On Feb 25, 2015, at 5:07 PM, Marius Petria mpet...@adobe.com wrote: On 2/25/15, 5:31 PM, Antonio Sanso asa...@adobe.com wrote: Question on the implementation though. What if the sub service name is not set for a mapping? In my implementation if the subServiceName is null, then it is registered as empty string and can be bound as target=(subServiceName=)”. so which is the Service User that is supposed to be bound by @Reference in this case? If the sub service name is not set, the service reg property is not set, the target is then target=(!(subServiceName=*)) Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org
Re: Discuss SLING-4312: Register an osgi service for each available service user
hi * On Feb 20, 2015, at 6:53 PM, Marius Petria mpet...@adobe.com wrote: Hi, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. I do acknoweledge the issue , said that.. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? … I agree with what Felix’s said in [1]. Usually the person that set’s the OSGi configuration (aka the administrator) is different than the one that codes a bundle (aka the administrator). This can also happen in two distinct phases of the project. I have the impression that this feature mixes the concerns… regards antonio Second, it will be really helpful if you can also comment on the issue around the provided implementation. Marius [1] https://issues.apache.org/jira/browse/SLING-4312 [2] https://github.com/mpetria/sling/compare/mpetria:trunk...dev-SLING-4312
Re: Discuss SLING-4312: Register an osgi service for each available service user
hi * On Feb 24, 2015, at 6:00 PM, Oliver Lietz apa...@oliverlietz.demailto:apa...@oliverlietz.de wrote: On Friday 20 February 2015 17:53:02 Marius Petria wrote: Hi, hi Marius, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. I hadn't the time to look into the implementation but I have this use case right now. A service user mapping and a bundle with a service which relies on this mapping are deployed in a (AEM) package - service fails because of mapping not yet available when service gets activated. A ServiceUserMapping service as reference would solve this problem. So +1 for this approach and the name ServiceUserMapping. a valid alternative that will end up to a NOOP for SLING-4312 is to use Sling initial content in the same bundle rather than a package. e.g. in your pom instructions Sling-Initial-Content SLING-INF/content;path:=/libs/system/config;overwrite:=true; /Sling-Initial-Content /instructions I did use this approach and works (for the record it works also in AEM) regards antonio Regards, O. Marius [1] https://issues.apache.org/jira/browse/SLING-4312 [2] https://github.com/mpetria/sling/compare/mpetria:trunk...dev-SLING-4312
Re: Discuss SLING-4312: Register an osgi service for each available service user
On Wednesday 25 February 2015 10:50:36 Antonio Sanso wrote: hi * On Feb 24, 2015, at 6:00 PM, Oliver Lietz apa...@oliverlietz.demailto:apa...@oliverlietz.de wrote: On Friday 20 February 2015 17:53:02 Marius Petria wrote: Hi, hi Marius, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. I hadn't the time to look into the implementation but I have this use case right now. A service user mapping and a bundle with a service which relies on this mapping are deployed in a (AEM) package - service fails because of mapping not yet available when service gets activated. A ServiceUserMapping service as reference would solve this problem. So +1 for this approach and the name ServiceUserMapping. a valid alternative that will end up to a NOOP for SLING-4312 is to use Sling initial content in the same bundle rather than a package. hi Antonio, we have a dedicated bundle (with Sling-Initial-Content) for configurations and IMHO service user mappings (as well as other global configurations) should be kept at a single place and not spread around in different application bundles. Regards, O. e.g. in your pom instructions Sling-Initial-Content SLING-INF/content;path:=/libs/system/config;overwrite:=true; /Sling-Initial-Content /instructions I did use this approach and works (for the record it works also in AEM) regards antonio Regards, O. Marius [1] https://issues.apache.org/jira/browse/SLING-4312 [2] https://github.com/mpetria/sling/compare/mpetria:trunk...dev-SLING-4312
Re: Discuss SLING-4312: Register an osgi service for each available service user
Hi Antonio, On 2/25/15, 12:36 PM, Antonio Sanso asa...@adobe.com wrote: Usually the person that set’s the OSGi configuration (aka the administrator) is different than the one that codes a bundle (aka the administrator). This can also happen in two distinct phases of the project. I have the impression that this feature mixes the concerns… I think that is a perfect example why we should have such a dependency mechanism, as the the phases are executed by different personas. As a developer I would like to specify that my component should only be started when the administrator has configured a subServiceName and that is ready to be used. Using the Sling initial content in the same bundle as the component is not always possible, for example if the component is 3rd party bundle. Also I am not sure there is a guarantee to always work. Even more, the solution relies on the fact the service user is configured by the “developer” but as you said this can be configured by an “administrator. As a side note I think we should even allow a component to be able to restart when a mapping is changed as its security context is changed. Marius
Re: Discuss SLING-4312: Register an osgi service for each available service user
hi Oliver On Feb 25, 2015, at 12:09 PM, Oliver Lietz apa...@oliverlietz.de wrote: On Wednesday 25 February 2015 10:50:36 Antonio Sanso wrote: hi * On Feb 24, 2015, at 6:00 PM, Oliver Lietz apa...@oliverlietz.demailto:apa...@oliverlietz.de wrote: On Friday 20 February 2015 17:53:02 Marius Petria wrote: Hi, hi Marius, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. I hadn't the time to look into the implementation but I have this use case right now. A service user mapping and a bundle with a service which relies on this mapping are deployed in a (AEM) package - service fails because of mapping not yet available when service gets activated. A ServiceUserMapping service as reference would solve this problem. So +1 for this approach and the name ServiceUserMapping. a valid alternative that will end up to a NOOP for SLING-4312 is to use Sling initial content in the same bundle rather than a package. hi Antonio, we have a dedicated bundle (with Sling-Initial-Content) for configurations and IMHO service user mappings (as well as other global configurations) should be kept at a single place and not spread around in different application bundles. in general I do agree with you. This can be an exception though (hence why we introduced the concept of mapping amendments aka https://issues.apache.org/jira/browse/SLING-3578) regards antonio Regards, O. e.g. in your pom instructions Sling-Initial-Content SLING-INF/content;path:=/libs/system/config;overwrite:=true; /Sling-Initial-Content /instructions I did use this approach and works (for the record it works also in AEM) regards antonio Regards, O. Marius [1] https://issues.apache.org/jira/browse/SLING-4312 [2] https://github.com/mpetria/sling/compare/mpetria:trunk...dev-SLING-4312
Re: Discuss SLING-4312: Register an osgi service for each available service user
On Friday 20 February 2015 17:53:02 Marius Petria wrote: Hi, hi Marius, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. I hadn't the time to look into the implementation but I have this use case right now. A service user mapping and a bundle with a service which relies on this mapping are deployed in a (AEM) package - service fails because of mapping not yet available when service gets activated. A ServiceUserMapping service as reference would solve this problem. So +1 for this approach and the name ServiceUserMapping. Regards, O. Marius [1] https://issues.apache.org/jira/browse/SLING-4312 [2] https://github.com/mpetria/sling/compare/mpetria:trunk...dev-SLING-4312
Re: Discuss SLING-4312: Register an osgi service for each available service user
2015-02-21 8:55 GMT+01:00 Carsten Ziegeler cziege...@apache.org: Am 20.02.15 um 18:53 schrieb Marius Petria: Hi, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. In OSGi you should declare your dependencies, which means for components, the only option you have is requiring services. Therefore translating the above problem into service dependencies is imho the right way. it looks like using a service is the right way to address this need because, as Carsten said and as far as I know, it's the only OSGi mechanism for declaring a depends-on relationship. So I'm +1 for the proposed approach. Regards, Tommaso Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org
Re: Discuss SLING-4312: Register an osgi service for each available service user
Well there are other OSGi mechanisms to declare depends-on relationships, such as import/export packages, require-bundle (which nobody should use) and generic capabilities and requirements (Provide-Capability / Require-Capability). However, what we want here as far as I understand is a model where a DS component only exist if it's its mapping is available. For this purpose service dependencies are the only option AFAICS. My 2c, David On 23 February 2015 at 15:33, Tommaso Teofili tommaso.teof...@gmail.com wrote: 2015-02-21 8:55 GMT+01:00 Carsten Ziegeler cziege...@apache.org: Am 20.02.15 um 18:53 schrieb Marius Petria: Hi, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. In OSGi you should declare your dependencies, which means for components, the only option you have is requiring services. Therefore translating the above problem into service dependencies is imho the right way. it looks like using a service is the right way to address this need because, as Carsten said and as far as I know, it's the only OSGi mechanism for declaring a depends-on relationship. So I'm +1 for the proposed approach. Regards, Tommaso Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org
Re: Discuss SLING-4312: Register an osgi service for each available service user
Am 23.02.15 um 09:46 schrieb David Bosschaert: Well there are other OSGi mechanisms to declare depends-on relationships, such as import/export packages, require-bundle (which nobody should use) and generic capabilities and requirements (Provide-Capability / Require-Capability). However, what we want here as far as I understand is a model where a DS component only exist if it's its mapping is available. For this purpose service dependencies are the only option AFAICS. I think in this case we need a runtime or dynamic dependency while packages depedencies and capabilities are not really dynamic and are only useful at wiring time Carsten My 2c, David On 23 February 2015 at 15:33, Tommaso Teofili tommaso.teof...@gmail.com wrote: 2015-02-21 8:55 GMT+01:00 Carsten Ziegeler cziege...@apache.org: Am 20.02.15 um 18:53 schrieb Marius Petria: Hi, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. In OSGi you should declare your dependencies, which means for components, the only option you have is requiring services. Therefore translating the above problem into service dependencies is imho the right way. it looks like using a service is the right way to address this need because, as Carsten said and as far as I know, it's the only OSGi mechanism for declaring a depends-on relationship. So I'm +1 for the proposed approach. Regards, Tommaso Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org
Re: Discuss SLING-4312: Register an osgi service for each available service user
On Mon, Feb 23, 2015 at 9:46 AM, David Bosschaert david.bosscha...@gmail.com wrote: ...what we want here as far as I understand is a model where a DS component only exist if it's its mapping is available. For this purpose service dependencies are the only option AFAICS It looks like we all agree with this in this thread. Felix seemed to have issues with that in its Please, reconsider this ServiceUserMapping service comment in SLING-4312. -Bertrand
Re: Discuss SLING-4312: Register an osgi service for each available service user
Am 23.02.15 um 16:06 schrieb Bertrand Delacretaz: On Mon, Feb 23, 2015 at 9:46 AM, David Bosschaert david.bosscha...@gmail.com wrote: ...what we want here as far as I understand is a model where a DS component only exist if it's its mapping is available. For this purpose service dependencies are the only option AFAICS It looks like we all agree with this in this thread. Felix seemed to have issues with that in its Please, reconsider this ServiceUserMapping service comment in SLING-4312. For the service that is registered, we don't need to set the bundle symbolic name as a service reg property, the sub system name is sufficient as everything else is taken care by the hooks. In general, I don't think that this is a problem as the same information is freely available as a configuration. Therefore adding the service does not make more info available as already is. It's just a different distribution of the same info Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org
Re: Discuss SLING-4312: Register an osgi service for each available service user
Am 20.02.15 um 18:53 schrieb Marius Petria: Hi, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. In OSGi you should declare your dependencies, which means for components, the only option you have is requiring services. Therefore translating the above problem into service dependencies is imho the right way. Carsten -- Carsten Ziegeler Adobe Research Switzerland cziege...@apache.org
Discuss SLING-4312: Register an osgi service for each available service user
Hi, I discovered an issue related to service users. Due to the indeterminism of OSGI a consumer of ServiceUserMapper cannot be sure that getServiceUserID will find a registered mapping even if that mapping has been configured. For example if a component starts roughly at the same time as the mapping is installed it can happen that the calls the component makes to loginService to fail. More concretely that can happen for example if one needs a session in an activate method to register jcr event listener, or to read some configuration properties from the repository. In order to make this behavior more predictable I created an issue [1] proposing to always register an osgi service (I called it ServiceUserMapping) right after a mapping is installed, such that consumer components can reference it and wait for the mapping to be available. I also worked out an implementation in [2]. First, I would like to ask you if you think the problem is valid and if the approach is correct? Second, it will be really helpful if you can also comment on the issue around the provided implementation. Marius [1] https://issues.apache.org/jira/browse/SLING-4312 [2] https://github.com/mpetria/sling/compare/mpetria:trunk...dev-SLING-4312