[ 
https://issues.apache.org/jira/browse/SLING-9076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17046767#comment-17046767
 ] 

Julian Sedding edited comment on SLING-9076 at 2/27/20 4:34 PM:
----------------------------------------------------------------

[~nischgup] the scenario sounds basically like I had understood before. 
However, it's not entirely correct. Let me explain:
 # your service depends on {{ConfigurationResourceResolver}}, which is 
implemented by {{ConfigurationResourceResolverImpl}} (I assume cardinality is 
MANDATORY)
 # {{ConfigurationResourceResolverImpl}} depends on 
{{ConfigurationResourceResolvingStrategyMultiplexer}} with cardinality 
MANDATORY, which is implemented by 
{{ConfigurationResourceResolvingStrategyMultiplexerImpl}}
 # {{ConfigurationResourceResolvingStrategyMultiplexerImpl}} depends on 
{{ConfigurationResourceResolvingStrategy}} with cardinality MULTIPLE.

Only the last point is problematic for you, so you can configure 
ConfigurationResourceResolvingStrategyMultiplexerImpl to change the cardinality 
to AT_LEAST_ONE (exactly as you request in this issue, just via configadmin).

It may be confusing that I suggest configuring 
{{ConfigurationResourceResolvingStrategyMultiplexerImpl}}, when it doesn't have 
a metatype (i.e. it doesn't show up in the web console). However, all DS 
components can be configured, regardless of whether they have a metatype or 
not. (I only reached this insight after a few years.)

Something like the following should work (-I didnt' test-). You can place the 
config file in the filesystem install folder or in the repository install 
folder of your choice. On the first startup the configuration _may_ be 
installed too late, but I expect everything to be fine on second startup.
{code:none|title=org.apache.sling.caconfig.resource.impl.ConfigurationResourceResolvingStrategyMultiplexerImpl.config}
configurationResourceResolvingStrategy.cardinality.minimum=I"1"
configurationResourceResolvingStrategy.target="(component.name\=org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy)"
{code}
Note: the example assumes the latest caconfig-impl bundle is used. There were 
some changes to the implementation e.g. {{

So if you're running an older version, you may need to adjust the class names.


was (Author: jsedding):
[~nischgup] the scenario sounds basically like I had understood before. 
However, it's not entirely correct. Let me explain:
 # your service depends on {{ConfigurationResourceResolver}}, which is 
implemented by {{ConfigurationResourceResolverImpl}} (I assume cardinality is 
MANDATORY)
 # {{ConfigurationResourceResolverImpl}} depends on 
{{ConfigurationResourceResolvingStrategyMultiplexer}} with cardinality 
MANDATORY, which is implemented by 
{{ConfigurationResourceResolvingStrategyMultiplexerImpl}}
 # {{ConfigurationResourceResolvingStrategyMultiplexerImpl}} depends on 
{{ConfigurationResourceResolvingStrategy}} with cardinality MULTIPLE.

Only the last point is problematic for you, so you can configure 
ConfigurationResourceResolvingStrategyMultiplexerImpl to change the cardinality 
to AT_LEAST_ONE (exactly as you request in this issue, just via configadmin).

It may be confusing that I suggest configuring 
{{ConfigurationResourceResolvingStrategyMultiplexerImpl}}, when it doesn't have 
a metatype (i.e. it doesn't show up in the web console). However, all DS 
components can be configured, regardless of whether they have a metatype or 
not. (I only reached this insight after a few years.)

Something like the following should work (-I didnt' test-). You can place the 
config file in the filesystem install folder or in the repository install 
folder of your choice. On the first startup the configuration _may_ be 
installed too late, but I expect everything to be fine on second startup.
{code:none|title=org.apache.sling.caconfig.resource.impl.ConfigurationResourceResolvingStrategyMultiplexerImpl.config}
configurationResourceResolvingStrategy.cardinality.minimum=I"1"
configurationResourceResolvingStrategy.target="(component.name\=org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy)"
{code}

> CA config resolver API is not returning any resources when invoked on 
> instance start
> ------------------------------------------------------------------------------------
>
>                 Key: SLING-9076
>                 URL: https://issues.apache.org/jira/browse/SLING-9076
>             Project: Sling
>          Issue Type: Bug
>            Reporter: Nischay Gupta
>            Priority: Major
>
> Ca config resolver API is not returning any resources when invoked on bundle 
> activate when AEM instance starts – this is because of late binding config 
> resolution strategy service.
> In *ConfigurationResourceResolvingStrategyMultiplexerImpl* the cardinality is 
> set to atleast one *cardinality=ReferenceCardinality.MULTIPLE* but it should 
> be  *cardinality=ReferenceCardinality.ATLEAST_ONE*



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to