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

Konrad Windszus edited comment on SLING-12245 at 2/7/24 6:33 PM:
-----------------------------------------------------------------

Debugging revealed the following:

When renaming a working rewriter pipeline config from 
{{/apps/system/config/rewriter2}} to {{/apps/system/config/rewriter}} the 
following {{ResourceChange}} is received:
{code}
ResourceChange[type=ADDED, path=/apps/system/config/rewriter, external=false]
{code}
which is ignored in {{ProcessorManagerImpl.onChange(...)}}

However when renaming a working rewriter pipeline config from 
{{/apps/system/config/rewriter}} to {{/apps/system/config/rewriter2}} the 
following {{ResourceChanges}} are received:
{code}
ResourceChange[type=REMOVED, path=/apps/system/config/rewriter, external=false]
ResourceChange[type=REMOVED, path=/apps/system/config/rewriter/custom, 
external=false]
{code}
which leads to removing the config at {{/apps/system/config/rewriter}} in 
{{ProcessorManagerImpl.onChange(...)}} (in case it was previously registered).

This is due to the fact how the JCR Event Listener is being registered in 
https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/8fb5a3d44de01f05964028debcf24531f2f65747/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java#L104.

Looks like the OakEventFilter does not behave synchronously here, i.e. in case 
of renames only notifies about each removal of a subtree, but not for the 
addition for each addition of a subtree.


was (Author: kwin):
Debugging revealed the following:

When renaming a working rewriter pipeline config from 
{{/apps/system/config/rewriter2}} to {{/apps/system/config/rewriter}} the 
following {{ResourceChange}} is received:
{code}
ResourceChange[type=ADDED, path=/apps/system/config/rewriter, external=false]
{code}
which is ignored in {{ProcessorManagerImpl.onChange(...)}}

However when renaming a working rewriter pipeline config from 
{{/apps/system/config/rewriter}} to {{/apps/system/config/rewriter2}} the 
following {{ResourceChanges}} are received:
{code}
ResourceChange[type=REMOVED, path=/apps/system/config/rewriter, external=false]
ResourceChange[type=REMOVED, path=/apps/system/config/rewriter/custom, 
external=false]
{code}
which leads to removing the config at {{/apps/system/config/rewriter}} in 
{{ProcessorManagerImpl.onChange(...)}} (in case it was previously registered).

> Sling Rewriter does not detect configuration changes coming in via move
> -----------------------------------------------------------------------
>
>                 Key: SLING-12245
>                 URL: https://issues.apache.org/jira/browse/SLING-12245
>             Project: Sling
>          Issue Type: Improvement
>    Affects Versions: Rewriter 1.3.10
>            Reporter: Konrad Windszus
>            Priority: Major
>
> If one renames/moves a JCR node from {{/apps/my/config/invalid-rewriter}} to 
> {{/apps/my/config/rewriter}} the new rewriter configuration is not being 
> detected by the {{ProcessorManagerImpl}} due to the 
> {{ResourceChangeListener}} only being configured to listen for changes below 
> the {{rewriter}} resource 
> (https://github.com/apache/sling-org-apache-sling-rewriter/blob/4d1952648e35e7001236f282040a78479f7726d4/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java#L69).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to