Thank you all.
Special thanks to Carsten - that was exactly I was searching for.

My reference looks now like this:
    @Reference(policyOption = ReferencePolicyOption.GREEDY, collectionType = 
CollectionType.TUPLE)
    private volatile List<Map.Entry<Map<String, Object>, ISecurityChecker>> 
_securityCheckers;

As you said, I am getting a Map.Entry that contains the service.pid which is - 
in my case - "my.config~system1".
I am filtering based on Ray's code snippet for the right configuration: 
            Filter filter = 
FrameworkUtil.createFilter("(service.pid=my.config~"+ repoName + ")");
            ISecurityChecker securityChecker = 
_securityCheckers.stream().filter(e -> 
filter.matches(e.getKey())).map(Map.Entry::getValue).findFirst().orElse(null);

I am probably building a small wrapper handles all the configuration instances 
as I have several rest endpoints which do all the same security check.

Big Thanks!
Philipp

-----Ursprüngliche Nachricht-----
Von: Carsten Ziegeler <cziege...@apache.org> 
Gesendet: Montag, 6. August 2018 17:21
An: users@felix.apache.org; Cristiano <cvgav...@gmail.com>; Philipp Höfler 
<philipp.hoef...@pernexas.com>
Betreff: Re: Configurator R7 example

I think the current @Component annotation is correct :) (sorry)

If you use factory="..." you will create a component factory as defined in the 
DS specification - that's in contrast to a component managed by factory 
configurations (which this example is about).

If you managed to get the Map of properties (which should work with the 
Map.Entry change I posted recently), then the full PID of the configuration is 
stored in a property named "service.pid" - you can then search for the tilde in 
there and get what you want.

Regards

Carsten


Cristiano Gavião wrote
> 
> 
> On 06/08/2018 11:10, Philipp Höfler wrote:
>> Sorry, pid is probably the wrong word for that. Alias might be more 
>> correct.
>> I am talking about the name after the ~ in the configuration file 
>> (my.config~system1).
>> In this case I would like to get "system1".
> 
> Ah, now I understood.
> 
> I think you won't get that since your component is not a factory.  If 
> I'm remember right, you need to use a FPID (factory pid), so your 
> component must be declared this 
> way:*@Component(factory="anFactoryPID")*
> 
> Couple years ago, I used to use the ConfigAdmin directly to activate 
> my mult-instance components and the information you want was only 
> provided by the Configuration object returned from CM:
> 
>> configuration = getConfigurationAdmin()
>>                     .createFactoryConfiguration(pFactoryPid, null); 
>> factoryPID = configuration.getFactoryPid(); pid = 
>> configuration.getPid()
> 
> I just started with Configurator too, but I don't know if this FPID 
> and PID information are being published in the configuration map 
> currently also. CM used not do that until R6 (at least I was not able to find 
> them).
> 
> 
--
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to