[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-12 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14358698#comment-14358698
 ] 

Marius Petria commented on SLING-4312:
--

Committed revision 1666196.

I implemented all suggestions from Felix and Carsten's comments. Thanks.

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-10 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14355078#comment-14355078
 ] 

Marius Petria commented on SLING-4312:
--

I understand. For my knowledge, how can you easily obtain the ServiceReference 
of the service that is bounded to a reference?

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-09 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14352894#comment-14352894
 ] 

Carsten Ziegeler commented on SLING-4312:
-

+1 to Felix comments

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-09 Thread Felix Meschberger (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14352876#comment-14352876
 ] 

Felix Meschberger commented on SLING-4312:
--

Ok, thanks. This starts to look ok. I think we can agree on this new service to 
be a marker. And a marker only.

As such I still (sorry) have a few comments of feedback:

* I think we should properly document the fact that the new service is a 
marker. Maybe even name it something like ServiceUserMapped ?
* Suggest to change the Mapping.SERVICENAME value to have a leading dot, that 
is {{.serviceName}} instead if {{serviceName}}. This marks the property private.
* I think we can remove the {{ServiceUserMapping.getSubServiceName()}} method 
since it adds no value. If a dependent service needs the subservice name due 
to, for example, multiple cardinality dependency, the service property of the 
ServiceReference can be queried.
* Suggest to defaine  ServiceUserMapper.SERVICE_NAME constant with the service 
name to prevent these tons of {{ServiceUserMapper.class.getName()}} calls.
* Suggest to implement an internal helper method to retrieve the service name 
for a bundle. This common method would be called from at least three locations 
(two in ServiceUserMappingBundleFilter and one in ServiceUserMapperImpl)

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-09 Thread Felix Meschberger (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14352981#comment-14352981
 ] 

Felix Meschberger commented on SLING-4312:
--

bq. ServiceUserMapping.getSubServiceName() is useful if a component takes the 
subServiceName as a parameter via an osgi config

I don't fully understand why the getSubServiceName() may be usefull in this 
context ? If the Subservice Name is available as a property from the service 
reference, which is required to support the target filter, you can get that 
exact value from the respective ServiceReference, which in turn is always the 
first step in getting a service.

bq. Can you also share your thoughts on the relation with SLING-4461?

I think, as proposed in SLING-4461, the filter to support this situation could 
be used as such, yet I agree this is complicated. In addition, if we have a 
default mapping, we could register that with a default service name, which can 
be passed through by the ServiceUserMappingBundleFilter and thus made visible.

Or maybe the default mapping setup was just a bad idea ?

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-09 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14352935#comment-14352935
 ] 

Marius Petria commented on SLING-4312:
--

Hi [~fmeschbe]

I think your points are fine, one I would like to comment though. 
ServiceUserMapping.getSubServiceName() is useful if a component takes the 
subServiceName as a parameter via an osgi config. You would need to provide the 
subServiceName to bind the ServiceUserMapping 
(mapping.target=(subServiceName=dedicatedUserService)) and again as a dedicated 
OSGI config property (componentSubServiceName=dedicatedUserService). That 
redundancy can be avoided by being able to query the mapping for the mapped 
subServiceName.

Can you also share your thoughts on the relation with SLING-4461? One issue 
with the current implementation of this marker interface is that it cannot 
accurately represent the fact that a call to ServiceUserMapper.getServiceUserID 
will succeed if and only if a mapping is registered. That happens because of 
fallback mappings. More exactly consumer components that bind to a specific 
subServiceName will not be started even if a default has been configured. That 
breaks the separation of concerns, meaning that an administrator is forced to 
configure the service users in a particular way (not using the fallbacks). 
SLING-4461 proposes to drop the fallbacks but that will introduce a breaking 
change. WDYT?

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-09 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14353010#comment-14353010
 ] 

Carsten Ziegeler commented on SLING-4312:
-

You have the ServiceReference with the properties for this, no need to parse 
the target. I'm also wondering what use case this will have?

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-09 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14353011#comment-14353011
 ] 

Carsten Ziegeler commented on SLING-4312:
-

bq. Or maybe the default mapping setup was just a bad idea ?

While it looked pretty good when we added this, today I tend to think that we 
shouldn't have done it in the first place

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-03-09 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14353006#comment-14353006
 ] 

Marius Petria commented on SLING-4312:
--

bq. you can get that exact value from the respective ServiceReference, which in 
turn is always the first step in getting a service.

That is right but then you will have to parse the target filter which might be 
hard (imagine an OR filter). The guarantee offered by the ServiceUserMapping is 
that if it is bound to something then calling 
getServiceUserID(bundle,mapping.getSubServiceName()) will succeed. But we can 
drop this method if you think the argument is not strong enough.




 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
Assignee: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.1.diff, SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-27 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14340045#comment-14340045
 ] 

Marius Petria commented on SLING-4312:
--

Committed revision 1662665.

- I changed the tests to use mockito instead of MockBundle
- for mappings with not sub service the subServiceName property is not 
registered, so the target reference should be (!(subServiceName=*))


 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Fix For: Service User Mapper 1.1.2

 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-25 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14336270#comment-14336270
 ] 

Marius Petria commented on SLING-4312:
--

Hi [~fmeschbe],

I changed the ServiceUserMapping interface to contain only the subServiceName, 
hence hiding the serviceName which might be considered an implementation 
detail. The entire code is at [1].


[1] https://github.com/mpetria/sling/compare/mpetria:trunk...dev-SLING-4312

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Fix For: Service User Mapper 1.1.0

 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-23 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14333270#comment-14333270
 ] 

Marius Petria commented on SLING-4312:
--

[~fmeschbe], [~bdelacretaz] I have started a discussion thread in [1]. Please 
respond to that if you have any inquiries or suggestions.

[1] 
http://apache-sling.73963.n3.nabble.com/Discuss-SLING-4312-Register-an-osgi-service-for-each-available-service-user-tp4047706.html


 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-20 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14328768#comment-14328768
 ] 

Marius Petria commented on SLING-4312:
--

Committed patch in revision 1661081.


 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-20 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14328926#comment-14328926
 ] 

Marius Petria commented on SLING-4312:
--

[~cziegeler], the ServiceUserMapperImplTest uses MockBundle only to produce a 
bundle with a custom symbolic name. That can easily be done with mockito 
directly without relying on MockBundle [1]. Relying on mockito makes everything 
green even on Java 6.

However I have one question: is it ok to introduce the dependency on 
osgi.core.4.3.0?

[1] 
https://github.com/mpetria/sling/commit/f28a0eca06003f5d5d309ed4797ee01fa557cfa2

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-20 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14328965#comment-14328965
 ] 

Carsten Ziegeler commented on SLING-4312:
-

[~mpetria] I think using mockito is the better way anyway and yes depending on 
4.3.0 is fine

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-20 Thread Felix Meschberger (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14329054#comment-14329054
 ] 

Felix Meschberger commented on SLING-4312:
--

Please, reconsider this ServiceUserMapping service !

This service has two major issues:

# It -exposes- leaks an (administrative) implementation detail to developers: 
The service name is internal derived from the bundle providing the service. It 
is documented with the bundle how its dervied and its made available to 
adminitrators for them to configure the mapping. With this service we expose 
this implementation detail to developers. I am really not in favor of such a 
thing.
# A service may have multiple subservices. This ServiceUserMapping just exposes 
a single sub service. Thus we will have ServiceUserMapping service for each 
subservice and thus a proliferation of services whose uses are really limited 
to a select few cases.

Also, going back to the original issue: Why do we need this fix (or band-aid, 
if you will) ?

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-20 Thread Bertrand Delacretaz (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14329073#comment-14329073
 ] 

Bertrand Delacretaz commented on SLING-4312:


Looks like a discussion on our dev list might be a better way to converge on a 
solution

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-20 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14329064#comment-14329064
 ] 

Marius Petria commented on SLING-4312:
--

Hi [~fmeschbe],

1. Actually the serviceName is not necessary to be exposed. We can use only the 
subServiceName so I can drop it from the ServiceUserMapping interface.
2. ServiceUserMapping is meant to represent *one* mapping not all.
3. This mechanism is meant to provide a reliable way for a component to start 
only when there exists a mapping for the subService it wants to use. The 
usecase is that if you want to use loginService in an activate method there is 
not way to guarantee that the mapping you need is registered and hence the 
ServiceUserMapper.getServiceUserID might fail.

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria
 Attachments: SLING-4312.diff


 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-19 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14327187#comment-14327187
 ] 

Marius Petria commented on SLING-4312:
--

I did the change to only register what is changed, I still need to test a bit 
more but I think this is close to finish.

[1] 
https://github.com/mpetria/sling/compare/mpetria:e62a0e94005709357e9a42a2ba526985d4b588a4...dev-SLING-4312


 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-19 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14327198#comment-14327198
 ] 

Carsten Ziegeler commented on SLING-4312:
-

[~mpetria] Looks ok to me, except :) that I think you should also implement 
FindHook - while EventListenerHook works with the current DS implementation, 
those two hooks should be implemented in pairs usually. For example if someone 
uses directly the framework API to find a service this needs to be filtered.

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-19 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14328635#comment-14328635
 ] 

Carsten Ziegeler commented on SLING-4312:
-

bq. One more question: The ServiceUserMapping exposes only serviceName and 
subServiceName. I did not expose also the serviceUserId as this seems to be 
something that should not be known to a consumer. Is it OK?

Yes. I think that makes sense

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-19 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14327589#comment-14327589
 ] 

Marius Petria commented on SLING-4312:
--

Implemented also the FindHook.

One more question: The ServiceUserMapping exposes only serviceName and 
subServiceName. I did not expose also the serviceUserId as this seems to be 
something that should not be known to a consumer. Is it OK?

[1] https://github.com/mpetria/sling/compare/mpetria:trunk...dev-SLING-4312


 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-18 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14325654#comment-14325654
 ] 

Carsten Ziegeler commented on SLING-4312:
-

[~mpetria] Yes I think this goes in the right direction. Some comments:

- you need to handle the amendments as well, whenever one is bound, register a 
service user etc.
- mentioning the serviceName should not be required as this is the calling 
bundle. You don't want to hardcode bundle symbolic names in your code. Not sure 
what the best way is.
We could say, that these mapping services are only visible to the bundles which 
they are declared for; so we could use a service hook to filter out services. 
But maybe there is an easier/lightweight solution to that

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-18 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14326085#comment-14326085
 ] 

Marius Petria commented on SLING-4312:
--

Hi [~cziegeler]

I implemented the bundle filter such that the mapping is visible only for those 
that can use it [1]. ([~bosschaert] pointed me in the right direction) 

The amendments are treated because I hooked myself just before/after the 
activeBindings are updated. 

I have two questions related to my current impl.
1. The ServiceUserMapping interface, is it a good name, structure?
2. Right now each amendment modification triggers the unregistering of all 
ServiceUserMapping and then registers all back. Do you think that needs to be 
optimized?

[1] 
https://github.com/mpetria/sling/compare/mpetria:e62a0e94005709357e9a42a2ba526985d4b588a4...307d32bfafb908ae90569ffd200079553ac2a32c



 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-18 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14326105#comment-14326105
 ] 

Carsten Ziegeler commented on SLING-4312:
-

[~mpetria] I think ServiceUserMapping is an appropriate name
We definitely need to optimize the registering and only register/unregister 
what has changed.

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-02-17 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14324375#comment-14324375
 ] 

Marius Petria commented on SLING-4312:
--

I created a first draft for exposing a ServiceUserMapping for each active 
mapping [1]. It basically unregisters/registers one service for each mapping in 
updateBindings method. 

The usage would be 
{code}
@Reference(target = (subServiceName=myservicename)
ServiceUserMapping mapping;

@Activate
void activate() {
MapString, Object authenticationInfo = new ...;
authenticationInfo.put(ResourceResolverFactory.SUBSERVICE, 
mapping.getSubServiceName());
resourceResolverFactory. getServiceResourceResolver(authenticationInfo);
}
{code}


[~cziegeler] can you have a look and tell me if I am going in the right 
direction?


[1] 
https://github.com/mpetria/sling/commit/c499631ac8866f909db6a9ac3783d7b998ac5956

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-01-16 Thread Bertrand Delacretaz (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14280181#comment-14280181
 ] 

Bertrand Delacretaz commented on SLING-4312:


Thinking about it, ServiceUser sounds like a better name for the service. It's 
the presence of that that shows that a given service user is ready to be used.

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (SLING-4312) Register an osgi service for each available service user

2015-01-16 Thread Marius Petria (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14280186#comment-14280186
 ] 

Marius Petria commented on SLING-4312:
--

It might even be ServiceUserMapping as one would want to target the serviceName 
not the actual serviceUser that is mapped for that service.

 Register an osgi service for each available service user 
 -

 Key: SLING-4312
 URL: https://issues.apache.org/jira/browse/SLING-4312
 Project: Sling
  Issue Type: Improvement
  Components: Service User Mapper
Reporter: Marius Petria

 In order to only activate osgi components when a service user mapping is 
 available it would be useful to have an osgi service registered for a service 
 user. A component can reference the registered service name and only start 
 when that becomes available.
 {code}
 @Reference(target=(name=serviceName))
 ServiceUserExists userExists;
 {code}
  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)